0 Replies Latest reply on Jul 7, 2008 4:57 AM by derm116

    Difference between creating chart series in AS and MXML

    derm116
      Hi all,

      I was wondering if anyone knew of a difference between creating a chart series in AS and in MXML. I had the following series in MXML which updated everytime a slider was moved.

      <mx:series>
      + <mx:AreaSeries id="largeSeries" name="close" dataProvider="{mainData}" dataFunction="{dfnGeneral}"+
      + areaFill="{new SolidColor(0xCDE2F8, 0.20)}"+
      + areaStroke="{new Stroke(0x0066DD, 1)}"+
      + fill="{new SolidColor(0x0066DD, 1)}"+

      + radius="3" form="segment"+

      + itemRenderer="com.fmr.lineChart.skins.LineSeriesCustomRenderer"+
      + updateComplete="seriesComplete()" />+
      + </mx:series>+

      I created the exact same series in AS

      public function addAreaSeries(id:String, colour:uint, arr:Array):void {
      + +
      + var areaSeries:AreaSeries = new AreaSeries();+
      + areaSeries.id = id;+
      + areaSeries.name = "close";+
      + areaSeries.dataProvider = mainData;+
      + areaSeries.dataFunction = dfnGeneral;+
      + areaSeries.displayName = id;+
      + areaSeries.setStyle("areaStroke", new Stroke(colour, 1));+
      + areaSeries.setStyle("areaFill", new SolidColor(colour, 0.20));+
      + areaSeries.setStyle("fill", new SolidColor(colour, 1));+
      + areaSeries.setStyle("radius", 3);+
      + areaSeries.setStyle("form", "segment");+
      + areaSeries.setStyle("itemRenderer", new ClassFactory(com.fmr.lineChart.skins.LineSeriesCustomRenderer));+
      + areaSeries.addEventListener("updateComplete", callSeriesComplete);+
      + +
      + // Back up the current series on the chart.+
      var currentSeries:Array = mainChart.series;

      // Add the new series to the current Array of series.
      currentSeries.push(areaSeries);

      // Add the new Array of series to the chart.
      mainChart.series = currentSeries;

      + }+

      However, the AS one doesn't seem to update when the slider is moved? I'm slicing mainData, which is the dataprovider for both, depending on how much the slider is moved - so the dataset for both series changes when the slider is moved but only the MXML one visibly changes - the AS one stays the same?.
      Has anyone come across an issue like this before where an AS component doesn't update whereas it's MXML counterpart does? Any help would be greatly appreciated as I've been looking at this for a good while now and can't seem to figure it out!

      Thanks,
      Derm