THREEDANGLEPIE.jsp 1.86 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.*" %>
<%!
void createChart(HttpServletRequest request, String img)
{
    //the tilt angle of the pie
    int angle = Integer.parseInt(img) * 15;

    //The data for the pie chart
    double[] data = {25, 18, 15, 12, 8, 30, 35};

    //Create a PieChart object of size 100 x 110 pixels
    PieChart c = new PieChart(100, 110);

    //Set the center of the pie at (50, 55) and the radius to 38 pixels
    c.setPieSize(50, 55, 38);

    //Set the depth and tilt angle of the 3D pie (-1 means auto depth)
    c.set3D(-1, angle);

    //Add a title showing the tilt angle
    c.addTitle("Tilt = " + angle + " deg", "arial.ttf", 8);

    //Set the pie data
    c.setData(data);

    //Disable the sector labels by setting the color to Transparent
    c.setLabelStyle("", 8, Chart.Transparent);

    //output the chart
    request.getSession().setAttribute("chart" + img, c.makeChart2(Chart.PNG));
}
%>
<%
createChart(request, "0");
createChart(request, "1");
createChart(request, "2");
createChart(request, "3");
createChart(request, "4");
createChart(request, "5");
createChart(request, "6");
%>
<html>
<body topmargin=0 leftmargin=5 rightmargin=0 marginwidth=5 marginheight=0>
<div style="font-size:18pt; font-family:verdana; font-weight:bold">
    3D Angle
</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="chart0.chart?no_cache=<%=Chart.getUniqueId()%>">
<img src="chart1.chart?no_cache=<%=Chart.getUniqueId()%>">
<img src="chart2.chart?no_cache=<%=Chart.getUniqueId()%>">
<img src="chart3.chart?no_cache=<%=Chart.getUniqueId()%>">
<img src="chart4.chart?no_cache=<%=Chart.getUniqueId()%>">
<img src="chart5.chart?no_cache=<%=Chart.getUniqueId()%>">
<img src="chart6.chart?no_cache=<%=Chart.getUniqueId()%>">
</body>
</html>