Dmitry
Interactive Data in Action

Follow

Interactive Data in Action

Follow

Tooltip Issue

Dmitry's photo
Dmitry
ยทMar 30, 2021ยท

1 min read

Need to make tooltip.

Have this structure in my html:

<div id="tooltip">
            Place: <span id="place"
                  class="info"></span><br>
</div>

Try this snippet in my .js

.on("mouseover", function (d) {
            d3.select(this).style("fill", "black");
            d3.select("#place").text(d.place);
            d3.select("#tooltip")
              .style("left", d3.select(this).attr("cx") + "px")
              .style("top", d3.select(this).attr("cy") + "px")
              .style("display", "block")
              .style("opacity", 0.8);
          })

But seems nothing goes to text(d.place) ๐Ÿค”๐Ÿค”๐Ÿค”

ย 
Share this