Synchronized scaling of two TChart components

I am using two TChart components and would like to do synchronized scaling for them. I found that TChart has a ZoomRect procedure for scaling to the desired rectangle in the diagram, but I have not found a way to read the coordinates of this zoom rectangle from another graph.

Here is some pseudo code for further clarification:

MainChart.OnZoom := HandleZooming;

...

procedure HandleZooming(Sender: TObject);
var
  zoomRectangle: TRect;
begin
  zoomRectangle := MainChart.?????;
  SecondaryChart.ZoomRect(zoomRectangle);
end;

I am using Delphi XE.

+3
source share
1 answer

This should do it:

zoomRectangle := Rect(
  MainChart.Zoom.X0, 
  MainChart.Zoom.Y0, 
  MainChart.Zoom.X1,
  MainChart.Zoom.Y1
);
+11
source

Source: https://habr.com/ru/post/1796003/


All Articles