0 Replies Latest reply on Sep 18, 2010 3:06 PM by surenmsr

    Linechart - Multiple Series issue

    surenmsr

      HI,
      For the last few days I am trying to resolve the issue in line  chart..I am trying to show series dynamically and I am using below code  for the same.

       

      I get all legends on the linechart, but somehow  x-axis datapoints are updated with updated dataprovider. At the end all series are having same datapoints. didt understand where I am  doing mistake. can someone give me clue .. thanks in advance - Surendra

       

      my ArrayCollection is result of SQL query (select ts,label,rt from table1).

      ouput of sql will be similar like below

      ts,label,rt

      1,a,15

      1,b,12

      2,a,18

      3,a,4

      3,b,30

       

      ts - in x-axis

      rt - in y-axis

      label are multiple line series..

       

       

       

      for each(var property:Object in tmpAC) {
      if (wholist[property.lb] != property.lb)
      wholist[property.lb] = property.lb;
      }

       

      for (var s:String in wholist) {
      lblStr = s;
      tmpAC.filterFunction = dataSet;
      tmpAC.refresh();
      var ls:LineSeries;
      ls = new LineSeries();
      ls.displayName = lblStr;
      ls.yField = "rt";
      ls.xField = "ts";
      ls.dataProvider = tmpAC;
      var currentSeries:Array = lchart.series;
      currentSeries.push(ls);
      lchart.series = currentSeries;
      lchart.invalidateSeriesStyles();
      }

       


      public function dataSet(obj:Object):Boolean
         {
            if (obj.lb == lblStr)
            {
            return obj;
            }
            else
            {
               return false;
            }
         }