1 Reply Latest reply on Jun 15, 2007 8:53 AM by martinjconnolly

    dynamically adding lineseries into a column chart

    martinjconnolly
      Hi all
      I'm trying to do something similar to the multiple chart types example in the Flex Help, but programatically creating the chart depending on input variables. The basic form of code is:

      var cs1:ColumnSeries = new ColumnSeries();
      var cs2:ColumnSeries = new ColumnSeries();
      var ls1:LineSeries = new LineSeries();

      cs1.yField="Sold"; cs1.displayName="Sold";
      cs2.yField="Forecast"; cs2.displayName="Forecast";
      ls1.yField="Plan"; ls1.displayName="Plan";

      myArray = new Array();
      myArray.push(cs1); myArray.push(cs2); myArray.push(ls1);
      columnchart1.series = myArray;

      This worked fine with just columns, but as soon as I added the lineseries I get the error:
      ReferenceError: Error #1056: Cannot create property offset on mx.charts.series.LineSeries.
      at mx.charts::ColumnChart/mx.charts:ColumnChart::applySeriesSet()

      My data provider has valid data for all 3 series so what is going wrong?
      Thanks