0 Replies Latest reply on Apr 5, 2012 8:41 AM by fsoender

    LineChart scrolling

    fsoender

      Do any one know how to add an scroll function to my linechart?

       

      Full Code:

       

      <?xml version="1.0" encoding="utf-8"?>

      <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"                  

                              creationComplete="{init()}"

                              applicationComplete="applicationCompleteHandler(event)">

            

            

             <fx:Script>

                    <![CDATA[

                                       

                           import flash.events.TimerEvent;

                           import flash.utils.Timer;               

                           import flashx.textLayout.events.ScrollEvent;                 

                           import mx.collections.ArrayCollection;

                           import mx.events.FlexEvent;                           

                          

                           [Bindable]

                           public var myArray:ArrayCollection = new ArrayCollection();

                           public function initTimer():void

                           {

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

                                 myTimer.addEventListener("timer", timerHandler);

                                 myTimer.start();

                           }

                          

                           public function timerHandler(event:TimerEvent):void

                           {

                                 var obj:Object = new Object();                        

                                 obj.time = getTimer();                         

                                 obj.Value = 1;

                                 myArray.addItem(obj);                                 

                           }                   

                    ]]>

                   

             </fx:Script>

            

             <s:layout>          

                    <s:VerticalLayout paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" />

             </s:layout>  

            

             <mx:LineChart id="chart" width="663" height="780" 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>