chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
const g = svg.append("g");
const defs = svg.append("defs");
defs
.append("path")
.datum({ type: "Sphere" })
.attr("id", "sphere")
.attr("d", path(outline));
defs
.append("clipPath")
.attr("id", "clip")
.append("use")
.attr("xlink:href", "#sphere");
g.append("path").attr("d", path(outline)).attr("fill", "#F6F6FF");
g.attr("clip-path", "url(#clip)");
g.append("path")
.attr("d", path(graticule))
.attr("stroke", "#fff")
.attr("stroke-width", 1, 25)
.attr("fill", "none");
g.append("path")
.attr("d", path(land))
.attr("fill", "#4BADF8")
.attr("stroke", "#fff");
g.append("path")
.attr("d", path(borders))
.attr("fill", "none")
.attr("stroke", "#fff");
g.append("path")
.attr("d", path(outline))
.attr("fill", "none")
.attr("stroke", "#AEAEFF")
.attr("stroke-width", "3px");
g.selectAll("text")
.data(citiesData)
.enter()
.append("text")
.attr("x", (d) => projection([parseInt(d["lng"]), parseInt(d["lat"])])[0])
.attr(
"y",
(d) => projection([parseInt(d["lng"]), parseInt(d["lat"])])[1] - 2
)
.text((d) => d.city)
.style("font-size", "2.5px")
.attr("fill", (d) =>
d.country === "India"
? "black"
: d.country === "Nepal"
? "black"
: "black"
)
.attr("text-anchor", "middle");
return svg.node();
}