X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/blobdiff_plain/b34bde11dcf0b2f922010a5cc01756c4a7805443..28d193ff34844a996984f5276713ddd1d0a7f264:/web/static/seepark_web.js?ds=sidebyside diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index 9b24b60..9ac4f44 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -8,17 +8,20 @@ function dayschart(element, title, days, xtickformat) { url: api_base_url_sensors + beginend(days), mimeType: 'json', xs: { - '0316a2193bff': '0316a2193bff_x', - '0316a21383ff': '0316a21383ff_x' + '0416a1ac66ff': '0416a1ac66ff_x', + '0516a207a4ff': '0516a207a4ff_x', + '0416a1bab9ff': '0416a1bab9ff_x' }, names: { - '0316a2193bff': 'Wassertemperatur in 4 m Tiefe', - '0316a21383ff': 'Wassertemperatur in 5 m Tiefe' + '0416a1ac66ff': 'Wassertemperatur in 50 cm Tiefe', + '0516a207a4ff': 'Wassertemperatur in 1 m Tiefe', + '0416a1bab9ff': 'Wassertemperatur in 2 m Tiefe' }, xFormat: '%Y-%m-%d %H:%M:%S', colors: { - '0316a2193bff': 'lightblue', - '0316a21383ff': 'darkblue' + '0416a1ac66ff': 'lightskyblue', + '0516a207a4ff': 'royalblue', + '0416a1bab9ff': 'midnightblue' } }; } else { @@ -85,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 } } }, @@ -95,7 +98,7 @@ function dayschart(element, title, days, xtickformat) { name: function (name, ratio, id, index) { var prefix = ''; if (element.substr(0, 7) == 'chart_w') { - var re = /\d m/; + var re = /\d+ c?m/; prefix = 'Wasser '; } else { var re = /Luft/; @@ -126,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) {