Sunday, 4 March 2012

Simple Charts(column chart)


<?xml version="1.0"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script><![CDATA[
     import mx.collections.ArrayCollection;
     [Bindable]
    public var arr:ArrayCollection = new ArrayCollection([
        {Month:"Jan", Income:2000, Expenditure:1500},
        {Month:"Feb", Income:1000, Expenditure:200},
        {Month:"Mar", Income:1500, Expenditure:500},
{Month:"Apr", Income:1002, Expenditure:226},
{Month:"May", Income:2566, Expenditure:566},
{Month:"Jun", Income:4478, Expenditure:476},
{Month:"Jul", Income:7654, Expenditure:3654},
{Month:"Aug", Income:1112, Expenditure:655},
{Month:"Sep", Income:6546, Expenditure:244},
{Month:"Oct", Income:545, Expenditure:445},
{Month:"Nov", Income:2435, Expenditure:654},
{Month:"Dec", Income:6354, Expenditure:356}
     ]);
  ]]></mx:Script>
  <mx:Panel title="My Column Chart">
     <mx:ColumnChart id="ColumnChart" dataProvider="{arr}" showDataTips="true">
        <mx:horizontalAxis>
           <mx:CategoryAxis
                dataProvider="{arr}"
                categoryField="Month"
           />
        </mx:horizontalAxis>
        <mx:series>
           <mx:ColumnSeries
                xField="Month"
                yField="Income"
                displayName="Income"
           />
           <mx:ColumnSeries
                xField="Month"
                yField="Expenditure"
                displayName="Expenditure"
           />
        </mx:series>
     </mx:ColumnChart>
     <mx:Legend dataProvider="{ColumnChart}"/>
  </mx:Panel>
</mx:Application>

No comments:

Post a Comment