Custom plot color for even and odd row

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
lch28hk
Posts: 1
Joined: Thu Dec 08, 2011 5:23 am
antibot: No, of course not.

Custom plot color for even and odd row

Post by lch28hk » Thu Dec 08, 2011 5:32 am

Does anyone know how to set the color for even and odd row in the plot? like this example:

http://www.jpmorganam.com.hk/wps/portal ... LX19fXzI!/

Thanks,

mkrauskopf
Posts: 31
Joined: Thu May 27, 2010 4:23 pm
antibot: No, of course not.

Re: Custom plot color for even and odd row

Post by mkrauskopf » Fri Dec 09, 2011 2:05 pm

One way is to use interval markers (about which I've learned yesterday in other thread). Something like:

Code: Select all

getPlot().addRangeMarker(new IntervalMarker(20, 40, new Color(0, 255, 255, 128)), Layer.BACKGROUND);
should do the trick. Pick you favorite color and use simple iteration over range-axis range to add multiple markers instead of hard-coded values.

Might be, there is better trick about which I don't know.

Cheers,
-- m.

Locked