I have a plot with multiple y-axes on the left side and multiple y-axes on the right side, each containing multiple traces. The axes are all set to overlay the first yaxis. Each axis can be set visible or not by a checkbox, which changes the traces’ and axis’ visibility to ‘false’ or ‘true’ and then Plotly.redraw() is called. This works so far. My Problem is following: I want to be able to drag the y-axis with the mouse and also zoom with the scroll wheel, so the config “scrollZoom” is set to true. Unfortunately, it only works on the last added y-axis, even if it is hidden (visibility=false). So if I show only one y-axis (which was not the last added), nothing seems to move when dragging or zooming. In fact, the hidden axis is being dragged and zoomed. Is there a way to change the stacking order of the axes, so that I can decide which one is affected when dragging or zooming?
I just found out: set axis ‘layer’ to “below traces” for all but the one to be on top. The top one set to “above traces”. And now it works.