1 Reply Latest reply on Jan 5, 2010 3:52 AM by LaVengeance

    Refresh a single chart in a series of charts

    194642537 Level 1

      Hi All,

       

       

          I have a screen with 4 charts. But I want to refresh each of the charts after a particular duartion.

       

       

      For example the first chart should be refreshed after 1 minute.

       

      The second chart should be replaced after 30sec...... And so on.........

       

      Please help me to do this.

       

       

      Thanks

        • 1. Re: Refresh a single chart in a series of charts
          LaVengeance Level 1

          You can add timers to each of your charts explicitly. Set the duration as desired in each of these timers ( 60000 milli seconds  for 1st chart and 30000 for the second chart ). You will have to add event handlers for the timer complete event (TimerEvent.TIMER). In these event handlers call your http service or refresh your charts by updating the chart's dataprovider.

           

          example code below :

           

          <mx:Script>
                  <![CDATA[

              private var timer:Timer;
                     
                      private function init():void{
                             
                              timer = new Timer(60000);    // 1 minute
                              timer.addEventListener(TimerEvent.TIMER,refershGraph);
                              timer.start();


                    }



              private function refershGraph(event:TimerEvent):void{

           

                   

                    // update the dataprovider of your chart or call your httpservice here

                        

                   // reset the timer and start it again         

                    timer.reset();           
                    timer.start();   

           

              }


          ]]>
              </mx:Script>
             

           

           

          Cheers