FusionCharts for Flex > Chart Creation > Single-Series > Data from URL

Creating the XML data document for the Chart
 

Before building the chart, we need to have the data to be represented on the chart. We're plotting half yearly sales summary for a given year, say 2008. The following data in tabular form will be used for creating the XML data document for the chart.

 
Month
Sales(2008)
January
$17400
February
$19800
March
$21800
April
$23000
May
$29000
June
$27600
 
FusionCharts for Flex internally needs its data in pre-defined XML format. So, you need to convert this data into XML.
 
Further, to know more about the XML structure used in FusionCharts for Flex, please go through 'FusionCharts and XML » Chart XML Reference' section.
 

Here is the converted XML data:

<chart caption='Half Yearly Sales Summary' subcaption='For the year 2008 - First Half' xAxisName='Month' yAxisName='Sales' numberPrefix='$'>
    <set label='Jan' value='17400' />
    <set label='Feb' value='19800' />
    <set label='Mar' value='21800' />
    <set label='Apr' value='23000' />
    <set label='May' value='29000' />
    <set label='June' value='27600' />
</chart>


You can build the chart either from Design view or by entering code into the source view. To build the chart in Design view, follow the method described in the 'Simple Sales Chart' page under 'Your First Chart' section. Here, we need to set the value of FCChartType and FCDataURL properties of the chart component as 'Column3D' and 'Data.xml' respectively.

However, if you wish to perform the same thing from the Source view, the following code will help you out:

 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"/>
     <ns1:FusionCharts x="10" y="10" FCDataURL="Data.xml" FCChartType="Column3D"/>
</mx:Application>
 

As you can see above, we have only set the chart type and provided appropriate chart data. That's it! Now, run the code and you'll get the following chart: