Binding to zoom ending with the zoom behavior

d3.js, zooming

Solution

In d3 v4 the the zoom.on typenames have changed. They are "start", "zoom" and "end" now.

  var d3zoom = d3.zoom()
    .on("start", zoomStartFunction)
    .on("zoom", zoomFunction)
    .on("end", zoomEndFunction);

  svg.call(d3zoom);

Check out the very helpful docs.

Problem

It would be convenient if there was a way to easily bind to an event at the end of a zoom behavior transition - when the user mouseup or touchends something that moves the chart. Is this possible by just binding all of the up events, or is this something that people have done some other way?

Original source