-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plotly selection state is lost when re-rendering. #147
Comments
You should be able to use |
It does not seem to work for selection state. |
In your codepen, what does the problem look like? Can you post a gif? I can't replicate any issues on this end... |
Posted a couple gifs in the description. |
Oh I see, the selection box disappears. Yes, this is not something which is persistent in plotly.js at the moment (it's not part of the figure spec at all actually) ... issue: plotly/plotly.js#1851 |
Cool. Ideally to fit React's model selection could even be a controlled prop. |
Yes, this would be ideal but the underlying Plotly.js library doesn't really work in such a way as to be compatible with this. The idea behind |
@DylanVann you can control the |
Just ran into this issue myself.
Any pointers or workarounds would be much appreciated? Thanks. |
Actually, I re-read the issue above and realise that was really concerned about the selection box but I'm not too bothered about the box. For me, I lose the selection itself. Is there a way to preserve the selected points? I've used all the state management described at https://github.com/plotly/react-plotly.js#state-management to preserve the axis ranges etc but I don't see selected objects in any of that state? |
It would be good to get the selection as an input props. I was hoping to use react-plotly. I'm implementing something like crossfilter where the plot selections/brushes are a key part of the interface. However it sounds like the underlying plotly library doesn't have robust selection support. Is there some workaround, so I can use react-plotly instead of d3? — maybe overlaying my own selection box outside of plotly, but then it would have to synchronize with the margins and scales. |
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.... |
@DylanVann Is your problem resolved? Shall we close this issue? |
As far as I'm aware it is not. |
Any update on this issue ? |
I have same issue, In React when it's re-rendering. |
I see this is an old issue, but I've been recently successful in working around it by using the Essentially, I have the
|
This 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):
The text was updated successfully, but these errors were encountered: