0 Replies Latest reply on May 20, 2012 8:27 AM by fsoender

    Class ChartScroller

    fsoender Level 1

      Hi,

       

      Do anyone know how to make this code with chart slide with Class ChartScroller?

       

       

      Class:

       

      Class ChartScroller

      chart

      property

      chart:CartesianChart [read-write]

      Chart which content should be scrolled/zoomed.

      Implementation               public function get chart():CartesianChart

                         public function set chart(value:CartesianChart):void

       

       

       

       

       

       

      Code:

       

      <?xml version="1.0"?>     

      <s:Application

             xmlns:fx="http://ns.adobe.com/mxml/2009

             xmlns:mx="library://ns.adobe.com/flex/mx"

             xmlns:s="library://ns.adobe.com/flex/spark"

             initialize="initTimer()">

            

             <fx:Script>

                                       

                   import flash.utils.Timer;

                   import flash.events.TimerEvent;

                   import mx.collections.ArrayCollection;

                  

                   [Bindable]

                   public var myArray:ArrayCollection = new ArrayCollection();

                   public function initTimer():void {

                          var myTimer:Timer = new Timer(100, 0);

                          myTimer.addEventListener("timer", timerHandler);

                          myTimer.start();

                   }

                  

                   public function timerHandler(event:TimerEvent):void {

                          var obj:Object = new Object();

                          obj.time = getTimer();

                          obj.Value = 30;

                          myArray.addItem(obj);

                         

                   }

             </fx:Script>

            

            

             <mx:LineChart id="chart" dataProvider="{myArray}" showDataTips="true">

                   <mx:horizontalAxis>

                          <mx:LinearAxis/>

                   </mx:horizontalAxis>

                   <mx:verticalAxis>

                          <mx:LinearAxis minimum="0"/>

                   </mx:verticalAxis>

                   <mx:series>

                          <mx:LineSeries yField="Value"/>

                   </mx:series>

             </mx:LineChart>                  

      </s:Application>