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
Limits for TAxisArrowTool
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Thomas,
You can achieve what you request doing something like:
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 |
Instructions - How to post in this forum |
When ChartTool1Click is called, the axis scrolling is finished. I have to undo the action, then I must hide the arrow as you described.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;
Is it possible to get triggered before TAxisArrowTool performs the axis scrolling?
Thomas
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 :
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;
Pep Jorge
http://support.steema.com
http://support.steema.com