Skip to content
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

Invisible traces in 1.17.0+ when using Plotly.redraw #942

Closed
tim-hutchinson opened this issue Sep 15, 2016 · 4 comments · Fixed by #947
Closed

Invisible traces in 1.17.0+ when using Plotly.redraw #942

tim-hutchinson opened this issue Sep 15, 2016 · 4 comments · Fixed by #947
Assignees

Comments

@tim-hutchinson
Copy link

tim-hutchinson commented Sep 15, 2016

In my use of Plotly, I frequently end up with an empty placeholder created while data is retrieved, then update it with new data using Plotly.redraw(). After 1.17, only one trace is drawn in a scatter plot when following this method. The legend and tooltips are created as expected, but the actual trace is missing from the chart. A quick check indicates this is also true if calling through Plotly.update()
CodePen

image

I've checked past versions and it looks like it's working as of 1.16.3, but not from 1.17.0 - 1.17.2
CodePen working in 1.16.3

@tim-hutchinson tim-hutchinson changed the title Missing traces in 1.17.0+ when using Plotly.redraw Invisible traces in 1.17.0+ when using Plotly.redraw Sep 15, 2016
@arikfr
Copy link

arikfr commented Sep 15, 2016

I experienced the same thing. I just didn't know how to describe it... Thanks @tim-hutchinson !

@etpinard
Copy link
Contributor

Thanks very much for the report!

We made numerous changes to the update paths during the animate PR (#802 - release in 1.17.0), so problems like this one don't come as a surprise.

In the meantime, I suggest replacing your Plotly.redraw with (the more robust) Plotly.addTraces as in http://codepen.io/etpinard/pen/VKaVmY

Now that we added a Plotly.update method (that can update both data and layout simultaneously #875, I'm thinking about deprecating Plotly.redraw in v2.0.0. Can I ask what do you find convenient about Plotly.redraw?

@tim-hutchinson
Copy link
Author

With Plotly.redraw, I only need to know that the data for the chart changed, not how it changed, which makes it easy to use Plotly with data binding (we're wrapping it into a Polymer component). With methods like addTraces/deleteTraces, I need to know to manage the state to know that I added a new trace, or track which one I'm deleting. Or if I add data to an existing trace, I need to handle that case too. It's all doable, and probably higher performance, just additional overhead of working out what changed.

Are there differences between Plotly.redraw and Plotly.update as they exist today? From the docs, they read like they do the same thing. I'd actually discovered this by updating to 1.17 with the intent of moving to Plotly.update

@etpinard
Copy link
Contributor

With Plotly.redraw, I only need to know that the data for the chart changed, not how it changed, which makes it easy to use Plotly with data binding

I see. Thanks for the info.

Are there differences between Plotly.redraw and Plotly.update as they exist today?

Plotly.update has a access to a few more fast update paths. Plotly.redraw is generally dumb when it comes to updates.

That said, Plotly.update can't add or delete trace objects found in graphDiv.data. It can still hide traces them using { visible: false }, but their corresponding graphDiv.data items will still be present.

etpinard added a commit that referenced this issue Sep 15, 2016
- to bring it on-par with Plotly.plot
- fixes #942 by properly supplying uid to new traces
  which are now required by the Scatter.plot method.
@etpinard etpinard self-assigned this Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants