{
const svg = d3.create("svg")
.attr("width", 256)
.attr("height", 256);
const cols = 32;
const rows = 16;
const dx = 8;
const dy = 12
;
for (let i = 0; i < cols; i++) {
for (let j = 0; j < rows; j++) {
const x = i * dx;
const y = j * dy;
const isEvenCol = i % 2 === 0;
const p1 = isEvenCol ? [x + dx / 2, y] : [x + dx / 2, y + dy];
const p2 = isEvenCol ? [x, y + dy] : [x, y];
const p3 = isEvenCol ? [x + dx, y + dy]: [x + dx, y];
svg.append("polygon")
.attr("points", `${p1} ${p2} ${p3}`)
.attr("fill", isEvenCol ? "yellow" : "white")
.attr("stroke", isEvenCol ? "blue" : "deeppink")
.attr("stroke-width", 1.5);
}
}
return svg.node();
}