X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-canvas.js;h=e531ece4ba73566b0a5df54ab391fccd687d6935;hb=4ecb55b5c66f7723d1f5c588af62855bd4c06faa;hp=fa0dd800b4ad79405133858010f137979a09eace;hpb=5d93f811018b7c7ef41cc0da7e1793ee228e0ed9;p=dygraphs.git diff --git a/dygraph-canvas.js b/dygraph-canvas.js index fa0dd80..e531ece 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -57,6 +57,8 @@ var DygraphCanvasRenderer = function(dygraph, element, elementContext, layout) { this.height = this.element.height; this.width = this.element.width; + this.elementContext.save(); + // --- check whether everything is ok before we return if (!this.isIE && !(DygraphCanvasRenderer.isSupported(this.element))) throw "Canvas is not supported."; @@ -125,6 +127,11 @@ DygraphCanvasRenderer.prototype.clear = function() { context.clearRect(0, 0, this.width, this.height); }; +DygraphCanvasRenderer.prototype.onDoneDrawing = function() { + // balances the save called in the constructor. + this.elementContext.restore(); +} + /** * Checks whether the browser supports the <canvas> tag. * @private @@ -475,7 +482,7 @@ DygraphCanvasRenderer.prototype._renderLineChart = function(opt_seriesName, opt_ for (var j = 0; j < sets.length; j++) { setName = setNames[j]; - if (opt_seriesName && setName != opt_seriesName) continue; + if (opt_seriesName && !(is_last && setName == opt_seriesName)) continue; var points = sets[j];