简体   繁体   中英

tooltip responsive inside a div - not showing

I would like to insert a d3 chart on a div in html but Tootlip is not working or not showing in html. what am I doing wrong?

code

<div id="mainTooltip" class="hidden">

I added a new div and wrapped your code in another div so all positions stay relative to eachother

The only new code I had to add was this:

  .on("mouseover", function(d) {

      d3.select("#centerTooltip")
        .classed("hidden", false)
        .html(d.data.str_lab + "<br />" + d.data.num);
  })

And in the div wrapper css I added:

#all {
  margin:auto;
  width: 700px;
}

To make sure that everything aligns properly.

Here's a fork of your code: Plunker

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM