Netcuff @ 2005-01-19 17:26 Pie Pie.jsp 3D Pie Pie3d.jsp Pie Pie.JSP
<% @ Page ContentType = "Text / HTML; Charset = GBK"%> <% @ page import = "org.jfree.data.default"%> <% @ page import = "Org.jfree .CHART.JFREECHART "%> <% @ page import =" org.jfree.Chart.axis.categoryaxis "%> <% @ page import =" org.jfree.chart.axis.valueaxis "%> <% @ Page Import = "Org.jfree.Chart.StandardLegend"%> <% @ page import = "org.jfree.Chart.Plot.pieplot"%> <% @ page import = "org.jfree.chart.plot.categoryPlot"%>%> <% @ page import = "org.jfree.Chart.ChartrenderingInfo"%> <% @ page import = "org.jfree.chart.servlet.servletutilities"%> <% @ page import = "Org.jfree.Chart.urls .StandardPieURLGenerator "%> <% @ page import =" org.jfree.chart.entity.StandardEntityCollection "%> <% DefaultPieDataset data = new DefaultPieDataset (); data.setValue (" detachment ", 1000); data.setValue ( "Two Dragons", 880); Data.SetValue ("Three Team", 728); Data.SetValue ("Four Team", 608); Data.SetValue ("Five Drawing", 1238); Data.SetValue ("Six DRPLOT PLOT = New PIEPLOT PLOT = New PIEPLOT (DATA); font default_title_font = new font ("black body", font.bold, 18); jfreechart chart = new jfree Chart ("", default_title_font, plot, true); font font = new font ("black body", font.tribype_font, 12); StandardLegend Legend = (StandardLegend) Chart.getlegend (); Legend.SetItemFont (font); chart. SetBackgroundPaint (java.awt.color.white); // Optional, set picture background color Chart.Settitle ("Treasured Passenger Vehicle illegal behavior analysis"); // Optional, set the picture title ChartRenderingInfo info =
new ChartRenderingInfo (new StandardEntityCollection ()); String filename = ServletUtilities.saveChartAsPNG (chart, 500, 300, info, session); String graphURL = request.getContextPath () "? / DisplayChart filename =" filename;%>
head> P> body> html> 3D pie chart PIE3D.JSP
<% @ page contenttype = "text / html; charset = GBK"%> <% @ page import = "org.jfree.chart.chartFactory, Org.jfree.chart.chartPanel, Org.jfree.Chart.jfreechart, org. jfree.chart.StandardLegend, org.jfree.chart.axis.NumberAxis, org.jfree.chart.plot.CategoryPlot, org.jfree.chart.plot.PlotOrientation, org.jfree.chart.renderer.LineAndShapeRenderer, org.jfree. chart.servlet.ServletUtilities, java.awt.Color, org.jfree.chart.plot.PiePlot3D, org.jfree.data.DefaultPieDataset, org.jfree.data.PieDataset "%> <% DefaultPieDataset result = new DefaultPieDataset (); Result.SetValue ("Java", New Double (43.2)); Result.SetValue ("Visual Basic", New Double (10.0)); Result.SetValue ("C / C ", New Double (17.5)); Result. SetValue ("PHP", New Double (32.5)); Result.SetValue ("Perl", New Double (0.0)); jfreechart chart = chartfactory.createpiechart3d ("Pie Chart 3D Demo 1", // Chart Title Result, // Data true, false; // set the background color for the chart ... chart.setback; pieplot3d plot = (PIEPLOT3D) Chart.getPlot (); plot .setStartAngle (270); // plot.setDirection (Rotation.CLOCKWISE); plot.setForegroundAlpha (0.5f); plot.setNoDataMessage ( "No data to display"); String filename = ServletUtilities.saveChartAsPNG (chart, 500, 300, null, session); string graphURL = request.getContextPath () "
/ Displaychart? Filename = " filename;%> Note the above code, all : Jfreechart-0.9.20.jar, JCOMMON-0.9.5.JAR Up to debug the pass! Web.xml Configure the servlet code: XML Version = "1.0" encoding = "uTF-8"?>