summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-statistics
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-02-21 23:01:22 +0100
committerJo-Philipp Wich <jo@mein.io>2020-02-21 23:01:22 +0100
commit96dcae3a34087ed350c2d8d462d15f87226cfcfc (patch)
treec737c6e5d046730473d78f3c49286b58a82257f1 /applications/luci-app-statistics
parent4322cae66aad1cf9a63a10d2654557274f0fc198 (diff)
luci-app-statistics: use stable random seed for dynamic graph colors
Fixes: #3666 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'applications/luci-app-statistics')
-rw-r--r--applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool.js b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool.js
index 7949886f4e..fbb5da626d 100644
--- a/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool.js
+++ b/applications/luci-app-statistics/htdocs/luci-static/resources/statistics/rrdtool.js
@@ -335,6 +335,10 @@ return L.Class.extend({
_longest_name = 0,
_has_totals = false;
+ /* use the plugin+instance+type as seed for the prng to ensure the
+ same pseudo-random color sequence for each render */
+ random.seed(sfh([plugin, plugin_instance || '', dtype || ''].join('.')));
+
function __def(source) {
var inst = source.sname,
rrd = source.rrd.replace(/[\\:]/g, '\\$&'),