Skip to content

restyle not working for ternary charts #526

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

Closed
VeraZab opened this issue May 12, 2016 · 3 comments
Closed

restyle not working for ternary charts #526

VeraZab opened this issue May 12, 2016 · 3 comments
Labels
bug something broken

Comments

@VeraZab
Copy link

VeraZab commented May 12, 2016

Hi,
I'm unable to create ternary charts with the restyle function:
http://codepen.io/veraz/pen/GZeVVx

Could you please take a look. Thanks!

@etpinard
Copy link
Contributor

There are two distinct issues highlighted in this bug report.

  1. Cartesian axes not clearing after the first restyle call
  2. Ternary a, b, c data arrays are not updating in the subsequent restyle calls.

For 1. that's the intended behaviour (unfortunately).

Full explanation: the first Plotly.plot call creates a graph with 1 visible: false trace (because it has no x/y coordinates). This invisible trace spans a set of cartesian axes - you can see it by adding console.log(gd.layout.xaxis, gd.layout.yaxis). Then, Plotly.restyle updates that first trace to type scatterternary which spans a ternary layout object - you can see it by adding console.log(gd.layout.ternary), BUT does not remove the now-orphan layout.xaxis and layout.yaxis. Note that this Plotly.plot + Plotly.restyle signature works as expected for scattergeo and scatter3d restyle calls because of this very cheeky block that hasn't been expended for ternary on purpose because I'm thinking about dropping it in v2.0.0. For more info about how orphan subplots work see PR #289.

To fix issue: http://codepen.io/etpinard/pen/ which is far from clean. Bringing in @chriddyp , how hard would it be for trace type updates to be done through newPlot instead? That would be the most robust solution I think. If that's inconceivable, we could make ternary subplot on-par with geo and gl3d by not showing orphan cartesian axes when ternary subplots are present.

For 2. well ... that's a bug.

But an easy one to fix: we just need to add a, b, c to the list of recalc restyle attributes here.

@etpinard etpinard added the bug something broken label May 12, 2016
@etpinard etpinard reopened this May 12, 2016
@chriddyp
Copy link
Member

anything is possible. we can probably make that work.

@mdtusz
Copy link
Contributor

mdtusz commented May 17, 2016

Part 2 is complete - part 2 however will likely remain as is until v2.0 or a significant framework refactor ¯_(ツ)_/¯ . We can close this if everyone is satisfied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

4 participants