我使用JFreeChart创建饼图,并且想要像在iReport那样分别设置值和标签。 换句话说,我希望图表在饼图上显示的结果不同于图例中的结果。 有什么方法可以实现这一目标吗?
I am creating pie charts using JFreeChart, and I want to set the value and the label seperately like in iReport. In other words, I want the chart to show different results on the pie than in the legend. Is there any way that I can achieve this?
最满意答案
MessageFormat ArgumentIndex值对应于系列名称 , 域和范围 。 您可以为每个系列或底座中的所有系列设置不同的发电机。
PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {1} {2}"));附录:对于PiePlot ,这些值具有略微不同的含义 - 系列名称 , 值和百分比 。
The MessageFormat ArgumentIndex values correspond to the series name, domain and range. You can set a different generator for each series or for all series in the base.
PiePlot plot = (PiePlot) chart.getPlot(); plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {1} {2}"));Addendum: For PiePlot, the values have a slightly different meaning—series name, value and percentage.
更多推荐
发布评论