Classic chart X axis Visible property

I have 2 x axis . i want to hide each axis manually when i click button


i tired this script but its hiding the all 2 axis in single click.

but i want each axis to be hide manually by using separate button for each axis.

can any one please help me out?

I’m not sure this code would hide both axes, as getDomainAxis() returns the Axis with an index of 0.

You can use getDomainAxis() with an index parameter to get a specific axis.