我试着检查DOM等等,我不知道为什么'.tooltip'被追加到处理程序。如果去掉这不会影响任何东西,似乎没有显著值:这个事件处理程序在做什么?
g.selectAll("circle")
//
//why is .tooltip appended here?
//
.on("mouseover.tooltip", function(d) {
d3.select("text#" + d.line_id).remove();
d3.select("#chart")
.append("text")
.text(d.late_percent + "%")
.attr("x", time_scale(d.time) + 10)
.attr("y", percent_scale(d.late_percent) - 10)
.attr("id", d.line_id);
});
任何澄清是非常赞赏。感谢乡亲;)
这是正确的,但请注意,OP不*使用jQuery *他使用D3,它提供了类似的事件命名空间。 – nrabinowitz
令人惊叹!谢谢你;)解决! –