Raphael JS Pie: Add ID to path slices

折月煮酒 提交于 2019-12-04 14:06:38

the piechart object provides 3 ways to reach their sectors.

1) each function

pie.each(function(sector, cover, i) {
 sector.attr({/*...*/}); //raphael
 $(sector.node).foo(); //jquery
});

2) series object (for styling and transforming)

var i = 0; // 0 = 56, 1 = 104, 2 = 158 …

//raphael way to hide the first sector
pie.series.items[i].attr({ opacity : 0 });  

//jquery way to hide the first sector
$(pie.series.items[i].node).hide(); 

whereby i is the index of your data-array

demo: http://jsbin.com/eriqa5/2/edit

3) covers object (for mouse and touch events)

//raphael way to hover the first sector
pie.covers.items[0].hover(...);

//jquery way to hover the first sector
$(pie.covers.items[0].node).hover(...);

demo: http://jsbin.com/eriqa5/4/edit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!