Adding to a Plot

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
andyt
Posts: 4
Joined: Fri Oct 27, 2006 5:58 pm
Contact:

Adding to a Plot

Post by andyt » Fri Oct 27, 2006 6:08 pm

Hi,

Just started using JFreeChart.

How to add a line to a ScatterPlot?

I have tried generating the image of the ScatterPlot and using it as background to a XYLineChart.

Maybe I need to follow what ChartFactory is doing and customise.

Thanks for any pointers,

Andy

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Oct 30, 2006 2:39 pm

If you have the JFreeChart Developer Guide, take a look at RegressionDemo1.java, which adds a regression line to a set of points.

Otherwise, the approach is to add two datasets to the plot, and also two renderers (one an XYLineAndShapeRenderer that displays only shapes, the other an XYLineAndShapeRenderer that displays only lines).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

andyt
Posts: 4
Joined: Fri Oct 27, 2006 5:58 pm
Contact:

Post by andyt » Tue Oct 31, 2006 12:59 pm

Many thanks for the pointer David... It worked for me :)

Locked