{
let width = 960;
let height = 800;
let svg = d3.select(DOM.svg(width, height));
let g = svg.append("g");
const rateById = {};
deaths.forEach(d => (rateById[d.location] = +d.rate));
g.selectAll("path")
.data(topojson.feature(us, us.objects.Local_Authority_Districts__May_2020__Boundaries_UK_BFC).features)
.enter().append("path")
.attr("class", "county")
.attr("d", path)
.style("fill", d => color(rateById[d.id]))
const tooltip = svg.append("g");
svg
.selectAll(".county")
.on("touchmove mousemove", function(d) {
tooltip.call(
callout,
`${d.properties.lad20nm}`
);
tooltip.attr(
"transform",
`translate(${d3.mouse(this)[0]},${d3.mouse(this)[1]})`
);
d3.select(this)
.attr("stroke", "red")
.raise();
})
.on("touchend mouseleave", function() {
tooltip.call(callout, null);
d3.select(this)
.attr("stroke", null)
.lower();
});
return svg.node();
}