jfreechart问题
我今天刚下的 jfreechart 1.0.3 测试了一个饼状图可以显示了但是
我在网上找到这样一段代码:
<%@ page contentType= "text/html;charset=GBK "%>
<%@ page import= "org.jfree.chart.ChartFactory,
org.jfree.chart.JFreeChart,
org.jfree.chart.plot.PlotOrientation,
org.jfree.chart.servlet.ServletUtilities,
org.jfree.data.DefaultCategoryDataset "
%>
<%
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(300, "广州 ", "苹果 ");
dataset.addValue(200, "广州 ", "梨子 ");
dataset.addValue(500, "广州 ", "葡萄 ");
dataset.addValue(340, "广州 ", "芒果 ");
dataset.addValue(280, "广州 ", "荔枝 ");
JFreeChart chart = ChartFactory.createBarChart3D( "水果销量统计图 ",
"水果 ",
"销量 ",dataset,
PlotOrientation.VERTICAL,
false,
false,
false);
String filename = ServletUtilities.saveChartAsPNG(chart, 500, 300, null, session);
String graphURL = request.getContextPath() + "/servlet/DisplayChart?filename= " + filename;
%>
<IMG height=300 src= " <%= graphURL %> " width=500 useMap= "# <%= filename %> " border=0>
为什么 运行的时候出现下面的错误:
An error occurred at line: 7 in the jsp file: /zhu2.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Tomcat\work\Standalone\localhost\_\zhu2_jsp.java:11: 找不到符号
符号: 类 DefaultCategoryDataset
位置: 软件包 org.jfree.data
import org.jfree.data.DefaultCategoryDataset;
^
C:\Tomcat\work\Standalone\localhost\_\zhu2_jsp.java:48: 找不到符号
符号: 类 DefaultCategoryDataset
位置: 类 org.apache.jsp.zhu2_jsp
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
^
An error occurred at line: 7 in the jsp file: /zhu2.jsp
Generated servlet error:
C:\Tomcat\work\Standalone\localhost\_\zhu2_jsp.java:48: 找不到符号
符号: 类 DefaultCategoryDataset
位置: 类 org.apache.jsp.zhu2_jsp
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
------解决方案--------------------估计是版本问题,jfreechart新旧版本有不兼容的问题
------解决方案--------------------http://www.wave12.com/web/home.asp
图表组件wsChart4.5(DLL版)