I'm trying to draw two pie charts using gRaphael
, like so:
var r = new Raphael(0, 0, '100%', '100%');
r.piechart(100,120,80,[60,40]);
r.piechart(300,120,80,[40,60]);
This produces the following picture:
The two pie charts are identical even though the order of the arguments I passed to r.piechart
is different. Is there any way I can prevent this from happening so that one of the charts will have the 60% blue slice on the bottom and the other one will remain as it is?
Here is a fiddle. I'm not a gRaphael expert, so there might be a better way.. I changed the piechart function (line 99 of g.pie.js) from
values.sort(function (a, b) {
return b.value - a.value;
});
to
if (opts.sort !== false) {
values.sort(function (a, b) {
return b.value - a.value;
});
}
And than changed your code to:
r.piechart(100,120,80,[60,40], {sort: false});
r.piechart(300,120,80,[40,60], {sort: false});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With