主程序文件:
<?xml version="1.0" encoding="utf-8"?>
<!--七乐彩(7/30)-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Style>
Application{font-size:14pt;}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var lottery:ArrayCollection = new ArrayCollection( [
{ Ball: "球1", Q110: 04, Q111: 06, Q112: 03 },
{ Ball: "球2", Q110: 05, Q111: 07, Q112: 09 },
{ Ball: "球3", Q110: 11, Q111: 08, Q112: 20 },
{ Ball: "球4", Q110: 12, Q111: 09, Q112: 24 },
{ Ball: "球5", Q110: 14, Q111: 18, Q112: 25 },
{ Ball: "球6", Q110: 15, Q111: 26, Q112: 26 },
{ Ball: "球7", Q110: 23, Q111: 30, Q112: 28 }
]);
]]>
</mx:Script>
<mx:Stroke id = "s1" color="red"/>
<mx:Stroke id = "s2" color="green"/>
<mx:Stroke id = "s3" color="blue"/>
<mx:Panel width="600" height="600" layout="horizontal" title="七乐彩第2008Q110期-第2008Q112期开奖情况">
<mx:LineChart id="linechart" height="100%" width="100%"
paddingLeft="5" paddingRight="5"
showDataTips="true" dataProvider="{lottery}">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Ball"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="Q110" form="segment" displayName="第2008Q110期" lineStroke="{s1}"/>
<mx:LineSeries yField="Q111" form="segment" displayName="第2008Q111期" lineStroke="{s2}"/>
<mx:LineSeries yField="Q112" form="segment" displayName="第2008Q112期" lineStroke="{s3}"/>
</mx:series>
</mx:LineChart>
<mx:Legend dataProvider="{linechart}" legendItemClass="MyLegendItem"/>
</mx:Panel>
</mx:Application>
<!--七乐彩(7/30)-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Style>
Application{font-size:14pt;}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var lottery:ArrayCollection = new ArrayCollection( [
{ Ball: "球1", Q110: 04, Q111: 06, Q112: 03 },
{ Ball: "球2", Q110: 05, Q111: 07, Q112: 09 },
{ Ball: "球3", Q110: 11, Q111: 08, Q112: 20 },
{ Ball: "球4", Q110: 12, Q111: 09, Q112: 24 },
{ Ball: "球5", Q110: 14, Q111: 18, Q112: 25 },
{ Ball: "球6", Q110: 15, Q111: 26, Q112: 26 },
{ Ball: "球7", Q110: 23, Q111: 30, Q112: 28 }
]);
]]>
</mx:Script>
<mx:Stroke id = "s1" color="red"/>
<mx:Stroke id = "s2" color="green"/>
<mx:Stroke id = "s3" color="blue"/>
<mx:Panel width="600" height="600" layout="horizontal" title="七乐彩第2008Q110期-第2008Q112期开奖情况">
<mx:LineChart id="linechart" height="100%" width="100%"
paddingLeft="5" paddingRight="5"
showDataTips="true" dataProvider="{lottery}">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Ball"/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="Q110" form="segment" displayName="第2008Q110期" lineStroke="{s1}"/>
<mx:LineSeries yField="Q111" form="segment" displayName="第2008Q111期" lineStroke="{s2}"/>
<mx:LineSeries yField="Q112" form="segment" displayName="第2008Q112期" lineStroke="{s3}"/>
</mx:series>
</mx:LineChart>
<mx:Legend dataProvider="{linechart}" legendItemClass="MyLegendItem"/>
</mx:Panel>
</mx:Application>
自定义组件MyLegendItem.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:LegendItem xmlns:mx="http://www.adobe.com/2006/mxml" styleName="font12">
<mx:Style>
.font12{font-size:12pt;fontWeight:normal;}
</mx:Style>
</mx:LegendItem>
<mx:LegendItem xmlns:mx="http://www.adobe.com/2006/mxml" styleName="font12">
<mx:Style>
.font12{font-size:12pt;fontWeight:normal;}
</mx:Style>
</mx:LegendItem>
这个组件主要是为了改变那个Legend的字体大小等。
本文转自 xcf007 51CTO博客,原文链接:http://blog.51cto.com/xcf007/102055
,如需转载请自行联系原作者