Control Crosshair position lazarus / 55-TAChart ---------------------------------------------------------------------- marcou · 2016-06-07 17:04 Hi, I'd like to set the position of a TDataPointCrosshairTool. I would like to change its value and then the crosshair to be updated. I could not figure this out unless editing TAChart to add a write to the Position property. But then the crosshair does not update. Is there a way to do it in clean way? thanks, Gilles Marcou ---------------------------------------------------------------------- wp · 2016-06-07 17:31 Property TDatapointCrosshairTool.Position? But it think it will not work to move the Position by code since the CrosshairCursor must be captured by a data point and the position will change on the next mouse event. I don't know what you want to achieve. Maybe it would be easier to use a TConstantLine series for your purpose. ---------------------------------------------------------------------- marcou · 2016-06-08 06:54 Thanks for your reply. Indeed I was not enough precise. I'd like to have to charts, each with one serie, but the points of both chart are refering to the same conceptual objects. So, if a user click on one chart, I'd like to show him the corresponding point on the other chart. I used to do it with the deprecated reticule, and it was very friendly. You're right that the position of the reticule is lost as soon as a mouse event is executed on a Chart. However, this is not a real problem for my application because the user is concerned by the position of the reticule only when clicking on a Chart. So on mouse click event it is possible to show or hide the relevant crosshair. Best regards, Gilles Marcou ---------------------------------------------------------------------- wp · 2016-06-08 09:17 You mean something like in the attachment? Here every chart has its own toolset consisting of a datapoint click tool (for clicking on a data point) and a crosshair tool for visual feedback of where the click occurs (could be omitted), plus a constant line series (initially hidden). Both charts share the same x values. When you click on a data point in one chart the constant line series is moved to the datapoint with the same x value in the other chart and shown. When you move the mouse into the other chart the constant line in this chart disappears to avoid confusion. ---------------------------------------------------------------------- marcou · 2016-06-08 16:42 Hi, I cannot execute your attachement... There is an unknwon MouseInsideOnly property of the TDataPointCrossHairTool. I use Lazarus 1.4.4 on mac, but maybe you use a more recent one... However,your description is globally correct. In my case, x is an object with properties p1, p2, p3 and p4 and I plot (p1,p2) in one chart and (p3,p4) in the second one. Beside, my user needs to be able to select one of the objets into a list, and see where it is located on both plots. Indeed, this would be a good workaround. I'll surely try to use your solution. Beside, the use of CrossHairTool to activate or inactivate the TConstantLine seems elegant. In fact, I tried to change the point colors of the serie, but the big advantage of crosshair, is that it is not affected by the overlap of data points (as adding an additional serie). And, I like the rendering too. Thanks for your help, Gilles Marcou ---------------------------------------------------------------------- wp · 2016-06-08 16:59 I am using trunk, but I think not much has changed since 1.4.4. Open the lfm file in a text editor (not the Lazarus IDE) and delete the offending line with MouseInsideOnly.