0 Replies Latest reply on May 31, 2012 5:57 AM by fsoender

    Refresh Graph

    fsoender Level 1

      I got this graph that I can slide with my finger, but was wondering if its possible to update it automatic with this code?

       

       

       

      //Function for sliding graph.


      protected function mouseDownHandler(event:MouseEvent):void

       

      {

       

      lastX = event.stageX;

       

      systemManager.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);

       

      systemManager.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);

       

      }

       

       

       

      protected function mouseMoveHandler(event:MouseEvent):void

       

      {

       

      var delta:Number = (lastX - event.stageX) / chart.width * viewportMax;

       

      if (hAxis.minimum + delta < 0)

       

      {

       

      hAxis.minimum = 0;

       

      hAxis.maximum = viewportMax;

       

      }

       

      else if (hAxis.maximum + delta > chart.dataProvider.length - 0)

       

      {

       

      hAxis.maximum = chart.dataProvider.length - 0;

       

      hAxis.minimum = hAxis.maximum - viewportMax;

       

      }

       

      else

       

      {

       

      hAxis.minimum += delta;

       

      hAxis.maximum += delta;

       

      }

       

      lastX = event.stageX;

       

      }

       

       

       

      protected function mouseUpHandler(event:MouseEvent):void

       

      {

       

      systemManager.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);

       

      systemManager.removeEventListener(MouseEvent.MOUSE_MOVE, mouseUpHandler);

       

      }