REFACTORING: moved option retrieving out of the for loop for better
authorDavid Eberlein <david.eberlein@ch.sauter-bc.com>
Mon, 15 Apr 2013 08:37:10 +0000 (10:37 +0200)
committerDavid Eberlein <david.eberlein@ch.sauter-bc.com>
Mon, 15 Apr 2013 08:37:10 +0000 (10:37 +0200)
performance.

dygraph.js

index dd0a524..5fee847 100644 (file)
@@ -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]);