2 Replies Latest reply on Dec 23, 2011 11:45 AM by xu.xiaoshun@gmail.com

    Why is it different using ArrayCollection and XMLListCollection?


      As shown in the screenshot below. The first one has ArrayCollection as dataProvider. The second one has XMLListCollection as dataProvider.

      I would like the result for XMLListCollection but now I only have ArrayCollection as input. How can I deal with it? Thanks!


      <?xml version="1.0" encoding="utf-8"?> 

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" >



                                    import mx.collections.ArrayCollection; 


                                    private var dp:ArrayCollection = new ArrayCollection([ 

                                              {name: "00:00:00", v1: "2"},

                                              {name: "00:15:00", v1: "3"},

                                              {name: "00:30:00", v1: "4"},

                                              {name: "00:45:00", v1: "3"},

                                              {name: "01:00:00", v1: "5"},

                                              {name: "01:15:00"},

                                              {name: "01:30:00"},

                                              {name: "01:45:00"},

                                              {name: "02:00:00"}






                <mx:XMLListCollection id="dp2">



                                              <hour name="00:00:00" v1="2"/>

                                              <hour name="00:15:00" v1="3"/>

                                              <hour name="00:30:00" v1="4"/>

                                              <hour name="00:45:00" v1="3"/>

                                              <hour name="01:00:00" v1="5"/>

                                              <hour name="01:15:00" />

                                              <hour name="01:30:00" />

                                              <hour name="01:45:00" />

                                              <hour name="02:00:00" />





                <mx:LineChart id="lineChart" height="100%" width="100%" dataProvider="{dp}" showDataTips="true"> 


                                    <mx:CategoryAxis categoryField="name"/> 



                                    <mx:LineSeries yField="v1" form="curve" displayName="v1"/>



                <mx:Legend dataProvider="{lineChart}" direction="horizontal"/>



                <mx:LineChart id="lineChart2" height="100%" width="100%" dataProvider="{dp2}" showDataTips="true"> 


                                    <mx:CategoryAxis categoryField="@name"/> 



                                    <mx:LineSeries yField="@v1" form="curve" displayName="v1"/>



                <mx:Legend dataProvider="{lineChart2}" direction="horizontal"/>