Skip navigation
Currently Being Moderated

Help with Automatic refreshing

May 31, 2012 5:56 AM

I got this graph that I can slide with my finger, Im 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);
   
   }
  
   

 
Replies
  • Currently Being Moderated
    May 31, 2012 10:23 AM   in reply to fsoender

    The only thing I see in there that's unexplained is your usage of some object named "hAxis". Apparently changing the "maximum" or "minimum" property alters it. That code simply pays attention to your finger and adjusts those properties. You could adjust them youself to alter it without your finger. Just try setting it manually in a range that makes sense.

     

    e.g.

     

    // set explicit, 200 for example, change to taste (not sure what the value represents)

    hAxis.minimum = 200;

    hAxis.maximum = 200;

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 2, 2012 7:42 PM   in reply to fsoender

    Sure. "Something" receives the data, and when it does it modifies the properties on the chart. We'd need to know what the chats instance name is as well as how to configure it, which function is assigned to receive data and what that data looks like.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points