i’ve found plotly components behave bizarrely when the window is resized…
they don’t always fill the width of their containers or they go beyond it…
https://anvil.works/build#clone:N4UOYZDGBRU6VJV2=F6K44EYYUVX3ECLRLGS72GXH
i’ve found plotly components behave bizarrely when the window is resized…
they don’t always fill the width of their containers or they go beyond it…
https://anvil.works/build#clone:N4UOYZDGBRU6VJV2=F6K44EYYUVX3ECLRLGS72GXH
This is pretty standard for Plotly. Once it’s drawn it’s basically stuck until it’s redrawn. I really like Plotly but I also really don’t like Plotly sometimes.
The only trick I’ve found is to set a div size that works for nearly any screen. Padding in the plot helps with this. If the div size changes it gets all wonky.
I’m not a plotly expert, but a possible work-around;
You could try rendering the plotly graphs to a canvas element on page load, and then use the canvas element to take a snapshot of the plotly graph, and then display that image instead. Then have plotly redraw the graphs only after re-sizing has been done, and save the new plot again as a snapshot.
I think my proposal might make it a lot worse though…
I’ve been browsing around the weird 3d matplotlib docs, will let you know if I find something…
Revisiting this for anyone that comes across it in the future. You can use a combination of handling the window resize event posted here: Get Window Size After Resize and the function self.plot1.redraw()
to resize the plot on window resize dynamically.