charts icon indicating copy to clipboard operation
charts copied to clipboard

Bar chart animation starts from 0 when bar.value is updated

Open jcardama opened this issue 4 years ago • 2 comments

I have a bar chart with a bar set with bar.value = 100. Then when I update this value to 150 the following happens:

From 100 it jumps to 0 and then animates back to 150.

I'm looking for a way so that instead of jumping to 0 and then animating to 150 it animates from 100 to the next new value which in this case is 150.

Is there a way to do this?

jcardama avatar Jan 26 '21 18:01 jcardama

Not with the way I did it here :(. You can probably save the previous BarChartData and pass that into BarChartData.forEachWithArea and then do the calculation based off of that. It's a cool idea though, animating chart diffs, I didn't really think of those use cases :(

tehras avatar Jan 26 '21 23:01 tehras

@tehras I tried a similar animation with a custom line chart library I was making. I can try implementing something here. Will using the barChartData.maxYValue be fine for that?

yashovardhan99 avatar Mar 15 '21 19:03 yashovardhan99