X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/blobdiff_plain/bc07cbc61c74ba84791b67b170b43b293aa7230e..28d193ff34844a996984f5276713ddd1d0a7f264:/web/static/seepark_web.js diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index 66cc2a9..9ac4f44 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -88,7 +88,7 @@ function dayschart(element, title, days, xtickformat) { // FIXME var days = Math.round(duration / 86400 / 2); if (days > 0) { - loaddays(days); + loaddays(this, element, days); // this = chart } } }, @@ -129,11 +129,19 @@ function dayschart(element, title, days, xtickformat) { }); }; -function loaddays(days) { - chart.load({ - url: api_base_url_sensors + beginend(days), - mimeType: 'json' - }); +function loaddays(chart, element, days) { + // TODO: maybe move to top or factor out somehow + if (element.substr(0, 7) == 'chart_w') { + chart.load({ + url: api_base_url_sensors + beginend(days), + mimeType: 'json' + }); + } else { + chart.load({ + url: api_base_url_weather + beginend(days), + mimeType: 'json' + }); + } } function beginend(days) {