Page 1 of 1
TeeChart 6.01: zoom by code
Posted: Wed Oct 26, 2011 3:35 pm
by 8577919
Hi,
we still use TeeChart version 6.01.
with 2 CursorTool-Lines the user can define a time-period at the x-axis.
On clicking a button we like to zoom the x-axis (the y-axis should stay the same) in a manner that the period defined by the cursortool-lines stretches to the whole x-axis (zoom-in).
Because we have trouble to code this task, I hope you could help us on this.
Thank you very much for your help,
Josef Gschwendtner
Re: TeeChart 6.01: zoom by code
Posted: Thu Oct 27, 2011 8:10 am
by yeray
Hello Josef,
I've tried the following code and it seems to respond as expected.
Code: Select all
uses Series, TeeTools;
var Cursor1, Cursor2: TCursorTool;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Chart1.AddSeries(TFastLineSeries).FillSampleValues();
Cursor1:=Chart1.Tools.Add(TCursorTool) as TCursorTool;
Cursor2:=Chart1.Tools.Add(TCursorTool) as TCursorTool;
Cursor1.Style:=cssVertical;
Cursor2.Style:=cssVertical;
Chart1.Draw;
Cursor1.XValue:=10;
Cursor2.XValue:=15;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Chart1.Axes.Bottom.SetMinMax(Cursor1.XValue, Cursor2.XValue);
end;
Doesn't it do what you are looking for? Don't hesitate to let us know if you still have problems with it.
Re: TeeChart 6.01: zoom by code
Posted: Thu Oct 27, 2011 10:40 am
by 8577919
Hi Yeray,
thank you for your response. This was not the solution, but now I found out by myself
I forgot, that I just have to set the Minimum/Maximum-Property to get the desired behavior.
Chart.Axes.Bottom.Automatic := False;
Chart.Axes.Bottom.Minimum := Round(FCursorToolFrom.XValue);
Chart.Axes.Bottom.maximum := Round(FCursorToolTo.XValue);
Thank you,
Josef
Re: TeeChart 6.01: zoom by code
Posted: Thu Oct 27, 2011 1:33 pm
by yeray
Hi Josef,
I'm glad to be helpful one way or the other.