我试图确定当我将鼠标悬停在某个图例项目上时,我怎么知道我悬停在哪一个。
// draw legend colored rectangles
legend.append("rect")
.attr("x", width + 170)
.attr("width", 18)
.attr("height", 18)
.on("mouseover", function(d) {
})
.style("fill", color);
现在,图例中有 3 个矩形。如何获得我悬停的矩形的 id?