0
var bar = chart.selectAll("g")
.data(data)
.enter()
.append("g")
.attr("transform", function(d, i) {
return "translate("+barWidth*i+",0)";
})
.on("mouseover", function() {
d3.select(this)
.attr("fill", "red");
})
.on("mouseout", function(d, i) {
d3.select(this)
.attr("fill", "blue");
});
我試圖做一個鼠標懸停來顯示數據。我開始嘗試根據上面的代碼更改鼠標懸停的顏色。D3工具提示或條形圖上的鼠標懸停
http://codepen.io/JohnnyBizzel/pen/xqbjVQ