jfreechart柱状图生成

一、添加以下jfreechart的jar包:

  1. gnujaxp.jar
  2. iText-2.1.5.jar
  3. jcommon-1.0.16.jar
  4. jfreechart-1.0.13.jar
  5. jfreechart-1.0.13-experimental.jar
  6. jfreechart-1.0.13-swt.jar
  7. swtgraphics2d.jar
 

二、在web.xml中加入用于查看图片的servlet(在jfreechart中已经被实现):

<servlet>     <servlet-name>DisplayChart</servlet-name>     <servlet-class>org.jfree.chart.servlet.DisplayChart</servlet-class>  </servlet>  <servlet-mapping>      <servlet-name>DisplayChart</servlet-name>      <url-pattern>/displayChart</url-pattern>  </servlet-mapping>

三、chart.jsp中的核心代码

< %@ page contentType="text/html; charset=GB2312" %> < %@ page import="java.awt.*, java.text.*, java.util.*" %> < %@ page import="org.jfree.chart.*,org.jfree.chart.labels.*,org.jfree.ui.*" %> < %@ page import="org.jfree.chart.axis.*" %> < %@ page import="org.jfree.chart.plot.*" %> < %@ page import="org.jfree.chart.servlet.ServletUtilities" %> < %@ page import="org.jfree.data.category.DefaultCategoryDataset" %> < %@ page import="org.jfree.chart.renderer.category.BarRenderer3D" %>

 

 

 

 
原文地址: jfreechart柱状图生成 | http://orgcent.com/jfreechart-histogram-generation/

你可能感兴趣的:(jfreechart)