Reputation: 11882
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?
Upvotes: 7
Views: 4854
Reputation: 175
I was looking for the same thing, and I found this post.
You can write something like this:
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 it helps.
Upvotes: 3