先上几张图代码如下flex4.5?xmlversion=1.0encoding=utf-8?s:Applicationxmlns:fx=:s=library://ns.adobe.com/flex/sparkxmlns:mx=library://ns.adobe.com/flex/mxwidth=100%height=100%creationComplete=init()fx:Script![CDATA[/***5.扇形图*/importmx.events.FlexEvent;importmx.states.AddChild;privatevarsector:Sprite=newSprite();privatefunctiondrawSector(x:Number,y:Number,r:Number,R:Number,angle:Number,startA:Number):void{sector.graphics.clear();sector.graphics.lineStyle(1,0,1,true);sector.graphics.beginFill(0,0.5);if(Math.abs(angle)360){angle=360;}varn:Number=Math.ceil(Math.abs(angle)/45);varangleA:Number=angle/n;angleA=angleA*Math.PI/180;startA=startA*Math.PI/180;varstartB:Number=startA;sector.graphics.moveTo(x+r*Math.cos(startA),y+r*Math.sin(startA));sector.graphics.lineTo(x+R*Math.cos(startA),y+R*Math.sin(startA));for(vari:int=1;in;i++){startA+=angleA;varangleMid1:Number=startA-angleA/2;varbx:Number=x+R/Math.cos(angleA/2)*Math.cos(angleMid1);varby:Number=y+R/Math.cos(angleA/2)*Math.sin(angleMid1);varcx:Number=x+R*Math.cos(startA);varcy:Number=y+R*Math.sin(startA);sector.graphics.curveTo(bx,by,cx,cy);}//内圆起点sector.graphics.lineTo(x+r*Math.cos(startA),y+r*Math.sin(startA));//内圆弧for(varj:int=n;j1;j--){startA-=angleA;varangleMid2:Number=startA+angleA/2;varbx2:Number=x+r/Math.cos(angleA/2)*Math.cos(angleMid2);varby2:Number=y+r/Math.cos(angleA/2)*Math.sin(angleMid2);varcx2:Number=x+r*Math.cos(startA);varcy2:Number=y+r*Math.sin(startA);sector.graphics.curveTo(bx2,by2,cx2,cy2);}//内圆终点sector.graphics.lineTo(x+r*Math.cos(startB),y+r*Math.sin(startB));//完成sector.graphics.endFill();}protectedfunctionbutton1_clickHandler():void{drawSector(200,200,50,100,-105,-30);con.addChild(sector);}/***********************************************************************************6.环形分块图**********************************************************************************/importmx.effects.easing.*;importmx.charts.series.items.PieSeriesItem;importmx.charts.events.ChartItemEvent;privatefunctionpieChart_itemClick(evt:ChartItemEvent):void{varitem:PieSeriesItem=evt.hitData.chartItemasPieSeriesItem;vardegrees:Number=radiansToDegrees(item.startAngle);vararr:Array=[];if(checkBox.selected){arr[item.index]=0.2;}pieSeries.perWedgeExplodeRadius=arr;pieSeries.startAngle-=degrees;dp.refresh();}privatefunctionradiansToDegrees(radians:Number):Number{returnradians*(180/Math.PI);}[Bindable]privatevararr:Array=[{id:1,city:'北京',money:1000,pay:300},{id:2,city:'上海',money:1200,pay:500},{id:3,city:'天津',money:800,pay:200}];importmx.charts.chartClasses.IAxis;importmx.formatters.CurrencyFormatter;/***7.flex画线1*/privatevarcurrFormatter:CurrencyFormatter;privatefunctioninit():void{currFormatter=newCurrencyFormatter();currFormatter.precision=2;}privatefunctionlinearAxis_labelFunc(item:Object,previousValue:Object,axis:IAxis):String{currFormatter=newCurrencyFormatter();currFormatter.precision=2;returncurrFormatter.format(item);}privatefunctionlineChart_creationComplete():void{varlinearAxisMinimum:int=Math.floor(linearAxis.computedMinimum);varlinearAxisMaximum:int=Math.ceil(linearAxis.computedMaximum);linearAxis.minimum=linearAxisMinimum;linearAxis.maximum=linearAxisMaximum;}/***8.flex画线2*/importmx.charts.CategoryAxis;importmx.charts.chartClasses.IAxis;privatefunctioncategoryAxis_labelFunc(item:Object,prevValue:Object,axis:CategoryAxis,categoryItem:Object):String{vardatNum:Number=Date.parse(item);vartempDate:Date=newDate(datNum);returntempDate.date.toString();}importmx.charts.series.items.PieSeriesItem;importmx.charts.HitData;importmx.utils.StringUtil;privatefunctionpieSeries_labelFunc(item:Object,field:String,index:Number,percentValue:Number):String{returnStringUtil.substitute({0}({1}%),item.@label,percentValue.toFixed(1));}]]/fx:Scriptfx:Declarationsmx:XMLListCollectionid=dpfx:XMLListproductlabel=Product1data=3/productlabel=Product2data=1/productlabel=Product3data=4/productlabel=Product4data=1/productlabel=Product5data=5/productlabel=Product6data=9//fx:XMLList/mx:XMLListCollection/fx:Declarationsfx:Declarationsmx:XMLListCollectionid=dpLinemx:sourcefx:XMLListquotedate=8/27/2007open=40.38close=40.81/quotedate=8/24/2007open=40.5close=40.41/quotedate=8/23/2007open=40.82close=40.6/quotedate=8/22/2007open=40.4close=40.77/quotedate=8/21/2007open=40.41close=40.13/quotedate=8/20/2007open=40.55close=40.74/quotedate=8/17/2007open=40.18close=40.32/quotedate=8/16/2007open=39.83close=39.96/quotedate=8/15/2007open=40.22close=40.18/quotedate=8/14/2007open=41.01close=40.41/quotedate=8/13/2007open=41close=40.83/quotedate=8/10/2007open=41.3close=41.06/quotedate=8/9/2007open=39.9close=40.75/quotedate=8/8/2007open=39.61close=40.23/quotedate=8/7/2007open=39.08close=39.42/quotedate=8/6/2007open=38.71close=39.38/quotedate=8/3/2007open=39.47close=38.75/quotedate=8/2/2007open=39.4close=39.52/quotedate=8/1/2007open=40.29close=39.58//fx:XMLList/mx:source/mx:XMLListCollection/fx:Declarationsfx:De