choropleth = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.attr("transform", "translate(480,0)")
.append(() =>
legend({
color: nullcolorforlegend,
title: "No Data",
width: 50,
tickFormat: ".1f"
})
);
svg.append("g")
.attr("transform", "translate(480,0)")
.append(() =>
legend({
color: color,
title: data.title,
width: 300,
tickFormat: ".1f"
.attr("fill", function(d){
if(data.get(d.properties.GISJOIN) > 0){
return color(data.get(d.properties.GISJOIN));
}
else{
return nancolor;
}
})
.attr("d", path)
.append("title")
.text(d => " Vacancy Percentage: " + data.get(d.properties.GISJOIN));
svg.append("g")
.selectAll("path")
.data(tracts.features)
.join("path")
.attr("stroke", "white")
.attr("stroke-linejoin", "round")
.attr("stroke-width", 1)
.attr("fill", d => color(data.get(d.properties.GISJOIN)))
.attr("d", path)
.append("title")
.text(d => " Percent Vacant: " + data.get(d.properties.GISJOIN));
return svg.node();
}