我使用鼠标悬停功能在单独的div中显示点的详细信息,当我将鼠标悬停在另一个圆圈上时,它会首次出现,但是当我将鼠标悬停在另一个圆圈上时,它不会更改
d3.js代码
var points = g.selectAll("path")
.data(subset,function(d){return d.geometry.coordinates;});
points.enter().append("path");
points.attr("d", path).attr("class", "points");
points.attr("d",path.pointRadius(function(d) { return sizeScale(d.properties[size_name]);}));
points.style("fill-opacity", 0.4);
points.style("fill", function(d){ return ordinalScale(d.properties[color_name]);});
points.on("mouseover",function(d){
var details = [];
for(var prop in d.properties){
details.push(prop + " : " + d.properties[prop] + "<br/>");
}
console.log(details)
d3.select("#info_box").selectAll("li").data(details).enter().append("li").html(function(d){return d;});
});