From: Robert Konigsberg Date: Sun, 18 Nov 2012 03:10:51 +0000 (-0500) Subject: Remove the old code for attr_. X-Git-Tag: v1.0.0~157^2~3^2~5 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=9f85a3e657c011d6036ce0cbe623bc4350558316;p=dygraphs.git Remove the old code for attr_. --- diff --git a/dygraph.js b/dygraph.js index 3a8c862..df12101 100644 --- a/dygraph.js +++ b/dygraph.js @@ -569,46 +569,7 @@ Dygraph.prototype.attr_ = function(name, seriesName) { Dygraph.OPTIONS_REFERENCE[name] = true; } // - - // Building an array which we peruse in backwards order to find the correct value. - // Options are checked in this order: - // series, axis, user attrs, global attrs. - // TODO(konigsberg): Can this be made faster by starting with the series and working outward, - // rather than building an array? - - var sources = []; - sources.push(this.attrs_); - if (this.user_attrs_) { - sources.push(this.user_attrs_); - if (seriesName) { - if (this.user_attrs_.hasOwnProperty(seriesName)) { - sources.push(this.user_attrs_[seriesName]); - } - - // TODO(konigsberg): This special case ought to be documented. - if (seriesName === this.highlightSet_ && - this.user_attrs_.hasOwnProperty('highlightSeriesOpts')) { - sources.push(this.user_attrs_.highlightSeriesOpts); - } - } - } - - var ret = null; - for (var i = sources.length - 1; i >= 0; --i) { - var source = sources[i]; - if (source.hasOwnProperty(name)) { - ret = source[name]; - break; - } - } - - var computedValue = seriesName ? this.attributes_.findForSeries(name, seriesName) : this.attributes_.find(name); - if (ret !== computedValue) { - console.log("Mismatch", name, seriesName, ret, computedValue); - } - - var USE_NEW_VALUE = true; - return USE_NEW_VALUE ? computedValue : ret; + return seriesName ? this.attributes_.findForSeries(name, seriesName) : this.attributes_.find(name); }; /**