-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Preserve ui state across Plotly.react redraws #3236
Conversation
omitted some from this commit because another commit will point them to a new function
it was putting the whole layout into the relayout call
@@ -2074,7 +2072,7 @@ function _relayout(gd, aobj) { | |||
if(manageArrays.isAddVal(vi)) { | |||
undoit[ai] = null; | |||
} else if(manageArrays.isRemoveVal(vi)) { | |||
undoit[ai] = obji; | |||
undoit[ai] = (nestedProperty(layout, arrayStr).get() || [])[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might not have anyone who cares about undo/redo anymore, but we have it so here's a fix. We were missing the .get()
the way this was written before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmt0 @nicolaskruchten for the future perhaps ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a tentative plan to 🔪 undo/redo in v2 #420 (comment), with the rationale:
we used these in our old workspace, but this is really not the right level to be managing this issue, as plots may be coupled to other application state (ie changes in data arrays) and using our queue would muck up that correspondence.
so unless we reverse that conclusion let's not build anything else using it.
// gd.data[inputIndices[i]], | ||
// fullLayout._tracePreGUI[gd._fullData[fullIndices[i]]._fullInput.uid], | ||
// {dimensions: gdDimensions[i]} | ||
// ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like the better way to handle this is to create a dimensionorder
attribute, so we can just store that, rather than directly mutating the dimensions
array.
Like columnorder
in table
traces, but that feature isn't fully built out either so I left both of these as open items for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably deserves a new issue 🚀
A parallel release works for me 👍 Users can try each feature out independently |
That would be great! |
A branch containing both transitions and uirevision, to be used for dcc |
For those reading along, see plotly/dash-core-components#387 for the dash-core-components prerelease and https://community.plot.ly/t/preserving-ui-state-like-zoom-in-dcc-graph/15793/3 for the installation instructions and examples 🎉 |
Last chance attempt to change the name... would we consider |
|
|
Yep, I have the same problems with that key name :) But perhaps that ship has indeed sailed. ⛵️ |
I agree it's not a great name, but at this point I think it's the least bad. I wouldn't insist on concordance with |
interaction between previous changes in this PR and #3256
@@ -136,6 +136,9 @@ var radialAxisAttrs = { | |||
} | |||
}; | |||
|
|||
// radial title is not gui-editable, so it needs dflt: '', similar to carpet axes. | |||
radialAxisAttrs.title.text.dflt = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, ok to merge 💃 ! |
For plotly/dash-core-components#198
restyle
/relayout
/update
->_guiRestyle
etc that wrap the original methods to record the original state.uirevision
attributes (that all inherit directly or indirectly fromlayout.uirevision
so in the simplest case you can just use that and forget the others) that can be used to maintain the state user interaction has left the plot in. Ifuirevision
exists and did not change, any attribute the user has modified via the built-in GUI will keep the user-specified value unless it has a new explicit value in the new figure.cc @chriddyp @nicolaskruchten
@etpinard best to review commit-by-commit. The first six (and the eighth as well as test reorg in a443747) are pre-cleaning and various obscure bugfixes. The meat of the changes are in a11ec44 (tracking changes), 4af2bf8 (adding the new attributes & inheritance), and 03baca7 (responding to the changes in
Plotly.react
). I missedselectedpoints
in the first iteration, that's added in 6a9d0d7, and tests are added in the last commit 54304b4.