Data Update In Real Time Series
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" initialize="initTimer()">
<mx: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(5000, 0);
myTimer.addEventListener("timer", timerHandler);
myTimer.start();
}
public function timerHandler(event:TimerEvent):void {
var obj:Object = new Object();
obj.time = getTimer();
obj.stockPrice += 1;
myArray.addItem(obj);
}
</mx:Script>
<mx:SeriesInterpolate id="redrawSeries" duration="1500" minimumElementDuration="200" elementOffset="0"/>
<mx:ColumnChart id="chart" dataProvider="{myArray}" showDataTips="true">
<mx:horizontalAxis>
<mx:LinearAxis/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis minimum="40"/>
</mx:verticalAxis>
<mx:series>
<mx:ColumnSeries yField="stockPrice" showDataEffect="redrawSeries"/>
</mx:series>
</mx:ColumnChart>
</mx:Application>
Related examples in the same category