viewof svg = {
const svg = d3
.select(DOM.svg(width, height))
.style("width", "100%")
.style("height", "auto")
.call(zoom);
svg
.append("rect")
.attr("width", width)
.attr("height", height)
.attr("x", 0)
.attr("y", 0)
.attr("fill", "hsl(0, 0%, 96%)");
const g = svg.append("g").classed("map-layers", true);
g.selectAll("path")
.data(geojson.features)
.enter()
.append("path")
.attr("class", (d) => quantile(d.properties[category]))
.attr("d", path)
.append("title")
.text((d) => `${format(d.properties[category])} / sq meter`);
const legend = svg
.append("g")
.classed("legend", true)
.attr("transform", `translate(20, ${height - 60})`);
legend
.selectAll("rect")
.data(quantile.range())
.enter()
.append("rect")
.attr("height", 8)
.attr("width", x.bandwidth())
.attr("x", (d) => x(d))
.attr("class", (d) => d);
legend.select(".domain").remove();
legend.selectAll(".tick > line").remove();
return svg.node();
}