Flex中 如何获得ColumnChart的xField运行时显示的值? 20
程序如下<?xmlversion="1.0"encoding="utf-8"?><s:Applicationxmlns:fx="http://ns.adobe.com/m...
程序如下
<?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"
viewSourceURL="srcview/index.html">
<fx:Script>
<![CDATA[
import mx.charts.series.items.ColumnSeriesItem;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
[Bindable]private var medalsAC:ArrayCollection = new ArrayCollection( [
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);
protected function columnseries1_clickHandler(event:MouseEvent):void
{
var css : ColumnSeries = event.currentTarget as ColumnSeries;
Alert.show(css.labelFunction.call(1));
}
]]>
</fx:Script>
<s:layout>
<s:HorizontalLayout verticalAlign="middle" horizontalAlign="center" />
</s:layout>
<s:Panel title="ColumnChart Control" width="600" height="100%"
color="0x000000"
borderAlpha="0.15">
<s:layout>
<s:HorizontalLayout horizontalAlign="center"
paddingLeft="10" paddingRight="10"
paddingTop="10" paddingBottom="10"/>
</s:layout>
<mx:ColumnChart id="column" height="100%" color="0x323232"
showDataTips="true" dataProvider="{medalsAC}" showAllDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Country"/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries xField="Country" yField="Gold" displayName="Gold" click="columnseries1_clickHandler(event)" />
<mx:ColumnSeries xField="Country" yField="Silver" displayName="Silver"/>
<mx:ColumnSeries xField="Country" yField="Bronze" displayName="Bronze"/>
</mx:series>
</mx:ColumnChart>
<mx:Legend dataProvider="{column}" color="0x323232"/>
</s:Panel>
</s:Application>
我想获得Country运行显示时具体的值 展开
<?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"
viewSourceURL="srcview/index.html">
<fx:Script>
<![CDATA[
import mx.charts.series.items.ColumnSeriesItem;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
[Bindable]private var medalsAC:ArrayCollection = new ArrayCollection( [
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);
protected function columnseries1_clickHandler(event:MouseEvent):void
{
var css : ColumnSeries = event.currentTarget as ColumnSeries;
Alert.show(css.labelFunction.call(1));
}
]]>
</fx:Script>
<s:layout>
<s:HorizontalLayout verticalAlign="middle" horizontalAlign="center" />
</s:layout>
<s:Panel title="ColumnChart Control" width="600" height="100%"
color="0x000000"
borderAlpha="0.15">
<s:layout>
<s:HorizontalLayout horizontalAlign="center"
paddingLeft="10" paddingRight="10"
paddingTop="10" paddingBottom="10"/>
</s:layout>
<mx:ColumnChart id="column" height="100%" color="0x323232"
showDataTips="true" dataProvider="{medalsAC}" showAllDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Country"/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries xField="Country" yField="Gold" displayName="Gold" click="columnseries1_clickHandler(event)" />
<mx:ColumnSeries xField="Country" yField="Silver" displayName="Silver"/>
<mx:ColumnSeries xField="Country" yField="Bronze" displayName="Bronze"/>
</mx:series>
</mx:ColumnChart>
<mx:Legend dataProvider="{column}" color="0x323232"/>
</s:Panel>
</s:Application>
我想获得Country运行显示时具体的值 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询