map = {
var svg = d3.select(DOM.svg(width, height));
var countyMap = svg.append("g")
.selectAll("path")
.data(counties.features)
.enter()
.append("path")
.attr("d", path)
.attr("fill", "#cccc")
.attr("stroke", "white")
.attr("stroke-width", 0.1);
svg.append("g")
.selectAll("path")
.data(states.features)
.enter()
.append("path")
.attr("d", path)
.attr("stroke", "white")
.attr("stroke-width", 1)
.attr("fill", "none");
svg.append("g")
.attr("transform", "translate("+600+","+100+")")
.append(() => legend({color,
title: "COVID Cases",
ticks : bins,
tickFormat : ".0s",
width: 300}
)
);
function update(date) {
countyMap.attr("fill", function(d) {
var cases = data.get(d.properties["COUNTY_FIPS"] + " " + dateToString(date));
if (cases) {
var fcolor = color(cases);
} else {
var fcolor = "#cccc";
}
return fcolor ;
});
}
return Object.assign(svg.node(), {update});
}