* skip over points with missing yVals.
*/
DygraphCanvasRenderer._getIteratorPredicate = function(connectSeparatedPoints) {
- return connectSeparatedPoints
- ? DygraphCanvasRenderer._predicateThatSkipsEmptyPoints
- : null;
+ return connectSeparatedPoints ?
+ DygraphCanvasRenderer._predicateThatSkipsEmptyPoints :
+ null;
};
DygraphCanvasRenderer._predicateThatSkipsEmptyPoints =
if (point.canvasy === null || point.canvasy != point.canvasy) {
if (stepPlot && prevCanvasX !== null) {
// Draw a horizontal line to the start of the missing data
- ctx.moveTo(prevX, prevY);
- ctx.lineTo(point.canvasx, prevY);
+ ctx.moveTo(prevCanvasX, prevCanvasY);
+ ctx.lineTo(point.canvasx, prevCanvasY);
}
prevCanvasX = prevCanvasY = null;
} else {
e.dygraph, e.setName, ctx, cb[0], cb[1], color, pointSize);
ctx.restore();
}
-}
+};
/**
* Attaches canvas coordinates to the points array.
var sets = this.layout.points;
var setNames = this.layout.setNames;
var setCount = setNames.length;
+ var setName;
this.colors = this.dygraph_.colorsMap_;
var setPlotters = {}; // series name -> plotter fn.
for (i = 0; i < setNames.length; i++) {
- var setName = setNames[i];
+ setName = setNames[i];
var setPlotter = this.attr_("plotter", setName);
if (setPlotter == plotter_attr) continue; // not specialized.
var is_last = (i == plotters.length - 1);
for (var j = 0; j < sets.length; j++) {
- var setName = setNames[j];
+ setName = setNames[j];
if (opt_seriesName && setName != opt_seriesName) continue;
var points = sets[j];
drawPointCallback,
pointSize
);
-}
+};
/**
* Draws the shaded error bars/confidence intervals for each series.
ctx.beginPath();
while (iter.hasNext) {
var point = iter.next();
- if (!Dygraph.isOK(point.y)) {
+ if ((!stepPlot && !Dygraph.isOK(point.y)) || (stepPlot && !isNaN(prevY) && !Dygraph.isOK(prevY))) {
prevX = NaN;
continue;
}
newYs[1] = e.plotArea.h * newYs[1] + e.plotArea.y;
if (!isNaN(prevX)) {
if (stepPlot) {
- ctx.moveTo(prevX, newYs[0]);
- } else {
ctx.moveTo(prevX, prevYs[0]);
- }
- ctx.lineTo(point.canvasx, newYs[0]);
- ctx.lineTo(point.canvasx, newYs[1]);
- if (stepPlot) {
- ctx.lineTo(prevX, newYs[1]);
+ ctx.lineTo(point.canvasx, prevYs[0]);
+ ctx.lineTo(point.canvasx, prevYs[1]);
} else {
- ctx.lineTo(prevX, prevYs[1]);
+ ctx.moveTo(prevX, prevYs[0]);
+ ctx.lineTo(point.canvasx, newYs[0]);
+ ctx.lineTo(point.canvasx, newYs[1]);
}
+ ctx.lineTo(prevX, prevYs[1]);
ctx.closePath();
}
prevYs = newYs;
prevX = point.canvasx;
}
ctx.fill();
-}
+};
/**
* Draws the shaded regions when "fillGraph" is set. Not to be confused with