3 Replies Latest reply on Sep 24, 2010 9:22 AM by Flex in a Week, FiaW

    drag and drop a node in the line graph

    flexsap Level 1

      Hello Flex experts,

       

        I am using line graph for the monthly data. I want to drag a node , maybe the february node down. How can i achieve it? My code as follows does not work. Will highly appreciate your help as it is urgent requirement.

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <?xml version="1.0"?>

      <!-- charts/BasicLine.mxml -->

      <mx:Application

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml"

      >

       

       

      <mx:Script>

      <![CDATA[

       

       

      import

      mx.controls.Alert;

       

       

      import

      mx.collections.ArrayCollection;

       

       

      import

      mx.core.DragSource;

       

       

      import

      mx.managers.DragManager;

       

       

      import

      mx.events.*;

       

       

      import

      mx.containers.Canvas;

      private

       

       

      function dragExitHandler(event:DragEvent):void

      {

      Alert.show(

       

      " An event exit . "

      );

      }

      private

       

       

      function dragOverHandler(event:DragEvent):void

      {

      Alert.show(

       

      " An event drag . "

      );

      }

      [

       

      Bindable

      ]

       

       

      public var expenses:ArrayCollection = new

      ArrayCollection([

      {Month:

       

      "Jan"

      , Profit:2000, Expenses:1500, Amount:450},

      {Month:

       

      "Feb"

      , Profit:1000, Expenses:200, Amount:600},

      {Month:

       

      "Mar"

      , Profit:1500, Expenses:500, Amount:300}

      ]);

      ]]>

       

      </mx:Script>

       

       

      <mx:Panel title="Line Chart"

      >

       

       

      <mx:LineChart id="myChart

      "

      dataProvider="

       

      {expenses}

      "

      showDataTips="

       

      true

      "

      dragEnabled="

       

      true

      "

      dragMoveEnabled="

       

      true

      "

      dropEnabled="

       

      true

      "

      dragOver="dragOverHandler(event);"

      dragDrop="dragExitHandler(event);"

      dragExit="dragExitHandler(event);"

       

       

      >

       

       

      <mx:horizontalAxis>

       

       

      <mx:CategoryAxis

      dataProvider="

       

      {expenses}

      "

      categoryField="

       

      Month

      "

       

       

       

      />

       

       

      </mx:horizontalAxis>

       

       

      <mx:series>

       

       

      <mx:LineSeries

      yField="

       

      Profit

      "

      displayName="

       

      Profit

      "

       

       

      />

       

       

      <mx:LineSeries

      yField="

       

      Expenses

      "

      displayName="

       

      Expenses

      "

       

       

      />

       

       

      </mx:series>

       

       

      </mx:LineChart>

       

       

      <mx:Legend dataProvider="{myChart}"

      />

       

       

      </mx:Panel>

       

       

      Best regards!

      Sandip