Hi Axay, In this case, you wont need the customization I showed u. You can use Bar chart's default features and show the data. See if this one works for you:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script><![CDATA[ import mx.charts.HitData; import mx.collections.ArrayCollection; [Bindable] public var expenses:ArrayCollection = new ArrayCollection([ {time : 12, labelField:"A0", labelText:"A1", val:34}, {time : 34, labelField:"A1", labelText:"A1", val:78}, {time : 45, labelField:"A2", labelText:"A2", val:67}, {time : 34, labelField:"A3", labelText:"A3", val:45}, {time : 55, labelField:"A4", labelText:"A4", val:89} ]); private function showDP(obj:HitData):String{ return obj.item.val; } private function labelFunc(categoryValue:Object, previousCategoryValue:Object, axis:CategoryAxis, categoryItem:Object):String{ return categoryItem.labelText; } ]]></mx:Script> <mx:Panel title="Bar Chart"> <mx:BarChart id="myChart" dataProvider="{expenses}" showDataTips="true" dataTipFunction="showDP"> <mx:verticalAxis> <mx:CategoryAxis labelFunction="labelFunc" dataProvider="{expenses}" categoryField="labelField" /> </mx:verticalAxis> <mx:horizontalAxis> <mx:CategoryAxis dataProvider="{expenses}" categoryField="time" /> </mx:horizontalAxis> <mx:series> <mx:BarSeries yField="labelField" xField="time" displayName="Time" /> </mx:series> </mx:BarChart> <mx:Legend dataProvider="{myChart}"/> </mx:Panel> </mx:Application> Regards, Venkat www.venkatv.com On Tue, Oct 21, 2008 at 12:17 PM, Axay <[EMAIL PROTECTED]> wrote: > > Hi Venkat, > > Thanks for the previous posts. I am still facing some issues. Right > now bar chart is using data like this: > > [Bindable] > private var arrayC:ArrayCollection=new > ArrayCollection([ > {time1:12, time2:56, time3:5, > time4:100} > > ]); > > > But this way i am not able to show proper dataTips or the label to the > chart which is the requirement. My input data are like this (Please > consider that we do not know the length of this array Collection. So > data might increase): > > [Bindable] > private var arrayC:ArrayCollection=new > ArrayCollection([ > {time : 12, labelText:A1, val:34}, > {time : 34, labelText:A1, val:78}, > {time :45, labelText:A2, val:67}, > {time : 34, labelText:A3, val:45}, > {time : 55, labelText:A4, val:89}, > > ]); > > As shown above, i have to show a labelText as label for each bar and > datatip as val. Is there any workaround for this? > > Please give some suggestions. > > Thanks, > Axay > > On Oct 19, 4:42 pm, "Venkat Viswanathan" <[EMAIL PROTECTED]> > wrote: > > 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, > > Venkatwww.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 -~----------~----~----~----~------~----~------~--~---

