From: David Eberlein Date: Mon, 15 Apr 2013 08:37:10 +0000 (+0200) Subject: REFACTORING: moved option retrieving out of the for loop for better X-Git-Tag: v1.0.0~37^2~5 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=aa29d4841105e9b12246e2552fd868122bfe9a06;p=dygraphs.git REFACTORING: moved option retrieving out of the for loop for better performance. --- diff --git a/dygraph.js b/dygraph.js index dd0a524..5fee847 100644 --- a/dygraph.js +++ b/dygraph.js @@ -2758,6 +2758,8 @@ Dygraph.prototype.computeYAxisRanges_ = function(extremes) { Dygraph.prototype.extractSeries_ = function(rawData, i, logScale) { // TODO(danvk): pre-allocate series here. var series = []; + var errorBars = this.attr_("errorBars"); + var customBars = this.attr_("customBars"); for (var j = 0; j < rawData.length; j++) { var x = rawData[j][0]; var point = rawData[j][i]; @@ -2769,9 +2771,9 @@ Dygraph.prototype.extractSeries_ = function(rawData, i, logScale) { } } // Fix null points to fit the display type standard. - if(point === null && this.attr_("errorBars")){ + if(point === null && errorBars){ series.push([x, [null,null]]); - }else if(point === null && this.attr_("customBars")){ + }else if(point === null && customBars){ series.push([x, [null,null,null]]); } else { series.push([x, point]);