[Lazarus] TAChart DataPointCrossHairTool

"Leonardo M. Ramé" l.rame at griensu.com
Sun Sep 21 18:44:39 CEST 2014


On 21/09/14 11:56, Werner Pamler wrote:
>>> Hi, I'm playing with the DataPointCrossHairTool, and I would like to
>>> know if it's possible to display the horizontal line on cursor's
>>> position, instead as the default data point value.
>
> Not 100% sure, but I believe that this tool always snaps to the data
> points.
> An alternative would be to add a constant line series to the chart and use
> a TDatapointDragTool to drag the line. Use the chart's MouseDown to show
> and
> the MouseUp to hide the line. The "toolsdemo" in TAChart's demo folder
> is an
> example of the basic idea (the green and purple dashed vertical lines).
>
>
> --

I kind of got what I need, based on Mouse.CursorPos and 
TAChart.ScreenToClient.

Now, I need to convert the mouse pos to a relative value to the axis.

In the AfterDrawBackWall event, to get current Y cursos position, I have:

ASender.ScreenToClient(Mouse.CursorPos).Y

Now, how can I convert that value to its relative to axis value.

Please, take a look at the attached screenshot, in the bottom chart, you 
can see the cursor and an horizontal line, with its value at the rigth 
axis, in this case is a 64 (yellow bold) between 3.50 and 4.00, instead 
of 64 I want to display the correct value (approx. 3.95).


-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot - 210914 - 13:41:22.png
Type: image/png
Size: 30629 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140921/8f6a6910/attachment-0003.png>


More information about the Lazarus mailing list