0 Replies Latest reply on Dec 1, 2009 10:17 AM by ice1000

    Trouble Redrawing a Chart

    ice1000 Level 1

      I have a combination chart that has stacked columns and two line series. On one series, after the 7th LineSeriesItem, the data is all zero. My goal is to have the line series end at the last >0 data point.


      I wrote some code that splices the data series. As I step through the code, I see that the series is spliced correctly, however, when I call invalidateDisplayList to force a redraw of the chart, I get a "Error #1010: A term is undefined and has no properties." error in the GraphicsUtilities.as code. It looks like the Flex code is trying to draw a line segment to a now deleted datapoint.


      After I click continue, the chart is redrawn and the line segments are not drawn and the line series appears as I expect.


      Can anyone help me figure out what is causing this error?



                  //loops through chart series and will remove all items that are
                  //zero from data series
                  private var tempSeries:LineSeries;
                  private function removeZeroItems():void {
                      var mySeries:String = "Realistic Estimate";
                      for(var i:String in chart.series){
                          //find mySeries in chart.series
                          if(chart.series[i] is LineSeries){
                              if(chart.series[i].yField == mySeries){
                                  for(var j:String in chart.series[i].items){
                                      if(chart.series[i].items[j].yValue == null){
                                          //remove current item
                                          //having only j specified in splice
                                          //will remove any items after it
                                  tempSeries = new LineSeries();
                                  tempSeries = chart.series[i];
                                  chart.series.splice(i,1); //remove series
                                  chart.series.push(tempSeries); //add temp spliced series
                                  chart.invalidateDisplayList(); //causes error