chart = {
const width = 1015;
const height = 472;
const projection = d3.geoMercator().fitSize([width, height], topojson.feature(mx, mx.objects.states));
const path = d3.geoPath().projection(projection);
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
const g = svg.append("g");
const states = g.append("g")
.attr("fill", "#1C9099")
.attr("cursor", "pointer")
.selectAll("path")
.data(topojson.feature(mx, mx.objects.states).features)
.join("path")
.attr("class", "county")
.attr("id", function(d){return "e"+d.properties.state_code})
.attr("d", path);
states.append("title")
.text(d => d.properties.name);
g.append("path")
.attr("fill", "none")
.attr("stroke", "#F8F2F2")
.attr("stroke-linejoin", "round")
.attr("d", path(topojson.mesh(mx, mx.objects.states, (a, b) => a !== b)));
const tooltip = svg.append("g");
svg
.selectAll(".county")
.on("touchmove mousemove", function(event, d) {
tooltip.call(callout,`${d.properties.state_name}`);
tooltip.attr("transform", `translate(${d3.pointer(event, this)})`);
d3.select(this)
.attr("stroke", "#37AFA9")
.attr("fill", "#A6BDDB")
.raise();
})
.on("touchend mouseleave", function() {
tooltip.call(callout, null);
d3.select(this)
.attr("stroke", null)
.attr("fill", null)
.lower();
});
return svg.node();
}