flex 饼图PieChart

flex 饼图PieChart

flex 饼图PieChart_第1张图片

 




http://www.adobe.com/2006/mxml" >

import mx.collections.ArrayCollection;
[Bindable]
private var db:ArrayCollection = new ArrayCollection ([
{country:"美国",gold:35,sliver:20,bronze:10},
{country:"中国",gold:60,sliver:25,bronze:10},
{country:"日本",gold:2,sliver:10,bronze:8}
]);

private function showMoreInfo(data:Object, field:String, index:Number, percentValue:Number):String{
//data表示传进来的整个对象,你可以访问他的各种属性了.field表示目前你用了哪个属性(这里是gold).
//index是顺序(也就是美国0,中国1,日本2),percentValue是百分比(他的返回值很长,比如36.0815241424);
var percent:String = percentValue.toString().substr(0,6);
return data.country + "\n 金牌总数:" + data.gold + "\n 银牌总数:" + data.sliver + "\n 百分比:" + percent + "%";
}

]]>


showDataTips="true">

labelFunction="showMoreInfo">























你可能感兴趣的:(Flex)