Answer the question
In order to leave comments, you need to log in
How to make value increase over time in text d3?
I try to set using the interval, but it's still always 0.
svgContainer.selectAll('g text')
.transition()
.ease(d3.easeLinear)
.duration(500)
.attr('opacity', 1)
.text((d, i) => {
let value = 0;
const valueInt = setInterval(() => {
value++;
if (value === this.lineData[i]) {
clearTimeout(valueInt);
} else {
}, 500/this.lineData[i]);
return value;
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question