flex 饼图PieChart

flex 饼图PieChart

<!-- 正文开始 -->

flex <wbr>饼图PieChart

 



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Script>
<![CDATA[
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 + "%";
}

]]>
</mx:Script>

<mx:PieChart id="pie" dataProvider="{db}" width="100%" height="100%" showDataTips="true">
<mx:series>
<mx:PieSeries field="gold" labelPosition="callout" nameField="country" labelFunction="showMoreInfo">
<!-- 清除掉投影-->
<mx:filters><mx:Array/></mx:filters>

<!-- 内部分割线条 -->
<mx:radialStroke>
<mx:Stroke weight="1" color="#ffffff" alpha="0.3" />
</mx:radialStroke>

<!-- 圆周边 边线 -->
<mx:stroke>
<mx:Stroke weight="2" color="#000000" alpha="0.5" />
</mx:stroke>

<!-- 提示信息的线 -->
<mx:calloutStroke>
<mx:Stroke weight="1" color="#000000" alpha="0.5" />
</mx:calloutStroke>
</mx:PieSeries>
</mx:series>

</mx:PieChart>
<!-- 图例说明 -->
<mx:Legend dataProvider="{pie}" />
</mx:Application>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值