From aa29d4841105e9b12246e2552fd868122bfe9a06 Mon Sep 17 00:00:00 2001 From: David Eberlein Date: Mon, 15 Apr 2013 10:37:10 +0200 Subject: [PATCH] REFACTORING: moved option retrieving out of the for loop for better performance. --- dygraph.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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]); -- 2.7.4