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

Here, we'll show how to send data to a Combination chart using Array. For example, here we will build a 2D Single Y Combination Chart using Array as data source.

Before you go further, we recommend you to see the section "Your First Chart" , as we start off from the concepts explained in that page.
 
We again use the first example. Here we will send data to it using Array. The code is given below.

 

<?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 2005 v 2006' },
                       { xAxisName:'Month' },
                       { numberPrefix:'$' },
                       { showValues:'0' }               
              ]);

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

 
As you see in the above code, we passed data through an ArrayCollection object named chartData. For this, we created the object with valid chart data. We also created another ArrayCollection object, chartParams, to store the chart parameters and bind it to FCParams attribute. Now, if you run the above code you will get the following figure.