X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/blobdiff_plain/3c0da30b37d61aa8ebeb2672ef64b1ce68e97112..866247a8ef351c97bf845799ef78f7eea25f9793:/web/static/seepark_web.js?ds=sidebyside diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index 47bd334..583a14a 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -105,13 +105,9 @@ function dayschart(element, title, days, xtickformat) { enabled: true, /* onzoomend: function (domain) { - // UNIX epoch - var start = domain[0].getTime()/1000; - var end = domain[1].getTime()/1000; - var duration = end - start; - // duration is now the diff of the "viewport in seconds" - // FIXME - var days = Math.round(duration / 86400 / 2); + var duration = (domain[1] - domain[0]) / 1000; // duration is now the diff of the "viewport in seconds" + // FIXME? + var days = duration / 86400; if (days > 0) { loaddays(this, element, days); // this = chart } @@ -159,6 +155,18 @@ function dayschart(element, title, days, xtickformat) { {axis: 'y', start: 100, end: 999, class: 'region-boiling'} ] }); + + // reload data + setInterval( + function() { + chart.load({ + url: api_base_url_sensors + beginend(days), + mimeType: 'json' + }); + chart.flush(); + }, + 5 * 60 * 1000 + ); }; function loaddays(chart, element, days) {