{
const height = width / 2;
const projection = d3
.geoEqualEarth()
.fitExtent(
[
[2, 2],
[width - 2, height - 2]
],
{ type: "Sphere" }
)
.rotate([-10, 0]);
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);
const path = d3.geoPath(projection);
svg
.append("g")
.append("path")
.datum({ type: "Sphere" })
.attr("d", path)
.attr("stroke", "black")
.attr("stroke-width", 2)
.attr("fill", "beige");
svg
.append("g")
.selectAll("path")
.data(world.features)
.join("path")
.attr("d", path)
.style("fill", (d) => color(d.properties.NAME))
.style("fill-opacity", 0.75)
.style("stroke", "black")
.style("stroke-width", 1.3)
.append("title")
.text((d) => d.properties.NAME);
svg
.append("text")
.attr("transform", "translate(10, 40)")
.style("font-size", "32px")
.text(year);
return svg.node();
}