Adding to a Plot

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

Adding to a Plot

Postby andyt » Fri Oct 27, 2006 6:08 pm


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,

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

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

If you have the JFreeChart Developer Guide, take a look at, 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: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
JFreeChart Project Leader
Posts: 11655
Joined: Fri Mar 14, 2003 10:29 am

Postby andyt » Tue Oct 31, 2006 12:59 pm

Many thanks for the pointer David... It worked for me :)
Posts: 4
Joined: Fri Oct 27, 2006 5:58 pm

Return to JFreeChart

Who is online

Users browsing this forum: Bing [Bot] and 7 guests