chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, 975, 610])
.attr("width", chartWidth + "px")
.attr('font-size', fontSize);
const g = svg.append("g")
.attr("transform", "translate(610,20)")
.append(() => legend({color, title: data.title, width: 260, tickFormat: d3.format(tickFormat)}))
g.selectAll("g").attr('font-size', fontSize);
svg.append("g")
.selectAll("path")
.data(topojson.feature(us, us.objects.states).features)
.join("path")
.attr("fill", d => color(data[d.properties.name]))
.attr("d", path)
.append("title")
.text(d => data.titles ? data.titles[d.properties.name]: null)
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();
}