chart = () => {
const svg = d3.create("svg")
.attr("width", chartwidth + margin.left + margin.right)
.attr("height", chartheight + margin.top + margin.bottom)
.style("overflow", "visible");
svg.append("style").html(css);
const g = svg.append("g")
.attr("transform", `translate(${[margin.left, margin.top]})`);
g.append("g")
.attr("class", "axis x-axis")
.attr("transform", `translate(0, ${chartheight})`)
.call(xAxisGenerator);
g.append("g")
.attr("class", "areas")
.selectAll(".area")
.data(series)
.join("path")
.attr("class", "area")
.attr("d", areaGenerator)
.attr("fill", d => colors[d.key])
g.append("g")
.attr("class", "axis y-axis")
.attr("transform", `translate(${chartwidth})`)
.call(yAxisGenerator);
return svg.node();
}