<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var finance:ArrayCollection = new ArrayCollection([
{Month:"一月",In:2000,Out:1500},
{Month:"二月",In:1000,Out:200},
{Month:"三月",In:1500,Out:200},
{Month:"四月",In:3500,Out:1000},
{Month:"五月",In:500,Out:800},
{Month:"六月",In:4500,Out:600},
{Month:"七月",In:1570,Out:300},
{Month:"八月",In:1000,Out:450},
{Month:"九月",In:1500,Out:400},
{Month:"十月",In:100,Out:400},
{Month:"十一月",In:1700,Out:2500},
{Month:"十二月",In:2000,Out:1500},
]);
]]>
</mx:Script>
<mx:Panel x="0" y="0" width="800" height="600" layout="absolute">
<mx:ColumnChart x="18" y="61" id="myChart" width="428" height="314.30002" dataProvider="{finance}" >
<mx:horizontalAxis>
<!--定义横坐标,绑定到“finance”数据集中的“month”上-->
<mx:CategoryAxis dataProvider="{finance}" categoryField="Month" title="(月份)">
</mx:CategoryAxis>
</mx:horizontalAxis>
<mx:series>
<!-- 数据以柱的形式表示-->
<mx:ColumnSeries displayName="收入" xField="In" yField="Month"/>
<mx:ColumnSeries displayName="支出" xField="Out" yField="Month" />
</mx:series>
</mx:ColumnChart>
<!--组件绑定柱状图的数据名-->
<mx:Legend dataProvider="{myChart}"/>
</mx:Panel>
</mx:WindowedApplication>
柱形图
最新推荐文章于 2021-05-28 13:33:12 发布
