When I divide the pie chart into only 2 parts, their part colors are automatically red and blue. If I want the colors are red and yellow, then how could I do it?
Thanks a lot!
change part color of pie chart
Re: change part color of pie chart
//Warning! - Air code...
PiePlot plot = (PiePlot)chart.getPlot();
ArrayList categories = new ArrayList(plot.getCategories());
Color[] colors = new Color[categories.size()];
...
//set your colors here
colors[0]= Color.red;
colors[1]= Color.yellow;
...
plot.setSeriesPaint(colors);
Hope this helps,
Ray Mercer
PiePlot plot = (PiePlot)chart.getPlot();
ArrayList categories = new ArrayList(plot.getCategories());
Color[] colors = new Color[categories.size()];
...
//set your colors here
colors[0]= Color.red;
colors[1]= Color.yellow;
...
plot.setSeriesPaint(colors);
Hope this helps,
Ray Mercer