flex柱状图代码: <?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"> <s:layout> <s:BasicLayout/> </s:layout> <fx:Script> <!--[CDATA[ import mx.collections.ArrayCollection; private var peoples:ArrayCollection = new ArrayCollection([ {People:"张三",语文:100,数学:90,English:80}, {People:"李四",语文:90,数学:100,English:80}, {People:"王二",语文:80,数学:90,English:100} ]); ]]--> </fx:Script> <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <mx:SolidColor id="sc1" color="yellow" alpha=".8"/> <mx:SolidColor id="sc2" color="0xCCCCCC" alpha=".6"/> <mx:SolidColor id="sc3" color="0xFFCC66" alpha=".6"/> <!--标识 边框颜色--> <mx:Stroke id="s1" color="yellow" weight="2"/> <mx:Stroke id="s2" color="0xCCCCCC" weight="2"/> <mx:Stroke id="s3" color="0xFFCC66" weight="2"/> </fx:Declarations> <!-- 柱形图 --> <mx:ColumnChart id="peoplet" dataProvider="{peoples}" fontSize="12" x="96" y="10"> <mx:horizontalAxis> <mx:CategoryAxis categoryField="People" /> </mx:horizontalAxis> <mx:series> <mx:ColumnSeries xField="People" yField="语文" displayName="语文" fill="{sc1}" stroke="{s1}"/> <mx:ColumnSeries xField="People" yField="数学" displayName="数学" fill="{sc2}" stroke="{s2}"/> <mx:ColumnSeries xField="People" yField="English" displayName="English" fill="{sc3}" stroke="{s3}"/> </mx:series> </mx:ColumnChart> <!-- 图例 --> <mx:Legend dataProvider="{peoplet}" /> </s:Application>