How to set Pie chart values in %

自古美人都是妖i 提交于 2019-12-25 18:18:04

问题


I am using JFreechart for creating chart. When i am creating pie chart the values for the pie chart are displaying with integer format.But i need those values in Percentage.

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%)

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

Adding value to dataset.All data are inside arraylist.

Please help me.


回答1:


PieChartDemo2 is an example that uses a StandardPieSectionLabelGenerator for this. There's a related example here.



来源:https://stackoverflow.com/questions/12119780/how-to-set-pie-chart-values-in

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!