toomuchdesign/react-minimal-pie-chart

Feature Request: Animate on data change

mrsamse opened this issue · 2 comments

Do you want to request a feature or report a bug?

Feature

If I set the "animate" Poperty to true, the chart will be nicely built up at start. Now the user can change the data of the chart and I would like to animate these changes.Now if I only change the data of the chart, it will be displayed correctly, but unfortunately no animation happens.

Hi @mrsamse,
this is definitely a missing feature. :)

Chart's segments actually don't shrink/grow gradually but pretend to do so using the styling strategy described here.

Animation is issued on mount with a specific workaround but animation on values update seems quite harder to achieve with the same approach.

It's not impossible but problematic considering this library's performance and weight requirements.

A different approach could consist of animating chart's segments by using an external library to tween the changing input values and re-render the chart accordingly. Of course, performances should be monitored in this case.

Here is a quick setup to support the idea.