Hey everyone I am having issues with using an arraycollection as a
dataprovider. I start with an xml variable (see below) then I convert
it to an ArrayCollection using ArrayUtil.toArray and I use the result
as a dataprovider. If I trace the dataprovider it prints out the xml
data, but my chart is empty. Can you use ArrayUtil on xml data with
this many nodes? I have spent way to much time on this. 

Here is what I have starting with my XML file.

XML CODE START

public var billData:XML = 
        <data>
                <bill account="100-1234567">
                    <month>May-05</month>
                    <active>true</active>            
                    <electricitybillamount>60.00</electricitybillamount>
                    <gasbillamount>45.00</gasbillamount>
                    <waterbillamount>15.00</waterbillamount>
                    <totalbill>120.00</totalbill>
                    <electricityusage>500</electricityusage>
                    <gasusage>71.4</gasusage>
                    <waterusage>200</waterusage>
                    <electricityservicecharge>18.00</electricityservicecharge>
                    <gasservicecharge>9.00</gasservicecharge>
                    <waterservicecharge>2.00</waterservicecharge>
                    <totalserviccharge>29.00</totalserviccharge>
                    <electricitytax>4.00</electricitytax>
                    <gastax>2.00</gastax> 
                    <watertax>1.00</watertax>
                    <totaltax>7.00</totaltax>
                    <elecperdaycost>2.00</elecperdaycost>
                    <gasperdaycost>1.00</gasperdaycost>
                    <waterperdaycost>.50</waterperdaycost>  
                    <totalperdaycost>3.50</totalperdaycost> 
                    <pastdueamount>0.00</pastdueamount>
                    <billingdays>33</billingdays>
                    <billdate>5/01/2007</billdate>
                    <budgetbillamount>155.00</budgetbillamount>
                    <readtype>manual</readtype>
                    <elecmeterreadend>152868</elecmeterreadend>
                </bill>
                <bill account="123-2345678">
                    <month>Apr-05</month>
                    <active>true</active>            
                    <electricitybillamount>88.88</electricitybillamount>
                    <gasbillamount>50.00</gasbillamount>
                    <waterbillamount>15.00</waterbillamount>
                    <totalbill>115.00</totalbill>
                    <electricityusage>300</electricityusage>
                    <gasusage>62.9</gasusage>
                    <waterusage>189</waterusage>
                    <electricityservicecharge>15.00</electricityservicecharge>
                    <gasservicecharge>6.00</gasservicecharge>
                    <waterservicecharge>3.00</waterservicecharge>
                    <totalserviccharge>24.00</totalserviccharge>
                    <electricitytax>4.50</electricitytax>
                    <gastax>2.50</gastax> 
                    <watertax>1.25</watertax>
                    <totaltax>8.25</totaltax>
                    <elecperdaycost>2.10</elecperdaycost>
                    <gasperdaycost>1.90</gasperdaycost>
                    <waterperdaycost>.50</waterperdaycost>  
                    <totalperdaycost>4.50</totalperdaycost> 
                    <pastdueamount>0.00</pastdueamount>
                    <billingdays>28</billingdays>
                    <billdate>3/29/2007</billdate>
                    <budgetbillamount>155.00</budgetbillamount>
                    <readtype>amr</readtype>
                    <elecmeterreadend>150008</elecmeterreadend>
                </bill>
                <bill account="145-3456789">
                    <month>Mar-05</month>
                    <active>true</active>            
                    <electricitybillamount>62.00</electricitybillamount>
                    <gasbillamount>45.10</gasbillamount>
                    <waterbillamount>10.00</waterbillamount>
                    <totalbill>118.10</totalbill>
                    <electricityusage>300</electricityusage>
                    <gasusage>50.4</gasusage>
                    <waterusage>210</waterusage>
                    <electricityservicecharge>13.00</electricityservicecharge>
                    <gasservicecharge>7.00</gasservicecharge>
                    <waterservicecharge>1.00</waterservicecharge>
                    <totalserviccharge>21.00</totalserviccharge>
                    <electricitytax>5.00</electricitytax>
                    <gastax>2.20</gastax> 
                    <watertax>1.10</watertax>
                    <totaltax>8.30</totaltax>
                    <elecperdaycost>2.20</elecperdaycost>
                    <gasperdaycost>1.70</gasperdaycost>
                    <waterperdaycost>.50</waterperdaycost>  
                    <totalperdaycost>4.40</totalperdaycost> 
                    <email>[EMAIL PROTECTED]</email>
                    <pastdueamount>0.00</pastdueamount>
                    <billingdays>30</billingdays>
                    <billdate>3/01/2007</billdate>
                    <budgetbillamount>155.00</budgetbillamount>
                    <readtype>manual</readtype>
                    <elecmeterreadend>146968</elecmeterreadend>
                </bill>
            </data>
/* starting another xml document */

  /*   public var billData2:XML = 
            <root>
                <account id="1234567">
                    <month date="May-05">
                            <active>true</active>            
                            <electricitybillamount>60.00</electricitybillamount>
                            <gasbillamount>45.00</gasbillamount>
                            <waterbillamount>15.00</waterbillamount>
                            <totalbill>120.00</totalbill>
                            <electricityusage>500</electricityusage>
                            <gasusage>71.4</gasusage>
                            <waterusage>200</waterusage>
                            
<electricityservicecharge>18.00</electricityservicecharge>
                            <gasservicecharge>9.00</gasservicecharge>
                            <waterservicecharge>2.00</waterservicecharge>
                            <totalserviccharge>29.00</totalserviccharge>
                            <electricitytax>4.00</electricitytax>
                            <gastax>2.00</gastax> 
                            <watertax>1.00</watertax>
                            <totaltax>7.00</totaltax>
                            <elecperdaycost>2.00</elecperdaycost>
                            <gasperdaycost>1.00</gasperdaycost>
                            <waterperdaycost>.50</waterperdaycost>  
                            <totalperdaycost>3.50</totalperdaycost> 
                            <pastdueamount>0.00</pastdueamount>
                            <billingdays>33</billingdays>
                            <billdate>5/01/2007</billdate>
                            <budgetbillamount>155.00</budgetbillamount>
                            <readtype>manual</readtype>
                            <elecmeterreadend>152868</elecmeterreadend>
                        </month>
                    <month date="Apr-05">
                            <active>true</active>            
                            <electricitybillamount>50.44</electricitybillamount>
                            <gasbillamount>23.77</gasbillamount>
                            <waterbillamount>15.12</waterbillamount>
                            <totalbill>115.11</totalbill>
                            <electricityusage>300</electricityusage>
                            <gasusage>62.9</gasusage>
                            <waterusage>189</waterusage>
                            
<electricityservicecharge>15.00</electricityservicecharge>
                            <gasservicecharge>6.00</gasservicecharge>
                            <waterservicecharge>3.00</waterservicecharge>
                            <totalserviccharge>24.00</totalserviccharge>
                            <electricitytax>4.50</electricitytax>
                            <gastax>2.50</gastax> 
                            <watertax>1.25</watertax>
                            <totaltax>8.25</totaltax>
                            <elecperdaycost>2.10</elecperdaycost>
                            <gasperdaycost>1.90</gasperdaycost>
                            <waterperdaycost>.52</waterperdaycost>  
                            <totalperdaycost>4.50</totalperdaycost> 
                            <pastdueamount>0.00</pastdueamount>
                            <billingdays>28</billingdays>
                            <billdate>3/29/2007</billdate>
                            <budgetbillamount>155.00</budgetbillamount>
                            <readtype>amr</readtype>
                            <elecmeterreadend>150008</elecmeterreadend>
                        </month>
                    <month date="Mar-05">
                            <active>true</active>            
                            <electricitybillamount>62.00</electricitybillamount>
                            <gasbillamount>45.10</gasbillamount>
                            <waterbillamount>10.00</waterbillamount>
                            <totalbill>118.10</totalbill>
                            <electricityusage>300</electricityusage>
                            <gasusage>50.4</gasusage>
                            <waterusage>210</waterusage>
                            
<electricityservicecharge>13.00</electricityservicecharge>
                            <gasservicecharge>7.00</gasservicecharge>
                            <waterservicecharge>1.00</waterservicecharge>
                            <totalserviccharge>21.00</totalserviccharge>
                            <electricitytax>5.00</electricitytax>
                            <gastax>2.20</gastax> 
                            <watertax>1.10</watertax>
                            <totaltax>8.30</totaltax>
                            <elecperdaycost>2.20</elecperdaycost>
                            <gasperdaycost>1.70</gasperdaycost>
                            <waterperdaycost>.50</waterperdaycost>  
                            <totalperdaycost>4.40</totalperdaycost> 
                            <email>[EMAIL PROTECTED]</email>
                            <pastdueamount>0.00</pastdueamount>
                            <billingdays>30</billingdays>
                            <billdate>3/01/2007</billdate>
                            <budgetbillamount>155.00</budgetbillamount>
                            <readtype>manual</readtype>
                            <elecmeterreadend>146968</elecmeterreadend>
                        </month>
                 </account>
                 <account id="2345678">
                    <month date="May-05">
                            <active>true</active>            
                            <electricitybillamount>12.34</electricitybillamount>
                            <gasbillamount>45.00</gasbillamount>
                            <waterbillamount>15.00</waterbillamount>
                            <totalbill>120.00</totalbill>
                            <electricityusage>500</electricityusage>
                            <gasusage>71.4</gasusage>
                            <waterusage>200</waterusage>
                            
<electricityservicecharge>18.00</electricityservicecharge>
                            <gasservicecharge>9.00</gasservicecharge>
                            <waterservicecharge>2.00</waterservicecharge>
                            <totalserviccharge>29.00</totalserviccharge>
                            <electricitytax>4.00</electricitytax>
                            <gastax>2.00</gastax> 
                            <watertax>1.00</watertax>
                            <totaltax>7.00</totaltax>
                            <elecperdaycost>2.00</elecperdaycost>
                            <gasperdaycost>1.00</gasperdaycost>
                            <waterperdaycost>.50</waterperdaycost>  
                            <totalperdaycost>3.50</totalperdaycost> 
                            <pastdueamount>0.00</pastdueamount>
                            <billingdays>33</billingdays>
                            <billdate>5/01/2007</billdate>
                            <budgetbillamount>155.00</budgetbillamount>
                            <readtype>manual</readtype>
                            <elecmeterreadend>152868</elecmeterreadend>
                        </month>
                    <month date="Apr-05">
                            <active>true</active>            
                            <electricitybillamount>44.44</electricitybillamount>
                            <gasbillamount>23.77</gasbillamount>
                            <waterbillamount>15.12</waterbillamount>
                            <totalbill>115.11</totalbill>
                            <electricityusage>300</electricityusage>
                            <gasusage>62.9</gasusage>
                            <waterusage>189</waterusage>
                            
<electricityservicecharge>15.00</electricityservicecharge>
                            <gasservicecharge>6.00</gasservicecharge>
                            <waterservicecharge>3.00</waterservicecharge>
                            <totalserviccharge>24.00</totalserviccharge>
                            <electricitytax>4.50</electricitytax>
                            <gastax>2.50</gastax> 
                            <watertax>1.25</watertax>
                            <totaltax>8.25</totaltax>
                            <elecperdaycost>2.10</elecperdaycost>
                            <gasperdaycost>1.90</gasperdaycost>
                            <waterperdaycost>.52</waterperdaycost>  
                            <totalperdaycost>4.50</totalperdaycost> 
                            <pastdueamount>0.00</pastdueamount>
                            <billingdays>28</billingdays>
                            <billdate>3/29/2007</billdate>
                            <budgetbillamount>155.00</budgetbillamount>
                            <readtype>amr</readtype>
                            <elecmeterreadend>150008</elecmeterreadend>
                        </month>
                    <month date="Mar-05">
                            <active>true</active>            
                            <electricitybillamount>62.00</electricitybillamount>
                            <gasbillamount>45.10</gasbillamount>
                            <waterbillamount>10.00</waterbillamount>
                            <totalbill>118.10</totalbill>
                            <electricityusage>300</electricityusage>
                            <gasusage>50.4</gasusage>
                            <waterusage>210</waterusage>
                            
<electricityservicecharge>13.00</electricityservicecharge>
                            <gasservicecharge>7.00</gasservicecharge>
                            <waterservicecharge>1.00</waterservicecharge>
                            <totalserviccharge>21.00</totalserviccharge>
                            <electricitytax>5.00</electricitytax>
                            <gastax>2.20</gastax> 
                            <watertax>1.10</watertax>
                            <totaltax>8.30</totaltax>
                            <elecperdaycost>2.20</elecperdaycost>
                            <gasperdaycost>1.70</gasperdaycost>
                            <waterperdaycost>.50</waterperdaycost>  
                            <totalperdaycost>4.40</totalperdaycost> 
                            <email>[EMAIL PROTECTED]</email>
                            <pastdueamount>0.00</pastdueamount>
                            <billingdays>30</billingdays>
                            <billdate>3/01/2007</billdate>
                            <budgetbillamount>155.00</budgetbillamount>
                            <readtype>manual</readtype>
                            <elecmeterreadend>146968</elecmeterreadend>
                        </month>
                 </account>
            </root> */
/*     private var billDataXMLList:XMLList = new XMLList(billData); */
                public var billXML:XML = new XML(billData);
                public var billDataAC:XMLListCollection = new
XMLListCollection(billData.bill);
                public var accountDataAC:XMLListCollection = new
XMLListCollection([EMAIL PROTECTED]);
/*         public var billDataLC:XMLListCollection = new
XMLListCollection(billData2.account[0].month); */
                public var billDataAC2:ArrayCollection = new
ArrayCollection(ArrayUtil.toArray(billXML.bill));

HERE IS HOW I AM USING IT

                        <mx:ColumnChart id="mybarchart" 
dataProvider="{model.billDataAC2}"
                        showDataTips="true" paddingLeft="5" paddingRight="5"
width="100%" height="100%" click="traceIT();">                                  
                        
                                        <mx:horizontalAxis>
                                                <mx:CategoryAxis 
categoryField="account"/>
                                        </mx:horizontalAxis>                    
        
                                        <mx:series>
                                                <mx:ColumnSeries  
displayName="Electric Bill" xField="month"
yField="electricitybillamount"/>
                                                <mx:ColumnSeries  
displayName="Gas Bill" xField="month"
yField="gasbillamount"/>        
                                                <mx:ColumnSeries  
displayName="Water Bill" xField="month"
yField="waterbillamount"/>                                                      
                
                                        </mx:series>                    
                                </mx:ColumnChart>

Reply via email to