From: gregor herrmann Date: Thu, 2 Aug 2018 11:11:24 +0000 (+0200) Subject: we have air temperature charts! X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/commitdiff_plain/8c2295bb87f0b24ba45cda39edb052dc9368a10e we have air temperature charts! --- diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index 71c9862..1390cd7 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -1,6 +1,42 @@ var api_base_url_sensors = '/api/1/sensor/type/Wassertemperatur?mode=consolidated&format=c3'; +var api_base_url_weather = '/api/1/openweathermap/city/3319578?mode=consolidated&format=c3'; function dayschart(element, title, days, xtickformat) { + var chartdata; + if (element.substr(0, 7) == 'chart_w') { + chartdata = { + url: api_base_url_sensors + beginend(days), + mimeType: 'json', + xs: { + '0316a2193bff': '0316a2193bff_x', + '0316a21383ff': '0316a21383ff_x' + }, + names: { + '0316a2193bff': 'Wassertemperatur in 4 m Tiefe', + '0316a21383ff': 'Wassertemperatur in 5 m Tiefe' + }, + xFormat: '%Y-%m-%d %H:%M:%S', + colors: { + '0316a2193bff': 'lightblue', + '0316a21383ff': 'darkblue' + } + }; + } else { + chartdata = { + url: api_base_url_weather + beginend(days), + mimeType: 'json', + xs: { + '3319578': '3319578_x' + }, + names: { + '3319578': 'Lufttemperatur in Obsteig' + }, + xFormat: '%Y-%m-%d %H:%M:%S', + colors: { + '3319578': 'red' + } + }; + }; var chart = c3.generate({ bindto: '#' + element, size: { @@ -12,23 +48,7 @@ function dayschart(element, title, days, xtickformat) { title: { text: title }, - data: { - url: api_base_url_sensors + beginend(days), - mimeType: 'json', - xs: { - '0316a2193bff': '0316a2193bff_x', - '0316a21383ff': '0316a21383ff_x' - }, - names: { - '0316a2193bff': 'Wassertemperatur in 4 m Tiefe', - '0316a21383ff': 'Wassertemperatur in 5 m Tiefe' - }, - xFormat: '%Y-%m-%d %H:%M:%S', - colors: { - '0316a2193bff': 'lightblue', - '0316a21383ff': 'darkblue' - } - }, + data: chartdata, axis: { x: { type: 'timeseries', @@ -94,7 +114,7 @@ function dayschart(element, title, days, xtickformat) { {axis: 'y', start: 100, end: 999, class: 'region-boiling'} ] }); - }; +}; function loaddays(days) { chart.load({ @@ -114,3 +134,8 @@ 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, 'Woche %V'); dayschart('chart_water_365', 'Der See (Jahr)', 365, '%b %d'); + +dayschart('chart_air_1', 'Die Luft (Tag)', 1, '%H:%M'); +dayschart('chart_air_7', 'Die Luft (Woche)', 7, '%a %d'); +dayschart('chart_air_31', 'Die Luft (Monat)', 31, 'Woche %V'); +dayschart('chart_air_365', 'Die Luft (Jahr)', 365, '%b %d'); diff --git a/web/templates/seepark_web.html b/web/templates/seepark_web.html index 562c526..3eae133 100644 --- a/web/templates/seepark_web.html +++ b/web/templates/seepark_web.html @@ -45,6 +45,11 @@
+

Die Luft

+
+
+
+