Search code examples
amchartsamcharts4

amcharts 4 - Hide/show yAxis is leaving empty space


I am implementing show/hide feature of yAxes using show() and hide() methods. But the result looks this way:

enter image description here

Is there a way to remove that empty space between the axes?


Solution

  • hide simply sets the opacity of the elements to 0. To completely remove the space occupied by the axis, you need to set disabled to true on the axis' renderer. Setting it back to false will restore the axis completely.

    axis.renderer.disabled = true;