chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
const serie = svg.append("g")
.selectAll("g")
.data(series)
.join("g");
serie.append("path")
.attr("fill", "none")
.attr("stroke", d => color(d[0].key))
.attr("stroke-width", 2)
.attr("d", line);
serie.append("g")
.attr("font-family", "sans-serif")
.attr("font-size", 9)
.attr("text-anchor", "middle")
.selectAll("text")
.data(d => d)
.join("text")
.text(d => d.value)
.attr("dy", 3.5)
.attr("x", d => x(d.year))
.attr("y", d => y(d.value))
.clone(true).lower()
.attr("fill", "none")
.attr("stroke", "white")
.attr("stroke-width", 3);
serie.append("g")
.attr("font-family", "sans-serif")
.attr("font-size", 11)
.attr("text-anchor", "end")
.attr("font-weight", "bold")
.selectAll("text")
.data((d, i) => d.filter((d, i, data) => i === data.length - 1))
.join("text")
.text(d => d.key)
.attr("x", d => x(d.year))
.attr("y", d => y(d.value) - 10)
.clone(true).lower()
.attr("fill", "none")
.attr("stroke", "white")
.attr("stroke-width", 3);
return svg.node();
}