MULTIRADAR.jsp 2.26 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 55 56 57 58 59 60 61 62
<%@page import="ChartDirector.*" %>
<%
//The data for the chart
double[] data0 = {90, 60, 85, 75, 55};
double[] data1 = {60, 80, 70, 80, 85};

//The labels for the chart
String[] labels = {"Speed", "Reliability", "Comfort", "Safety", "Efficiency"};

//Create a PolarChart object of size 480 x 380 pixels
PolarChart c = new PolarChart(480, 380);

//Set background color to gold (goldGradient), with 1 pixel 3D border effect
c.setBackground(c.gradientColor(Chart.goldGradient, 90, 2), Chart.Transparent, 1
    );

//Add a title to the chart using 12 pts Arial Bold Italic font. The title text
//is white (0xffffff) on a black background
c.addTitle("Space Travel Vehicles Compared", "arialbi.ttf", 12, 0xffffff
    ).setBackground(0x0);

//Set center of plot area at (240, 210) with radius 150 pixels
c.setPlotArea(240, 210, 150);

//Add a legend box at (5, 30) using 10 pts Arial Bold font. Set the background
//to silver (silverGradient), with a black border, and 1 pixel 3D border effect.
c.addLegend(5, 30, true, "arialbd.ttf", 10).setBackground(c.gradientColor(
    Chart.silverGradient, 90, 0.5), 1, 1);

//Add an area layer to the chart using semi-transparent blue (0x806666cc). Add a
//blue (0x6666cc) line layer using the same data with 3 pixel line width to
//highlight the border of the area.
c.addAreaLayer(data0, 0x806666cc, "Ultra Speed");
c.addLineLayer(data0, 0x6666cc).setLineWidth(3);

//Add an area layer to the chart using semi-transparent red (0x80cc6666). Add a
//red (0xcc6666) line layer using the same data with 3 pixel line width to
//highlight the border of the area.
c.addAreaLayer(data1, 0x80cc6666, "Super Economy");
c.addLineLayer(data1, 0xcc6666).setLineWidth(3);

//Set the labels to the angular axis as spokes.
c.angularAxis().setLabels(labels);

//output the chart
request.getSession().setAttribute("chart1", c.makeChart2(Chart.PNG));
%>
<html>
<body topmargin=0 leftmargin=5 rightmargin=0 marginwidth=5 marginheight=0>
<div style="font-size:18pt; font-family:verdana; font-weight:bold">
    Multi Radar Chart
</div>
<hr color="#000080">
<div style="font-size:10pt; font-family:verdana">
    <a href="VIEWSOURCE.jsp?file=<%=request.getServletPath()%>">
        View Chart Source Code
    </a>
</div>
<br>
<img src="chart1.chart?no_cache=<%=Chart.getUniqueId()%>">
</body>
</html>