X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/blobdiff_plain/480131b30d68c715e6187a96cd669db1f1fd3e0b..105e2625c0cacd63414fa47979f882672f633e35:/web/static/seepark_web.js diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index ca30ac1..73e9ac2 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: { @@ -69,3 +84,9 @@ var chart = c3.generate({ ] }); +function loaddays(days) { + chart.load({ + url: '/data/' + days, + mimeType: 'json' + }); +}