chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height])
.style("font", "10px sans-serif");
const g = svg.append("g")
.selectAll("g")
.data(data)
.join("g")
.attr("transform", (d, i) => `translate(0,${i * (step + 1) + margin.top})`);
g.append("clipPath")
.attr("id", d => (d.clip = DOM.uid("clip")).id)
.append("rect")
.attr("width", width)
.attr("height", step);
g.append("defs").append("path")
.attr("id", d => (d.path = DOM.uid("path")).id)
.attr("d", d => area(d.values));
g.append("g")
.attr("clip-path", d => d.clip)
.selectAll("use")
.data(d => new Array(overlap).fill(d))
.join("use")
.attr("fill", (d, i) => color(i))
.attr("transform", (d, i) => `translate(0,${(i + 1) * step})`)
.attr("xlink:href", d => d.path.href);
g.append("text")
.attr("x", 4)
.attr("y", step / 2)
.attr("dy", "0.35em")
.text(d => d.key);
svg.append("g")
.call(xAxis);
return svg.node();
}