chart = {
const svg = d3.select(DOM.svg(width, height));
const g = svg
.append("g")
.selectAll("g")
.data(boxes)
.join("g");
g.append("path")
.attr("stroke", "currentColor")
.attr(
"d",
(d, i) => `
M${x(i) + x.bandwidth() / 2},${y(d.range[1])}
V${y(d.range[0])}
`
);
g.append("path")
.attr("fill", "#ddd")
.attr(
"d",
(d, i) => `
M${x(i)},${y(d.quartiles[2])}
H${x(i) + x.bandwidth()}
V${y(d.quartiles[0])}
H${x(i)}
Z
`
);
g.append("path")
.attr("stroke", "currentColor")
.attr("stroke-width", 2)
.attr(
"d",
(d, i) => `
M${x(i)},${y(d.quartiles[1])}
H${x(i) + x.bandwidth()}
`
);
g.append("g")
.attr("fill", "currentColor")
.attr("fill-opacity", 0.2)
.attr("stroke", "none")
.attr("transform", (d, i) => `translate(${x(i) + x.bandwidth() / 2},0)`)
.selectAll("circle")
.data(d => d.outliers)
.join("circle")
.attr("r", 3)
.attr("cx", () => (Math.random() - 0.5) * 4)
.attr("cy", d => y(d));
svg.append("g").call(xAxis);
svg.append("g").call(yAxis);
return svg.node();
}