Reputation: 371
I'm using AmCharts4 by including it in footer.
<script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
<script>am4core.useTheme(am4themes_animated);</script>
I am able to draw a chart and it animates on load, but would love to make it animate on receiving new data.
both chart.animateAgain()
or chart.animateData()
throws me TypeError: chart.animateAgain is not a function
.
To create the chart I did chart = am4core.create("chartdiv", am4charts.RadarChart);
To assign new data I just did chart.data = newData
.
Upvotes: 0
Views: 901
Reputation: 16012
animateData
and animateAgain
are methods in version 3. Version 4 has a completely different API.
To redraw the chart and trigger the animation again in version 4, you can call invalidateData
, which is also useful in cases where you need to manually update the chart. You can also call deepInvalidate
if you really want to trigger a full redraw, but it's very performance heavy and the documentation warns to only do this if absolutely necessary.
Upvotes: 1