您的位置:首页 > 其它

JFreeChart框架中生成饼状图上怎样显示数据 [问题点数:40分,结帖人GreenLawn]

2016-01-21 08:56 489 查看
我用JFreeChart框架生成饼状图,但想把数据信息在饼图上显示,是在饼图内部(即圆内)显示!怎样实现啊??

去掉lable
pieplot.setLabelGenerator(null);
去掉线
pieplot.setLabelLinksVisible(false);

饼图标签显示百分比方法
PiePlot pp = (PiePlot)chart.getPlot();
pp.setLabelGenerator(new StandardPieSectionLabelGenerator("{2}"));

如果百分比要包括一位小数,则使用
pp.setLabelGenerator(new StandardPieSectionLabelGenerator("{2}",new DecimalFormat("0.0"),new DecimalFormat("0.0%")));

显示实际数值
PiePlot pp = (PiePlot)chart.getPlot();
pp.setLabelGenerator(new StandardPieSectionLabelGenerator("{1}"));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: