I have a stackblitz here - https://stackblitz.com/edit/simple-line-chart?embed=1&file=src/app/bar-chart.ts&hideNavigation=1
Its a simple line graph using D3
I'd like to animate the line from left to right.
Cant find many of this or anything explaing the best way
The actual graph will have a bar chart as well so I cant animate and white block on top to show the line
Why messing around with a tween function, interpolators and
this
?The easiest and most common solution is simply setting the
stroke-dasharray
and thestroke-dashoffset
for the total length...And then changing it with a simple transition:
No need for tweening the
stroke-dasharray
.Here is the forked code: https://stackblitz.com/edit/simple-line-chart-3hpaje?file=src/app/bar-chart.ts
It is all a
this
problem.Edit
Why do we need
i
?This is the same