3

I'm using two TChart components and would like to do synchronized zooming for them. I found that TChart has ZoomRect procedure for zooming into a desired rectangle on the chart but I haven't found any way to read the coordinates of this zoom rectangle from another chart.

Here's some pseudo code for extra clarification:

MainChart.OnZoom := HandleZooming;

...

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

I'm using Delphi XE.

Ville Salonen
  • 2,654
  • 4
  • 29
  • 34

1 Answers1

11

This should do it:

zoomRectangle := Rect(
  MainChart.Zoom.X0, 
  MainChart.Zoom.Y0, 
  MainChart.Zoom.X1,
  MainChart.Zoom.Y1
);
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490