reload chart data in javascript instead of rereshing the whole page
authorgregor herrmann <gregor@toastfreeware.priv.at>
Tue, 4 Sep 2018 20:09:49 +0000 (22:09 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Tue, 4 Sep 2018 20:09:49 +0000 (22:09 +0200)
web/static/seepark_web.js
web/templates/seepark_web.html

index 721c586c2f9cb8fb2d8387484760c9e32018ce3e..9a7501b6ecec87291d6646081b03a874bd0b6fd5 100644 (file)
@@ -155,8 +155,20 @@ function dayschart(element, title, days, xtickformat) {
                        {axis: 'y', start:  100, end: 999, class: 'region-boiling'}
                ]
        });
+
        // woraround for unrendered dots
        setTimeout(function () { chart.flush(); }, 5000);
+
+       // reload data
+       setInterval(
+               function() {
+                       chart.load({
+                               url: api_base_url_sensors + beginend(days),
+                               mimeType: 'json'
+                       })
+               },
+               5 * 60 * 1000
+       );
 };
 
 function loaddays(chart, element, days) {
index 8868950b8badb357e0fa88951cf4576d8cdec202..fb96583f1523e3ea36eec10fe7ab609ebd7ea5a5 100644 (file)
@@ -8,7 +8,6 @@
                <meta http-equiv="Pragma" content="no-cache" />
                <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
                <meta http-equiv="Expires" content="0" />
-               <meta http-equiv="Refresh" content="300" />
 
                <!-- Load c3.css -->
                <link href="{{url_for('static', filename='c3.min.css')}}" rel="stylesheet">