chart = {
var svg = d3.select(DOM.svg(width, height));
svg
.append('path')
.datum(countries)
.attr('d', pathGenerator)
.attr('class', 'country')
.attr('fill', 'gray')
.attr('opacity', 0.3)
.attr('stroke', 'black')
.attr('stroke-width', '0.5');
var circles = svg
.selectAll('path')
.data(LatLngs)
.enter()
.append('circle');
circles
.attr("cx", d => d[2][0])
.attr("cy", d => d[2][1])
.attr('r', d => Math.sqrt(d[3]))
.attr('class', 'circle')
.attr("fill", "#d60f23")
.attr('opacity', 0.4)
.on("mouseover", function(d) {
div
.transition()
.duration(200)
.style("opacity", .9);
div
.html(
"<b>COUNTRY: </b>" +
d[0] +
"<br/><b>REGION: </b>" +
d[1] +
"</br><b>CONFIRMED DEATHS: </b>" +
"1" +
"</br>AS OF 14/03/2020"
)
.style("left", d3.event.pageX + "px")
.style("top", d3.event.pageY - 28 + "px");
})
.on("mouseout", function(d) {
div
.transition()
.duration(500)
.style("opacity", 0);
});
return svg.node();
}