nteract icon indicating copy to clipboard operation
nteract copied to clipboard

transform-plotly is parsing input data incorrectly.

Open rchiodo opened this issue 2 years ago • 0 comments

Application or Package Used @nteract/transform-plotly

Describe the bug Plotly animations don't seem to work. (see this issue: https://github.com/microsoft/vscode-jupyter/issues/4364)

To Reproduce Steps to reproduce the behavior:

  1. Create a plotly graph in VS code as mentioned in the above issue
  2. Attempt to animate
  3. Animation fails with a console error saying frames cannot be found

Expected behavior Animation should work

Screenshots Pertinent console output. image

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.

rchiodo avatar May 28 '22 00:05 rchiodo