{
const svg = d3.select(DOM.svg(100, 100));
const padding = 5;
const strokeWidth = 5;
const g = svg
.selectAll("g")
.data(data)
.join("g")
.attr(
"transform",
(d, i) =>
`translate(${[
i * squareSize + strokeWidth / 2,
i * squareSize + strokeWidth / 2
]})`
);
g.append("rect")
.attr("width", squareSize - padding)
.attr("height", squareSize - padding)
.attr("stroke", "steelblue")
.attr("stroke-width", strokeWidth)
.attr("fill", "lightblue");
g.append("circle")
.attr(
"transform",
`translate(${[(squareSize - padding) / 2, (squareSize - padding) / 2]})`
)
.attr("r", (squareSize - padding) / 3)
.attr("fill", "salmon");
g.append("text")
.attr(
"transform",
`translate(${[(squareSize - padding) / 2, (squareSize - padding) / 2]})`
)
.attr("text-anchor", "middle")
.attr("dy", ".35em")
.attr("fill", "white")
.attr("font-family", "Arial")
.text((d) => d);
return svg.node();
}