You probably want to use one brushfor this d3.js. You can see an example that I put together at http://bl.ocks.org/1962173 that does something similar.
Relevant Code:
var brush = d3.svg.brush()
.x(x)
.extent([d3.time.monday(now),d3.time.saturday.ceil(now)])
.on("brush", display);
where displayis a function that redraws data based on the current length brush. This way, you don’t have to try to hook your handlers or even worry about resizing the selection at all.
source
share