var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
g.updateOptions({
- xAxisLabelFormatter: function (totalMinutes) {
- var hours = Math.floor( totalMinutes / 60);
- var minutes = Math.floor((totalMinutes - (hours * 60)));
- var seconds = Math.round((totalMinutes * 60) - (hours * 3600) - (minutes * 60));
+ axes : {
+ x : {
+ axisLabelFormatter: function (totalMinutes) {
+ var hours = Math.floor( totalMinutes / 60);
+ var minutes = Math.floor((totalMinutes - (hours * 60)));
+ var seconds = Math.round((totalMinutes * 60) - (hours * 3600) - (minutes * 60));
- if (hours < 10) hours = "0" + hours;
- if (minutes < 10) minutes = "0" + minutes;
- if (seconds < 10) seconds = "0" + seconds;
+ if (hours < 10) hours = "0" + hours;
+ if (minutes < 10) minutes = "0" + minutes;
+ if (seconds < 10) seconds = "0" + seconds;
- return hours + ':' + minutes + ':' + seconds;
+ return hours + ':' + minutes + ':' + seconds;
+ }
+ }
}
});
var opts = {
width: 480,
height: 320,
- xAxisLabelFormatter: function(x, granularity, opts, dg) {
- assertEquals('number', typeof(x));
- assertEquals('number', typeof(granularity));
- assertEquals('function', typeof(opts));
- assertEquals('[Dygraph graph]', dg.toString());
- return 'x' + x;
- },
- yAxisLabelFormatter: function(y, granularity, opts, dg) {
- assertEquals('number', typeof(y));
- assertEquals('number', typeof(granularity));
- assertEquals('function', typeof(opts));
- assertEquals('[Dygraph graph]', dg.toString());
- return 'y' + y;
+ axes : {
+ x : {
+ axisLabelFormatter: function(x, granularity, opts, dg) {
+ assertEquals('number', typeof(x));
+ assertEquals('number', typeof(granularity));
+ assertEquals('function', typeof(opts));
+ assertEquals('[Dygraph graph]', dg.toString());
+ return 'x' + x;
+ }
+ },
+ y : {
+ axisLabelFormatter: function(y, granularity, opts, dg) {
+ assertEquals('number', typeof(y));
+ assertEquals('number', typeof(granularity));
+ assertEquals('function', typeof(opts));
+ assertEquals('[Dygraph graph]', dg.toString());
+ return 'y' + y;
+ }
+ }
},
labels: ['x', 'y']
};
var opts = {
width: 480,
height: 320,
- xAxisLabelFormatter: function(x, granularity, opts, dg) {
- assertTrue(Dygraph.isDateLike(x));
- assertEquals('number', typeof(granularity));
- assertEquals('function', typeof(opts));
- assertEquals('[Dygraph graph]', dg.toString());
- return 'x' + Util.formatDate(x);
- },
- yAxisLabelFormatter: function(y, granularity, opts, dg) {
- assertEquals('number', typeof(y));
- assertEquals('number', typeof(granularity));
- assertEquals('function', typeof(opts));
- assertEquals('[Dygraph graph]', dg.toString());
- return 'y' + y;
- },
- axes: {
- x: { pixelsPerLabel: 60 }
+ axes : {
+ x : {
+ axisLabelFormatter: function(x, granularity, opts, dg) {
+ assertTrue(Dygraph.isDateLike(x));
+ assertEquals('number', typeof(granularity));
+ assertEquals('function', typeof(opts));
+ assertEquals('[Dygraph graph]', dg.toString());
+ return 'x' + Util.formatDate(x);
+ },
+ pixelsPerLabel: 60
+ },
+ y : {
+ axisLabelFormatter: function(y, granularity, opts, dg) {
+ assertEquals('number', typeof(y));
+ assertEquals('number', typeof(granularity));
+ assertEquals('function', typeof(opts));
+ assertEquals('[Dygraph graph]', dg.toString());
+ return 'y' + y;
+ }
+ }
},
labels: ['x', 'y']
};
var opts = {
width: 480,
height: 320,
- xValueFormatter: function(x, opts, series_name, dg) {
- assertEquals('number', typeof(x));
- assertEquals('function', typeof(opts));
- assertEquals('string', typeof(series_name));
- assertEquals('[Dygraph graph]', dg.toString());
- return 'x' + x;
- },
- yValueFormatter: function(y, opts, series_name, dg) {
- assertEquals('number', typeof(y));
- assertEquals('function', typeof(opts));
- assertEquals('string', typeof(series_name));
- assertEquals('[Dygraph graph]', dg.toString());
- return 'y' + y;
+ axes : {
+ x : {
+ valueFormatter: function(x, opts, series_name, dg) {
+ assertEquals('number', typeof(x));
+ assertEquals('function', typeof(opts));
+ assertEquals('string', typeof(series_name));
+ assertEquals('[Dygraph graph]', dg.toString());
+ return 'x' + x;
+ }
+ },
+ y : {
+ valueFormatter: function(y, opts, series_name, dg) {
+ assertEquals('number', typeof(y));
+ assertEquals('function', typeof(opts));
+ assertEquals('string', typeof(series_name));
+ assertEquals('[Dygraph graph]', dg.toString());
+ return 'y' + y;
+ }
+ }
},
labels: ['x', 'y']
};
var opts = {
width: 480,
height: 320,
- xValueFormatter: function(x, opts, series_name, dg) {
- assertEquals('number', typeof(x));
- assertEquals('function', typeof(opts));
- assertEquals('string', typeof(series_name));
- assertEquals('[Dygraph graph]', dg.toString());
- return 'x' + Util.formatDate(x);
+ axes : {
+ x : {
+ valueFormatter: function(x, opts, series_name, dg) {
+ assertEquals('number', typeof(x));
+ assertEquals('function', typeof(opts));
+ assertEquals('string', typeof(series_name));
+ assertEquals('[Dygraph graph]', dg.toString());
+ return 'x' + Util.formatDate(x);
+ },
+ pixelsPerLabel: 60
+ },
+ y : {
+ valueFormatter: function(y, opts, series_name, dg) {
+ assertEquals('number', typeof(y));
+ assertEquals('function', typeof(opts));
+ assertEquals('string', typeof(series_name));
+ assertEquals('[Dygraph graph]', dg.toString());
+ return 'y' + y;
+ }
+ }
},
- yValueFormatter: function(y, opts, series_name, dg) {
- assertEquals('number', typeof(y));
- assertEquals('function', typeof(opts));
- assertEquals('string', typeof(series_name));
- assertEquals('[Dygraph graph]', dg.toString());
- return 'y' + y;
- },
- axes: { x: { pixelsPerLabel: 60 } },
labels: ['x', 'y']
};
var opts = {
width: 480,
height: 320,
- xValueFormatter: function(x) {
- return 'xvf' + x;
- },
- yValueFormatter: function(y) {
- return 'yvf' + y;
- },
- xAxisLabelFormatter: function(x, granularity) {
- return 'x' + x;
- },
- yAxisLabelFormatter: function(y) {
- return 'y' + y;
+ axes : {
+ x : {
+ valueFormatter: function(x) {
+ return 'xvf' + x;
+ },
+ axisLabelFormatter: function(x, granularity) {
+ return 'x' + x;
+ },
+ },
+ y : {
+ valueFormatter: function(y) {
+ return 'yvf' + y;
+ },
+ axisLabelFormatter: function(y) {
+ return 'y' + y;
+ },
+ }
},
labels: ['x', 'y']
};
var graph = document.getElementById("graph");
var g = new Dygraph(graph, data, opts);
g.updateOptions({
- xValueFormatter: function(x) {
- return 'xvf' + x;
+ axes : {
+ x : {
+ valueFormatter: function(x) {
+ return 'xvf' + x;
+ }
+ }
}
});
g.updateOptions({
- yValueFormatter: function(y) {
- return 'yvf' + y;
+ axes : {
+ y : {
+ valueFormatter: function(y) {
+ return 'yvf' + y;
+ }
+ }
}
});
g.updateOptions({
- xAxisLabelFormatter: function(x, granularity) {
- return 'x' + x;
+ axes : {
+ x : {
+ axisLabelFormatter: function(x) {
+ return 'x' + x;
+ }
+ }
}
});
g.updateOptions({
- yAxisLabelFormatter: function(y) {
- return 'y' + y;
+ axes : {
+ y : {
+ axisLabelFormatter: function(y) {
+ return 'y' + y;
+ }
+ }
}
});