Plotly does not correctly redraw text items when updated through Plotly.react()
Open
Nobody has claimed this yet.
bug
P3
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
- Open https://codepen.io/rtwfroody/pen/OJRxdMy, and you'll see a graph with the points labeled "one", "two", and "three".
- Hit the toggle checkbox, and the graph contents will change. Now only the first point is labeled. This is expected.
- Hit the toggle checkbox again. The code returns the graph to the exact same data as it started with, but the 2nd and 3rd points have no labels.
- No matter how many times you hit the checkbox, the original labels are never drawn.
This is a simple example of the issue I have in https://casualhacker.net/covid19-wealth. In that link, you can see that when you change the scale (see log checkboxes), then the labels are redrawn correctly.
Using layout.datarevision doesn't make things better.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior from the linked CodePen using Plotly.react(), toggling the checkbox to remove and restore the labels. Start by tracing the Plotly.react() redraw path for text items and check whether layout.datarevision affects it. Done means the second and third labels return after restoring the original data, matching the initial graph.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100