X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-layout.js;h=58f169b6b2745da21d315d96e4ab40c89b4f3e1c;hb=f4b87da223beb6c042a39746b813880f4a465b63;hp=15638176b320776b9af1af380f016b04a51ec8d7;hpb=77e1c5505aaa9bf749417927c45992a34169d104;p=dygraphs.git diff --git a/dygraph-layout.js b/dygraph-layout.js index 1563817..58f169b 100644 --- a/dygraph-layout.js +++ b/dygraph-layout.js @@ -215,6 +215,7 @@ DygraphLayout.prototype._evaluateLineCharts = function() { this.setPointsLengths = []; this.setPointsOffsets = []; + var connectSeparated = this.attr_('connectSeparatedPoints'); for (var setIdx = 0; setIdx < this.datasets.length; ++setIdx) { var dataset = this.datasets[setIdx]; var setName = this.setNames[setIdx]; @@ -241,6 +242,9 @@ DygraphLayout.prototype._evaluateLineCharts = function() { yval: yValue, name: setName }; + if (connectSeparated && item[1] === null) { + point.yval = null; + } this.points.push(point); setPointsLength += 1; } @@ -357,6 +361,10 @@ DygraphLayout.prototype.removeAllDatasets = function() { */ DygraphLayout.prototype.unstackPointAtIndex = function(idx) { var point = this.points[idx]; + // If the point is missing, no unstacking is necessary + if (!point.yval) { + return point; + } // Clone the point since we modify it var unstackedPoint = {}; @@ -371,7 +379,7 @@ DygraphLayout.prototype.unstackPointAtIndex = function(idx) { // The unstacked yval is equal to the current yval minus the yval of the // next point at the same xval. for (var i = idx+1; i < this.points.length; i++) { - if (this.points[i].xval == point.xval) { + if ((this.points[i].xval == point.xval) && this.points[i].yval) { unstackedPoint.yval -= this.points[i].yval; break; }