Colors and Subplots

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

Colors and Subplots

Post by sebastian » Fri Mar 07, 2003 1:17 pm

Is there a way to change the SeriesColours of Subplots if you have an combined or overlaid XY Plot in 0.9.6????

sth like plot.getSubplot().getRenderer().setSeriesPaint(new Color(...))

I don't even manage to get the subplot instances :-( because there is no getSubplot() method

or do i have to know in advance which colours i have to assign to my subplotSeries???


because
this code

XYPlot plot1 = new XYPlot(dataset, null, null, new HighLowRenderer());
XYPlot plot2 = new XYPlot(dataset2, null, null);
// generate chart
OverlaidXYPlot plot = new OverlaidXYPlot(timedomainaxis, rttrangeaxis);
plot.add(plot1);
plot.add(plot2);

returns a plot with two red lines


thanks for replies

Sebastian

David Gilbert

Re: Colors and Subplots

Post by David Gilbert » Sat Mar 08, 2003 1:10 am

Hi Sebastian,

One way to ensure that the subplots use different colors is to assign a single DrawingSupplier instance to all the renderers in the subplots. See the CombinedXYPlotDemo.java class for one example.

Alternatively, you can manually set the colors in the renderers for each subplot...along the lines of the code you suggested, except that there is no getSubplot(...) method. In the current version, you can get a list of subplots using the getSubplots() method...work needs to be done to improve the API for accessing/removing subplots.

Regards,

Dave Gilbert

Locked