1 Reply Latest reply on Jan 10, 2010 10:18 PM by RUSH-ME

    Dynamic Chart Creation from Script

    Rajesh Subbiah

      Hi All,

       

      I have dynamically created the chart using the following code : i.e. in XML i have many different values and for each value i want to show differtent line series. The code works properly but i want  the graphs to be of the form as curve. Is it possible to do using action script.

       

      var labellist:Array = new Array();
      var myXML:XML  =XML(event.result);
      valueChart.series= null;

      for each(var property:XML in myXML.sample.label) {
                  // Create an Array of unique names.
                  if (labellist[property] != property)
                      labellist[property] = property;
              }

              // Iterate over names and create a new series
              // for each one.
             
              for (var s:String in labellist) {
                  // Use all samples labelse name matches s.
                  var localXML:XMLList = myXML.sample.(label==s);

                  // Create the new series and set its properties.
                  var localSeries:LineSeries = new LineSeries();
                 
                
                 
                 valueChart.dataProvider = localXML;
                  localSeries.dataProvider = localXML;
                  localSeries.yField = "value";
                  localSeries.xField = "time";
                
                  // Set values that show up in dataTips and Legend.
                  localSeries.displayName = s;

                  // Back up the current series on the chart.
                
                 var currentSeries:Array =  valueChart.series;
               //  var currentSeries:Array ;
                
                  // Add the new series to the current Array of series.
                  currentSeries.push(localSeries);
                  // Add the new Array of series to the chart.
                  valueChart.series = currentSeries;
                   valueChart.validateDisplayList();
                valueChart.validateNow();
                 
              }