+
+ var iter = Dygraph.createIterator(points, firstIndexInSet, setLength,
+ DygraphCanvasRenderer._getIteratorPredicate(this.attr_("connectSeparatedPoints")));
+
+ if (strokeWidth && !stepPlot && (!strokePattern || strokePattern.length <= 1)) {
+ this._drawTrivialLine(ctx, iter, setName, color, strokeWidth, drawPointCallback, pointSize, drawPoints, drawGapPoints);
+ } else {
+ this._drawNonTrivialLine(ctx, iter, setName, color, strokeWidth, strokePattern, drawPointCallback, pointSize, drawPoints, drawGapPoints, stepPlot);
+ }
+ ctx.restore();
+};
+
+DygraphCanvasRenderer.prototype._drawPointsOnLine = function(ctx, pointsOnLine, drawPointCallback, setName, color, pointSize) {
+ 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();
+ }
+}
+
+DygraphCanvasRenderer.prototype._drawNonTrivialLine = function(
+ ctx, iter, setName, color, strokeWidth, strokePattern, drawPointCallback, pointSize, drawPoints, drawGapPoints, stepPlot) {
+ var prevX = null;
+ var prevY = null;
+ var nextY = null;
+ var point;
+ var pointsOnLine = []; // Array of [canvasx, canvasy] pairs.
+ var first = true;
+ while(iter.hasNext()) {
+ point = iter.next();
+ nextY = iter.hasNext() ? iter.peek().canvasy : null;
+ if (DygraphCanvasRenderer.isNullOrNaN_(point.canvasy)) {