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
OverlaidXYPlot setSeriesPaint not working
Re: OverlaidXYPlot setSeriesPaint not working
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
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