chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, 975, 610]);
svg
.append("g")
.attr("transform", "translate(610,20)")
.append(() =>
legend({ color, title: data.title, width: 260, tickFormat: '.0s' })
);
svg
.append("g")
.selectAll("path")
.data(topojson.feature(us, us.objects.counties).features)
.join("path")
.attr("fill", d => color(data.get(d.id) || 0))
.attr("d", path)
.append("title")
.text(
d =>
`${
nyc.includes(d.id)
? 'New York City'
: `${d.properties.name}, ${states.get(d.id.slice(0, 2)).name}`
}\n${format(data.get(d.id) || 0)}`
);
svg
.append("path")
.datum(topojson.mesh(us, us.objects.states))
.attr("fill", "none")
.attr("stroke", "#ccc")
.attr("stroke-linejoin", "round")
.attr("d", path);
return svg.node();
}