From: gregor herrmann Date: Tue, 4 Sep 2018 20:09:49 +0000 (+0200) Subject: reload chart data in javascript instead of rereshing the whole page X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/commitdiff_plain/6af726be0c250408a62696db0dec7c08abe9769d reload chart data in javascript instead of rereshing the whole page --- 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 @@ -