add prototype for data loading function in zoom change
authorgregor herrmann <gregor@toastfreeware.priv.at>
Mon, 4 Jun 2018 17:45:15 +0000 (19:45 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Mon, 4 Jun 2018 17:45:15 +0000 (19:45 +0200)
web/static/seepark_web.js

index ca30ac17a5fcf3f2257818d26c08b7c4e94f9062..eedcb44b51de04ba48d21dcbeda7a9722de216a7 100644 (file)
@@ -42,7 +42,22 @@ var chart = c3.generate({
                }
        },
        zoom: {
                }
        },
        zoom: {
-               enabled: true
+               enabled: true,
+               onzoomend: function (domain) {
+                       // UNIX epoch
+                       var start = domain[0].getTime()/1000;
+                       var end   = domain[1].getTime()/1000;
+                       var duration = end- start;
+                       // duration is now the diff of the "viewport in seconds"
+                       // and now we could try and load more/less data
+                       // this works but doesn't make sense :)
+                       /*
+                       chart.load({
+                               url: '/data/7',
+                               mimeType: 'json'
+                       });
+                       */
+               }
        },
        tooltip: {
                format: {
        },
        tooltip: {
                format: {