Page 1 of 1

About Custom Axis

Posted: Wed Mar 03, 2010 2:01 pm
by 10046032
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

Re: About Custom Axis

Posted: Wed Mar 03, 2010 4:54 pm
by yeray
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.

Re: About Custom Axis

Posted: Thu Mar 04, 2010 5:56 am
by 10046032
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

Re: About Custom Axis

Posted: Thu Mar 04, 2010 8:39 am
by 10046032
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

Re: About Custom Axis

Posted: Thu Mar 04, 2010 8:58 am
by yeray
Hi johnnix,

I'm glad to see that you've found it! Thanks for sharing.

Re: About Custom Axis

Posted: Thu Mar 04, 2010 9:02 am
by 10046032
Hello Yeray,

No problem, just consider adding a property e.g. IsCustom !!!

Regards

Re: About Custom Axis

Posted: Thu Mar 04, 2010 10:23 am
by yeray
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).