0 Replies Latest reply on Nov 10, 2009 11:19 PM by kmcsekar

    Annotation:  CartesianDataCanvas.addChild(Sprite)

    kmcsekar

      I want to draw my own custom shapes at specific data points.

       

      I could get the pixel coordinate from CartesianDataCanvas and using graphics element of CartesianDataCanvas, I could draw custom shape.

       

      But I would like to have my drawing in a sprite and add it to datacavas.

       

      When I try to add the Sprite to CartesianDataCanvas, it doesn't work.

       

       

       

       

       

       

       

      var dataCanvas:CartesianDataCanvas = new CartesianDataCanvas();

      myChart.annotationElements.push(dataCanvas);

       

      var sprite:Sprite = new Sprite();

       

       

       

      var  graphics:Graphics = sprite.graphics;

      graphics.lineStyle(10,  0xCFFFCC,  .75,

      true , LineScaleMode.NORMAL, CapsStyle.ROUND, JointStyle.MITER, 2);

       

      //I have my custom shape here.

      graphics.moveTo(0,0); graphics.lineTo(500,500);

       

      dataCanvas.addChild(sprite);

       

      (or)

       

       

      dataCanvas.addChild(n

      ew UIComponent().addChild(sprite));

       

      Above addition of sprite to datacanvas doesn't work.

       

      How ever, if try to use dataCanvas.graphics, that works.

       

      But I won't to do it through sprite because I want to modularize.

       

      Please respond ASAP.

       

      Thanks