Over-riding default color selections.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
alans
Posts: 14
Joined: Thu Sep 18, 2008 1:39 am

Over-riding default color selections.

Post by alans » Tue Oct 21, 2008 1:56 am

I'd like to over-ride the default color for a chart with my own.

Does anyone know if this is possible.


For example. I have a compound timeline chart that displays
different type of user actions. The top contain one time and the
bottom a different.

I'd like the top part to be a different shades of blue while the
bottom use shades of a different base color.

Does anyone know if it is possible to write a callback method
or pass in an array of colors to the render to over-ride the
default selection?

Thanks.

ozonew4m
Posts: 2
Joined: Wed Oct 29, 2008 2:04 pm
Contact:

.

Post by ozonew4m » Wed Oct 29, 2008 5:28 pm

I would also be interested to know this Pleeease :)

alans
Posts: 14
Joined: Thu Sep 18, 2008 1:39 am

Post by alans » Thu Oct 30, 2008 12:35 am

You can set this by callig "getRenderer()" from a Plot, and then calling "setSeriesPaint(0, )" with the color you want.

I found it easiest to keep the List/Set/Map of colors on my own then setting each color as you add it to the chart.


some loop {


AbstractRenderer r1 = (AbstractRenderer) xyPlot.getRenderer();
r1.setSeriesPaint(0, graphColors.getNextColor() );

}

Locked