XYDataSet : Points rather than Lines

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

XYDataSet : Points rather than Lines

Post by Steph » Mon Oct 07, 2002 11:57 am

Hi,

Is it possible to plot points rather than lines in a XYDataSet ?
And can we choose the shape of the points (squares, circles, triangles...) ?

Thanx

Steph

David Gilbert

Re: XYDataSet : Points rather than Lines

Post by David Gilbert » Mon Oct 07, 2002 2:27 pm

Hi Steph,

You can change the renderer for the XYPlot:

XYPlot plot = myChart.getXYPlot();
XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES);
plot.setRenderer(renderer);

If you want to use custom shapes, you should look at the setShapeFactory method in the Plot class.

Regards,

DG.

Steph

Re: XYDataSet : Points rather than Lines

Post by Steph » Mon Oct 07, 2002 4:08 pm

Thanx a lot David,

It works properly.

But I would like to plot several curves in the same chart : one must be a line without shapes and the others must be only shapes.
Is it possible to do that with an XYDataset object ?
Your previous answer works only if I want to set every curves of my chart in the same type.

Thanks

Steph

David Gilbert

Re: XYDataSet : Points rather than Lines

Post by David Gilbert » Mon Oct 07, 2002 5:02 pm

At the moment you need to use an OverlaidXYPlot with two (or more) subplots, because the renderer is 'per plot' rather than 'per series'. It might make sense to change that, but I'll have to wait until I've thought about it properly first...

Regards,

DG.

Steph

Re: XYDataSet : Points rather than Lines

Post by Steph » Tue Oct 08, 2002 9:00 am

Ok Thanks a lot
Just a last question :

Is it possible to fill the shapes with a colour (cause every shapes I plot
are empty) ?

Regards

Steph

Locked