D3.js: Position tooltips using element position, not mouse position?
In your particular case you can simply use d to position the tooltip, i.e. tooltip.html(d) .style(“left”, d + “px”) .style(“top”, d + “px”); To make this a bit more general, you can select the element that is being moused over and get its coordinates to position the tooltip, i.e. tooltip.html(d) .style(“left”, d3.select(this).attr(“cx”) + “px”) .style(“top”, … Read more