JFreeChart---饼图
来源:互联网 发布:vc6.0编程实例 编辑:程序博客网 时间:2024/04/30 20:16
源码:
/** * 饼状图 */@Testpublic void test3() {DefaultPieDataset dataset = new DefaultPieDataset();dataset.setValue("苹果", 100);dataset.setValue("梨子", 200);dataset.setValue("葡萄", 300);dataset.setValue("香蕉", 400);dataset.setValue("橙子", 500);JFreeChart chart = ChartFactory.createPieChart("水果产量图", dataset);chart.setTitle(new TextTitle("水果产量", new Font("宋体", Font.BOLD, 12)));chart.setBackgroundPaint(Color.WHITE);//图表背景颜色chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 10));//3、获取图标区域对象PiePlot plot = (PiePlot) chart.getPlot();plot.setBackgroundPaint(Color.WHITE);//颜色plot.setBackgroundAlpha(0.6f);//背景色透明度plot.setForegroundAlpha(0.9f);//前景色透明度plot.setLabelFont(new Font("宋体", Font.PLAIN, 10));plot.setCircular(true);//true:圆,false:椭圆plot.setNoDataMessage("无数据");plot.setLabelGap(0.2D);//显示数据,以及所占百分比//plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}:({1}, {2})", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance()));try {ChartUtilities.writeChartAsJPEG(new FileOutputStream("E:/chart/pie_1.jpg"), chart, 400, 300, null);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}
源码:
/** * 饼状图 */@Testpublic void test4() {DefaultPieDataset dataset = new DefaultPieDataset();dataset.setValue("苹果", 100);dataset.setValue("梨子", 200);dataset.setValue("葡萄", 300);dataset.setValue("香蕉", 400);dataset.setValue("橙子", 500);JFreeChart chart = ChartFactory.createPieChart("水果产量图", dataset);chart.setTitle(new TextTitle("水果产量", new Font("宋体", Font.BOLD, 12)));chart.setBackgroundPaint(Color.WHITE);//图表背景颜色chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 10));//3、获取图标区域对象PiePlot plot = (PiePlot) chart.getPlot();plot.setBackgroundPaint(Color.WHITE);//颜色plot.setBackgroundAlpha(0.6f);//背景色透明度plot.setForegroundAlpha(0.9f);//前景色透明度plot.setLabelFont(new Font("宋体", Font.PLAIN, 10));plot.setCircular(true);//true:圆,false:椭圆plot.setNoDataMessage("无数据");plot.setLabelGap(0.2D);//显示数据,以及所占百分比plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}:({1}, {2})", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance()));try {ChartUtilities.writeChartAsJPEG(new FileOutputStream("E:/chart/pie_2.jpg"), chart, 600, 560, null);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}
源码:
/** * 饼状图 */@Testpublic void test5() {DefaultPieDataset dataset = new DefaultPieDataset();dataset.setValue("苹果", 100);dataset.setValue("梨子", 200);dataset.setValue("葡萄", 300);dataset.setValue("香蕉", 400);dataset.setValue("橙子", 500);JFreeChart chart = ChartFactory.createPieChart3D("水果产量图", dataset);chart.setTitle(new TextTitle("水果产量", new Font("宋体", Font.BOLD, 12)));chart.setBackgroundPaint(Color.WHITE);//图表背景颜色chart.getLegend().setItemFont(new Font("宋体", Font.PLAIN, 10));//3、获取图标区域对象PiePlot plot = (PiePlot) chart.getPlot();plot.setBackgroundPaint(Color.WHITE);//颜色plot.setBackgroundAlpha(0.6f);//背景色透明度plot.setForegroundAlpha(0.9f);//前景色透明度plot.setLabelFont(new Font("宋体", Font.PLAIN, 10));plot.setCircular(true);//true:圆,false:椭圆plot.setNoDataMessage("无数据");plot.setLabelGap(0.2D);//显示数据,以及所占百分比plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}:({1}, {2})", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance()));try {ChartUtilities.writeChartAsJPEG(new FileOutputStream("E:/chart/pie_3.jpg"), chart, 600, 560, null);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}
0 0
- JFreeChart---饼图
- JFreeChart饼图
- Jfreechart 饼图 和 曲线
- JFreeChart饼图(PieChart)
- JFreeChart制作图表--饼图
- JFreeChart制作图表--饼图
- JFreeChart 3D饼图
- JFreeChart
- JFreeChart
- JFreeChart
- JFreeChart
- JFreeChart
- JFreeChart
- JFreeChart
- jfreechart
- JFreeChart
- JFreeChart
- jfreechart
- 【HEVC学习与研究】30、解码Coding Unit数据
- 【cocos2d-js官方文档】十八、Cocos2d-js v3.0的对象构造和类继承
- Android handler
- Github for Windows使用介绍
- Ajax请求本地文件
- JFreeChart---饼图
- 编写一个程序,统计给定文件中包含的每个单词出现的频率,并按单词表的顺序显示统计结果
- HugePages on Oracle Linux 64-bit (Doc ID 361468.1)
- ZooKeeper使用场景-Leader选举
- AbstractByteBufAllocator
- AsyncTask的注意事项
- 苹果手机个性定制,IPHONE4S手机外壳DIY专属定制,创意设计外壳
- 自己创建map结构体 sort + cmp
- 硬币问题java实现