I have a Line chart with 3 lines, their line colors are automatically red , blue and green. If I want the colors are red, green and blue, then how could I do it?
Help me, please.
Inma.
Changed de colors in
Re: Changed de colors in
Hi!!
You have to create an XYPlot object from your JFreeChart object using the getXYPlot() method and then use the method: setSeriesPaint(java.awt.Paint[] paint) to change the color of the lines.
It will look like:
myXYPlot = myJFreeChart.getXYPlot();
myXYPlot.setSeriesPaint(new Paint[] {Color.red, Color.green, Color.blue});
You have to create an XYPlot object from your JFreeChart object using the getXYPlot() method and then use the method: setSeriesPaint(java.awt.Paint[] paint) to change the color of the lines.
It will look like:
myXYPlot = myJFreeChart.getXYPlot();
myXYPlot.setSeriesPaint(new Paint[] {Color.red, Color.green, Color.blue});
Re: Changed de colors in
Hi!!
thanks for your answer,
I´m try to do the solution that you give me, but I obtain an exception :
com.jrefinery.chart.VerticalCategoryPlot but I dont Know why...
thanks for your answer,
I´m try to do the solution that you give me, but I obtain an exception :
com.jrefinery.chart.VerticalCategoryPlot but I dont Know why...

Re: Changed de colors in
Hi again!!!
Sorry!!!
It isn't a XYPlot. Your chart has a CategoryPlot (or something like this). Try to change the method getXYPlot() by getDataset().
It will look like:
myPlot = myJFreeChart.getDataset();
myPlot.setSeriesPaint(new Paint[] {Color.red, Color.green, Color.blue});
Elio.
Sorry!!!
It isn't a XYPlot. Your chart has a CategoryPlot (or something like this). Try to change the method getXYPlot() by getDataset().
It will look like:
myPlot = myJFreeChart.getDataset();
myPlot.setSeriesPaint(new Paint[] {Color.red, Color.green, Color.blue});
Elio.
Re: Changed de colors in
Thanks for your help !
Exactly, my chart has a CategoryPlot I try to do something like:
CategoryPlot cPlot = chart.getCategoryPlot();
cPlot.setSeriesPaint(new Paint[] {Color.red, Color.green, Color.blue});
and It´s working!!!!
thanks again
Inma.
Exactly, my chart has a CategoryPlot I try to do something like:
CategoryPlot cPlot = chart.getCategoryPlot();
cPlot.setSeriesPaint(new Paint[] {Color.red, Color.green, Color.blue});
and It´s working!!!!
thanks again

Inma.