Retrieve attributes of raphael pie chart

2019-08-26 02:36发布

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条回答
Anthone
2楼-- · 2019-08-26 02:43

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);
查看更多
登录 后发表回答