如何设置饼图值的百分比

yzuktlbb  于 2021-07-09  发布在  Java
关注(0)|答案(1)|浏览(363)

我正在使用jfreechart创建图表。创建饼图时,饼图的值以整数格式显示。但我需要以百分比形式显示这些值。

My current Output :- 

Service manager (1)
Service Executive (6)
Service co-coordinator (3)

My Expected output :-

Service manager (10%)
Service Executive (60%)
Service co-coordinator (30%)

样品code:-

for(int i=0;i<dataset_bydeglist.size();i+=2){
                        dataset.setValue(dataset_bydeglist.get(i).toString()+" ("+(Integer)dataset_bydeglist.get(i+1)+") ",(Integer)dataset_bydeglist.get(i+1));
                    }

正在向dataset添加值。所有数据都在arraylist中。
请帮帮我。

ca1c2owp

ca1c2owp1#

PieChartDemo2 是一个使用 StandardPieSectionLabelGenerator 为了这个。这里有一个相关的例子。

相关问题