viewof chosen_msa = {
let width = 960;
let height = 600;
let value = null;
let svg = d3.select(DOM.svg(width, height));
let g1 = svg.append("g");
let g2 = svg.append("g");
const OPTbyMSA = {};
opt.forEach(d => (OPTbyMSA[d["Metro area"]] = +d["Total number who worked in area following school"]));
let projPath = d3.geoPath().projection(projection);
const outlineClick = svg.append("path")
.attr("fill", "red")
.attr("stroke", "black")
.attr("pointer-events","none");
g1.selectAll("path")
.data(usa.features)
.enter().append("path")
.attr("d", projPath)
.style("fill", "none")
.style("stroke", "black");
g2.selectAll("path")
.data(msa.features)
.enter().append("path")
.attr("d", projPath)
.attr("class", "metro-area")
.style("fill", d => colorScale(OPTbyMSA[d.properties.name]))
.style("stroke", d => strokeScale(OPTbyMSA[d.properties.name]))
.on("mouseover", d => tooltip.style("visibility", "visible").attr("background", colorScale(OPTbyMSA[d.properties.name])).text((d.properties.name + " " + OPTbyMSA[d.properties.name])))
.on("mousemove", d => tooltip.style("top", (d3.event.pageY-10)+"px").style("left",(d3.event.pageX+10)+"px").html(d.properties.name + " " + OPTbyMSA[d.properties.name]))
.on("mouseout", d => tooltip.style("visibility", "hidden"))
.on("click", d => {
const node = svg.node();
node.value = value = value === d.properties.name ? null : d.properties.name;
node.dispatchEvent(new CustomEvent("input"));
outlineClick.attr("d", value ? projPath(d) : null);
});
return svg.node();
}