reload from the correct different API endpoints for air and water
authorgregor herrmann <gregor@toastfreeware.priv.at>
Thu, 6 Sep 2018 15:35:24 +0000 (17:35 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Thu, 6 Sep 2018 15:35:24 +0000 (17:35 +0200)
web/static/seepark_web.js

index d023575..ff430ff 100644 (file)
@@ -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
        );