Accepted answer

In d3 version 4, d3.extent no longer works the same way (you can't use it to get the brushed extent). Instead this functionality has been abstracted into d3.event.selection. So try:

var s = d3.event.selection;
xScale.domain([navXScale.invert(s[0]), navXScale.invert(s[1])]);

After fixing that, you'll also need to introduce a clip-path into your plot.

Updated fiddle.

Related Query

More Query from same tag