<%@page import="ChartDirector.*" %> <%! void createChart(HttpServletRequest request, String img) { //the tilt angle of the pie int angle = Integer.parseInt(img) * 90 + 45; //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 36 pixels c.setPieSize(50, 55, 36); //Set the depth, tilt angle and 3D mode of the 3D pie (-1 means auto depth, //"true" means the 3D effect is in shadow mode) c.set3D(-1, angle, true); //Add a title showing the shadow angle c.addTitle("Shadow @ " + 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"); %> <html> <body topmargin=0 leftmargin=5 rightmargin=0 marginwidth=5 marginheight=0> <div style="font-size:18pt; font-family:verdana; font-weight:bold"> 3D Shadow Mode </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()%>"> </body> </html>