X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/blobdiff_plain/6d184c0177af1000cac5ff6c4edf6a754f827577..eaf5e7b3422d01fa5370c65d27412a927d8977ec:/web/static/seepark_web.js diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index 75c362b..c762fb0 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -58,7 +58,13 @@ function dayschart(element, title, days, xtickformat) { var chart = c3.generate({ bindto: '#' + element, size: { - width: document.getElementById(element).parentElement.clientWidth * 80 / 100 + width: getwidth(element) + }, + onresized: function () { + chart.resize({ + width: getwidth(element) + }); + // chart.flush(); }, transition: { duration: null @@ -94,6 +100,7 @@ function dayschart(element, title, days, xtickformat) { }, zoom: { enabled: true, + /* onzoomend: function (domain) { // UNIX epoch var start = domain[0].getTime()/1000; @@ -106,6 +113,7 @@ function dayschart(element, title, days, xtickformat) { loaddays(this, element, days); // this = chart } } + */ }, tooltip: { format: { @@ -177,6 +185,10 @@ function beginend(days) { return '&begin=' + begin + '&end=' + end; } +function getwidth(element) { + return document.getElementById(element).parentElement.clientWidth * 80 / 100; +} + dayschart('chart_water_1', 'Der See (Tag)', 1, '%H:%M'); dayschart('chart_water_7', 'Der See (Woche)', 7, '%a %d'); dayschart('chart_water_31', 'Der See (Monat)', 31, '%Y-%m-%d');