Hi
I have 3 charts on my form and as they all have the same range of xvalues I have synchronized them as regards zooming and scrolling. This works fine all except for OnUndoZoom event. Obviously when I reset the zoom for Chart1 I want to call the UndoZoom for the other two charts which I do, but of course doing this fires their UndoZoom event which then calls Chart1's UndoZoom event in a recursive loop. There must be an easy way round this can you help?
Bruce.
Synchronizing charts and the UndoZoom event
Re: Synchronizing charts and the UndoZoom event
Hi Bruce,
I'd suggest you to use flags to control this. Here you have an example:
I'd suggest you to use flags to control this. Here you have an example:
Code: Select all
uses Series;
var zoom1, zoom2: boolean;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Chart1.View3D:=false;
Chart1.AddSeries(TPointSeries).FillSampleValues;
Chart2.View3D:=false;
Chart2.AddSeries(TPointSeries).DataSource:=Chart1[0];
zoom1:=true;
zoom2:=true;
end;
procedure TForm1.Chart1Zoom(Sender: TObject);
begin
if zoom1 then
begin
zoom1:=false;
with Chart1.Zoom do
Chart2.ZoomRect(Rect(X0, Y0, X1, Y1));
zoom1:=true;
end;
end;
procedure TForm1.Chart2Zoom(Sender: TObject);
begin
if zoom2 then
begin
zoom2:=false;
with Chart2.Zoom do
Chart1.ZoomRect(Rect(X0, Y0, X1, Y1));
zoom2:=true;
end;
end;
procedure TForm1.Chart1UndoZoom(Sender: TObject);
begin
if zoom1 then
begin
zoom1:=false;
Chart2.UndoZoom;
zoom1:=true;
end;
end;
procedure TForm1.Chart2UndoZoom(Sender: TObject);
begin
if zoom2 then
begin
zoom2:=false;
Chart1.UndoZoom;
zoom2:=true;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Synchronizing charts and the UndoZoom event
Thanks once again Yeray!
Re: Synchronizing charts and the UndoZoom event
Hi,
You're welcome, Bruce
You're welcome, Bruce
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |