我在 Firefox 中仅在这一行收到此错误:
.on("mousemove", function() {
return tooltip.style("top", (event.pageY - 10) + "px").style("left", (event.pageX + 10) + "px");
})
最佳答案
使用d3.event
。 d3.event
存储当前事件(如果有)。
.on("mousemove", function() {
return tooltip.style("top", (d3.event.pageY - 10) + "px").style("left", (d3.event.pageX + 10) + "px");
});
Note that the first parameter of the mouse over function is the data bonded to the corresponding element and second parameter is it's index.
关于javascript - 引用错误: event is not defined firefox d3. js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33865765/