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?
Asked
Active
Viewed 8,927 times
5

trashgod
- 203,806
- 29
- 246
- 1,045

Vijayalakshmi
- 189
- 1
- 3
- 11
2 Answers
9
Use setSimpleLabels()
, as shown below; org.jfree.chart.demo.PieChartDemo1
is a good starting point.
PiePlot plot = (PiePlot) chart.getPlot();
plot.setSimpleLabels(true);

trashgod
- 203,806
- 29
- 246
- 1,045
1
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.

Naved
- 4,020
- 4
- 31
- 45
-
The labels are shown outside by default, as seen in [`org.jfree.chart.demo.PieChartDemo1`](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/demo/PieChartDemo1.html). – trashgod Sep 05 '11 at 11:30