-
-
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
Emit plotly_relayouting
event during drag interactions
#2606
Emit plotly_relayouting
event during drag interactions
#2606
Conversation
I'd vote 👎 here. This would make 3D drag inconsistent with its cartesian counterpart. You may argue that 3D drag is already inconsistent, so what gives? But, going forward we should try to make interactions on all our subplot types more consistent, not the other way around. Now, I'm not against adding another event (e.g.
|
@etpinard Thanks for the feedback! When you said 3D drag is "already inconsistent", were you referring to 3D zooming which does emit 'plotly_relayout' events as the zooming is happening? Haven't really studied the performance issue. FYI, in my situation, I'm trying to create a synchronized set of 3d scatter plots. Trying to make all of them rotate in real time as you drag on one of them... So far things are pretty smooth with a set of 3 synchronized plots with ~4500 points in each. |
As you point out @zhihua-chen I can't imagine that simply emitting the event would impact performance noticeably, right? It's how the developer responds to that event that matters, but I think we should let them decide how much performance hit is acceptable in their own application. Likewise I don't think we should throttle these events, let developers do that themselves if it suits their application - though at some point perhaps it would be neat to build that into our events API, like Can we do this in a way that explicitly mirrors |
I'm a fan of this. This mirrors @zhihua-chen would you be interested in adding |
@etpinard Sure. Do you have a list of the plot types so I don’t leave anything out? |
@zhihua-chen sure!
|
Writing down some notes and questions as I go through the code. What payload should be emitted with these events? With gl3d, this was easy, just emit the updated camera location. What about other chart types? Should the event payloads for “relayouting” be standardized somehow? People must have thought about this when they decided to emit the “relayout” event. Are payloads for this event already consistent across chart types? Is there a place to document these events? |
Easy answer. The payload should be the same as the associated |
We have https://plot.ly/javascript/plotlyjs-events/, but you don't need to worry about it. |
When should the event be For zooming in cartesian plots, it makes sense to have a relayouting event in For zoomwheel and panning in cartesian plots, there are no intermediate steps. Once the you move the mouse or scroll the wheel, the plot is redrawn immediately (a small delay is set in the case of zoomwheel.) Currently, zoomwheel emits a |
…ragging-events-in-gl3d
…ow-dragging-events-in-gl3d
Every time we actually alter
panning works the same as zoom - on |
Thanks for the detailed response @alexcjohnson, that is really helpful. Please forgive this newbie for some more questions. Question 1: why the multiple layers of drawing action? What determines what gets redrawn during the interaction and what gets redrawn at the relayout? Related question 2: zoomWheel employs a debounce, why doesn’t panning? gl3d interactions do not use a debounce right now, do they need one? Wait. Answering part of the question 2 myself, panning doesn’t do relayout until dragging ends. So the debounce in zoomWheel is more about reducing number of relayout calls. |
No problem at all! I'm happy to answer lots of questions for anyone contributing a PR 😎
Just performance - we can translate and rescale very efficiently, but after that's done we need to actually recalculate & repositions the points to be displayed, and depending on the new ranges there may be more (or less) detail in the new view - for example scatter plots employ more aggressive decimation (and eventually clipping) the farther you get from the visible viewport.
You got it! zoom/pan effectively have a built-in debounce with the multiple mousemoves before mouseup. zoomWheel only has one event type. The performance considerations are very different for SVG than for WebGL. It might be worthwhile (cc @etpinard) to make the WebGL events look more like the SVG ones though, both to signal that the plot is mid-interaction so should perhaps not be subjected to other modifications (see eg #2644) and to limit effects on performance of the rest of the application (so we can allow users to choose whether to respond to every mousemove or just the final view)... but we may need to wait for v2 for that as it would be a somewhat breaking change. |
All right. I have added layouting events to all chart types @etpinard listed. |
Nice job @zhihua-chen . Would you be interesting in adding test cases for each of these new event triggers? |
plotly_relayouting
event during drag interactions
sure. busy with work though. will take a while... |
@zhihua-chen are you still interested in trying to bring this PR to the finish line? If not, I might have time to add a few commits in time for 1.47.0. |
Sorry. Please go ahead and do whatever you would like. I’m too distracted
at this moment...
Zhihua
…On Wed, Apr 3, 2019 at 5:06 PM Étienne Tétreault-Pinard < ***@***.***> wrote:
@zhihua-chen <https://github.com/zhihua-chen> are you still interested in
trying to bring this PR to the finish line?
If not, I might have time to add a few commits in time for 1.47.0.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2606 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ANDJfiTug6ECPTVX7373KcBMw6pRYAVEks5vdRfXgaJpZM4TwW_t>
.
|
Solving merge conflicts for this PR is rather risky considering the changes since last year. I suggest we may close this PR and open a feature request to possibly address |
👍 for opening a new PR. I would wait until this new PR exists before closing this one here, to keep an active placeholder. |
Closing. I just realised there's an issue opened for this already -> #2082 |
Currently a gl3d plot does not emit 'plotly_relayout' while dragging is happening. The event is not emitted until 'mouseup'. This PR will let a gl3d emit the 'plotly_relayout' event while the mouse is moving.