收藏 分享(赏)

JAVA+生成树状图及饼图.doc

上传人:fmgc7290 文档编号:6356608 上传时间:2019-04-09 格式:DOC 页数:6 大小:48KB
下载 相关 举报
JAVA+生成树状图及饼图.doc_第1页
第1页 / 共6页
JAVA+生成树状图及饼图.doc_第2页
第2页 / 共6页
JAVA+生成树状图及饼图.doc_第3页
第3页 / 共6页
JAVA+生成树状图及饼图.doc_第4页
第4页 / 共6页
JAVA+生成树状图及饼图.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

1、JAVA 生成树状图及饼图import java.awt.Color;import java.awt.Font;import java.io.PrintWriter;import java.text.DecimalFormat;import java.util.List;import javax.servlet.http.HttpSession; import org.jfree.chart.ChartFactory;import org.jfree.chart.ChartRenderingInfo;import org.jfree.chart.ChartUtilities;import or

2、g.jfree.chart.JFreeChart;import org.jfree.chart.axis.CategoryAxis;import org.jfree.chart.entity.StandardEntityCollection;import org.jfree.chart.labels.ItemLabelAnchor;import org.jfree.chart.labels.ItemLabelPosition;import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;import org.jfree.cha

3、rt.labels.StandardPieSectionLabelGenerator;import org.jfree.chart.labels.StandardPieToolTipGenerator;import org.jfree.chart.plot.CategoryPlot;import org.jfree.chart.plot.PiePlot3D;import org.jfree.chart.plot.PlotOrientation;import org.jfree.chart.renderer.category.BarRenderer3D;import org.jfree.char

4、t.servlet.ServletUtilities;import org.jfree.data.category.DefaultCategoryDataset;import org.jfree.data.general.DefaultPieDataset;import org.jfree.ui.TextAnchor;public class ChartGenerater /* * 利用JFreeChart生成柱形及饼状图 * version JFreeChart 1.08* List list 生成图形的源数据 * String titles 标题 * String x 图形的水平轴注释 *

5、 String y 图形的垂直轴注释 * String charttype 图形类型,piechart为饼图,barchart为柱形图 */ public static String generateChart(List list, String titles,HttpSession session, PrintWriter pw, String x, String y,String charttype) String filename = “;Font font;int len = list.size();if (“piechart“.equals(charttype.trim() try

6、/ 建立PieDataSetDefaultPieDataset dataset = new DefaultPieDataset();/ 生成一个3D饼图for(int i=0;i 9) return Color.BLUE;Color cols = new ColorColor.RED,Color.BLUE,Color.BLACK,Color.YELLOW,Color.GREEN,Color.MAGENTA,Color.ORANGE,Color.PINK,Color.DARK_GRAY,Color.CYAN;return colsi;页面调用filename = CRMChartGenerater.generateChart(list,escape(title),session, new java.io.PrintWriter(out),“,“,charttype);graphURL = request.getContextPath() + “/chart?filename=“ + filename;“ border=0 usemap=“#“/

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 网络科技 > Java

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报