OverlaidXYPlot setSeriesPaint not working

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

OverlaidXYPlot setSeriesPaint not working

Post by Raj » Tue Nov 05, 2002 6:00 pm

Hi All,
I am using a OverlaidXYPlot to plot a timseries (line) and a interval timeseries (bars). When I try to customize the colors for the series the legend changes the color but the series colors remains unchanged.
Urgent please help.

Raj

Bill Kelemen

Re: OverlaidXYPlot setSeriesPaint not working

Post by Bill Kelemen » Wed Nov 06, 2002 2:24 am

Hi Raj,

Here is the fix:

In com.jrefinery.chart.OverlaidXYPlot add:

<code>
import java.awt.Paint;
</code>

and the followint two methods:

<code>
/**
* OVERRIDE: (to do all subplots)
* Sets the paint used to color any shapes representing series, and
* notifies registered listeners that the plot has been modified.
* @param paint An array of Paint objects used to color series.
*/
public void setSeriesPaint(Paint[] paint)
{
super.setSeriesPaint(paint);
Iterator iterator = subplots.iterator();
while (iterator.hasNext())
{
XYPlot plot = (XYPlot)iterator.next();
plot.setSeriesPaint(paint);
}
}

/**
* OVERRIDE: (to do all subplots)
* Sets the item renderer, and notifies all listeners of a change to
* the plot.
* @param renderer The new renderer.
*/
public void setXYItemRenderer(XYItemRenderer renderer)
{
super.setRenderer(renderer);
Iterator iterator = subplots.iterator();
while (iterator.hasNext())
{
XYPlot plot = (XYPlot)iterator.next();
plot.setRenderer(renderer);
}
}
</code>

Regards,
Bill

Locked