Mousewheel zooming starting point lazarus / 55-TAChart ---------------------------------------------------------------------- Marq01 · 2016-02-10 19:12 Hi, When implementing mousewheel zooming in the TAchart it zooms with the mouse pointer as origin. Is it possible to have the 0.0 coordinate as zoom origin regardless of the mouse position? If so, can you give a code example to manage this? Arnoud ---------------------------------------------------------------------- wp · 2016-02-10 21:56 There are two mousewheel zoom modes depending on the selection of to property "FixedPoint" of the MouseWheelZoomTool (http://wiki.lazarus.f reepascal.org/TAChart_documentation#Extent_tools): FixedPoint = true --> zooming uses the current mouse position as a stationary pointFixedPoint = false --> zooming uses the center of the visible chart window as a stationary point (This mode was not working correctly, I fixed it in r51858 of trunk and requested backporting to Laz 1.6 RC3)Is FixedPoint = false ok for you? Or do you really need to zoom relative to the origin? [EDIT] If you really want to zoom relative to the origin you can add a TZoomMouseWheelTool, set its FixedPoint to false and ZoomFactor to a value slightly larger than 1 (maybe 1.1). Then add event handlers for OnBeforeMouseWheelUp and OnBeforeMouseWheelDown and the following code: 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 uses  TAChartUtils, TAGeometry; { TForm1 } procedure TForm1.DoZoomStep(ATool: TChartTool; const AFactor: TDoublePoint);var  sz, center: TDoublePoint;  ext: TDoubleRect;begin  ext := Chart1.LogicalExtent;  sz := ext.b - ext.a;  center := DoublePoint(ext.a.x, ext.a.y);  ext.a := center;  ext.b := center + sz * AFactor;  Chart1.LogicalExtent := ext;end; procedure TForm1.ChartToolset1ZoomMouseWheelTool2BeforeMouseWheelDown(  ATool: TChartTool; APoint: TPoint);var  tool: TZoomMouseWheelTool;begin  tool := TZoomMouseWheelTool(ATool);  if (tool.ZoomFactor > 0) and (tool.ZoomRatio > 0) then    DoZoomStep(ATool, DoublePoint(      tool.ZoomFactor,      tool.ZoomFactor * tool.ZoomRatio)    );  ATool.Handled;end; procedure TForm1.ChartToolset1ZoomMouseWheelTool2BeforeMouseWheelUp(  ATool: TChartTool; APoint: TPoint);var  tool: TZoomMouseWheelTool;begin  tool := TZoomMouseWheelTool(ATool);  if (tool.ZoomFactor > 0) and (tool.ZoomRatio > 0) then    DoZoomStep(ATool, DoublePoint(      1 / tool.ZoomFactor,      1 / tool.ZoomFactor / tool.ZoomRatio)    );  ATool.Handled;end; The DoZoomStep procedure (which is adapted from the original code of the tool) sets the zoom origin at the lower left corner of the chart window (Chart.Logicalextent.a) and, from here, multiplies to Chart.Logicalextent by the zoom factor. It would be a good exercise for you to modify this procedure such that zooming is relative to any other point