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
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to