Drawing datapoints in the order they were added to the serie

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Siniz
Posts: 30
Joined: Mon Jul 21, 2008 10:38 am

Drawing datapoints in the order they were added to the serie

Post by Siniz » Wed Aug 27, 2008 2:15 pm

Hi! I've got another delicate problem. I tried browsing the API but couldn't find the solution.

What I want to do is very simple to understand. I am currently using a XYSeries and XYSeriesCollection. I am adding points one by one from a list with about 300 points.

As you know, when I add a new point via XYSeries.add(double x, double y) the point gets added to the series where it belongs between the x-values. Now when I draw the graph it will get painted from smallest to biggest x-value.

What I want is that it draws it in the order of points I added. So if I have an x value of 5 first, then 3, then 10 I want the lines to go in that order. Is that possible?

RoyW
Posts: 93
Joined: Wed Apr 23, 2008 7:42 pm
Contact:

Post by RoyW » Wed Aug 27, 2008 3:28 pm

Looking at the API for 1.10 there is a constructor

Code: Select all

public XYSeries(Comparable key, boolean autoSort)
Have you tried passing false for autoSort?
The answer does not come from thinking outside the box, rather the answer comes from realizing the truth; There is no Box. my js site

Siniz
Posts: 30
Joined: Mon Jul 21, 2008 10:38 am

Post by Siniz » Wed Aug 27, 2008 3:44 pm

Heh, what can I say :oops:
Thanks! ;)

Locked