[Lazarus] Line Endings
Benito van der Zander
benito at benibela.de
Thu Dec 24 01:46:32 CET 2009
Dear all, dear Alexander,
I saw in tachart source code that adding points to a serie they are kept
ordered by X coordinate.
There is any reason for that?
Taken from source:
// We keep data points ordered by X coordinate.
// Note that this leads to O(N^2) time except
// for the case of adding already ordered points.
// So, is the user wants to add many (>10000) points to a graph,
// he should pre-sort them to avoid performance penalty.
Here my problem related to that.
I am working with a TLineSerie where I do not plot lines, in order to
obtain a simple scatter plot.
I add many points to my chart, the points are added in a defined order
that is not related to x value.
After adding all the points if I use GetNearestPoint I obtain as AIndex
the integer value related to the new indexing order.
For example if I add points with the following coordinates in this order:
X Y
7 0
1 2
3 1
When I will use GetNearestPoint I will get AIndex 0 for the second added
point, AIndex 1 for the third and AIndex =3 for the first added point.
Why? The points are added in a specific order that is useful to me. When
I move the mouse over the chart I need to obtain the correct index in
order to perform some actions related to that specific point.
Is it possible to modify this feature? Otherwise is it possible to make
the x ordering optional? For example introducing a property like Sorted
= True, False
Regards,
Andrea
More information about the Lazarus
mailing list