chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
console.log(regressionEndpoints)
svg.append("path")
.datum(regressionEndpoints)
.attr("fill", "none")
.attr("stroke", "deeppink")
.attr("stroke-width", 1)
.attr("stroke-linejoin", "round")
.attr("stroke-dasharray", "10 10")
.attr("stroke-linecap", "round")
.attr("d", d3.line()
.x(d => x(d.startYear))
.y(d => y(d.mean)));
svg.append("path")
.datum(data)
.attr("fill", "none")
.attr("stroke", "steelblue")
.attr("stroke-width", 2)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round")
.attr("d", line);
return svg.node();
}