Set range limit for y-axis

I have a multi-y-axis line graph and I would like to set a limit to how far a user can click and drag a y-axis to pan the data vertically. My goal is to prevent the user from allowing any data points from going off the grid.

Alternatively, I would like to know how to call a function upon the event that a axis has been moved. Then I could perhaps iterate the correct the range if needed.

Clicking and dragging the axes does trigger the plotly_relayout event which can be caught like so:

let myPlot: any = document.getElementById('graph');
myPlot.on('plotly_relayout', function(){
    alert("axis moved!");
});

I can use this to check if any data points are outside the current range but I’m still interested in knowing if this functionality already exists

We don’t expose attribute that do what you’re asking at the moment unfortunately.

I’d recommend subscribing to https://github.com/plotly/plotly.js/issues/1876 for the most up-to-date development.