DYNAMIC COLUMN CHART

7 views
Skip to first unread message

Shankar Waghamare

unread,
Nov 7, 2012, 3:34:56 AM11/7/12
to flex_...@googlegroups.com
Hi,

we are trying to develope a dynamic column chart .but i faild to achived this can any one know how to create a dynamic column chart .some sample code
i am providing.
var arrCol:ArrayCollection=new ArrayCollection();
  var ob:Object;
for(var l:int=0;l<4;l++)
  {
  ob=new Object();
  if(l==0)
  {
  ob["month"]="January"
  ob['category']="diesel Expense";
  }else if(l==1)
  {
  ob["month"]="Feb"
  ob['category']="stationary Expense";
  ob["category_head"]="Generator";
  }
  else if(l==2)
  {
  ob["month"]="March"
  ob['category']="Light Bill Expense";
  ob["category_head"]="Generator";
 
  }
  else if(l==3)
  {
  ob["month"]="april"
  ob['category']="security Expense";
  ob["category_head"]="Generator";
 
  }
arrCol.addItem(ob);
}
//***********  stackedColumnChart is my columnchart object
 stackedColumnChart.dataProvider=arrCol;
    xAxis.categoryField="month"

 var columnSet:ColumnSet = new ColumnSet();
        columnSet.type = "clustered";  
         var columnSeries:ColumnSeries;
     var seriesArray:Array = new Array();
     
 for(var i:int = 0; i < arrCol1.length; i++){ 
         columnSeries = new ColumnSeries();    
         columnSeries.yField = arrCol1[i].category ;
        columnSeries.displayName = arrCol1[i].category;
         seriesArray.push(columnSeries);
     //   Alert.show("ff"+ arrCol[i].category);
 }           columnSet.series = seriesArray;
stackedColumnChart.series = [columnSet]; 
var legend:Legend = new Legend();
legend.y=50;
legend.x=20;
legend.direction = "horizontal";
  legend.dataProvider = stackedColumnChart;  
  this.addChild(legend);
this.addChild(stackedColumnChart);
***************
this code is showing legend properly but does not create any column chart.
please help it urgent......
thanks
Reply all
Reply to author
Forward
0 new messages