- }
- },
- zoom: {
- 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: {
- name: function (name, ratio, id, index) {
- var re = /\d m/;
- var res = re.exec(name);
- return res;
- },
- value: function (value, ratio, id, index) {
- return value + '°';
+ },
+ zoom: {
+ 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"
+ // FIXME
+ var days = Math.round(duration / 86400 / 2);
+ if (days > 0) {
+ loaddays(days);
+ }
+ }
+ },
+ tooltip: {
+ format: {
+ name: function (name, ratio, id, index) {
+ var re = /\d m/;
+ var res = re.exec(name);
+ return res;
+ },
+ value: function (value, ratio, id, index) {
+ return value.toFixed(2) + '°';
+ }