chart = {
const path = d3.geoPath();
const svg = d3
.create("svg")
.attr("viewBox", wide ? [0, 0, width, height] : [0, 0, height, width])
.style("display", "block")
.style("margin", "0 -14px")
.style("width", "calc(100% + 28px)")
.style("height", "auto");
const g = svg
.append("g")
.attr(
"transform",
wide
? null
: `
rotate(90 ${width / 2},${height / 2})
translate(${(width - height) / 2},${(width - height) / 2})
`
)
.attr("stroke", "white")
.attr("stroke-width", 0.03);
for (const threshold of thresholds) {
g.append("path")
.attr("d", path(simplify(contours.contour(data.values, threshold))))
.attr("fill", color(threshold));
yield svg.node();
}
}