Hi,

Repeaters are used to traverse through an array/arraycollection and make
something available in the view. In your case, we are not traversing through
the arraycollection. If you see my code carefully, it is traversing through
the objects inside the first element of the arraycollection.

And mx:series accepts an array. You cannot traverse through an object using
Repeater and create an array. For doing such a thing, actionscript is the
only way out.

Regards,
Venkat
www.venkatv.com

On Sun, Oct 19, 2008 at 2:27 PM, Axay <[EMAIL PROTECTED]> wrote:

>
> This is awesome..This has solved the problem. Thanks a lot...
> But just for understanding why can't we use mx:Repeater in this case?
>
> Thanks,
> Axay
>
> On Oct 19, 1:54 pm, "Venkat Viswanathan" <[EMAIL PROTECTED]>
> wrote:
> > Hi Axay,
> >
> > Why don't you add it with actionscript.. something like this..
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > creationComplete="loadSeries()"
> > layout="absolute" >
> >        <mx:Script>
> >                <![CDATA[
> >                    import mx.charts.series.BarSeries;
> >                        import mx.collections.ArrayCollection;
> >                        private var barSeries:BarSeries;
> >
> >                        [Bindable]
> >                        private var arrayC:ArrayCollection=new
> > ArrayCollection([
> >                                {time1:12, time2:56, time3:5, time4:100}
> >
> >                        ]);
> >
> >                         private function loadSeries():void{
> >                             var seriesArr:Array = new Array;
> >                             for (var i:String in arrayC.getItemAt(0))
> >                             {
> >                                 var bc:BarSeries = new BarSeries;
> >                                 bc.xField = i;
> >                                 seriesArr.push(bc);
> >                             }
> >                             chart.series = seriesArr;
> >                         }
> >
> >                ]]>
> >        </mx:Script>
> >
> >        <mx:BarChart id="chart" type="stacked"  barWidthRatio="10"
> > width="100%"  dataProvider="{arrayC}" >
> >        </mx:BarChart>
> >
> > </mx:Application>
> >
> > Regards,
> > Venkatwww.venkatv.com
> >
> > On Sun, Oct 19, 2008 at 12:52 PM, Axay <[EMAIL PROTECTED]>
> wrote:
> >
> > > Hi all,
> >
> > > I have to show multiple barSeries in a bar chart. It works fine by the
> > > following way....
> >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > > layout="absolute" >
> > >        <mx:Script>
> > >                <![CDATA[
> > >                        import mx.collections.ArrayCollection;
> > >                        private var barSeries:BarSeries;
> >
> > >                        [Bindable]
> > >                        private var arrayC:ArrayCollection=new
> > > ArrayCollection([
> > >                                {time1:12, time2:56, time3:5, time4:100}
> >
> > >                        ]);
> >
> > >                ]]>
> > >        </mx:Script>
> >
> > >        <mx:BarChart id="chart" type="stacked"  barWidthRatio="10"
> > > width="100%"  dataProvider="{arrayC}" >
> > >                <mx:series>
> > >                        <mx:BarSeries xField="time1"  />
> > >                        <mx:BarSeries xField="time2" />
> > >                        <mx:BarSeries xField="time3" />
> > >                        <mx:BarSeries xField="time4" />
> >
> > >                </mx:series>
> >
> > >        </mx:BarChart>
> >
> > > </mx:Application>
> >
> > > But instead of using <mx:BarSeries> multiple times, I want to use
> > > mx:Repeater component like this inside BarChart. But this didn't work
> > > out:
> >
> > > <mx:Repeater id="rep" dataProvider="{arrayC}">
> > >                        <mx:BarSeries xField="{rep.currentItem}" />
> > > </mx:Repeater>
> >
> > > Please give some suggestions on this.
> >
> > > Thanks,
> > > Axay
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to