Hi there,
I'm having troubles trying to draw a function like 'x=y*y', or 'y=sqrt(x)' which is the same. I tried StandardXYItemRenderer first and XYSeriesCollection as a dataset. But that's not good 'cause for one x-value there're two y-values and drawing goes up and down at that point. Can anyone give a hint what else I could use? I've spent 4-5 hours with JFreeChart so I'm new to it.
Thank you.
Drawing curve
Re: Drawing curve
Hi George,
I had the same problem. To solve this I did extend the XYseries class and did override the add method to unconditionally add the provided pair to the dataset. In this way you get around the sorting of your data.
See the following code snippet for the add method.
public void add(XYDataPair pair) throws SeriesException {
// check arguments...
if (pair == null) {
throw new IllegalArgumentException("XYSeries.add(...): null item not allowed.");
}
data.add(pair);
}
Regards RT
I had the same problem. To solve this I did extend the XYseries class and did override the add method to unconditionally add the provided pair to the dataset. In this way you get around the sorting of your data.
See the following code snippet for the add method.
public void add(XYDataPair pair) throws SeriesException {
// check arguments...
if (pair == null) {
throw new IllegalArgumentException("XYSeries.add(...): null item not allowed.");
}
data.add(pair);
}
Regards RT
Re: Drawing curve
Hi Rene,
This probably works if you use something different than XYSeriesCollection. That beast has "private List data" where it keeps series.
But you were definitelly right about the root of the problem. Sorting is what's screwing things up. I think we sould point this out to the developers, shouldn't we?
Regards GB
This probably works if you use something different than XYSeriesCollection. That beast has "private List data" where it keeps series.
But you were definitelly right about the root of the problem. Sorting is what's screwing things up. I think we sould point this out to the developers, shouldn't we?
Regards GB