From 4d62a83c52bf2667b85dc51cb0b7f556ccd28a39 Mon Sep 17 00:00:00 2001 From: MrTimbones Date: Mon, 14 Nov 2022 12:08:44 +0000 Subject: [PATCH 1/2] Automatically refresh the graph every minute when embedded in a dashboard --- graph.core.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/graph.core.js b/graph.core.js index 8757bb9..9b07f4c 100644 --- a/graph.core.js +++ b/graph.core.js @@ -162,6 +162,19 @@ const GraphLayoutApp = { menu?.show_l3?.(); }); } + else { + // automatic refresh every 60s < interval < 1 day + var refresh = 60; + var parent = this; + window.setInterval(function() { + if (parent.state.floatingtime) { + parent.onGraphTimeRefresh(); + } + else { + parent.onReload(); + } + }, refresh * 1000); // ms + } this._onHashChange = this.onSavedHashChange.bind(this); this._onColorModeChange = () => this.renderChart(); From 6fdd57a9ab1b3a2b11226dc19b4c0923c543e8d3 Mon Sep 17 00:00:00 2001 From: MrTimbones Date: Wed, 7 Feb 2024 23:55:27 +0000 Subject: [PATCH 2/2] Use graph interval as refresh interval, within limits --- graph.core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graph.core.js b/graph.core.js index 9b07f4c..1e33513 100644 --- a/graph.core.js +++ b/graph.core.js @@ -164,7 +164,7 @@ const GraphLayoutApp = { } else { // automatic refresh every 60s < interval < 1 day - var refresh = 60; + var refresh = Math.min(Math.max(60, this.state.interval / 2), 86400); var parent = this; window.setInterval(function() { if (parent.state.floatingtime) {