from http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&file=charts_intro_108_12.html
 
 

Using an XML file as a data provider

You can define data provider data in a structured file. The following example shows the contents of the data.xml file:

    
        81768
        60310
        43357
    
    
        81156
        58883
        49280
    

You can load the file directly as a source of a Model, as the following example shows:



  
  
     
        
           
        
        
           
           
           
        
     
  

To use an ArrayCollection as the chart's data provider, you convert the Model to one, as the following example shows:



  
     import mx.utils.ArrayUtil;
  
  
  
  
     
        
           
        
        
           
           
           
        
     
  

You can also define the XML file as a URL for an HTTPService component, and then bind the HTTPService result directly to the chart's data provider, as the following example shows:



  
  
     
        
           
        
        
           
           
           
        
     
     

To use an ArrayCollection, you convert the HTTPService result to an ArrayCollection, as the following example shows:



  
  
  
     
        
           
        
        
           
           
           
        
     
  

You can also set the result format of the HTTPService to E4X, and then use it as a source for an XMLListCollection object, as the following example shows: