choropleth = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.selectAll("path")
.data(blkgrp_features.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 => `${d.properties[idName]} : Flood Depth ${d3.format(".2f")(data.get(d.properties.GISJOIN))} feet`);
svg.append("g")
.selectAll("path")
.data(floodplain.features)
.join("path")
.attr("stroke", "#e34a33")
.attr("stroke-width", 5)
.attr("d", path);
svg.append("g")
.attr("transform", `translate(20, ${height - 90})`)
.append(() =>
legend({
color: color,
title: "Flood Depth (Feet)",
width: 260,
tickFormat: ".1f"
})
);
svg.append("text")
.attr("x", width / 2)
.attr("y", 20)
.attr("text-anchor", "middle")
.attr("font-size", "30px")
.attr("font-weight", "bold")
.text("Flood Exposure at Block Group Level");
svg.append("text")
.attr("x", width / 2)
.attr("y", 40)
.attr("text-anchor", "middle")
.attr("font-size", 16)
.attr("font-style", "italic")
.text("Johnson County, Iowa");
svg.append("text")
.attr("x", 320)
.attr("y", 250)
.attr("text-anchor", "middle")
.attr("font-size", 12)
.attr("font-style", "italic")
.text("Data: Census 2019 - 2023 and Iowa Geospatial Data Clearinghous")
.attr("transform", "translate(-140, 350)");
return svg.node();
}