How to detect if user double click on x axis area or Y axis area?
Any event I can use?
Thank you
How to detect user double click on x axis area or Y axis are
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Herman,
You can use TChart's OnClickAxis event.
You can use TChart's OnClickAxis event.
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Herman,
or
Yes, but it's easier with some events which already provide mouse coordinates on their arguments list.ummm but I want to detect it on double click event instead of just clicking.
Yes, you can do something like:And clickaxis seems to be work when i click precisely on the axis line, what if i click on area near the axis line (outside the axis for sure, not inside) but still have the same effect. Possible?
Code: Select all
procedure TForm1.Chart1DblClick(Sender: TObject);
var
Top,Bottom,Left,Right: Integer;
MousePos: TPoint;
begin
Top:=Chart1.Axes.Left.IStartPos;
Bottom:=Chart1.Axes.Left.IEndPos;
Left:=Chart1.Axes.Left.PosAxis-30;
Right:=Chart1.Axes.Left.PosAxis;
MousePos:=Chart1.GetCursorPos;
if ((MousePos.X>=Left) and (MousePos.X<=Right) and
(MousePos.Y>=Top) and (MousePos.Y<=Bottom)) then
Chart1.Title.Text[0]:='Left Axis Clicked!'
else Chart1.Title.Text[0]:= IntToStr(Top)+', ' +
IntToStr(Bottom)+', ' +
IntToStr(Left)+', ' +
IntToStr(Right);
end;
Code: Select all
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
Top,Bottom,Left,Right: Integer;
begin
Top:=Chart1.Axes.Left.IStartPos;
Bottom:=Chart1.Axes.Left.IEndPos;
Left:=Chart1.Axes.Left.PosAxis-30;
Right:=Chart1.Axes.Left.PosAxis;
if ((X>=Left) and (X<=Right) and (Y>=Top) and (Y<=Bottom)) then
Chart1.Title.Text[0]:='Left Axis Clicked!'
else Chart1.Title.Text[0]:= IntToStr(Top)+', ' +
IntToStr(Bottom)+', ' +
IntToStr(Left)+', ' +
IntToStr(Right);
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 |