chart = {
var new_england = topojson.feature(us, us.objects.counties);
var land = topojson.feature(us, {
type: "GeometryCollection",
geometries: us.objects.counties.geometries.filter(function(d) {
var states = ["09", "25", "23", "33", "44", "50"]
return states.includes(d.id.slice(0, 2));
})
});
var projection = d3.geoIdentity().fitExtent([[20, 20], [940, 580]], new_england);
var path = d3.geoPath(projection);
const svg = d3.create("svg")
.attr("viewBox", "0 0 960 600")
.style("width", "960")
.style("height", "600");
svg.append("g")
.attr("transform", "translate(600,40)")
.call(legend);
svg.append("g")
.selectAll("path")
.data(new_england.features)
.join("path")
.attr("fill", d => color(data.get(d.id)))
.attr("d", path)
.append("title")
.text(d => `${d.properties.name}, ${states.get(d.id.slice(0, 2)).name}
${format(data.get(d.id))}`);
svg.append("path")
.datum(topojson.mesh(us, us.objects.states, (a, b) => a !== b))
.attr("fill", "none")
.attr("stroke", "white")
.attr("stroke-linejoin", "round")
.attr("d", path);
return svg.node();
}