]> ToastFreeware Gitweb - chrisu/seepark.git/blobdiff - web/static/seepark_web.js
xtick format: fix year labels (month year)
[chrisu/seepark.git] / web / static / seepark_web.js
index e663296312b816216f16a9fceeaf1b5987871660..33fb82dc245416c8d9ebda4498a1ef952b007bfa 100644 (file)
@@ -88,10 +88,17 @@ function dayschart(element, title, days, xtickformat) {
                },
                tooltip: {
                        format: {
+                               // TODO: maybe move to top
                                name: function (name, ratio, id, index) {
-                                       var re = /\d m/;
-                                       var res = re.exec(name);
-                                       return res;
+                                       var prefix = '';
+                                       if (element.substr(0, 7) == 'chart_w') {
+                                               var re = /\d m/;
+                                               prefix = 'Wasser ';
+                                       } else {
+                                               var re = /Luft/;
+                                       };
+                                       var result = re.exec(name);
+                                       return prefix + result;
                                },
                                value: function (value, ratio, id, index) {
                                        return value.toFixed(2) + '°';
@@ -138,9 +145,9 @@ function beginend(days) {
 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_water_365', 'Der See (Jahr)',  365, '%b %Y');
 
 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');
+dayschart('chart_air_365',   'Die Luft (Jahr)',  365, '%b %Y');