-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Line animations fail in some frames for some lines. #2794
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
Thanks for the report! As per our issue guidelines:
|
... and note that the same instructions work for graphs with |
@etpinard Data is generated and the layout is specified in the attached script. Thanks. |
@iandanforth we understand that the Python code here reproduces the bug but the first step for us to work on this issue would need to be converting it to pure JavaScript anyway, which is substantially easier for you (since you already have this graph generated) than it is for us, and can also help rule out non-JavaScript root causes. That’s why we ask reporters to provide a reproduction specifically in JavaScript. Thanks for your understanding! |
@alexcjohnson Thanks for the note. The output of the script is an HTML file which is 9.4M which throws an error during the export->save flow. Here is the generated file |
Hmm ok, seems there are several issues here. The HTML file should help us to debug, so thanks for posting that. |
I should note the 'error' on export is more of a warning due to the filesize, so I can't save/share it with my free account. |
Ok. I was able to reproduce the issue (issues?) in a fairly minimal codepen: https://codepen.io/etpinard/pen/pZJZJo?editors=0010 From my observations, the animation doesn't apply transitions (i.e. a linear tween) to the lines until about the 10th frame, before the animation only redraws the line with the frame data pts. That's a bug. Now, in https://codepen.io/etpinard/pen/QBbxpV (which behaves like the python generated file @iandanforth provided, but with less traces) there seems to be a race condition where some frames transition before others. This shouldn't happen. |
@etpinard Thanks for looking into this, I really appreciate your time and effort! |
Ok, after some further investigations, I don't think there's an easy fix for this issue. In brief, our current transition machinery (which make use of d3.js) doesn't allow to smoothly transition between line paths of different coordinate lengths. Now, why does some frame smoothly transition in @iandanforth's example? That's because the line point decimation algo produces lines with the same number of underlying coordinates in a few cases. Note that by setting I found one workaround for d3's (and plotly's 😏 ) limitations in https://bocoup.com/blog/improving-d3-path-animation where we make all frames have the same number of coordinates. In your case, something like https://codepen.io/etpinard/pen/djoQXJ?editors=1010 (where all coordinates past the frame index our clamped to the "last" coord) with plotly.js/src/traces/scatter/line_points.js Lines 360 to 363 in 918ed9c
to not have their duplicated points taken out. The above codepen with the above patch gives: @alexcjohnson do you think patching the above line in |
Yes, seems like
That would be great, but sounds theoretically ambiguous. How can we tell if an increase in number of points is an append, prepend, insert, or something else? All of those would imply different animations. |
@iandanforth #2814 along with https://gist.github.com/etpinard/c14dc5b69241586bd95c2f7bf2b0f5a7 will give you a way to smoothly animate your line traces. |
This is great! Again really appreciated. |
OS: OSX 10.13.2
Browsers: Chrome/Firefox/Safari latest
As you can see in this gif, most of the frames animate properly. Some however have the lines "jumping" to their final values rather than being smoothly transitioned.
This animated scatter is being created from the Python API, but I suspect this is more appropriate for the js side to investigate. (Correct me if I'm wrong).
Here is the script to recreate the above chart.
Notes
The text was updated successfully, but these errors were encountered: