From 64223ff95e2a780247736eb540798893ed3cfb27 Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Thu, 28 Jun 2018 01:10:05 -0400 Subject: [PATCH] return brush independently from container --- src/components/graph/setupSVGandBrush.js | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/components/graph/setupSVGandBrush.js b/src/components/graph/setupSVGandBrush.js index ec86c587..3234748b 100644 --- a/src/components/graph/setupSVGandBrush.js +++ b/src/components/graph/setupSVGandBrush.js @@ -23,21 +23,23 @@ export const setupSVGandBrushElements = ( .attr("height", side) .attr("class", `${styles.graphSVG}`); - svg.append("g").call( - d3 - .brush() - .extent([ - [0, 0], - [ - responsive.height - graphPaddingTop, - responsive.height - graphPaddingTop - ] - ]) - .on("brush", handleBrushSelectAction) - .on("end", handleBrushDeselectAction) - ); + const brush = d3 + .brush() + .extent([ + [0, 0], + [responsive.height - graphPaddingTop, responsive.height - graphPaddingTop] + ]) + .on("brush", handleBrushSelectAction) + .on("end", handleBrushDeselectAction); + + const brushContainer = svg + .append("g") + .attr("class", "graph_brush") + .call(brush); return { - svg + svg, + brushContainer, + brush }; };