score:1

Accepted answer

Just un-comment this part in your code to actually produce the zoom rect, which gets used in the brushed function.

    svg
      .append("rect")
      .attr("class", "zoom")
      .attr("width", containerWidth - 20)
      .attr("height", height)
      .attr("transform", "translate(0,20)")
      .call(zoom);

See working codesandbox.io


Related Query

More Query from same tag