diff options
| author | Rani Hod <rani.hod@gmail.com> | 2023-10-02 18:01:54 +0300 |
|---|---|---|
| committer | Paul Donald <newtwen@gmail.com> | 2023-12-04 23:47:49 +0100 |
| commit | 2c59acec8c340f52757469e0dddf6a4b3c410b95 (patch) | |
| tree | 0da66cd387e43dcad0fe65956c264eaa67750f6e | |
| parent | cfa6bd31978c9bca964c676fea0ede71646ee9d9 (diff) | |
luci-app-statistics: regenerate graphs on window resize
Currently graphs are redrawn only based on the refresh interval
(never or every 5/30/60 seconds).
Since the image size is calculated based on the window size,
redraw graphs (once) also after resizing the window.
This also captures window resize due to orientation change
(e.g., for mobile).
Since multiple resize events are fired when dragging the window
border, there is a 250ms delay for debouncing.
Signed-off-by: Rani Hod <rani.hod@gmail.com>
Tested-by: Paul Donald <newtwen@gmail.com>
(cherry picked from commit 8fcd52f5130acd1a0738ff47f9bba2c9cc42e662)
| -rw-r--r-- | applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js index a3189143eb..2f13ea30fd 100644 --- a/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js +++ b/applications/luci-app-statistics/htdocs/luci-static/resources/view/statistics/graphs.js @@ -244,6 +244,10 @@ return view.extend({ requestAnimationFrame(L.bind(this.updateGraphs, this, hostSel, spanSel, timeSel, graphDiv)); + var resizeTimeout; + var rgCallback = L.bind(this.refreshGraphs, this, hostSel, spanSel, timeSel, graphDiv); + addEventListener('resize', function() { clearTimeout(resizeTimeout); resizeTimeout = setTimeout(rgCallback, 250); }); + return view; }, |
