Accepted answer

You could select the y and height attr and set it like this

d3.selectAll('.bar').on("mouseover", function(d){
  let xPos ="x")
  let width ="width")/2
  let thisHeight = Number("height")) / 2
  let thisY = Number("y"))
  let tipPos = +xPos+width
  let html =

  console.log(thisHeight, thisY)'.chart-tooltip').style("display", null)'.chart-tooltip')
  .style("left", tipPos + "px")
  .style("top", + thisY + thisHeight + "px") // <-- Here


And the label will be appended to the middle, here's a fork


Related Query

More Query from same tag