1 Reply Latest reply on Sep 11, 2010 4:39 AM by VladBlinov

    Problem with AreaChart canvas.addDataChild()

    VladBlinov

      Hello.

       

      canvas.addDataChild(hint,_x,_y) works incorrectly. I don't know why).

      I want to when you click it added a hint. There is no reaction after click. I use DateTimeAxis.

       

      my_text.gif

       

      If I set a direct values (canvas.addDataChild (hint, 50,50)), the graph is redrawn and added point scale. Mistification).

       

      Source:

       

      <mx:AreaChart ... itemClick="handleChange(event)" >

      ...

      <mx:annotationElements>

             <mx:CartesianDataCanvas id="canvas" includeInRanges="true"/>

      </mx:annotationElements>

       

      </mx:AreaChart>

       

       

      <mx:Script>

      <![CDATA[

      ...

      private var date:String = new String();

      private var actions:Number = new Number();

       

       

       

      private function handleChange(e:ChartItemEvent):void

      {

           var hint:String = e.hitData.item.hint;

           date = e.hitData.item.date;

           actions = e.hitData.item.actions;

           addLabelsToColumn(hint,date,actions);

      }

       

      private function addLabelsToColumn(_hint:String,_x:String, _y:Number):void

      {

           canvas.clear();

           hint = new Label();

           hint.setStyle("fontWeight", "bold");

           hint.setStyle("color", "0x660000");

           hint.text = _hint;

       

           canvas.addDataChild(hint,_x,_y);

      }

       

      </mx:Script>

       

      Thanks in advance.