From 2cc17515dc6876a17b61f13607fc619e6ab3fdab Mon Sep 17 00:00:00 2001 From: John Kiernander Date: Fri, 12 Jul 2013 09:39:12 +0100 Subject: [PATCH] Fix tooltip removal --- src/objects/plot/area.js | 4 ++++ src/objects/plot/bar.js | 9 +++------ src/objects/plot/bubble.js | 9 +++------ src/objects/plot/line.js | 4 ++++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/objects/plot/area.js b/src/objects/plot/area.js index e64a035..8ef455e 100644 --- a/src/objects/plot/area.js +++ b/src/objects/plot/area.js @@ -17,6 +17,10 @@ catPoints = {}, markers; + if (chart._tooltipGroup !== null && chart._tooltipGroup !== undefined) { + chart._tooltipGroup.remove(); + } + // If there is a category axis we should draw a line for each aggField. Otherwise // the first aggField defines the points and the others define the line if (series.x._hasCategories() || series.y._hasCategories()) { diff --git a/src/objects/plot/bar.js b/src/objects/plot/bar.js index 344988e..632ec40 100644 --- a/src/objects/plot/bar.js +++ b/src/objects/plot/bar.js @@ -20,12 +20,9 @@ theseShapes = null, className = "series" + chart.series.indexOf(series); - // Clear any hover gubbins before redrawing so the hover markers aren't left behind - chart._group.selectAll(".hoverShapes") - .transition() - .duration(duration / 4) - .style("opacity", 0) - .remove(); + if (chart._tooltipGroup !== null && chart._tooltipGroup !== undefined) { + chart._tooltipGroup.remove(); + } if (series.shapes === null || series.shapes === undefined) { theseShapes = chart._group.selectAll("." + className).data(chartData); diff --git a/src/objects/plot/bubble.js b/src/objects/plot/bubble.js index 6aa1809..bf030e5 100644 --- a/src/objects/plot/bubble.js +++ b/src/objects/plot/bubble.js @@ -20,12 +20,9 @@ theseShapes = null, className = "series" + chart.series.indexOf(series); - // Clear any hover gubbins before redrawing so the hover markers aren't left behind - chart._group.selectAll(".hoverShapes") - .transition() - .duration(duration / 4) - .style("opacity", 0) - .remove(); + if (chart._tooltipGroup !== null && chart._tooltipGroup !== undefined) { + chart._tooltipGroup.remove(); + } if (series.shapes === null || series.shapes === undefined) { theseShapes = chart._group.selectAll("." + className).data(chartData); diff --git a/src/objects/plot/line.js b/src/objects/plot/line.js index 643c882..9ede26b 100644 --- a/src/objects/plot/line.js +++ b/src/objects/plot/line.js @@ -18,6 +18,10 @@ line, markers; + if (chart._tooltipGroup !== null && chart._tooltipGroup !== undefined) { + chart._tooltipGroup.remove(); + } + if (series.x._hasCategories() || series.y._hasCategories()) { firstAgg = 0; }