Classic chart X axis Visible property

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

event.source.parent.parent.getComponent('CTN_Charts').getComponent('Chart').getChart().getXYPlot().getDomainAxis().setVisible(0)

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.

event.source.parent.parent.getComponent('CTN_Charts').getComponent('Chart).getChart().getXYPlot().getDomainAxis(1).setVisibile(0)