I created a gist with my problem.
I started with this example .
So my problem is that I need zoom in and out buttons in addition to the mouse controls.
Mouse controls (zooming with the wheel and panning by dragging and dropping) are implemented using the zoom () action . It works very well.
Then I added two buttons to zoom in and out:
var _zoom = d3.zoom()
.scaleExtent([1 / 2, 8])
.on("zoom", zoomed);
var gui = d3.select("#gui")
gui.append("span")
.classed("zoom in", true)
.text("+")
.on("click", function() { _zoom.scaleBy(container, 2); })
gui.append("span")
.classed("zoom out", true)
.text("-")
.on("click", function(){ _zoom.scaleBy(container, 0.5); })
. , ( ), +: .
?