【发布时间】:2019-05-05 04:34:55
【问题描述】:
svg.append('circle')
.attr('class', 'points')
.attr("cx", d => x(d.date))
.attr("cy", d => y(d.close))
.attr("r", 10)
.attr("fill", "#364652")
.on('mouseover', (d, i) => {
console.log(this)
})
在上面的示例中 - this 返回窗口,因此该函数内部的 d3.select(this) 不起作用,就像在 v3 版本示例中那样。
如何获取鼠标悬停的元素?
【问题讨论】:
标签: javascript d3.js