Step 1: Create a sharepoint list with the following data in it.
Step 2: Below code creates the bar chart
<?xml version=”1.0″ encoding=”utf-8″?><mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” creationComplete=”onCreate(event)”><mx:Script><![CDATA[ import mx.charts.series.*; private var MainXMLList:XMLList; [Bindable] private function onCreate(e:Event):void private function MainXMLL(e:Event):void var myChart:BarChart = new BarChart(); // Create barchart dynamically // Setting up the Vertical Axis //Creating barseries (Pipeline, Closed, Complete) where Status array holds “Pipeline, Closed and Complete” myChart.percentWidth=95; myPanel.addChild(myChart); return tempArray; } ]]> </mx:Script> <mx:Panel id=”myPanel” width=”300″ height=”300″> </mx:Panel> </mx:Application> |
This will collect all BU Values and Status for(var i:int=0;i<MainXMLList.length();i++) { BU.push(MainXMLList[i].attribute(“ows_Project_x0020_BU”)) Status.push(MainXMLList[i].attribute(“ows_Status”)) }Below code retrieves unique values and stores back into the same array variableBU=removeDuplicates(BU)Status=removeDuplicates(Status)Below code construct a loop for BUs and inner loop for status to get the count of projects for(var b:int=0;b<BU.length;b++) This will create an array collection like below {Title :BU1 , Pipeline: 2, Closed: 2} |
Output