plotly / plotly/react-plotly.js

Axes incorrect when updating layout but not data

Open
#316 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
138
Avg merge
3d 2h
Merged PRs (30d)
4

Description

When updating the layout but passing a constant data object (or a new object but with nested constant objects), the traces stay the same but the axes reset to the defaults as if no data is plotted, causing the graph to be incorrect. The data points can also not be hovered over in this state.

Forcing the plot to redraw (e.g. by clicking 'Reset axes') corrects the plot and creating a deep copy of the data object before passing to the Plot component removes the issue.

Example at https://codesandbox.io/s/agitated-babycat-j9hjb8?file=/src/App.js (issue can be seen when changing text in input)

I have been unable to recreate this with pure plotly.js but I am less familiar with that library, so sorry if the issue is there instead.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with App.js in the linked CodeSandbox and reproduce the issue by changing the input while passing constant or nested-constant data to the Plot component. Trace the Plot component's layout-only update path and compare it with a deep-copied data update; done means axes retain the plotted ranges and data points remain hoverable without clicking Reset axes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.