re-order the dataset

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
vision
Posts: 16
Joined: Tue Mar 31, 2015 10:00 am
antibot: No, of course not.

re-order the dataset

Post by vision » Mon May 18, 2015 2:30 pm

hi at everybody,

i don't know if this is the best way, but
i need to plot a bubble chart with the smallest ball on top respect the big one.
To do this i try to preorder the data and after that i add on the dataset(defaultxyzdataset), but i obtain the same result.


So my question is exist some method to order the dataset, or it is the correct way to do this?

Many thanks at all for the reply.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: re-order the dataset

Post by paradoxoff » Mon May 18, 2015 8:27 pm

There is no JFree functionality that would allow the ordering of an existing, unordered XYDataset, or its series, not to mention ordering of an XYZDataset by the Z value.
It should be straightforward to get the data out of an XYZDataset, for example as an array of double[3][itemCount] where [0][itemIndex] is the x value, [1][itemIndex] the y value and [2][itemIndex] the z value of the respective item. Sorting this array by the z value should also be straightforward. You would have to make sure that the value with the smallest z value has the highest item index.
Since that did not work, your sorting algorithm is apparently broken.

vision
Posts: 16
Joined: Tue Mar 31, 2015 10:00 am
antibot: No, of course not.

Re: re-order the dataset

Post by vision » Tue May 19, 2015 8:58 am

oh many many thanks for the hint!!!

i will try to implements this, because yesterday i had try to presort the value and after put that in the dataset with no success.

again many thanks, it is beautiful to have the possibility of hint from other expert people about this powerful library!!! :P

Locked