Hi, I have to display following data in to a chart(chart should grow in x axis only. y axis value will be similar through out. For example first part will have start time at 16:00 and end time will be 16:25. The colors would be specific to ids).
The problems I am facing: 1. Not able to specify the x axis data in a readable format as time scale. I have to display start time and end time of each pattern in "hourly" or any other readable format. Right now it is not in readable format. 2. Also I want to get rid of y- axis OR at least its labels because they are not needed in my case. 3. If this is not possible then please tell me any other way to plot such chart OR if is there any better way to do so then also it would be good. Thanks, Axay <?xml version="1.0"?> <!-- charts/WaterfallStacked.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" initialize="generateRandomColorArray();" backgroundColor="0xffffff"> <mx:Script><![CDATA[ import mx.graphics.RadialGradient; import mx.graphics.GradientEntry; import mx.charts.HitData; import mx.charts.series.items.ColumnSeriesItem; import mx.graphics.SolidColor; import mx.graphics.IFill; import mx.collections.ArrayCollection; [Bindable] public var ChartData:ArrayCollection = new ArrayCollection([ {sTime:"16:00",eTime:"16:25",timeDifference:25, Id:"1",h:1, expId:"1"}, {sTime:"16:25",eTime:"16:45",timeDifference:20, Id:"2",h:1, expId:"1"}, {sTime:"16:45",eTime:"16:55",timeDifference:10, Id:"3",h:1, expId:"2"}, {sTime:"16:55",eTime:"17:00",timeDifference:5, Id:"4",h:1, expId:"2"}, {sTime:"17:00",eTime:"18:00",timeDifference:60, Id:"1",h:1, expId:"1"}, {sTime:"18:00",eTime:"19:50",timeDifference:110, Id:"2",h:1, expId:"2"}, {sTime:"19:50",eTime:"20:10",timeDifference:20, Id:"3",h:1, expId:"1"} ]); [Bindable] private var clusterColors:Array=new Array(); private function generateRandomColorArray():void { var redBias:Number = 0xFF; var greenBias:Number = 0xFF; var blueBias:Number = 0xFF; for(var i:int=0;i<1000;i++) { var ct:ColorTransform = new ColorTransform(1,1,1,1,Math.random() *redBias,Math.random()*greenBias,Math.random()*blueBias); var color:uint = ct.color; clusterColors.push(color); } clusterColors = removeDuplicates(clusterColors); } private function removeDuplicates(arr:Array):Array { var currentValue:String = ""; var tempArray:Array = new Array(); arr.sort(Array.CASEINSENSITIVE); arr.forEach( function(item:*, index:uint, array:Array):void { if (currentValue != item) { tempArray.push(item); currentValue= item; } } ); return tempArray.sort(Array.CASEINSENSITIVE); } private var fillBarColor_merged_arrayC:ArrayCollection = new ArrayCollection(); private function getColor(element:ColumnSeriesItem, index:Number):IFill { var radGrad:RadialGradient = new RadialGradient(); var arrGrad:Array = new Array(); if(element.item.Id!=element.item.expId) { var gradEntry1:GradientEntry = new GradientEntry(); gradEntry1.color = clusterColors[element.item.Id]; gradEntry1.ratio = 0.3; arrGrad.push(gradEntry1); var gradEntry2:GradientEntry = new GradientEntry(); gradEntry2.color = clusterColors[element.item.expId]; gradEntry2.ratio = 0.7; arrGrad.push(gradEntry2); radGrad.entries = arrGrad ; return radGrad; } var c:SolidColor = new SolidColor(); c.color = clusterColors[element.item.Id]; return c; } private function getdata(hd:HitData):String { var cs:ColumnSeriesItem = hd.element as ColumnSeriesItem; //trace(hd.item.clusterId); var str:String = "Id : "+hd.item.Id+" expId : "+hd.item.expId; return str; } ]]></mx:Script> <mx:ColumnChart id="loadPattern" width="100%" height="200" dataProvider="{ChartData}" columnWidthRatio="2" showDataTips="true" dataTipFunction="getdata" > <mx:horizontalAxis> <mx:CategoryAxis id="horzA" dataProvider="{ChartData}" categoryField="timeDifference" /> </mx:horizontalAxis> <mx:horizontalAxisRenderers> <mx:AxisRenderer canDropLabels="true" axis="{horzA}"/> </mx:horizontalAxisRenderers> <mx:series> <mx:ColumnSeries yField="h" xField="timeDifference" displayName="Ids" height="10" fillFunction="getColor"> </mx:ColumnSeries> </mx:series> </mx:ColumnChart> </mx:Application> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

