React-native-chart-kit: How to set animations for charts?

Created on 5 Apr 2018  路  5Comments  路  Source: indiespirit/react-native-chart-kit

Is possible to set a chart animation?

Most helpful comment

How exactly would I do that? Can you provide an example? I've tried to do it, but it seems that I can not pass animated values to datasets.

All 5 comments

You can use https://facebook.github.io/react-native/docs/animated.html to change values supplied to the chart

How exactly would I do that? Can you provide an example? I've tried to do it, but it seems that I can not pass animated values to datasets.

Why is this closed? there's no example in the docs that explains how to do this.
Animated doesn't return numbers that can be used in the data object supplied to charts.

How exactly would I do that? Can you provide an example? I've tried to do it, but it seems that I can not pass animated values to datasets.

@YuriRPGarcia I created an example in https://gist.github.com/MaurilioNovais/666b9e69e123107393c242136dfc62e6

Basically it is necessary to define an initial value for the Animated API and carry out the values transition in a certain time (property "duration" in the function "Animated.timing ()"). That done, just update the value of the chart variable as it is updated.

@tareqdayya You need to listen to the Animated value and update chart value.

it's not aminating the chart, just changing the data

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NS-BOBBY-C picture NS-BOBBY-C  路  5Comments

azui007 picture azui007  路  6Comments

vedika96 picture vedika96  路  4Comments

bailih picture bailih  路  4Comments

marinimau picture marinimau  路  6Comments