Flex中的FusionCharts 四图监听

<?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"
			   width="100%" height="100%" creationComplete="initHandler()"
			    xmlns:components="com.fusioncharts.components.*">
	<s:layout>
		<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
	</s:layout>
	<fx:Declarations>
		<!-- 将非可视元素(例如服务、值对象)放在此处 -->
	</fx:Declarations>

	<fx:Script>
		<![CDATA[
			import com.events.FCEvent;
			import com.fusioncharts.components.FusionCharts;

			import mx.collections.ArrayCollection;
			import mx.controls.Alert;

			[Bindable]
			/*数据源绑定*/
			private var pieArray:ArrayCollection = new ArrayCollection([
				{label:"一月",value:"891541",link:"S-1"},
				{label:"二月",value:"451542",link:"S-2"},
				{label:"三月",value:"784455",link:"S-3"},
				{label:"四月",value:"698988",link:"S-4"},
				{label:"五月",value:"321545",link:"S-5"},
				{label:"六月",value:"154512",link:"S-6"},
				{label:"七月",value:"265455",link:"S-7"},
				{label:"八月",value:"98988",link:"S-8"},
				{label:"九月",value:"784544",link:"S-9"},
				{label:"十月",value:"987844",link:"S-10"},
				{label:"十一月",value:"356522",link:"S-11"},
				{label:"十二月",value:"894556",link:"S-12"}
			]);

			[Bindable]
			/*饼图属性绑定*/
			private var params:ArrayCollection = new ArrayCollection([
				{baseFontSize:"12"},
				{caption:"2013年某桥每月通过的人数统计"},
				{showBorder:"1"},
				{borderColor:"#00FF00"},
				{bgColor:"#000000"},
				{showLegend:"1"},
				{legendShadow:"1"},
				{legendAllowDrag:"1"},
				{dashed:"1"},
				{showToolTip:"1"},
				{legendNumColumns:"6"},
				{baseFontColor:"#FF0000"},
				{showValue:"1"},
				{startingAngle:"90"}
			]);

            /**
			 * 初始化函数
			 */
			protected function initHandler():void
			{
				var FC:FusionCharts = new FusionCharts();
				FC.FCChartType = "Pie2D";
				FC.FCData(pieArray);
				FC.percentWidth = 100;
				FC.percentHeight = 100;
				pie.addChild(FC);
				FC.addEventListener("FCClickEvent",clickPie);
			}

			private function clickPie(evt:FCEvent):void
			{
				Alert.show(evt.param);
				column.removeAllChildren();
				var FC:FusionCharts = new FusionCharts();
				FC.FCChartType = "Column2D";
				FC.FCData(pieArray);
				FC.percentWidth = 100;
				FC.percentHeight = 100;
				column.addChild(FC);
				FC.addEventListener("FCClickEvent",clickColumn);
			}

			private function clickColumn(evt:FCEvent):void
			{
				Alert.show(evt.param);
				line.removeAllChildren();
				var FC:FusionCharts = new FusionCharts();
				FC.FCChartType = "Line";
				FC.FCData(pieArray);
				FC.percentWidth = 100;
				FC.percentHeight = 100;
				line.addChild(FC);
				FC.addEventListener("FCClickEvent",clickLine);
			}

			private function clickLine(evt:FCEvent):void
			{
				Alert.show(evt.param);
				bar.removeAllChildren();
				var FC:FusionCharts = new FusionCharts();
				FC.FCChartType = "Bar2D";
				FC.FCData(pieArray);
				FC.percentWidth = 100;
				FC.percentHeight = 100;
				bar.addChild(FC);
			}

		]]>
	</fx:Script>

	<mx:HBox width="100%" height="50%">
		<mx:HBox width="50%" height="100%" id="pie">

		</mx:HBox>
		<mx:HBox width="50%" height="100%" id="column">

		</mx:HBox>
	</mx:HBox>
	<mx:HBox width="100%" height="50%">
		<mx:HBox width="50%" height="100%" id="line">

		</mx:HBox>
		<mx:HBox width="50%" height="100%" id="bar">

		</mx:HBox>
	</mx:HBox>
</s:Application>
上一篇:父子一对多iframe,子iframe改子iframe元素


下一篇:nginx启用TCP反向代理日志配置