react-plotly.js icon indicating copy to clipboard operation
react-plotly.js copied to clipboard

useResizeHandler to accept list of events

Open nicolaskruchten opened this issue 7 years ago • 3 comments

So that it can be fired from events other than resize-window? e.g. resize-pane events from https://github.com/plotly/jupyterlab-chart-editor

nicolaskruchten avatar Mar 14 '18 13:03 nicolaskruchten

Hey @nicolaskruchten - was playing around with this today, wanted to get your thoughts on this approach.

If the divId prop exists, I also just attach the resizeHandler to a synthetic event added to the plot div. At that point it's easy to dispatch the div's custom resize event from outside of Plotly - for example by chaining it within another eventhandler (e.g. in conjunction with a ResizeObserver or something).

I'm admittedly not a JS expert by any means, so if this feels hamfisted definitely feel free to say so.

edit: seems to work pretty well: oY6o5KqaJF

dougdenn avatar Apr 22 '20 23:04 dougdenn

Hi,

I'm struggling with a similar issue in getting the Plotly graph to resize dynamically, as in the GIF example above. @dougleville Is there any chance you would be able to upload the code you used to do this?

Thanks

lallen-6 avatar Jan 10 '21 14:01 lallen-6

hey @lallen-6, check out the gist here, hopefully this helps.

obviously a bandaid due to the use of a patch, read more about patches here

dougdenn avatar Jan 11 '21 21:01 dougdenn