0 Replies Latest reply on May 18, 2007 12:23 PM by bvillemure

    Enable Multiple LineSeries to Display on Chart

    bvillemure
      Hi, I'm dynamically generating a LineSeries based off of a List box component. User clicks item in List and a LineSeries is dynamically generated based off a switch statement.

      Problem: Each time the user clicks a unique item in List box the LineSeries is replaced. What I'd like to do is allow the user ADD to the LineSeries (AddChild?) so that multiple LineSeries can be graphically represented within the LineChart.

      I'd also like to enable the LineSeries to be removed via a click event attached to the LineSeries graphic.

      I've offered the code that gets triggered when a user clicks an item within the click box.

      Any support here is greatly appreciated. Thanks!

      ////////////////////////////////////////////////////////////////////////////////////////// /////////
      public function drawORChart():void {
      //var numItems:int = fieldList2.selectedIndices.length;
      ls = null;

      var selectedIndex:int = fieldList2.selectedIndex;
      var selectedName:String = fieldList2.selectedItem.toString();
      trace(selectedIndex);
      trace(selectedName);

      var ls:LineSeries = new LineSeries();
      linechart2.series = [ls];
      //linechart2.addChild(ls);
      // associate array - create a series for each series of data

      switch(selectedIndex){
      //Win series
      case 0:
      ls = new LineSeries();
      ls.displayName = selectedName;
      ls.yField = "@offrailW";
      linechart2.series.push(ls);
      break;

      //Place series
      case 1:
      ls = new LineSeries();
      ls.displayName = selectedName;
      ls.yField = "@offrailP";
      linechart2.series.push(ls);
      break;

      //Show series
      case 2:
      ls = new LineSeries();
      ls.displayName = selectedName;
      ls.yField = '@offrailS';
      linechart2.series.push(ls);
      break;

      //4th series
      case 3:
      ls = new LineSeries();
      ls.displayName = selectedName;
      ls.yField = '@offrail4';
      linechart2.series.push(ls);
      break;

      //5th series
      case 4:
      ls = new LineSeries();
      ls.displayName = selectedName;
      ls.yField = '@offrail5';
      linechart2.series.push(ls);
      break;

      //6th series
      case 5:
      ls = new LineSeries();
      ls.displayName = selectedName;
      ls.yField = '@offrail6';
      linechart2.series.push(ls);
      break;

      //6th series
      case 6:
      ls = new LineSeries();
      ls.displayName = selectedName;
      ls.yField = '@offrail7';
      linechart2.series.push(ls);
      break;
      }
      }