设置图表的标签和值 [英] Setting label and value of the chart

查看:108
本文介绍了设置图表的标签和值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 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 值对应系列名称范围。您可以为每个系列或基础中的所有系列设置不同的生成器。

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}"));

附录:对于 PiePlot ,值为略有不同的含义 - 系列名称百分比

Addendum: For PiePlot, the values have a slightly different meaning—series name, value and percentage.

这篇关于设置图表的标签和值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆