choropleth = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.attr("transform", "translate(360,20)")
.append(() =>
legend({
color: quantile,
title: data.title,
width: 260,
tickFormat: ".2f"
})
);
svg.append("g")
.attr("transform", "translate(700,20)")
.append(() =>
legend({
color: nullcolorforlegend,
title: "No Data",
width: 50,
tickFormat: ".1f"
})
);
svg.append("g")
.selectAll("path")
.data(zips_features.features)
.join("path")
.attr("stroke", "black")
.attr("stroke-linejoin", "round")
.attr("stroke-width", 0.2)
.attr("fill", function(d){
if(data.get(+d.properties.zip5) >= 0){
return quantile(data.get(+d.properties.zip5));
}
else{
return nancolor;
}
})
.attr("d", path)
.append("title")
.text(d => " Proportion of Providers: " + data.get(+d.properties.zip5));
return svg.node();
}