Plotly selection state is lost when re-rendering.
See original GitHub issueThis codepen shows the issue: https://codepen.io/dylanvann/pen/OYaedz
The onHover
handler forces a re-render.
Whenever the Plot is re-rendered some state is lost. In particular the selection is lost.
How it behaves when re-rendering (selection box is not maintained):
How it behaves when not re-rendering (selection box is maintained):
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:16 (4 by maintainers)
Top Results From Across the Web
Plot does not re-render on state change
I have a component that changes view from line plot to table on checkbox change. Checkbox is handled through state: handleCheckbox = e...
Read more >How do I integrate Plotly realtime updating graphs with React ...
Plotly graphs have an update function that makes it so the entire graph isn't destroyed/rerendered. So I have a few questions. 1. Is...
Read more >A plotly.js React component from Plotly
This is a "dumb" component that doesn't merge its internal state with any updates. This means that if a user interacts with the...
Read more >holoviews.plotly Package
Refreshes the plot by rerendering it and then pushing the updated data if the plot has an associated Comm. set_root(root)#. Sets the root...
Read more >A Plotly.js React Component From Plotly - Morioh
datarevision are used to force a rerender. API Reference. Basic Props. Warning: for the time being, this component may mutate its layout and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m using Plotly with crossfilter, and it seems that sometimes I am losing the current selection because of a re-render and sometimes not. Haven’t got to the bottom of it yet… https://github.com/will-moore/parade-crossfilter/blob/master/src/plots/Plot.js is my wrapper to maintain axis ranges on re-render. The parent https://github.com/will-moore/parade-crossfilter/blob/master/src/plots/ScatterPlot.js listens for when the crossfilter filter changes to update the plot. Based on React-crossfilter example at https://www.lighttag.io/blog/react-dc-js/.
Just ran into this issue myself. When I drag to select a region on the scatter plot, I want to show the selected items so I’m using
onSelected
to update the selected IDs in a parent Component. But unfortunately this state change is causing the<Plot/>
inside the<PlotContainer />
to re-render and so I don’t see the selection change in the Plot:Any pointers or workarounds would be much appreciated? Thanks.