+};
+
+DygraphCanvasRenderer.prototype._drawTrivialLine = function(
+ ctx, points, setLength, firstIndexInSet, setName, color, strokeWidth, drawPointCallback, pointSize, drawPoints, drawGapPoints) {
+ var prevX = null;
+ var prevY = null;
+ var nextY = null;
+ var pointsOnLine = []; // Array of [canvasx, canvasy] pairs.
+ ctx.beginPath();
+ ctx.strokeStyle = color;
+ ctx.lineWidth = strokeWidth;
+ for (var j = firstIndexInSet; j < firstIndexInSet + setLength; ++j) {
+ var point = points[j];
+ nextY = (j + 1 < firstIndexInSet + setLength) ? points[j + 1].canvasy : null;
+ if (DygraphCanvasRenderer.isNullOrNaN_(point.canvasy)) {
+ prevX = prevY = null;
+ } else {
+ var isIsolated = (!prevX && DygraphCanvasRenderer.isNullOrNaN_(nextY));
+ if (drawGapPoints) {
+ // Also consider a point to be is "isolated" if it's adjacent to a
+ // null point, excluding the graph edges.
+ if ((j > firstIndexInSet && !prevX) ||
+ ((j + 1 < firstIndexInSet + setLength) && DygraphCanvasRenderer.isNullOrNaN_(nextY))) {
+ isIsolated = true;
+ }
+ }
+ if (prevX === null) {
+ prevX = point.canvasx;
+ prevY = point.canvasy;
+ if (j === firstIndexInSet) {
+ ctx.moveTo(point.canvasx, point.canvasy);
+ }
+ } else {
+ ctx.lineTo(point.canvasx, point.canvasy);
+ }
+ if (drawPoints || isIsolated) {
+ pointsOnLine.push([point.canvasx, point.canvasy]);
+ }
+ }
+ }
+ ctx.stroke();
+ for (var idx = 0; idx < pointsOnLine.length; idx++) {
+ var cb = pointsOnLine[idx];
+ ctx.save();
+ drawPointCallback(
+ this.dygraph_, setName, ctx, cb[0], cb[1], color, pointSize);
+ ctx.restore();
+ }