手把手教新手写jquery插件(转自www.jqueryba.com)
2012-08-24 20:35
471 查看
<?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" creationComplete="application1_creationCompleteHandler(event)"> <s:layout> <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/> </s:layout> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:SolidColor id="sc1" color="blue" alpha=".3"/> <mx:SolidColor id="sc2" color="red" alpha=".3"/> <mx:SolidColor id="sc3" color="green" alpha=".3"/> <mx:SolidColorStroke id = "s1" color="blue" weight="2"/> <mx:SolidColorStroke id = "s2" color="red" weight="2"/> <mx:SolidColorStroke id = "s3" color="green" weight="2"/> </fx:Declarations> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.events.FlexEvent; [Bindable] private var dp:ArrayCollection = new ArrayCollection( [ { Month: "Jan", Profit: 2000, Expenses: 1500, Amount: 450 }, { Month: "Feb", Profit: 1000, Expenses: 200, Amount: 600 }, { Month: "Mar", Profit: 1500, Expenses: 500, Amount: 300 }, { Month: "Apr", Profit: 1800, Expenses: 1200, Amount: 900 }, { Month: "May", Profit: 2400, Expenses: 575, Amount: 500 } ]); private var timer:Timer = new Timer(2000); protected function application1_creationCompleteHandler(event:FlexEvent):void { timer.addEventListener(TimerEvent.TIMER,timerHander); timer.start(); } private function timerHander(event:TimerEvent):void{ for(var i:int=0; i < dp.length; i++){ dp[i].Profit= dp[i].Profit + int(Math.random()*100); dp[i].Expenses= dp[i].Expenses + int(Math.random()*100); dp[i].Amount= dp[i].Amount + int(Math.random()*100); } dp.refresh(); } ]]> </fx:Script> <mx:LineChart id="linechart1" width="600" height="400" dataProvider="{dp}" showDataTips="true"> <mx:horizontalAxis> <mx:CategoryAxis categoryField="Month" /> </mx:horizontalAxis> <mx:series> <mx:LineSeries yField="Profit" form="curve" displayName="Profit" lineStroke="{s1}"/> <mx:LineSeries yField="Expenses" form="curve" displayName="Expenses" lineStroke="{s2}"/> <mx:LineSeries yField="Amount" form="curve" displayName="Amount" lineStroke="{s3}"/> </mx:series> </mx:LineChart> <mx:Legend dataProvider="{linechart1}"/> </s:Application>
相关文章推荐
- 手把手教新手写jquery插件(转自www.jqueryba.com)
- 手把手教新手写jquery插件(转自www.jqueryba.com)
- 手把手教新手写jquery插件(转自www.jqueryba.com)
- 拒绝插件wordpress首页利用代码进行文章字符串截取(转自www.jqueryba.com)
- Jquery插件和注意点(提取自http://www.cnblogs.com/fromearth/archive/2009/07/08/1519054.html)
- 也来折腾折腾css sprites(转自www.jqueryba.com)
- 简单jquery下拉菜单流畅版(转自www.jqueryba.com)
- content=”IE=7, IE=9″意思理解(转自www.jqueryba.com)
- 25个实用的jQuery技巧和解决方案(转自www.jqueryba.com)
- 也来折腾折腾css sprites(转自www.jqueryba.com)
- DIV+CSS网页布局对SEO的四大影响(转自www.jqueryba.com)
- a标签在firefox和chrome中失效(转自www.jqueryba.com)
- jquery特效分享国内最最优秀UED博客(转自www.jqueryba.com)
- javascript(jQuery版)切换tab效果自动切换(转自www.jqueryba.com)
- IE6下PNG图像透明完美解决方案–DD_belatedPNG(转自www.jqueryba.com)
- javascript(jQuery版)切换tab效果自动切换(转自www.jqueryba.com)
- DIV+CSS网页布局对SEO的四大影响(转自www.jqueryba.com)
- content=”IE=7, IE=9″意思理解(转自www.jqueryba.com)
- 深入理解变量作用域(转自www.jqueryba.com)
- jquery特效分享国内最最优秀UED博客(转自www.jqueryba.com)