1 Reply Latest reply on Jul 30, 2012 10:03 AM by Flex harUI

    Drawing On Chart But It's Disappearing

    tjnelso

      I created a column chart and added an annotation element to it:

       

      [code]
      <mx:annotationElements>
              <mx:CartesianDataCanvas id="chartCanvas"/>
      </mx:annotationElements>
      [/code]

       

      I added a creation complete method to draw on the canvas. The following function is called on creationComplete.

       

      [code]  
      protected function drawSteps():void
      {
             trace("chartCanvas.width is: " + chartCanvas.width);

            chartCanvas.graphics.lineStyle(1, 0x000000, 0.5);
            chartCanvas.graphics.beginFill(0xd4e3f0, 0.5);
            chartCanvas.graphics.moveTo(chartCanvas.width/2, yAxisMax);
            chartCanvas.graphics.lineTo(chartCanvas.width/2, 0);
            chartCanvas.graphics.endFill();
      }
      [/code]

       

      This works fine when the chart first loads but if I update the chart series the line goes away. I have added a call to the 'drawSteps()' function in my method that updates the chart series as well but it didn't work. I don't understand why changing the chart series would cause this to stop displaying though, especially considering I call it again when the series is changed. Can anyone help?