Binding to scaling ending in scaling behavior

It would be convenient if there was a way to easily snap to the event at the end of the transition to zooming - when the user clicks or touches something that moves the chart. Is this possible by simply tying all events up, or is this what people have done the other way?

+4
source share
2 answers

In d3 v4, the type names of zoom.on have changed. Now they "begin", "scale" and "end".

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

Check out the very helpful docs .

+3
source

I searched the same thing and I found this post .

You can write something like the following:

 var svg = outer.append("svg:g") .call(d3.behavior.zoom() .on("zoom", rescale) .on("zoomstart", zoomStart) .on("zoomend", zoomEnd)) .on("dblclick.zoom", null) .append("svg:g"); function zoomStart(){ console.log("ZOOM START"); } function zoomEnd(){ console.log("ZOOM END"); } 

Hope this helps.

+2
source

Source: https://habr.com/ru/post/1445642/


All Articles