chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height])
.attr("id", "chart");
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
svg.append("g")
.selectAll("path")
.data(data.series)
.join("path")
.attr("d", d => area(d.y_bounds))
.attr("data-index", (d, i) => i)
.attr("data-name", d => d.name)
.attr("fill", (d, i) => colors[i][0])
.attr("stroke", "none")
.attr("class", "area");
svg.append("g")
.selectAll("path")
.data(data.series)
.join("path")
.attr("d", d => line(d.y))
.attr("data-index", (d, i) => i)
.attr("data-name", d => d.name)
.attr("fill", "none")
.attr("stroke", (d, i) => colors[i][0])
.attr("stroke-width", 1.5)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr("class", "line");
svg.append("g")
.selectAll("text")
.data(lineLabels)
.enter().append("text")
.text(d => d.text)
.attr("fill", (d, i) => colors[i][1])
.attr("x", d => margin.left + (width * d.x))
.attr("y", d => margin.top + (height * d.y))
.attr("alignment-baseline", "middle")
.attr("text-anchor", "middle")
.attr("class", "small-copy");
return svg.node();
}