Chart displays -1 when initialized with (and not changed) percentage of 0
Closed this issue · 4 comments
af-lsh commented
You may like to check if the step is !== 0 in your animateValue
function
For example:
function animateValue(to) {
const step = to - currentPercent.value;
if (step) {
const delay = props.transition / Math.abs(step);
const counter = setInterval(() => {
if (step > 0) {
currentPercent.value += 1;
if (currentPercent.value >= to) {
clearInterval(counter);
}
} else {
currentPercent.value -= 1;
if (currentPercent.value <= to) {
clearInterval(counter);
}
}
}, delay);
}
}
delowardev commented
@af-lsh thanks for bringing it up, I will update it soon. Also, you can make a pull request if you want to.
af-lsh commented
@delowardev Would you mind to create a new version of the module with this fix to publish it to the package managers?
delowardev commented
@delowardev Would you mind to create a new version of the module with this fix to publish it to the package managers?
Hi @af-lsh,
I will push an update by tomorrow with the latest changes.
Thanks.
af-lsh commented
Thank you very much 👍