Legend Color

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Dong

Legend Color

Post by Dong » Thu Aug 22, 2002 9:00 pm

Hi,

Thanks for the JFreeChart package first:)

My issue is when I draw the chart, the legends/series can only show 9 unique colors,ie. red, blue,green...gray. From the 10th, it will repeat color from red,blue, etc..
How can I specify my color to the legend.

thanks a lot in advance.

D.Z.

David Gilbert

Re: Legend Color

Post by David Gilbert » Fri Aug 23, 2002 7:20 am

You can use the setSeriesPaint(Paint[] paint) method in the Plot class. Just create an array of Paint objects (any length you want) and pass it in. If you have too few objects compared to the number of series in your chart, JFreeChart will just go back to the start of the list (this is what you are seeing happening). If you have too many, no problem, some of them won't get used.

Regards,

DG.

Locked