holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.8k stars 519 forks source link

Take manual control over Plotly sizing #7483

Closed philippjfr closed 1 week ago

philippjfr commented 1 week ago

The sizing behavior of the Plotly pane has been quite annoying since we first created it. The problem being that Plotly does not seem to correctly determine the size of its container on the initial render so what the user saw when using a responsive sizing mode was an initial render, followed by a visible resize event, i.e. noticeable flicker.

Rather than letting Plotly handle the sizing behavior itself I've decided that we are now going to simply take control of the sizing behavior ourselves by computing the sizes of the container and then applying those using a relayout call. This appears to work very well, particularly when throttled, since resizing is a relatively expensive operation (~25 ms for an ordinary plot).

Fixes https://github.com/holoviz/panel/issues/7445 Fixes https://github.com/holoviz/panel/issues/6173 Fixes https://github.com/holoviz/panel/issues/5970

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 82.36%. Comparing base (ce938bf) to head (13a6e3e). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #7483 +/- ## ========================================== - Coverage 82.38% 82.36% -0.02% ========================================== Files 339 339 Lines 50980 50980 ========================================== - Hits 42000 41992 -8 - Misses 8980 8988 +8 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.