Drawing TAChart plot with mouse. lazarus / 55-TAChart ---------------------------------------------------------------------- Ed_H · 2020-04-23 20:28 Sorry for what may be an obvious question but I'm new to Lazarus and Free Pascal. Is it possible to draw a plot on a TAChart control using the mouse?  The line would mirror the mouse movement across the graph and there would be only one Y point plotted for each X location. Thank you ---------------------------------------------------------------------- wp · 2020-04-23 22:07 Look at the attached demo. It uses the OnMouseDown event to create a new series, and the OnMouseMove even to add the current mouse position (with left button pressed) to this series. With every MouseDown a new series is created with a new color. Of course, you can change these details... Note that it is important to turn off AllowZoom and AllowPan, otherwise the mouse events are swallowed by the built-in zoom and pan tools. ---------------------------------------------------------------------- Ed_H · 2020-04-24 07:46 Thanks very much for the example wp.  It looks like exactly what's needed. Unfortunately, I'm running Lazarus version 2.0.6 and it doesn't provide the AllowPan parameter.  Adding a CharToolset and linking it to the chart turns off both zoom and pan but I can't figure out how to redirect mousedown and mousemove events to activate code in your example.  None of the built-in tool options in ChartToolset seem appropriate. ---------------------------------------------------------------------- wp · 2020-04-24 08:13 In 2.0.6, AllowZoom alone is enough to turn off the built-in toolset. An other way to switch it off is to add a ChartToolset component and to link it to the chart's Toolset property; it is not required to add any tools to it. To understand look at the TAChart source: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TChart.UsesBuiltinToolset: Boolean;begin  Result := (GetToolset = FBuiltinToolset);   // this becomes false when an external ToolSet is hooked to the chart.end; procedure TZoomDragTool.MouseDown(APoint: TPoint);begin  if FChart.UsesBuiltinToolset and (not FChart.AllowZoom) then exit;  ... ---------------------------------------------------------------------- Ed_H · 2020-04-26 06:09 The sample program did exactly what I wanted. Two observations that might help someone else - Setting AllowZoom False in Lazarus 2.0.6 does allow MouseDown and MouseMove events to reach the handling procedures in the program.  It doesn't disable panning though.  At least for my requirements, adding a ChartToolset component and linking it to the chart's Toolset property was the better approach because it disabled panning as well as zooming. For this less recent version of Lazarus, loading the example caused an error because there is no AllowPanning property equivalent.  The project can be loaded by ignoring the error and continuing to load, then deleting the TAChart component on the project form and adding a new TAChart to replace it.  Nothing worked though until I realized you have to use the entries under the "events" tab, to link the appropriate mouse events with the matching procedure to handle them. Once I figured that out, everything worked perfectly. Thanks wp!