chart = {
const svg = d3
.create("svg")
.attr("viewBox", [0, 0, width, height])
.style("overflow", "visible");
const tooltip = d3tip()
.html(`<div> Hello </div>`);
svg
.selectAll("circle")
.data(region)
.join("circle")
.filter((d) => d.Number_Dead > 10)
.attr("cx", (d) => x(d.Number_Dead))
.attr("cy", (d) => y(d.Number_of_Survivors))
.attr("r", 2)
.on("mouseover", tooltip.show)
.on("mouseout", tooltip.hide)
.attr("fill", (d) => c(d.Number_Dead))
.style("opacity", 0.1)
.transition()
.duration(3000)
.delay((d, i) => i * 0.2)
.attr("r", (d) => r(d.Number_of_Survivors))
.style("opacity", 1);
svg
.selectAll("text")
.data(region)
.join("text")
.filter((d) => d.Number_Dead > 5)
.text((d) => d.Number_of_Survivors + " | " + d.Number_Dead)
.attr("x", (d) => x(d.Number_Dead - 2.5))
.attr("y", (d) => y(d.Number_of_Survivors - 1));
svg
.append("g")
.call(xAxis)
.append("text")
.attr("fill", "black")
.attr("transform","translate(500, 35)")
.text("Number of Deads");
svg
.append("g")
.call(yAxis)
.append("text")
.attr("fill", "black")
.attr("transform","rotate(-90)")
.attr("y", (margin.left)*-1)
.attr("x",((height/2)*-1)+35)
.text("Number of Survivors");
return svg.node();
}