{
const colorScale = d3.scaleSequentialLog()
.domain(d3.extent(Object.values(gdp)))
.interpolator(d3.interpolateBlues)
const chart = Plot.plot({
projection: "mercator",
width: 800,
height: 400,
marks: [
Plot.geo(countries, {
fill: d => colorScale(gdp[d.properties.name] || 1),
stroke: "#555",
title: d => `${d.properties.name}: $${gdp[d.properties.name] || "N/A"}B`,
})
]
});
d3.select(chart)
.selectAll("path")
.on("mouseenter", function() {
d3.select(this).transition().duration(200).attr("transform", "scale(1.01)");
})
.on("mouseleave", function() {
d3.select(this).transition().duration(200).attr("transform", "scale(1)");
});
return chart
}