Custom range via input field - override default implementation

Hi Plotly Community,

I’m wondering is there a way I can add my own implementation of the current functionality for editing the minimum and maximum range for a given axis using the input fields that appear when you click on either extreme of an axis. I want to keep a constant difference between the two range values.

Ideally I’d like to implement the following:
Upper Range Changed: [ value - (CurrentRange[1] - CurrentRange[0]) , value ]
Lower Range Changed: [ value , value + (CurrentRange[1] - CurrentRange[0]) ]
Where CurrentRange is the [min, max] range before the new value is entered and where ‘value’ is the number entered.

Example Scenario: I have a standard line chart plot with a single trace with data points in the range [20, 50] and I manually set the range to be [15, 55] via the layout object for the y-axis and the x-axis is in the range [0, n number of data points]. If I click on the top of the y-axis tick labels to display the input box used to modify the upper range limit and delete ‘55’ and enter ‘60’ I want the lower y-axis range to update to ‘20’ maintaining the difference between the upper and lower range of 40.

Is this possible?

(A codepen example would be great if possible!)

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online