Legend in OverlaidVerticalCategoryPlot

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

Legend in OverlaidVerticalCategoryPlot

Post by Mof » Thu Feb 20, 2003 12:19 am

I have created my own renderers by extending the default renderers, so that I can set my own colours, and shapes.
The problem I am having is that when I use the Overlaid..Plot, the Legend just shows red squares, even though I have no red objects on the chart at all.
Is there a way around this ?

Mof.

BTW great work with 0.9.5 & 0.9.6!!

Arnaud

Re: Legend in OverlaidVerticalCategoryPlot

Post by Arnaud » Thu Feb 20, 2003 10:51 am

Hello,

The default shapes and colors come from : com.jrefinery.chart.renderer.DefaultDrawingSupplier.createStandardSeriesShapes()
and com.jrefinery.chart.ChartColor.createDefaultPaintArray().

It is possible to set Your own shapes for a series with :
com.jrefinery.chart.renderer.AbstractRenderer.setSeriesShape(int dataset, int series, Shape shape)
for an example, look in TimeSeriesDemo9 :
"[...]
StandardXYItemRenderer renderer = (StandardXYItemRenderer) r;
renderer.setPlotShapes(true);
renderer.setDefaultShapeFilled(true);
renderer.setSeriesShape(0, new Ellipse2D.Double(-3.0, -3.0, 6.0, 6.0));
renderer.setSeriesShape(1, new Rectangle2D.Double(-3.0, -3.0, 6.0, 6.0));

[...]"

and for the paint, as You've guessed, use the setSeriesPaint(int series, Paint paint) method.

Regard,
Arnaud

Mof

Re: Legend in OverlaidVerticalCategoryPlot

Post by Mof » Fri Feb 21, 2003 2:21 am

I already do this, but my problem is that the legend didn't seem to be picking up my changes.

Mof.

Locked