]> ToastFreeware Gitweb - chrisu/seepark.git/blobdiff - web/static/seepark_web.js
aesthetic sugar: set width of charts to 80% of parent
[chrisu/seepark.git] / web / static / seepark_web.js
index 87e897a33c828485881944e241aa171b5c52eb3f..399fd86445cb39e5bac5abc4eb439647d5713bc3 100644 (file)
@@ -2,7 +2,10 @@ var api_base_url = '/api/1/sensor/type/Wassertemperatur?mode=consolidated&format
 
 function dayschart(element, interval, days) {
        var chart = c3.generate({
-               bindto: element,
+               bindto: '#' + element,
+               size: {
+                       width: document.getElementById(element).parentElement.clientWidth * 80 / 100
+               },
                transition: {
                        duration: null
                },
@@ -103,7 +106,7 @@ function beginend(days) {
        return '&begin=' + begin + '&end=' + end;
 }
 
-dayschart('#chart1',   'Tag',     1);
-dayschart('#chart7',   'Woche',   7);
-dayschart('#chart31',  'Monat',  31);
-dayschart('#chart365', 'Jahr',  365);
+dayschart('chart1',   'Tag',     1);
+dayschart('chart7',   'Woche',   7);
+dayschart('chart31',  'Monat',  31);
+dayschart('chart365', 'Jahr',  365);