【发布时间】:2016-11-27 05:01:26
【问题描述】:
我正在尝试复制Hierarchical edge bundling case,但添加鼠标悬停并单击创建的链接(svg 中的路径)。当我将.on("click") 或.on("mouseover") 添加到link 时,除了在事件侦听器上之外,它们不起作用。
我对示例所做的更改是:
link = link
.data(bundle(links))
.enter().append("path")
.each(function(d) {
d.source = d[0], d.target = d[d.length - 1];
})
.attr("class", "link")
.attr("d", line)
.on('click', function(d) {
alert('mouseover');
});
我的代码是here。
【问题讨论】:
标签: javascript d3.js svg mouseclick-event hierarchical