changing colors of graph

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

changing colors of graph

Post by shirish » Fri Dec 13, 2002 2:40 pm

hello,

i am using cewolf to create a horizontal bar graph which uses jfreechart internally.
i wanted to know if it is possible to change the colors of the bars as my fields are 25 and the colors are getting repeated. kindly help me.
if possible kindly forward me a small code example which sets the color.
mail me if more clarification are required.
thanking you.

shirish

Nancy Ryan

Re: changing colors of graph

Post by Nancy Ryan » Mon Dec 16, 2002 9:17 am

you could try something like this:

XYPlot plot = new XYPlot(xyDataset, timeAxis, valueAxis);

//color of the lines
Paint[] p = new Paint[] {Color.green.darker().darker(), Color.red, Color.orange, .......... }; //put as many distinct colors as you need here
plot.setSeriesPaint(p);

-NR

Locked