g.raphael icon indicating copy to clipboard operation
g.raphael copied to clipboard

How to animate pie slices?

Open ianstormtaylor opened this issue 13 years ago • 2 comments

How can I animate the angle of a pie slice? I want the chart fold in on itself.

I see it's been done here: http://raphaeljs.com/growing-pie.html

But that doesn't use g.raphael at all. Is there a way to do this?

ianstormtaylor avatar Apr 17 '11 19:04 ianstormtaylor

Or even just to change a value and transition the change.

ianstormtaylor avatar Apr 17 '11 19:04 ianstormtaylor

It's possible to do it with the below code :

var r=Raphael("my-div");
var pie = r.piechart(wdth, hght, 70, values, { legend: labels, legendpos: "east" });
pie.each(function() {
  this.sector.scale(0, 0, this.cx, this.cy);
  this.sector.animate({ transform: 's1 1 ' + this.cx + ' ' + this.cy }, 1000, "bounce")
})

Aymkdn avatar Nov 20 '12 14:11 Aymkdn