Page 1 of 1

Limits for TAxisArrowTool

Posted: Wed Jan 25, 2006 4:51 pm
by 9345036
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

Posted: Thu Jan 26, 2006 9:07 am
by narcis
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;

Posted: Fri Feb 03, 2006 3:37 pm
by 9345036
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

Posted: Mon Feb 13, 2006 3:39 pm
by Pep
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;