PieChart Legend color
PieChart Legend color
Hi !
How can I change the color legende in a PieChart ?
Thank in advance !
How can I change the color legende in a PieChart ?
Thank in advance !
Re: PieChart Legend color
You can use the setSeriesPaint(...) method inherited from the Plot class. It isn't immediately obvious, because the PiePlot doesn't really have series, but that is how it works right now...
Regards,
DG.
Regards,
DG.
Re: PieChart Legend color
ok ! thanks....I was looking in PiePlot class....
Is it possible to write around the PieChart the pourcent of each area ?
Nay
Is it possible to write around the PieChart the pourcent of each area ?
Nay
Re: PieChart Legend color
Try some of the options in the setSectionLabelType method (in the PiePlot class).
Regards,
DG
Regards,
DG
Re: PieChart Legend color
ok...but can I use a Plot Object and a piePlot Object for the same PieChart ?
it s seem not working....
If you have an example, it s welcome !
my code is :
....
Plot plot = chart.getPlot();
plot.setSeriesPaint(mylegendColor);
PiePlot piePlot = new PiePlot(mypieData);
piePlot.setSectionLabelType(PiePlot.NAME_AND_PERCENT_LABELS);
....
Thanks
ps : I buy the doc but there is no Part about Customising PiePlot
...
it s seem not working....
If you have an example, it s welcome !
my code is :
....
Plot plot = chart.getPlot();
plot.setSeriesPaint(mylegendColor);
PiePlot piePlot = new PiePlot(mypieData);
piePlot.setSectionLabelType(PiePlot.NAME_AND_PERCENT_LABELS);
....
Thanks
ps : I buy the doc but there is no Part about Customising PiePlot

Re: PieChart Legend color
The setSeriesPaint(...) method is defined in the Plot class, but it is also inherited by the PiePlot class. So you can do this:
PiePlot piePlot = new PiePlot(mypieData);
piePlot.setSectionLabelType(PiePlot.NAME_AND_PERCENT_LABELS);
piePlot.setSeriesPaint(myLegendColors);
Regards,
DG
PiePlot piePlot = new PiePlot(mypieData);
piePlot.setSectionLabelType(PiePlot.NAME_AND_PERCENT_LABELS);
piePlot.setSeriesPaint(myLegendColors);
Regards,
DG
Re: PieChart Legend color
Yes I tried this but it s do nothing....
Perhaps I need to do a PlotChangeEvent or something like this after ?
Do I need to invoke the piePlot.draw() method, normaly it s invoke with ChartFactory.createPieChart("title",mypieData, true) ?
Perhaps I need to do a PlotChangeEvent or something like this after ?
Do I need to invoke the piePlot.draw() method, normaly it s invoke with ChartFactory.createPieChart("title",mypieData, true) ?
Re: PieChart Legend color
OK, if you are using the ChartFactory to create your pie chart, then the PiePlot has been created for you. So, to get a reference to it, you need to do this:
PiePlot myPlot = (PiePlot) myChart.getPlot();
Then you can do the other stuff:
myPlot.setSectionLabelType(PiePlot.NAME_AND_PERCENT_LABELS);
myPlot.setSeriesPaint(myLegendColors);
If you just create a new PiePlot instance, then it has no connection at all with the chart you created previously.
Regards,
DG.
PiePlot myPlot = (PiePlot) myChart.getPlot();
Then you can do the other stuff:
myPlot.setSectionLabelType(PiePlot.NAME_AND_PERCENT_LABELS);
myPlot.setSeriesPaint(myLegendColors);
If you just create a new PiePlot instance, then it has no connection at all with the chart you created previously.
Regards,
DG.