transform-plotly is parsing input data incorrectly.
rchiodo opened this issue · comments
Application or Package Used
@nteract/transform-plotly
Describe the bug
Plotly animations don't seem to work. (see this issue: microsoft/vscode-jupyter#4364)
To Reproduce
Steps to reproduce the behavior:
- Create a plotly graph in VS code as mentioned in the above issue
- Attempt to animate
- Animation fails with a console error saying frames cannot be found
Expected behavior
Animation should work
Screenshots
Pertinent console output.
Desktop (please complete the following information):
- OS: N/A
- Browser N/A
- Version: 7.0.1
Additional context
After some investigation, the problem is here:
https://github.com/nteract/outputs/blob/9f538719d77e221f756d3ea77fd8a6c768115e30/packages/transform-plotly/src/index.tsx#L64
This calls into this function in plotly:
https://github.com/plotly/plotly.js/blob/68a4917e8967bb021929e819453ee84650f7bf6f/src/plot_api/plot_api.js#L64
Which expects the 'data' parameter to be an object. If it isn't, the frames for the animation are not found.
I believe the fix would be to pass in the figure itself, and not the elements of the figure.