chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
svg.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line)
.transition()
.duration(5000)
.ease(d3.easeLinear)
.attrTween("stroke-dasharray", function() {
const length = this.getTotalLength();
return d3.interpolate(`0,${length}`, `${length},${length}`);
});
svg.append("g")
.call(yAxis);
svg.append("g")
.call(xAxis);
return svg.node();
}