JFreeChart map generated popular among hungry students

  Abstract: JFreeChart map generated popular among hungry students 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> decompress documents jfreechart-0.9.11 directory and the jfreechart-lib 0.9.11.jar / jcommon-0.8.6.jar, lib / gnujaxp.jar are required for the operation of the development of the document, these three documents available to the application lib directory. 

  <table Width="676" border="0"> <tr> <td width="399"> web.xml file and then add the following: 


DisplayChart
  Org.jfree.chart.servlet.DisplayChart 


DisplayChart
  / Servlet / DisplayChart 
  </ Td> <td width="267"> </ td> </ tr> </ table> 
  Test code: 
  <% @ Page contentType = "text / html; GBK charset ="%> 
  <% @ Page import = "org.jfree.data.DefaultPieDataset"%> 
  <% @ Page import = "org.jfree.chart.JFreeChart"%> 
  <% @ Page import = "org.jfree.chart.plot.PiePlot"%> 
  <% @ 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 ( "June", 500); 
  Data.setValue ( "July", 580); 
  Data.setValue ( "August", 828); 

  PiePlot plot = new PiePlot (data); 

  JFreeChart chart = new JFreeChart ( "", JFreeChart.DEFAULT_TITLE_FONT, plot, true); 
  Chart.setBackgroundPaint (java.awt.Color.white); / / optional, and set the background color picture 
  Chart.setTitle ( "TAB ");// www.SenTom.net optional site visits, set up title picture 

  ChartRenderingInfo info = new ChartRenderingInfo (new StandardEntityCollection ()); 
  / / Length of 500 pictures, 300 is a high degree of picture 

  String filename = ServletUtilities.saveChartAsPNG (chart, 500, 300, info, session); 
  String graphURL = request.getContextPath () + "/ servlet / DisplayChart? Filename =" + filename; 
  Out.println (filename + " 
");
  Out.println (graphURL); 

%>

<head>

  </ Head> 
<body>


  "Width = 500 height = 300 border = 0 usemap ="#<%= filename%>"> 


  </ Body> 

  </ Td> </ tr> <tr> 

  ↑ Back 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags:

Releated Java Articles

Comments

Leave a Reply