且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法使D3 .on('mouseover',...)正常工作

更新时间:2022-11-10 11:01:33

自D3 V6 起,所有鼠标事件处理程序都将一个事件作为第一个参数传递,将数据作为第二个参数传递.在 V5 或更早的版本中,您的代码将可用.

Since D3 V6, all mouse event handlers has an event passed as the first argument and data as the second. In the V5 or earlier, your code will work.

V6或更高版本:

.on('mouseover', (event, d) => console.log(d.mass));

V5或更早版本:

.on('mouseover', d => console.log(d.mass));