From 4b2e41a4125c72ebaed81992361dd7af158ae357 Mon Sep 17 00:00:00 2001 From: Klaus Weidner Date: Sun, 10 Feb 2013 16:53:07 -0800 Subject: [PATCH] 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. --- dygraph-canvas.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.7.4