Conversation
|
Could you please open an issue? I'd like to talk through the proposed solution before reviewing a PR to fix the issue. |
Opened. Please see #380. |
|
In my use case, I have a collapsible sidebar with a transition animation. While the sidebar is opening or closing, the plot container changes size continuously, so At the moment I haven't added any throttling, since the transition is relatively short and I haven't noticed it causing any significant issues in practice. That said, if the performance impact of repeatedly calling Update: Throttling is not necessary because |
|
Based on the suggestion in #380 (comment), I removed the |
|
Given the work in plotly.js, I'm calling this PR on hold. |
|
Once your change in plotly.js is released, could you try installing that as a peer and seeing if we still need this change? |
I actually already did that in my local project, and with my changes in plotly.js, I don't need to use |
|
Just to clarify my previous comment: when I said that <Plot
data={data}
layout={{ autosize: true }}
config={{ responsive: true }}
style={{ width: '100%', height: '100%' }}
/>However, it seems that explicitly setting This is also true for the current <Plot
data={data}
style={{ width: '100%', height: '100%' }}
useResizeHandler
/>With the new resize behavior in <Plot
data={data}
config={{ responsive: true }}
style={{ width: '100%', height: '100%' }}
/>So And once my change in |
ResizeObserver is now widely available.
This PR uses
ResizeObserverto replacewindow.resizeforuseResizeHandlerso that plots respond to changes in the rendered graph div's size, rather than only to document view (window).Currently, layout changes such as toggling a sidebar can resize the plot container without triggering a
window.resizeevent, requiringPlotly.Plots.resize()to be called manually.With
ResizeObserver, plots can respond automatically to these layout changes. The existingwindow.resizelogic is removed sinceResizeObserveris now widely available.Closes #380