检索拉斐尔饼图的属性 [英] Retrieve attributes of raphael pie chart

查看:97
本文介绍了检索拉斐尔饼图的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取拉斐尔饼图的属性:

How to get the attributes of raphael pie chart:

属性,例如: 笔触,值(不带有图例),半径,x和y位置

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

我的饼图定义为:

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

我尝试过:

this.stroke-说不定

this.stroke -- says undefined

//我知道这可以使我正确地获得raphael对象,因为我也在做一些工作

// 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'); -甚至不显示未定义

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

有什么办法解决这个问题...谢谢

Any idea how to solve this...thanks

推荐答案

您可以像这样从饼图本身中获取它

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...

或者从馅饼本身这样

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

这篇关于检索拉斐尔饼图的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆