- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
下面通过查找资料做可两个Demo,只有饼图和柱状图的,其它的请各位自己研究了,大同小异.下面来说说,首先到官方网站下不到开发必须的两个
包:jcommon-1.0.0.jar,jfreechart-1.0.0-rc1.jar,就随便找了两个,版本不高,但是够用,下面就贴出调试过的代码:
%@pagelanguage=javapageEncoding=GBK%
%@pageimport=org.jfree.data.general.DefaultPieDataset%
%@pageimport=org.jfree.chart.*%
%@pageimport=org.jfree.chart.plot.*%
%@pageimport=org.jfree.chart.labels.StandardPieSectionLabelGenerator%
%@pageimport=org.jfree.chart.servlet.ServletUtilities%
%@pageimport=org.jfree.chart.urls.StandardPieURLGenerator%
%@pageimport=org.jfree.chart.entity.StandardEntityCollection%
%@pageimport=java.io.*%
!DOCTYPEhtmlPUBLIC-//W3C//DTDHTML4.01Transitional//EN/TR/html4/loose.dtd
html
head
metahttp-equiv=Content-Typecontent=text/html;charset=GBK
titleInserttitlehere/title
/head
body
%DefaultPieDatasetdata=newDefaultPieDataset();data.setValue(高中以下,3700);
data.setValue(高中,1530);
data.setValue(大专,5700);data.setValue(本科,8280);data.setValue(硕士,4420);data.setValue(博士,8000);
PiePlot3Dplot=newPiePlot3D(data);//3D饼图
plot.setURLGenerator(newStandardPieURLGenerator(barview.jsp));//设定链接
JFreeChartchart=newJFreeChart(,JFreeChart.DEFAULT_TITLE_FONT,plot,true);//
chart.setBackgroundPaint(Color.white);//可选,设置图片背景色chart.setTitle(程序员学历情况调查表);//可选,设置图片标题 //plot.setToolTipGenerator(newStandardPieSectionLabelGenerator());StandardEntityCollectionsec=newStandardEntityCollection();ChartRenderingInfoinfo=newChartRenderingInfo(sec);response.setContentType(text/html;charset=UTF-8);
PrintWriterw=newPrintWriter(out);//输出MAP信息//500是图片长度,300是图片高度Stringfilename=ServletUtilities.saveChartAsPNG(chart,500,300,info,session);ChartUtilities.writeImageMap(w,map0,info,false);
StringgraphURL=request.getContextPath()+/servlet/DisplayChart?filename=+filename;%
%@pageimport=org.jfree.chart.ChartFactory,org.jfree.chart.JFreeChart,org.jfree.chart.plot.PlotOrientation,org.jfree.chart.servlet.ServletUtilities,org.jfree.data.category.*%
%CategoryDat
您可能关注的文档
- The Taming of the Shrew读书笔记分析和总结.docx
- The Timeline of Educational Technology in China 分析和总结分析和总结.docx
- Hydrogen storage alloy of Mg 2 Ni produced from Mg and Ni ultrafine particles分析和总结分析和总结.docx
- h河南版《劳动与技术》五下教案.docx
- i20表解释分析和总结.docx
- IBM八道古怪题分析和总结.docx
- IBM笔试题分析和总结.docx
- IBM郭士纳分析和总结.docx
- icu护士实习心得.docx
- IC卡电梯智能控制系统技术参数及功能说明.docx
文档评论(0)