-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Plotly.react axis reset method not working as expected in dash context #2718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I guess the question is really what you mean by "resetting" the axis - to what initial state? In your bug codepen you first make the plot with no layout, ie autoranged, so that becomes the state to reset to. How can we tell that you meant the second state, after the Put another way, how can we tell the difference between the change you made with Anyway your point is well taken, there certainly are cases where you want these ranges to reset - if you make a totally different plot in the same div, for example, the reset ranges could bear zero resemblance to the new data. I'm just not sure how to distinguish these cases. I suppose we could make initial range into a regular attribute that, if omitted, we write back into @etpinard thoughts? |
I think the behavior in https://codepen.io/plotly/pen/VdPbMa?editors=1010 is correct (albeit maybe not optimal for the dash renderers). If users want to reset the "initial" axis ranges, they can always call The idea of adding a |
OK, it seems like there is some preserved state in Now, I would switch back to I'm OK with modifying this behaviour in Dash's |
Other than bugs, I can't think of anything.
Clearing cartesian Alternatively, we could clear all these |
I have a similar issue where I am changing the data being plotted using |
Another use case where this is a problem: In a Dash application I have a mapbox where the lat/lon ranges depend on a dropdown (i.e. different regions of world are displayed). User can map/zoom to see the data being graphed, but if they dbl-click, the axis is reset to the original range. I thought uirevision would help take care of that, but that doesn't seem to be the case? |
We found a related issue with
Problem disappears if we switch back to using the slower |
Any update on this? I would like that when users click the Home icon that Reset Axes takes that back to an initial layout. Can I trap clicking on the Home button (and insert some of my own code? e.g. I could have previously saved the original layout somewhere and have Home button call newplot? Or there is something alluded to above that clearing ax._rangeInitial is all that is needed?) Thanks, |
Ahh. I see how to do this last point. I can delete the existing modeBarButton for "Home" but add another button that uses the same icon, and now I have complete control over what happens when user clicks this. Cool. |
Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson |
Zooming and then resetting axis in this example: https://codepen.io/plotly/pen/VdPbMa?editors=1010 will autoscale to autorange rather than respecting the manually set ranges as in this working example: https://codepen.io/plotly/pen/YXbwyo
The text was updated successfully, but these errors were encountered: