From 93e38c518b76d229d1dad791c3c73b1de7528464 Mon Sep 17 00:00:00 2001 From: gregor herrmann Date: Mon, 4 Jun 2018 19:45:15 +0200 Subject: [PATCH] add prototype for data loading function in zoom change --- web/static/seepark_web.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index ca30ac1..eedcb44 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -42,7 +42,22 @@ var chart = c3.generate({ } }, 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: { -- 2.47.3