I have a barplot with 5 bars. What I want to do is when I move a mouse on each bar, different image is showing up in a tooltip. The code is like below
var tooltip2 = d3.select("#barchart")
.append("div")
.style("position", "absolute")
.style("visibility", "hidden")
.style("background-color", "white")
.style("border", "solid")
.style("border-width", "1px")
.style("border-radius", "5px")
.style("padding", "10px")
.html(function() {
if (d.elements == "location") {
return "<img src='https://my image address.png'></img>"
}
elif ...
});
How can I make this possible?