设置图表的标签和值(Setting label and value of the chart)

编程入门 行业动态 更新时间:2024-10-27 07:25:39
设置图表的标签和值(Setting label and value of the chart)

我使用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.

更多推荐

本文发布于:2023-07-28 04:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1300351.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图表   标签   Setting   label   chart

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!