jsp页面中
DefaultPieDataset data = new DefaultPieDataset();
data.setValue("六月", 500);
data.setValue("七月", 580);
data.setValue("八月", 828);
PiePlot plot = new PiePlot(data);
JFreeChart chart = new JFreeChart("",
JFreeChart.DEFAULT_TITLE_FONT, plot, true);
chart.setBackgroundPaint(java.awt.Color.white); //可选,设置图片背景色
chart.setTitle("Welcome to Jfreechart !"); //可选,设置图片标题
ChartRenderingInfo info = new ChartRenderingInfo(
new StandardEntityCollection());
//500是图片长度,300是图片高度
String filename = ServletUtilities.saveChartAsPNG(chart, 500, 300,
info, session);
String graphURL = request.getContextPath()
+ "/servlet/DisplayChart?filename=" + filename;
%>
Welcome to Jfreechart !
usemap="#">
web.xml中
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
DisplayChart
org.jfree.chart.servlet.DisplayChart
DisplayChart
/servlet/DisplayChart
index.jsp
柳德才
13691193654
18942949207
QQ:422157370
liudecai_zan@126.com
湖北-武汉-江夏-庙山
posted on 2009-01-11 11:38 liudecai_zan@126.com 阅读(1159) 评论(0) 编辑 收藏 所属分类: JFreeChart