设置图表的标签和值

发布于 2024-09-15 13:55:30 字数 123 浏览 5 评论 0原文

我正在使用 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

誰ツ都不明白 2024-09-22 13:55:30

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—as shown here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文