This examples demonstrates using transform.apply to apply the zoom behavior’s transform to data, rather than using a Canvas transform. This is typically slower, but it lets you customize the display on zoom, such as rendering circles that are the same size regardless of scale. This technique is similar to repositioning SVG elements on zoom.
https://d3js.org/d3.v4.min.js