FusionCharts for Flex > Chart Creation > Combination Charts > Data from Array

In this section we will demonstrate the process of creating a Combination Chart by providing data through Array.

Before you continue, we recommend that you go through "Your First Chart" section, as we start off from the concepts explained in that section.
 

Following is the code for creating the chart:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:ns1="com.fusioncharts.components.*">

      <ns1:FusionCharts x="10" y="10" FCChartType="MSCombi2D">
          <ns1:FCChartData FCData="{chartData}" FCParams="{chartParams}"/>
      </ns1:FusionCharts>
      <mx:Script>
          <![CDATA[

              import mx.collections.ArrayCollection;

              // Create an ArrayCollection object for chart data
              [Bindable]
              private var chartData:ArrayCollection=new ArrayCollection([
                        {label:'Jan'},
                        {label:'Feb'},
                        {label:'Mar'},
                        {label:'Apr'},
                        {label:'May'},
                        {label:'Jun'},
                        {seriesName:'2006'},
                        {value:'27400'},
                        {value:'29800'},
                        {value:'25800'},
                        {value:'26800'},
                        {value:'29600'},
                        {value:'32600'},
                        {seriesName:'2005', renderAs:'Area'},
                        {value:'10000'},
                        {value:'11500'},
                        {value:'12500'},
                        {value:'15000'},
                        {value:'11000'},
                        {value:'9800'},
                        {seriesName:'2004', renderAs:'Line'},
                        {value:'7000'},
                        {value:'10500'},
                        {value:'9500'},
                        {value:'10000'},
                        {value:'9000'},
                        {value:'8800'}
              ]);
              

              //Create an ArrayCollection object as a data source for chart parameters

              [Bindable]
              private var chartParams:ArrayCollection=new ArrayCollection([                
                       { caption:'Business Result 2004 vs 2005 vs 2006' },
                       { xAxisName:'Month' },
                       { numberPrefix:'$' },
                       { showValues:'0' }               
              ]);

          ]]>
      </mx:Script>
</mx:Application>

 
In the code, we have passed data through an ArrayCollection object named chartData. It is essential that only data in appropriate format be passed to the object. We have also created another ArrayCollection object named chartParams to store the chart parameters and bind it to FCParams attribute. The following chart will be rendered upon execution of the code: