{
const svg = d3.create("svg");
svg.attr("width", config.svgWidth).attr("height", config.svgHeight);
const scaleBandX = d3
.scaleBand()
.domain(d3.range(0, config.gridWidth))
.range([config.margin, config.svgWidth - config.margin * 2])
.paddingInner(0.2);
const scaleBandY = d3
.scaleBand()
.domain(d3.range(0, config.gridHeight))
.range([config.margin, config.svgHeight - config.margin * 2])
.paddingInner(0.2);
const g = svg.append("g");
const enterBox = (n) =>
n
.append("rect")
.attr("data-d", (d) => JSON.stringify(d))
.attr("width", () => scaleBandX.bandwidth())
.attr("height", () => scaleBandY.bandwidth())
.attr("stroke", (d) => d3.schemeSet3[d.quadrant])
.attr("fill", (d) => (d.insideCircle ? "lightgray" : "gray"))
.attr(
"transform",
(d) => `translate(${scaleBandX(d.x)},${scaleBandY(d.y)})`
);
g.selectAll(".box").data(gridData).join(enterBox);
return svg.node();
}