<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Script>
<![CDATA[
[Bindable]
private var arr:Array = [
{id:1,category:'医疗机构',money:1000},
{id:2,category:'传染病防治',money:1200},
{id:3,category:'放射卫生',money:800},
{id:3,category:'公共场所',money:3000},
{id:3,category:'生活饮用水',money:1800},
{id:3,category:'学校卫生',money:1200},
{id:3,category:'职业病防治',money:1100}
];
[Bindable]
private var arr2013:Array = [
{id:1,category:'医疗机构',money:700},
{id:2,category:'传染病防治',money:800},
{id:3,category:'放射卫生',money:600},
{id:3,category:'公共场所',money:2000},
{id:3,category:'生活饮用水',money:1200},
{id:3,category:'学校卫生',money:1000},
{id:3,category:'职业病防治',money:700}
];
[Bindable]
private var arr2014:Array = [
{id:1,category:'医疗机构',money:300},
{id:2,category:'传染病防治',money:400},
{id:3,category:'放射卫生',money:200},
{id:3,category:'公共场所',money:1000},
{id:3,category:'生活饮用水',money:600},
{id:3,category:'学校卫生',money:200},
{id:3,category:'职业病防治',money:400}
];
]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<mx:RadioButtonGroup id="stateInp" />
</fx:Declarations>
<mx:PieChart x="110" y="40" id="pieChart" dataProvider="{arr}" showAllDataTips="true" selectionMode="single">
<mx:series>
<mx:PieSeries displayName="Series 1" field="money"
labelPosition="callout" labelField="category" nameField="category">
</mx:PieSeries>
</mx:series>
</mx:PieChart>
<mx:Legend dataProvider="{pieChart}" direction="horizontal" labelPlacement="right" />
<s:HGroup paddingTop="30" paddingLeft="5">
<mx:RadioButton groupName="stateInp" id="all" value="1" selected="true" click="pieChart.dataProvider = this.arr" label="全部" width="64" height="100%" />
<mx:RadioButton groupName="stateInp" id="on" value="0" click="pieChart.dataProvider = this.arr2013" label="2013年" width="100%" height="100%"/>
<mx:RadioButton groupName="stateInp" id="off" value="2" click="pieChart.dataProvider = this.arr2014" label="2014年" width="100%" height="100%"/>
</s:HGroup>
</s:Application>