Hi, tnx for your response, but, the thing that I want to do is, as you can see in the example below, I want to set a minium height to a bar to achive that the purple five in the first column could be showed correctly, as well as, the six, and so on.
<?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="525" height="350" creationComplete="initApp()" y="36" backgroundColor="#FFFFFF" borderColor="#3D72B8"> <mx:Script> <![CDATA[ import mx.charts.chartClasses.Series; import mx.charts.ChartItem; import mx.collections.Sort; import mx.collections.SortField; import mx.collections.ArrayCollection; import mx.charts.HitData; import mx.charts.series.ColumnSeries; import mx.charts.series.items.ColumnSeriesItem; [Bindable] public var dpac:ArrayCollection = new ArrayCollection ([ { year:"2005", nbu:34, mon:66, infra:77,health:23,ent:6,c_i:40, com:5,other:20,total:function ():Number { return this.nbu+this.mon+this.infra+this.health+this.ent+this.c_i +this.com+this.other; } }, { year:"2006", nbu:29, mon:95, infra:108,health:23,ent:9,c_i:36, com:20,other:20,total:function ():Number { return this.nbu+this.mon+this.infra+this.health+this.ent+this.c_i +this.com+this.other; } }, { year:"2007", nbu:25, mon:20, infra:36,health:20,ent:23,c_i:40, com:20,other:20,total:function ():Number { return this.nbu+this.mon+this.infra+this.health+this.ent+this.c_i +this.com+this.other; } }, { year:"2008", nbu:40, mon:36, infra:181,health:42,ent:20,c_i:39, com:23,other:20,total:function ():Number { return this.nbu+this.mon+this.infra+this.health+this.ent+this.c_i +this.com+this.other; } }, ]); public var initSeriesArray:Array = new Array(); public var level:Number = 1; public var newSeries:Array; private function labeller(element:Object,series:Series):String { var s:String = ""; var barseries:ColumnSeries =ColumnSeries(series); if (barseries.xField=="total") { return element["total"]+" Total"; } else { return "Field '"+barseries.xField+" has "+element [barseries.xField]+ " element"+(element[barseries.xField]==1?"":"s"); } } private function initApp():void { initSeriesArray = column.series; } private function zoomIntoSeries(e:Event):void { newSeries = new Array(); if (level == 1) { newSeries.push(e.currentTarget); level = 2; } else { newSeries = initSeriesArray; level = 1; } column.series = newSeries; } public var b:Boolean = true; private function getLocation(index:int):Rectangle { var foundItem:Object = column.series [column.series.length-1].getChildAt(index+1); return new Rectangle( foundItem.x, foundItem.y, (column.series[column.series.length-1].width-column.series [column.series.length-1].getChildAt(0).width)/column.series.length, foundItem.height ); } ]]> </mx:Script> <mx:NumberFormatter id="nf1" useThousandsSeparator="true" precision="3"/> <!-- Define custom colors for use as fills. --> <mx:SolidColor id="sc8" color="0xA7A9AC" alpha="1"/> <mx:SolidColor id="sc7" color="0xFFDD00" alpha="1"/> <mx:SolidColor id="sc6" color="0x80BB42" alpha="1"/> <mx:SolidColor id="sc5" color="0xF8981D" alpha="1"/> <mx:SolidColor id="sc4" color="0x00AEEF" alpha="1"/> <mx:SolidColor id="sc3" color="0xEE3224" alpha="1"/> <mx:SolidColor id="sc2" color="0x711471" alpha="1"/> <mx:SolidColor id="sc1" color="0x3B73B9" alpha="1"/> <mx:Legend x="1" y="115"> <mx:LegendItem label="NBU" fontWeight="bold" markerHeight="15" markerWidth="15"> <mx:fill> <mx:SolidColor color="0xA7A9AC"/> </mx:fill> <mx:stroke> <mx:Stroke color="0xCCCCCC" weight="1"/> </mx:stroke> </mx:LegendItem> <mx:LegendItem label="Money" fontWeight="bold" markerHeight="15" markerWidth="15"> <mx:fill> <mx:SolidColor color="0xFFDD00"/> </mx:fill> <mx:stroke> <mx:Stroke color="0xCCCCCC" weight="1"/> </mx:stroke> </mx:LegendItem> <mx:LegendItem label="Infra" fontWeight="bold" markerHeight="15" markerWidth="15"> <mx:fill> <mx:SolidColor color="0x80BB42"/> </mx:fill> <mx:stroke> <mx:Stroke color="0xCCCCCC" weight="1"/> </mx:stroke> </mx:LegendItem> <mx:LegendItem label="Health Care" fontWeight="bold" markerHeight="15" markerWidth="15"> <mx:fill> <mx:SolidColor color="0xF8981D"/> </mx:fill> <mx:stroke> <mx:Stroke color="0xCCCCCC" weight="1"/> </mx:stroke> </mx:LegendItem> <mx:LegendItem label="EntSol" fontWeight="bold" markerHeight="15" markerWidth="15"> <mx:fill> <mx:SolidColor color="0x00AEEF"/> </mx:fill> <mx:stroke> <mx:Stroke color="0xCCCCCC" weight="1"/> </mx:stroke> </mx:LegendItem> <mx:LegendItem label="C&I" fontWeight="bold" markerHeight="15" markerWidth="15"> <mx:fill> <mx:SolidColor color="0xEE3224"/> </mx:fill> <mx:stroke> <mx:Stroke color="0xCCCCCC" weight="1"/> </mx:stroke> </mx:LegendItem> <mx:LegendItem label="CommFin" fontWeight="bold" markerHeight="15" markerWidth="15"> <mx:fill> <mx:SolidColor color="0x711471"/> </mx:fill> <mx:stroke> <mx:Stroke color="0xCCCCCC" weight="1"/> </mx:stroke> </mx:LegendItem> <mx:LegendItem label="Other" fontWeight="bold" markerHeight="15" markerWidth="15"> <mx:fill> <mx:SolidColor color="0x3B73B9"/> </mx:fill> <mx:stroke> <mx:Stroke color="0xCCCCCC" weight="1"/> </mx:stroke> </mx:LegendItem> </mx:Legend> <mx:ColumnChart id="column" showLabelVertically="true" type="100%" dataProvider="{dpac}" width="350" height="300" showDataTips="false" x="123" y="40" creationComplete="rpt.dataProvider=dpac"> <mx:series> <mx:ColumnSeries displayName="Other" yField="other" xField="year" fill="{sc1}" labelPosition="inside" color="0x000000" fontWeight="bold" /> <mx:ColumnSeries displayName="CommFin" yField="com" xField="year" minField="20" fill="{sc2}" labelPosition="inside" color="0x000000" fontWeight="bold" /> <mx:ColumnSeries displayName="CI" yField="c_i" xField="year" fill="{sc3}" labelPosition="inside" color="0x000000" fontWeight="bold" /> <mx:ColumnSeries displayName="EntSol" yField="ent" xField="year" fill="{sc4}" labelPosition="inside" color="0x000000" fontWeight="bold" /> <mx:ColumnSeries displayName="HealthCare" yField="health" xField="year" fill="{sc5}" labelPosition="inside" color="0x000000" fontWeight="bold" /> <mx:ColumnSeries displayName="Infra" yField="infra" xField="year" fill="{sc6}" labelPosition="none" color="0x000000" fontWeight="bold" /> <mx:ColumnSeries displayName="Money" yField="mon" xField="year" fill="{sc7}" labelPosition="inside" color="0x000000" fontWeight="bold" /> <mx:ColumnSeries displayName="NBU" yField="nbu" xField="year" fill="{sc8}" labelPosition="inside" color="0x000000" fontWeight="bold" /> </mx:series> <mx:horizontalAxis> <mx:CategoryAxis id="a1" dataProvider="{dpac}" categoryField="year" /> </mx:horizontalAxis> <mx:verticalAxisRenderers> <mx:AxisRenderer axis="{a1}" showLabels="false" /> </mx:verticalAxisRenderers> </mx:ColumnChart> <mx:Repeater id="rpt"> <mx:HBox horizontalAlign="center" width="{getLocation(rpt.currentIndex).width+5}" x="{getLocation(rpt.currentIndex).x+150}" y="{getLocation(rpt.currentIndex).y+20}"> <mx:Label text="{rpt.currentItem.total()}" fontSize="9" fontWeight="bold" width="100%" textAlign="center"/> </mx:HBox> </mx:Repeater> <mx:Label x="198" y="2" text="Total Cases" fontSize="16" color="#3D72B8" fontWeight="bold" width="133"/> </mx:Canvas> On May 1, 4:07 am, amit patel <[email protected]> wrote: > To > inkiev > > For that you change the array collection value see in the below example > > you change the value of the arrcoll and according to that you change the bar > height > > <?xml version="1.0"?> > <!-- charts/CustomLabelFunction.mxml --> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> > <mx:Script><![CDATA[ > import mx.controls.Alert; > import mx.charts.*; > import mx.collections.ArrayCollection; > > [Bindable] > public var expenses:ArrayCollection = new ArrayCollection([ > {Month: "Jan", Income: 800, Expenses: 1500}, > {Month: "Feb", Income: 1000, Expenses: 200}, > {Month: "Mar", Income: 1500, Expenses: 500} > ]); > > // This method customizes the values of the axis labels. > // This signature (with 4 arguments) is for a CategoryAxis. > public function defineLabel(cat:Object, > pcat:Object,ax:CategoryAxis,labelItem:Object):String > { > // Show contents of the labelItem: > for (var s:String in labelItem) { > // Alert.show(s + ":" + labelItem[s]); > } > // Alert.show(cat +","+ pcat);//Mar,Feb Month:Mar Income:1500 > Expenses:500 Feb,Jan Month:Feb etc. > // Return the customized categoryField value: > return cat + " '07"; > > // Note that if you did not specify a categoryField, > // cat would refer to the entire object and not the > // value of a single field. You could then access > // fields by using cat.field_name. > } > > // For a NumericAxis, you do not use the labelItem argument. > // This example uses a NumberFormatter to add a thousands > // separator. > public function defineVerticalLabel(cat:Object, > pcat:Object,ax:LinearAxis):String > { > return numForm.format(cat) + "%"; > } > > ]]></mx:Script> > > <mx:NumberFormatter id="numForm" useThousandsSeparator="true"/> > > <mx:Panel title="Custom Label Function"> > <mx:ColumnChart id="column" dataProvider="{expenses}" > showDataTips="true"> > <mx:horizontalAxis> > <mx:CategoryAxis > categoryField="Month" > title="Expenses" > labelFunction="defineLabel" > /> > </mx:horizontalAxis> > > <mx:verticalAxis> > <mx:LinearAxis > title="Income" > minimum="0" > maximum="2500" > labelFunction="defineVerticalLabel" > /> > </mx:verticalAxis> > > <mx:series> > <mx:ColumnSeries > > yField="Income" > displayName="Income" > /> > <mx:ColumnSeries > > yField="Expenses" > displayName="Expenses" > /> > </mx:series> > </mx:ColumnChart> > <mx:Legend > > <mx:LegendItem label="Amount"> > <mx:fill> > <mx:SolidColor color="0x0c0c0c"/> > </mx:fill> > <mx:stroke> > <mx:Stroke caps="square" color="0xfcfcfc"/> > </mx:stroke> > </mx:LegendItem> > </mx:Legend> > </mx:Panel> > </mx:Application> > > Amit > > On Tue, Apr 28, 2009 at 11:04 PM, InKiev <[email protected]> wrote: > > > Hi to all guys, I'm looking for a way to specify a minimum height to > > each bar in a stack columnchart. > > > I want to avoid that some labels may not display values that are above > > or that the bar is not long enough. > > > I'm using labels to show the value of the bar section. > > > Thanks and regards. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

