Retrieve attributes of raphael pie chart

依然范特西╮ 提交于 2019-12-12 04:37:17

问题


How to get the attributes of raphael pie chart:

attributes like: stroke, values (not with legend), radius, x and y position

My pie chart is defined as:

pie = r.piechart(120, 140, 50, [55, 22], {
    colors: ["green","red"],
    stroke: "black"   
});

I tried:

this.stroke -- says undefined

// I know this is getting me the raphael object correctly since I am doing some work also

this.click(function () { 
   alert(this.stroke); 
});

this.attr('stroke'); -- does not even display undefined

Any idea how to solve this...thanks


回答1:


You can get it from the pie slice itself like this

console.log(this.prev.prev.prev.attrs.stroke); //I know it looks a bit ugly...

Or from pie itself like this

console.log(pie.series[0].attrs.stroke);


来源:https://stackoverflow.com/questions/15846655/retrieve-attributes-of-raphael-pie-chart

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