Search

Custom Search
24
May
08

flex Line Chart

the LineSeries component displays data as a series of points that are connected by a line. You can also display line charts without points, or you can specify an icon to display as the point.

<?xml version=”1.0″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”
creationComplete=”initApp()” backgroundColor=”#FFFFFF”>

    <mx:Script>
    <![CDATA[

    import mx.collections.ArrayCollection;

    private var chartData:ChartData = new ChartData();

    [Bindable]
    private var productSales:ArrayCollection;

    private function initApp():void{
      productSales = chartData.getDataSet1();
    }
    ]]>
    </mx:Script>

  <mx:Panel title=”LineChart Example” width=”100%” height=”100%”
    paddingTop=”10″ paddingLeft=”10″ paddingRight=”10″ paddingBottom=”10″>

    <mx:LineChart id=”lineChart” height=”100%” width=”100%”
            paddingLeft=”5″ paddingRight=”5″
            showDataTips=”true” dataProvider=”{productSales}”>
      <mx:horizontalAxis>
        <mx:CategoryAxis categoryField=”Quarter”/>
      </mx:horizontalAxis>
      <mx:series>
         <mx:LineSeries yField=”Gizmos” form=”curve” displayName=”Gizmos”/>
         <mx:LineSeries yField=”Widgets” form=”curve” displayName=”Widgets”/>
         <mx:LineSeries yField=”Gadgets” form=”curve” displayName=”Gadgets”/>
      </mx:series>
    </mx:LineChart>
    <mx:Legend dataProvider=”{lineChart}” direction=”horizontal”/>
  </mx:Panel>
</mx:Application>

Care to share this story?

Most Commented Posts

Get Adobe Flash playerPlugin by wpburn.com wordpress themes