0 Replies Latest reply on Nov 5, 2012 6:52 AM by tiger886

    Dynamic Column Chart

    tiger886

      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];

       

      ***************

      this code is showing legend properly but does not create any column chart.

      please help it urgent......

      thanks