1 Reply Latest reply on Aug 23, 2011 2:27 PM by ms1505

    Programatically Create CallResponder and LineSeries for LineChart Based on List Component -PHP MYSQL


      Hello Developers,


      I have a SQL Server that has muiltiple tables. The name of the table and the column are derived from List Components and plootted on the Chart.
      I am using 2 List Components to allow the user to select the "TableName" and the "TableColumn".
      Based on those 2 parameters the LineSeries is to be created.
      The user can create as many LineSeries as they want by selecting multiple selection in the both List Components.


      Variable Declarations:

         protected var listregion:String = "west";
         protected var listtabletype:String;
         protected var tablename:String = "rwestdk";
         protected var col:Array = new Array("RRC_Conn_Estab_Fail");
         protected var sourcelineseries:ArrayCollection;
         protected var responder:CallResponder = new CallResponder;
         protected var ResponderArray:Array = new Array(5);
         protected var ResponderArrayValue:int;
         protected var LineSeriestemp:LineSeries = new LineSeries;



      This Function Creates the Name of the Table:
      protected function createtablename(tech:String,area:String,date:String,kpiraw:String):String
          var tech:String = tech;
          var area:String = area;
          var date:String = date;
          var kpiraw:String = kpiraw;
          var tablename:String = tech+area+date+kpiraw;
          return tablename;


      This is the ChangeHandler for one of theList Components: (variable "listregion" is derived from the other List Component and is declared as an application variable):
         protected function tabletypelist_changeHandler(event:IndexChangeEvent):void
          tabletypelistlength = event.target.selectedItems.length;
          for (var i:int = 0; i < event.target.selectedItems.length; i++)
           ResponderArrayValue = i;
           ResponderArray[i] = new CallResponder;
           col[i]  = event.target.selectedItems[i] as String;
           tablename  = createtablename("r",listregion,"d","k");
           ResponderArray[i].token = Kpitables.getColFromTable(tablename, col[i]);
      This is the function called by the CallResponder Event Listener:
         protected function responderListen(event:ResultEvent):void
          sourcelineseries = this.ResponderArray[ResponderArrayValue].lastResult;

      This is the function that creates the LineSeries:
      protected function CreateLineSeries(source:ArrayCollection):void

          LineChart1.series[ResponderArrayValue] = LineSeriestemp;
          LineChart1.series = LineChart1.series.slice(0,LineChart1.series.length);