projects
/
dygraphs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
dd724e2
)
Respect options set in the series-axis object (e.g. Y2 : { labelsKMB: true })
author
Robert Konigsberg
<konigsberg@google.com>
Sun, 18 Nov 2012 02:44:43 +0000
(20:44 -0600)
committer
Robert Konigsberg
<konigsberg@google.com>
Sun, 18 Nov 2012 02:44:43 +0000
(20:44 -0600)
dygraph-options.js
patch
|
blob
|
blame
|
history
diff --git
a/dygraph-options.js
b/dygraph-options.js
index
95c1525
..
9227870
100644
(file)
--- a/
dygraph-options.js
+++ b/
dygraph-options.js
@@
-45,6
+45,9
@@
var DygraphOptions = function(dygraph) {
DygraphOptions.prototype.reparseSeries = function() {
this.labels = this.find("labels").slice(1);
DygraphOptions.prototype.reparseSeries = function() {
this.labels = this.find("labels").slice(1);
+ this.axes = [ {} ]; // Always one axis at least.
+ this.series = {};
+
var axisId = 0; // 0-offset; there's always one.
// Go through once, add all the series, and for those with {} axis options, add a new axis.
for (var idx = 0; idx < this.labels.length; idx++) {
var axisId = 0; // 0-offset; there's always one.
// Go through once, add all the series, and for those with {} axis options, add a new axis.
for (var idx = 0; idx < this.labels.length; idx++) {
@@
-56,6
+59,7
@@
DygraphOptions.prototype.reparseSeries = function() {
var axis = optionsForSeries["axis"];
if (typeof(axis) == 'object') {
yAxis = ++axisId;
var axis = optionsForSeries["axis"];
if (typeof(axis) == 'object') {
yAxis = ++axisId;
+ this.axes[yAxis] = axis;
}
this.series[seriesName] = { idx: idx, yAxis: yAxis, options : optionsForSeries };
}
}
this.series[seriesName] = { idx: idx, yAxis: yAxis, options : optionsForSeries };
}
@@
-82,10
+86,14
@@
DygraphOptions.prototype.reparseSeries = function() {
if (this.global_user.hasOwnProperty("axes")) {
var axis_opts = this.global_user.axes;
if (this.global_user.hasOwnProperty("axes")) {
var axis_opts = this.global_user.axes;
- this.axes.push(axis_opts["y"] || {});
- this.axes.push(axis_opts["y2"] || {});
- } else {
- this.axes.push({}); // There has to be at least one axis.
+ if (axis_opts.hasOwnProperty("y")) {
+ Dygraph.update(this.axes[0], axis_opts.y);
+ }
+
+ if (axis_opts.hasOwnProperty("y2")) {
+ this.axes[1] = this.axes[1] || {};
+ Dygraph.update(this.axes[1], axis_opts.y2);
+ }
}
};
}
};