+ if (strokeWidth && !stepPlot && (!strokePattern || strokePattern.length <= 1)) {
+ this._drawTrivialLine(ctx, points, setLength, firstIndexInSet, setName, color, strokeWidth, drawPointCallback, pointSize, drawPoints, drawGapPoints);
+ } else {
+ this._drawNonTrivialLine(ctx, points, setLength, firstIndexInSet, setName, color, strokeWidth, strokePattern, drawPointCallback, pointSize, drawPoints, drawGapPoints, stepPlot);
+ }
+ ctx.restore();
+};
+
+DygraphCanvasRenderer.prototype._drawNonTrivialLine = function(
+ ctx, points, setLength, firstIndexInSet, setName, color, strokeWidth, strokePattern, drawPointCallback, pointSize, drawPoints, drawGapPoints, stepPlot) {
+ var prevX = null;
+ var prevY = null;
+ var nextY = null;
+ var point, nextPoint;
+ var pointsOnLine = []; // Array of [canvasx, canvasy] pairs.
+ var next = DygraphCanvasRenderer.makeNextPointStep_(
+ this.attr_('connectSeparatedPoints'), points, firstIndexInSet,
+ firstIndexInSet + setLength);
+ for (var j = 0; j < setLength; j = next(j)) {
+ point = points[firstIndexInSet + j];
+ nextY = (next(j) < setLength) ?
+ points[firstIndexInSet + next(j)].canvasy : null;
+ if (DygraphCanvasRenderer.isNullOrNaN_(point.canvasy)) {