[Lazarus] TAChart DataPointCrossHairTool
"Leonardo M. Ramé"
l.rame at griensu.com
Sun Sep 21 23:18:45 CEST 2014
On 21/09/14 16:54, Werner Pamler wrote:
> To convert image coordinates (pixels within the chart rectangle which
> you, indeed, can obtain from the global mouse position converted to the
> local chart pixels) to "graph" coordinates you call the chart methods
> * "XImageToGraph(x:Integer): Double" for x coordinates,
> * "YImageToGraph(y:Integer): Double" for y coordinates, or
> * "ImageToGraph(P:TPoint): TDoublePoint" (for both).
> (or XGraphToImage() etc for the other direction).
> If you do not use axis transformations, then graph coordinates directly
> refer to the units of your data. If, on the other hand, axis
> transformations are involved (logarithmic axes, multiple axes etc) the
> values on the axes may be different from the graph units used in an
> internal coordinate system. In this case, you have to link the series to
> the axis (by means of the AxisIndexX and AxisIndexY properties) and call
> the GraphToAxis or AxisToGraph methods of the AxisTransformation which
> is obtained from the method GetTransform of the axis. In your example of
> y values the transformation chain would be
> mouse point yi --> graph coords by yg := Chart.YImageToGraph(yi) -->
> axis coords by ya := Chart.LeftAxis.GetTransform.GraphToAxis(yg).
> Here, ya refers to your input data, yi to the pixel data.
> But since you don't use transformations YImageToGraph is sufficient.
Great!, here's a screenshot.
Meanwhile I found a way to get the Y pixel value of a point, as you can
see, the "19.60" with yellow background refers to the last point in my
series, and is drawn exactly at the same position of the Close Y Point.
For this I used GetYImgValue( Index of last point ) of the series.
Leonardo M. Ramé
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot - 210914 - 18:15:42.png
Size: 29681 bytes
Desc: not available
More information about the Lazarus