{
const svg = d3.create("svg").attr("viewBox", [-20, -20, 1240, 640]);
svg
.append("path")
.attr("d", voronoi.renderBounds())
.attr("fill", "none")
.attr("stroke", "black");
svg
.append("path")
.attr("d", voronoi.render())
.attr("fill", "none")
.attr("stroke", "red");
svg
.selectAll("circle")
.data(points)
.join("circle")
.attr("r", 20)
.attr("transform", d => `translate(${d})`);
svg
.append("g")
.selectAll("circle")
.data(voronoi.cellPolygon(p))
.join("circle")
.attr("r", 8)
.attr("transform", d => `translate(${d})`);
svg
.append("g")
.selectAll("circle")
.data(edges(voronoi.cellPolygon(p)))
.join("circle")
.attr("r", 4)
.style("fill", "lightblue")
.attr("transform", d => `translate(${d})`);
svg
.selectAll("text")
.data(points)
.join("text")
.attr("transform", d => `translate(${d})`)
.attr("fill", d => "white")
.text((_, i) => i);
return svg.node();
}