From 28d193ff34844a996984f5276713ddd1d0a7f264 Mon Sep 17 00:00:00 2001 From: gregor herrmann Date: Wed, 8 Aug 2018 17:42:58 +0200 Subject: [PATCH] js: "fix" zooming we have sensors vs. weather now, and need mor variables --- web/static/seepark_web.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) 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) { -- 2.47.3