Highcharts piechart redraw with animation after setData ()

I am using piechart from http://www.highcharts.com/

So, I set the data as follows:

var cars = []; cars.push({name: "Keine Daten", y: 100}); piechart.series[0].setData(cars); piechart.setTitle({text: 'test '+year+' am '+daytime}); 

But piechart has no animation.

How to call an animation?

+4
source share
2 answers

If you need animation during the given data, you need to update each point separately. In other words, you can use the update () or addPoint () function

http://api.highcharts.com/highcharts#Point.update () http://api.highcharts.com/highcharts#Series.addPoint ()

+2
source

Just try @Sebastian Bochan to answer

 pie.series[0].addPoint({name: "New Point", y: Math.floor(10 + Math.random() * 30)}); 

http://jsfiddle.net/mJRMM/2/

0
source

Source: https://habr.com/ru/post/1484430/


All Articles