You might not want to use an XML file all the time to pass data to the chart. You might have built an XML string inside your flex application. FusionCharts for Flex allows you to set an XML string to provide data to the chart. In this section, we will discuss how to render a chart using data from XML string. |
Before you go further, we recommend you to see the previous page, "Creating Single Series Chart", as we start off from the concepts explained in that page. |
We would continue with the first chart that we have created in the previous example. But instead of providing the XML file's path, we would pass the XML hard-coded in a String variable in Flex. Let's see how we can do this: |
<?xml version="1.0" encoding="utf-8"?> <ns1:FusionCharts x="10" y="10" FCChartType="Column3D" FCDataXML="{xmlData}" /> <mx:Script> //Create a string with valid chart XML. |
As you can see above in the highlighted section, we define a string variable named xmlData. Here, we do not set the XML to FCDataURL attribute. Instead, we bind the string variable to the FCDataXML attribute. Now, if you run the above code in your Flex project, you will get the chart shown below: |
![]() |
To know more about the attributes/parameters like FCDataURL, FCDataXML, FCChartType etc., please go through Class Structure Properties page in "Flex Developers' Guide >> FusionCharts Control" section. |