X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-options.js;h=879a9e1fc36dfded5e0505b090eec760b559f553;hb=2ed3480b3d067f380abf6636cb984ac9ff7cd484;hp=ccba4f89637429c6547ab48eecfd7c335d34160b;hpb=e321ff2a4d3adfb640735f26c3eda1022e9e5f14;p=dygraphs.git diff --git a/dygraph-options.js b/dygraph-options.js index ccba4f8..879a9e1 100644 --- a/dygraph-options.js +++ b/dygraph-options.js @@ -42,13 +42,15 @@ var DygraphOptions = function(dygraph) { /** * Array of axis index to { series : [ series names ] , options : { axis-specific options. } - * @type {Array.<{series : Array., options : Object}>} + * @type {Array.<{series : Array., options : Object}>} @private */ this.yAxes_ = []; /** - * { options : { axis-specific options. } - * @type {Object} + * Contains x-axis specific options, which are stored in the options key. + * This matches the yAxes_ object structure (by being a dictionary with an + * options element) allowing for shared code. + * @type {options: Object} @private */ this.xAxis_ = {}; this.series_ = {}; @@ -83,6 +85,10 @@ DygraphOptions.AXIS_STRING_MAPPINGS_ = { 'Y2' : 1 }; +/** + * @param {string|number} axis + * @private + */ DygraphOptions.axisToIndex_ = function(axis) { if (typeof(axis) == "string") { if (DygraphOptions.AXIS_STRING_MAPPINGS_.hasOwnProperty(axis)) { @@ -96,10 +102,6 @@ DygraphOptions.axisToIndex_ = function(axis) { } throw "Dygraphs only supports two y-axes, indexed from 0-1."; } - if (typeof(axis) == "object") { - throw "Using objects for axis specification " + - "is not supported inside the 'series' option."; - } if (axis) { throw "Unknown axis : " + axis; } @@ -181,9 +183,9 @@ DygraphOptions.prototype.reparseSeries = function() { if (typeof(axis) == 'string') { if (!this.series_.hasOwnProperty(axis)) { - this.dygraph_.error("Series " + seriesName + " wants to share a y-axis with " + + Dygraph.error("Series " + seriesName + " wants to share a y-axis with " + "series " + axis + ", which does not define its own axis."); - return null; + return; } var yAxis = this.series_[axis].yAxis; this.series_[seriesName].yAxis = yAxis; @@ -312,7 +314,7 @@ DygraphOptions.prototype.getForAxis = function(name, axis) { */ DygraphOptions.prototype.getForSeries = function(name, series) { // Honors indexes as series. - if (series === this.dygraph_.highlightSet_) { + if (series === this.dygraph_.getHighlightSeries()) { if (this.highlightSeries_.hasOwnProperty(name)) { return this.highlightSeries_[name]; }