Skip to content

sliders + addTraces bug #4002

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
DaanyWaay opened this issue Jul 1, 2019 · 6 comments · Fixed by #4023
Closed

sliders + addTraces bug #4002

DaanyWaay opened this issue Jul 1, 2019 · 6 comments · Fixed by #4023
Assignees
Labels
bug something broken

Comments

@DaanyWaay
Copy link

If I add the traces manually the slider.steps[0] looses its arguments: https://codepen.io/anon/pen/ydMLyK

@etpinard
Copy link
Contributor

etpinard commented Jul 2, 2019

Hi @DaanyWaay

Using

graph.on('plotly_sliderchange', (event) => {
  console.log(event.step.args);
})

as in https://codepen.io/etpinard/pen/PreaRY?editors=1010 seems to always give the correct args list.

@etpinard
Copy link
Contributor

etpinard commented Jul 3, 2019

Related: #1704

@DaanyWaay
Copy link
Author

DaanyWaay commented Jul 4, 2019

Please notice that
console.log(event.step.args);
returns array of args as declared in sliders.steps but:

  • the first item is always "visible" string - PASS
  • the 2nd item is the array of values for step 2 and 3 - PASS
  • the 2nd item is empty array for step 1 - FAILED
    It is not possible to show the red line.

And this is the same code but with traces declared in newPlot, not by addTraces:
https://codepen.io/anon/pen/jjKRme?editors=1010

@etpinard
Copy link
Contributor

etpinard commented Jul 4, 2019

  • the 2nd item is empty array for step 1 - FAILED
    It is not possible to show the red line.

I don't understand what you're referring to here. Can I ask: what are you trying to accomplish with the slider event data?

@DaanyWaay
Copy link
Author

What I want to accomplish is exactly what you see in that code pen. This new pen is a slightly modified version of the previous one:
https://codepen.io/anon/pen/ydMLyK
I appreciate if you could explain why I can not display the red line while scrolling the slider. The traces have to be added by addTraces.
Please check the console log while scrolling the slider:

  • green: ["visible", Array(6)]
  • blue: ["visible", Array(6)]
  • red: ["visible", Array(0)]

This plot has exactly the same configuration and data and works OK: https://codepen.io/anon/pen/XLBGqq but I don't use addTraces there.

@etpinard
Copy link
Contributor

etpinard commented Jul 5, 2019

Ah now I see it. Thanks for posting!

@etpinard etpinard added the bug something broken label Jul 5, 2019
@etpinard etpinard changed the title "plotly_sliderchange" event doesn’t work correctly with manually added traces (step[0] looses args) sliders + addTraces bug Jul 5, 2019
@etpinard etpinard self-assigned this Jul 5, 2019
etpinard added a commit that referenced this issue Jul 5, 2019
etpinard added a commit that referenced this issue Jul 5, 2019
.. as this can have erroneous repercussions e.g. when
   fullLayout.sliders[i].steps[j].args is linked to the same
   ref as in gd.layout.
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

Successfully merging a pull request may close this issue.

2 participants