final PiePlot plot = (PiePlot) chart.getPlot();
for (int i = 0; i < 2; i++) {
plot.setSectionPaint(i, color[i]);
plot.setSectionPaint(plot.getSectionKey(i), color[i]);
}
I try to set some other color to the section of a PieChart.
setSectionPaint(int, Color) method is deprecated
setSectionPaint(Comparable, Color) method : I cannot get a Comparable object because plot.getSectionKey(int index ) is protected.
Is there a solution so I can change color of sections without error/warn message ?
Or how to retrieve the comparable object ?
You need to supply the correct
Comparable keyfrom your data set to invoke the desired implementation ofsetSectionPaint(). For example, inorg.jfree.chart.demo.PieChartDemo1, the following would set sectionOnetoColor.black.