{
const svg = d3.create("svg")
.attr("width", width)
.attr("height", chartheight + radius * 2);
const g = svg.append("g")
.attr("transform", `translate(${[ radius, radius ]})`);
g.selectAll("polygon")
.data(voronoi)
.join("polygon")
.attr("fill", d => z(d.area))
.attr("points", d => d)
.attr("stroke", d => z(d.area));
if (showpoints){
g.selectAll("circle")
.data(data)
.join("circle")
.attr("cx", d => x(d[0]))
.attr("cy", d => y(d[1]))
.attr("r", radius);
}
return svg.node();
}