JSFiddle - React, Tailwind, and code Playground

by Sergey Kalashnikov

HTML

<body>
<svg>
	<path...

CSS

body{
		margin-left: -700px;
		margin-top: -210px;
	}

JavaScript

var tooltip = d3.select("body")
    .append("div")
    .style("position", "absolute")
    .style("z-index", "10")
    .style("visibility", "hidden")
    .text("a simple tooltip");

//var city = [2, 5];
var city = [[750, 20]];
body = d3.select('body')
svg = body.append('svg')
path = svg.select('path')
circle = svg.selectAll('circle')
    .data(city)
    .enter()
circle
    .append('circle')
    .attr('r',100)
.attr('cx', function(c) { return c[0] }
     )
.attr('cy', function(c) { return c[1] }
     )
.attr('fill',function(d){return 'firebrick'})
    // обрабатываем наведение курсора на добавленный circle
    .on("mouseover", function(){return tooltip.style("visibility", "visible");})
.on("mousemove", function(){return tooltip.style("top",
    (d3.event.pageY-10)+"px").style("left",(d3.event.pageX+10)+"px");})
.on("mouseout", function(){return tooltip.sоtyle("visibility", "hidden");});