From a0668e798825ed7294cd0f0e5beb6e4bd0884e41 Mon Sep 17 00:00:00 2001 From: gregor herrmann Date: Thu, 6 Sep 2018 17:35:24 +0200 Subject: [PATCH 1/1] reload from the correct different API endpoints for air and water --- web/static/seepark_web.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index d023575..ff430ff 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -160,13 +160,24 @@ function dayschart(element, title, days, xtickformat) { }); // reload data in charts + // TODO: this is basically the same as the unused loaddays function below setInterval( function() { - chart.load({ - url: api_base_url_sensors + beginend(days), - mimeType: 'json' - }); - chart.flush(); + if (element.substr(0, 7) == 'chart_w') { + console.log("water"); + chart.load({ + url: api_base_url_sensors + beginend(days), + mimeType: 'json' + }); + chart.flush(); + } else { + console.log("air"); + chart.load({ + url: api_base_url_weather + beginend(days), + mimeType: 'json' + }); + chart.flush(); + } }, refresh_interval ); -- 2.47.3