From: Klaus Weidner Date: Mon, 11 Feb 2013 00:53:07 +0000 (-0800) Subject: Re-do the fix for stacked graph highlighting X-Git-Tag: v1.0.0~76^2~1 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=4b2e41a4125c72ebaed81992361dd7af158ae357;p=dygraphs.git Re-do the fix for stacked graph highlighting This reverts the change from https://github.com/danvk/dygraphs/pull/211 and instead provides a boolean arg to the plotter so that it can decide not to draw if needed. The problem with the approach from #211 is that this prevents error bars from being highlighted, and those should be redrawn on mouseover. Fixes issue 424. --- diff --git a/dygraph-canvas.js b/dygraph-canvas.js index e531ece..466d0ff 100644 --- a/dygraph-canvas.js +++ b/dygraph-canvas.js @@ -482,7 +482,7 @@ DygraphCanvasRenderer.prototype._renderLineChart = function(opt_seriesName, opt_ for (var j = 0; j < sets.length; j++) { setName = setNames[j]; - if (opt_seriesName && !(is_last && setName == opt_seriesName)) continue; + if (opt_seriesName && setName != opt_seriesName) continue; var points = sets[j]; @@ -514,6 +514,7 @@ DygraphCanvasRenderer.prototype._renderLineChart = function(opt_seriesName, opt_ plotArea: this.area, seriesIndex: j, seriesCount: sets.length, + onlySeries: opt_seriesName, allSeriesPoints: sets }); ctx.restore(); @@ -673,6 +674,7 @@ DygraphCanvasRenderer._errorPlotter = function(e) { DygraphCanvasRenderer._fillPlotter = function(e) { // We'll handle all the series at once, not one-by-one. if (e.seriesIndex !== 0) return; + if (e.onlySeries) return; var g = e.dygraph; var setNames = g.getLabels().slice(1); // remove x-axis