How to display values within pie chart sector

一笑奈何 提交于 2019-12-23 08:50:27

问题


I am using JFreeChart to create pie charts. Values are displayed outside pie chart sectors as labels. I want to display the values within the pie sectors. How can I achieve this. Please can any one help me?


回答1:


Use setSimpleLabels(), as shown below; org.jfree.chart.demo.PieChartDemo1 is a good starting point.

PiePlot plot = (PiePlot) chart.getPlot();
plot.setSimpleLabels(true);



回答2:


If you are using createPieChart3D to create Pie chart, following URL will be helpful to you.
http://www.java2s.com/Code/Java/Chart/JFreeChartPieChart3DDemo1.htm
What I know is, showing values inside is default feature of the chart. If you're unable to do so it seems that you have changed the default way.



来源:https://stackoverflow.com/questions/7303905/how-to-display-values-within-pie-chart-sector

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