d3.js-v4

d3.js v4 programmatic Pan+Zoom. How?

青春壹個敷衍的年華 提交于 2019-12-01 06:53:51
I did a small example of what i am trying to implement, here it is - https://jsfiddle.net/zeleniy/4sgqgcx0/ . You can zoom and pan SVG image as usual. But i have no idea how to implement zoom programmatically when user click on "+" and "-" buttons. Especially if he already zoom in/out and pan original image. Could you help me? On line 13 of the code you will find zoom event handler. var zoom = d3.zoom() .on('zoom', function() { canvas.attr('transform', d3.event.transform); }); On lines 35 and 39 - zoom event handlers d3.select('#zoom-in').on('click', function() { // what here? }); d3.select('

d3.js v4 programmatic Pan+Zoom. How?

删除回忆录丶 提交于 2019-12-01 04:56:41
问题 I did a small example of what i am trying to implement, here it is - https://jsfiddle.net/zeleniy/4sgqgcx0/. You can zoom and pan SVG image as usual. But i have no idea how to implement zoom programmatically when user click on "+" and "-" buttons. Especially if he already zoom in/out and pan original image. Could you help me? On line 13 of the code you will find zoom event handler. var zoom = d3.zoom() .on('zoom', function() { canvas.attr('transform', d3.event.transform); }); On lines 35 and