APPRISAL_REP51.jsp 1.63 KB
Newer Older
Thitichaipun Wutthisak committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
<%@page import="ChartDirector.*" %>
<%
//
//For demo purpose, we use hard coded data. In real life, the following data
//could come from a database.
//
double[] revenue = {100,83,80,82,73,83,77,77,77,71};
String[] labels = {"390009","390010","390011","390012","390013","390014","390015","390016","390017","390018",};

//Create a XYChart object of size 450 x 200 pixels
XYChart c = new XYChart(550, 320);

//c.setBackground(0xffff80, 0x0, 1);
c.setBackground(0xFFFFFF, 0x0, 1);

//Add a title to the chart using Times Bold Italic font
ChartDirector.TextBox title = c.addTitle("Assessment Summary", "arialbi.ttf", 11, 0x000000);
title.setBackground(0xE1E1E1, -1, 1);

//Set the plotarea at (60, 25) and of size 350 x 150 pixels
c.setPlotArea(80, 45, 380, 180);

//Add a blue (0x3333cc) bar chart layer using the given data. Set the bar border
//to 1 pixel 3D style.
c.addBarLayer(revenue, 0x3333cc, "Revenue").setBorderColor(-1, 1);

//Set x axis labels using the given labels
c.xAxis().setLabels(labels).setFontAngle(90);

//Add a title to the y axis
c.yAxis().setTitle("Score");

//Create the image and save it in a temporary location
request.getSession().setAttribute("chart1", c.makeChart2(Chart.PNG));

//Create an image map for the chart
String imageMap = c.getHTMLImageMap("CLICKLINE.jsp", "",
    "title='{xLabel} @ score {value|0}'");
%>

<html>
<body>
<br>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
  <tr>
    <td><div align="center"><img src="chart1.chart?no_cache=<%=Chart.getUniqueId()%>" border="0" usemap="#map1"> 
        <map name="map1">
          <%=imageMap%> 
        </map>
      </div></td>
  </tr>
</table>
</body>
</html>