percentInfectedGraph = {
const svg = d3
.create("svg")
.attr("viewBox", [0, 0, 460, 630])
.style("width", "400px");
svg
.append("g")
.attr("transform", "translate(50,20)")
.append(() =>
legend({
color: percentInfectedColor,
title: "Percent Infected",
width: 260,
tickFormat: '%'
})
);
const percent = d =>
numCases.get(d.properties.name) / populations[d.properties.name];
const color = d => percentInfectedColor(percent(d));
svg
.append('g')
.selectAll('g')
.data(topojson.feature(ri, ri.objects.counties).features)
.join('g')
.call(g =>
g
.append('path')
.attr("fill", color)
.attr("d", d3.geoPath(projection))
)
.call(labelCounties(color, d => d3.format('.4%')(percent(d))));
return svg.node();
}