choropleth = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.attr("transform", "translate(550,60)")
.append(() =>
legend({
color: nullcolorforlegend,
title: "No Data",
width: 50,
tickFormat: ".1f"
})
);
svg.append("g")
.attr("transform", "translate(250,60)")
.append(() =>
legend({
color: color,
title: data.title,
width: 260,
tickFormat: ".2f"
})
);
svg.append("g")
.selectAll("path")
.data(census_features.features)
.join("path")
.attr("stroke", "white")
.attr("stroke-linejoin", "round")
.attr("stroke-width", 0.1)
.attr("fill", function(d){
if(data.get(d.properties.TRACTCE) >= 0){
return color(data.get(d.properties.TRACTCE));
}
else{
return nancolor;
}
})
.attr("d", path)
.append("title")
.text(d => "Percent Poverty: " + data.get(d.properties.TRACTCE));
return svg.node();
}