PiePlot3D plot=(PiePlot3D)chart.getPlot();
// 图片中显示百分比:默认方式
plot.setLabelGenerator(new StandardPieSectionLabelGenerator(StandardPieToolTipGenerator.DEFAULT_TOOLTIP_FORMAT));
// 图片中显示百分比:自定义方式,{0} 表示选项, {1} 表示数值, {2} 表示所占比例 ,小数点后两位
plot.setLabelGenerator(new StandardPieSectionLabelGenerator( "{0}={1}({2}) ", NumberFormat.getNumberInstance(), new DecimalFormat( "0.00% ")));
// 图例显示百分比:自定义方式, {0} 表示选项, {1} 表示数值, {2} 表示所占比例
// 图片中显示百分比:默认方式
plot.setLabelGenerator(new StandardPieSectionLabelGenerator(StandardPieToolTipGenerator.DEFAULT_TOOLTIP_FORMAT));
// 图片中显示百分比:自定义方式,{0} 表示选项, {1} 表示数值, {2} 表示所占比例 ,小数点后两位
plot.setLabelGenerator(new StandardPieSectionLabelGenerator( "{0}={1}({2}) ", NumberFormat.getNumberInstance(), new DecimalFormat( "0.00% ")));
// 图例显示百分比:自定义方式, {0} 表示选项, {1} 表示数值, {2} 表示所占比例
本文介绍如何使用PiePlot3D设置图表中的百分比显示,包括默认和自定义方式,通过设置LabelGenerator实现不同需求。
2222

被折叠的 条评论
为什么被折叠?



