overlaid plots Vs TrendLines

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

overlaid plots Vs TrendLines

Post by Kishore » Mon Oct 21, 2002 12:42 pm

hi,
What is the difference between overlaid plots and TrendLines.
or is both of them are same.
thanks,
Kishore

Dave Gilbert

Re: overlaid plots Vs TrendLines

Post by Dave Gilbert » Tue Oct 22, 2002 9:09 am

Hi Kishore,

Overlaid plots allow you to draw two or more plots in the same space.

Why would you want to do this? The main reason is that a plot has a single renderer, which means that all the data series are drawn the same way (as lines, or as shapes, or as bars etc). If you want to combine (say) a scatter plot with a trend line, then you need to overlay two plots, each plot having a different renderer.

Regards,

DG

Kishore

Re: overlaid plots Vs TrendLines

Post by Kishore » Wed Oct 23, 2002 5:39 am

Hi DG,
Thanks a lot for u'r Prompt Response.one more help.is it possible for you to provide me an example, containing a trend line over the scatter plot.
Thanks,
Kishore.

Dave Gilbert

Re: overlaid plots Vs TrendLines

Post by Dave Gilbert » Wed Oct 23, 2002 8:53 am

If you look at the OverlaidXYPlot demo, and make the following one-line change:

// XYItemRenderer renderer1 = new VerticalXYBarRenderer(0.20);
XYItemRenderer renderer1 = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES);

...then you almost get what you want. You just need to make sure the other series represents a trend line, rather than random data as in this example.

There is another demo (RegressionDemo1.java) that shows how to add a linear or power regression line to a scatter plot. It is included in a special download only available to developers that have purchased the JFreeChart documentation.

Regards,

DG.

Locked