绑定到以缩放行为结尾的缩放 [英] Binding to zoom ending with the zoom behavior

查看:66
本文介绍了绑定到以缩放行为结尾的缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有一种方法可以轻松地在缩放行为转换结束时绑定到事件,这将很方便-当用户将鼠标悬停或触摸到移动图表的内容时.仅通过绑定所有up事件是否有可能实现此效果,还是人们以其他方式完成了此操作?

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?

推荐答案

在d3 v4中,zoom.on类型名称已更改.现在是开始",缩放"和结束".

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);

查看非常有用的文档.

这篇关于绑定到以缩放行为结尾的缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆