Search code examples
javajfreechart

How to display values within pie chart sector


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?


Solution

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

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