TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
johnnix
- Advanced
- Posts: 192
- Joined: Tue Jul 10, 2007 12:00 am
Post
by johnnix » Wed Mar 03, 2010 2:01 pm
Hello,
I have a chart where I am using a custom axis. I use the OnClickAxis event and I cannot find any way to know that the axis I clicked is the custom Axis. Any help will be mostly appreciated
Kindest regards
-
Yeray
- Site Admin

- Posts: 9647
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Wed Mar 03, 2010 4:54 pm
Hi johnnix,
The following code seems to work fine.
Code: Select all
procedure TForm1.Chart1ClickAxis(Sender: TCustomChart; Axis: TChartAxis;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var i: Integer;
begin
for i:=0 to Chart1.Axes.Count-1 do
if (Axis = Chart1.Axes[i]) then showmessage('clicked ' + IntToStr(i));
end;
Could you please send us a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
-
johnnix
- Advanced
- Posts: 192
- Joined: Tue Jul 10, 2007 12:00 am
Post
by johnnix » Thu Mar 04, 2010 5:56 am
Hello Yeray,
Maybe I was not clear enough

What I need to do is to identify that the axis I clicked is my custom axis. In the ClickAxis event I can check the Horizontal property of Axis to determine if it is the X or Y axis but there is no property like IsCustom!!! Is this clear?
Regards
-
johnnix
- Advanced
- Posts: 192
- Joined: Tue Jul 10, 2007 12:00 am
Post
by johnnix » Thu Mar 04, 2010 8:39 am
Hello,
Just figured out that Axis.Index is -1 for default axis so by checking this value I know if I clicked on the custom Axis.
Regards
-
Yeray
- Site Admin

- Posts: 9647
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Thu Mar 04, 2010 8:58 am
Hi johnnix,
I'm glad to see that you've found it! Thanks for sharing.
-
johnnix
- Advanced
- Posts: 192
- Joined: Tue Jul 10, 2007 12:00 am
Post
by johnnix » Thu Mar 04, 2010 9:02 am
Hello Yeray,
No problem, just consider adding a property e.g. IsCustom !!!
Regards
-
Yeray
- Site Admin

- Posts: 9647
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Thu Mar 04, 2010 10:23 am
Hi jonnyx,
There is already a private IsCustom function but making it public needs some adjustments because right now it fails if you remove some of the default axes.
I've added it to the wish list to be revised for further releases (TV52014703).