XY line plot with non-monotone X-values

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

XY line plot with non-monotone X-values

Post by James Housden » Wed Sep 18, 2002 9:33 am

I have two XYseries {(x,y1)} and {(x,y2)} that I can plot as two curves on an XY linechart without difficulties. However I would like to plot a graph of y1 against y2. I have created a series {(y1,y2)} but during creation the data points are sorted according to the first component values y1. This is not what I want. I need to keep the ordering of the points the same as in the original series.

As an example, for illustrative purposes only, I could have the two series {(t,sint)} and {(t,cost)} for 0=<t<2Pi. I would then like to plot {(y1,y2)}= {(sint, cost)} in the y1-y2 plane. The result should be a circle of radius 1.0.

Is there a simple way to do this?

Andreas Schroeder

Re: XY line plot with non-monotone X-values

Post by Andreas Schroeder » Wed Sep 18, 2002 9:41 am

Hi James,
A simple way: implement your own XYDataset, since the DefaultXYDataset sorts the values.

use e.g.
extends AbstractSeriesDataset implements XYDataset

and do the rest...
I have allready done this for my own purpose, and it works fine.
I have 200 random values positively correlated by 0.5 (i would say), plotted
with a line with nice alpha transparency. Looks like art - but was in fact a mistake (i did not want to plot a line, but shapes) :-)

Regards,

Andreas Schroeder

James Housden

Re: XY line plot with non-monotone X-values

Post by James Housden » Wed Sep 18, 2002 10:02 am

Hello Andreas,

Thanks for the suggestion. It is very helpful as I have only just started using JFreeChart.

Regards,
James

Locked