From 6af726be0c250408a62696db0dec7c08abe9769d Mon Sep 17 00:00:00 2001 From: gregor herrmann Date: Tue, 4 Sep 2018 22:09:49 +0200 Subject: [PATCH] reload chart data in javascript instead of rereshing the whole page --- web/static/seepark_web.js | 12 ++++++++++++ web/templates/seepark_web.html | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index 721c586..9a7501b 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -155,8 +155,20 @@ function dayschart(element, title, days, xtickformat) { {axis: 'y', start: 100, end: 999, class: 'region-boiling'} ] }); + // woraround for unrendered dots setTimeout(function () { chart.flush(); }, 5000); + + // reload data + setInterval( + function() { + chart.load({ + url: api_base_url_sensors + beginend(days), + mimeType: 'json' + }) + }, + 5 * 60 * 1000 + ); }; function loaddays(chart, element, days) { diff --git a/web/templates/seepark_web.html b/web/templates/seepark_web.html index 8868950..fb96583 100644 --- a/web/templates/seepark_web.html +++ b/web/templates/seepark_web.html @@ -8,7 +8,6 @@ - -- 2.47.3