html+js: rename stuff to prepare for weather
authorgregor herrmann <gregor@toastfreeware.priv.at>
Thu, 2 Aug 2018 09:32:07 +0000 (11:32 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Thu, 2 Aug 2018 09:34:00 +0000 (11:34 +0200)
web/static/seepark_web.js
web/templates/seepark_web.html

index 63bca13..71c9862 100644 (file)
@@ -1,6 +1,6 @@
-var api_base_url = '/api/1/sensor/type/Wassertemperatur?mode=consolidated&format=c3';
+var api_base_url_sensors = '/api/1/sensor/type/Wassertemperatur?mode=consolidated&format=c3';
 
-function dayschart(element, interval, days, xtickformat) {
+function dayschart(element, title, days, xtickformat) {
        var chart = c3.generate({
                bindto: '#' + element,
                size: {
@@ -10,10 +10,10 @@ function dayschart(element, interval, days, xtickformat) {
                        duration: null
                },
                title: {
-                       text: 'Der See (' + interval + ')'
+                       text: title
                },
                data: {
-                       url: api_base_url + beginend(days),
+                       url: api_base_url_sensors + beginend(days),
                        mimeType: 'json',
                        xs: {
                                '0316a2193bff': '0316a2193bff_x',
@@ -98,7 +98,7 @@ function dayschart(element, interval, days, xtickformat) {
 
 function loaddays(days) {
        chart.load({
-               url: api_base_url + beginend(days),
+               url: api_base_url_sensors + beginend(days),
                mimeType: 'json'
        });
 }
@@ -110,7 +110,7 @@ function beginend(days) {
        return '&begin=' + begin + '&end=' + end;
 }
 
-dayschart('chart1',   'Tag',     1, '%H:%M');
-dayschart('chart7',   'Woche',   7, '%a %d');
-dayschart('chart31',  'Monat',  31, 'Woche %V');
-dayschart('chart365', 'Jahr',  365, '%b %d');
+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');
index 3fed3e9..562c526 100644 (file)
                </div>
 
                <h2>Der See</h2>
-               <div id="chart1"></div>
-               <div id="chart7"></div>
-               <div id="chart31"></div>
-               <div id="chart365"></div>
+               <div id="chart_water_1"></div>
+               <div id="chart_water_7"></div>
+               <div id="chart_water_31"></div>
+               <div id="chart_water_365"></div>
+
 
                <!-- openweathermap widget -->
                <div id="openweathermap-widget-15"></div>