Deny order in gRaphael pie chart

I am trying to draw two pie charts using gRaphael , for example:

 var r = new Raphael(0, 0, '100%', '100%'); r.piechart(100,120,80,[60,40]); r.piechart(300,120,80,[40,60]); 

This results in the following image:

Mmmmmm pie

The two pie charts are identical, although the order of the arguments I passed to r.piechart is different. Is there a way to prevent this, so that one of the diagrams will have a 60% blue slice at the bottom, and the other will remain as it is?

+4
source share
1 answer

Here is the fiddle . I'm not an gRaphael expert, so there may be a better way. I changed the piechart function (line 99 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 how did your code change to:

 r.piechart(100,120,80,[60,40], {sort: false}); r.piechart(300,120,80,[40,60], {sort: false}); 
+8
source

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


All Articles