PROT-7 add servletjobbyday
[proteocache.git] / website / HistogramaExecutionTime.jsp
1 <%@page contentType="text/html" pageEncoding="UTF-8"%>
2 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
3 <%@ page import="java.awt.*" %>
4 <%@ page import="java.io.*" %>
5 <%@ page import="java.util.Random" %>
6 <%@ page import="org.jfree.chart.ChartFactory" %>
7 <%@ page import="org.jfree.chart.ChartPanel" %>
8 <%@ page import="org.jfree.chart.JFreeChart" %>
9 <%@ page import="org.jfree.chart.ChartUtilities" %>
10 <%@ page import="org.jfree.data.statistics.HistogramDataset" %>
11 <%@ page import="org.jfree.data.statistics.HistogramType" %>
12 <%@ page import="org.jfree.chart.plot.PlotOrientation;" %>
13
14 <%
15 double[] val = new double[10];
16 %>
17 <c:forEach items="${result}" var="res" varStatus="loop">
18 <c:choose>
19         <c:when test="${loop.last}">
20                 <c:forEach items="${res.timeTotalExec}" var="total">
21                                 ${total}
22                                 <c:set var="sum" value="${total}" />
23                         </c:forEach>
24         </c:when>
25 </c:choose>
26 </c:forEach>
27
28 <%
29 double[] value = new double[10];
30 out.println("{sum}");
31 for (int i=1; i < 10; i++) {
32         value[i] = i;
33     int number = 5;
34         HistogramDataset dataset = new HistogramDataset();
35         dataset.setType(HistogramType.RELATIVE_FREQUENCY);
36         dataset.addSeries("Histogram",value,number);
37         String plotTitle = "Histogram"; 
38         String xaxis = "number";
39         String yaxis = "value"; 
40         PlotOrientation orientation = PlotOrientation.VERTICAL; 
41         boolean show = false; 
42         boolean toolTips = false;
43         boolean urls = false; 
44         JFreeChart chart = ChartFactory.createHistogram( plotTitle, xaxis, yaxis, 
45          dataset, orientation, show, toolTips, urls);
46         int width = 800;
47         int height = 500; 
48  try {
49         File file1=new File("histogram2.jpg");
50         ChartUtilities.saveChartAsJPEG(file1, chart, width, height);
51  } catch (IOException e) {}
52 }
53
54 %>
55
56 <html>
57 <body>
58 <IMG SRC="histogram.PNG" WIDTH="800" HEIGHT="500" BORDER="0" USEMAP="#chart">
59 </body>
60 </html>