gRaphael Pie Chart : Add animation

后端 未结 1 497
后悔当初
后悔当初 2021-01-15 03:36

I want to display the pie chart with an animation that will make it grow from a \"small point\" to full size pie chart , something like this growing pie or this Highcharts D

1条回答
  •  清酒与你
    2021-01-15 04:10

    In order to achieve that kind of animation you have to access the sectors and... animate them :)

    You can do this using your_pie.each()

    pie.each(function(){
      //scale each sector to 0
      this.sector.scale(0, 0, this.cx, this.cy);
      //animate from 0 to default size
      this.sector.animate({ transform: 's1 1 ' + this.cx + ' ' + this.cy }, 1000, "bounce");
    });
    

    The fiddle is here: http://jsfiddle.net/85VtZ/6/

    Have fun ;)

    0 讨论(0)
提交回复
热议问题