-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Replot on drag #3716
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Replot on drag #3716
Conversation
... instead of `zoomlayer`, making it easier to reuse.
- setup in a similar way to Plots.rehover - stash drag dx/dy values on gd._dragdata, call drag handler `moveFn` after redraw - 🔪 gd._replotPending logic ! - 🔪 gd._dragging Promise.reject !
Awesome! Will this also work for updating images? The reason I ask is that I'd like to be able to eventually update this datashader example (https://plot.ly/python/change-callbacks-datashader/#image-updates-on-drag-zoom) to update the image during drag, not only on drag completion. To do this I think we would need to pick #2606 up again to have access to the relayout events during drag. |
it should. |
- 1 extendTraces during drag case - 1 plotly_relayout callback - 1 plotly_selecting callback
Alright, I added some tests (mostly inspired by past bug reports) and after more than a day hunting around for edge cases, I'm fairly confident this solution is pretty good. I'll tag this as reviewable. |
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.
Great PR! @etpinard
Please find my questions below.
I will send the second pass review with more testing on Friday.
Thanks.
Awesome PR. |
an attempt at fixing #3305
In brief, this PR completely 🔪
plotly.js/src/plot_api/plot_api.js
Lines 139 to 149 in 7bb5daa
and its
replotPending
logic and replaces it with aPlots.redrag
handler called at the endPlotly.plot
similar toPlots.rehover
. Bye bye uncaught promises and console errors 👋The current solution most likely will break in some scenarios, but it is enough to fix (I think) all the problematic examples listed in #3305 (comment), see:
For example, dragging under
dragmode:'zoom'
in anextendTraces
interval looks like:Notice: we're not trying to resize the zoombox, but instead we update its corresponding data-space range as new (auto-ranged) data pts come in.
cc @plotly/plotly_js