Limits for TAxisArrowTool

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
to2
Newbie
Newbie
Posts: 39
Joined: Thu Jan 19, 2006 12:00 am

Limits for TAxisArrowTool

Post by to2 » Wed Jan 25, 2006 4:51 pm

Hello,

how can I set limits for TAxisArrowTool? A click on the arrow moves the axis of given percent value. If the axis reaches a limit ArrowTool should stop scrolling. Currently it moves to infinity (MAXDOUBLE I think).

The only way I see is to recalculate the percentage after every click. I tried to capture the OnClick event, but TAxisArrowTool has done its scaling, when OnClick rises. It would be nice, if TAxisArrowTool provides limits for max/min of the axis which are not exeeded.

Thomas

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jan 26, 2006 9:07 am

Hi Thomas,

You can achieve what you request doing something like:

Code: Select all

procedure TForm1.ChartTool1Click(Sender: TAxisArrowTool; AtStart: Boolean);
begin
  if Chart1.Axes.Left.Maximum>1000 then ChartTool1.Position:=aaEnd
  else ChartTool1.Position:=aaBoth;
end;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

to2
Newbie
Newbie
Posts: 39
Joined: Thu Jan 19, 2006 12:00 am

Post by to2 » Fri Feb 03, 2006 3:37 pm

narcis wrote:

Code: Select all

procedure TForm1.ChartTool1Click(Sender: TAxisArrowTool; AtStart: Boolean);
begin
  if Chart1.Axes.Left.Maximum>1000 then ChartTool1.Position:=aaEnd
  else ChartTool1.Position:=aaBoth;
end;
When ChartTool1Click is called, the axis scrolling is finished. I have to undo the action, then I must hide the arrow as you described.

Is it possible to get triggered before TAxisArrowTool performs the axis scrolling?

Thomas

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Feb 13, 2006 3:39 pm

Hi Thomas,

one way would be to check in the OnMouseDown event if the tool has been clicked and then check in the OnScroll event :

Code: Select all

procedure TForm1.ChartTool1Click(Sender: TAxisArrowTool; AtStart: Boolean);
begin
if Chart1.Axes.Left.Maximum>260 then ChartTool1.Position:=aaEnd
  else ChartTool1.Position:=aaBoth;
noScroll := false;
end;

procedure TForm1.Chart1Scroll(Sender: TObject);
begin
if noScroll=false then
 // xxx...
end;

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
if ChartTool1.Axis.Clicked(x,y) then
  noScroll := true;
end;

Post Reply