开发者

Synchronized zooming of two TChart components

开发者 https://www.devze.com 2023-02-14 18:24 出处:网络
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 a

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.


This should do it:

zoomRectangle := Rect(
  MainChart.Zoom.X0, 
  MainChart.Zoom.Y0, 
  MainChart.Zoom.X1,
  MainChart.Zoom.Y1
);
0

精彩评论

暂无评论...
验证码 换一张
取 消