Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:ns1="com.anychart.*" layout="absolute" width="806" height="468"
- showCloseButton="true" close="PopUpManager.removePopUp(this);model.addedToStage= false" xmlns:strobe="com.inspired.sensors.views.strobe.*" backgroundColor="#EBE8E8" xmlns:views="com.inspired.sensors.views.*" cornerRadius="8">
- <mx:Script>
- <![CDATA[
- import mx.charts.CategoryAxis;
- import mx.formatters.DateFormatter;
- import com.anychart.axesPlot.scales.dateTime.DateTimeScale;
- import mx.collections.ArrayCollection;
- import mx.states.SetStyle;
- import mx.controls.Alert;
- import com.inspired.sensors.control.GetFuelTankVol;
- import com.inspired.sensors.model.EventConstants;
- import com.inspired.sensors.control.GetTankConsumptionInfoEvent;
- import com.adobe.cairngorm.control.CairngormEventDispatcher;
- import mx.managers.PopUpManager;
- import com.inspired.sensors.model.SensorModellocator;
- [Bindable] private var min:Date = new Date(2011,6,28,18,50,0);
- [Bindable] private var max:Date = new Date(2011,6,28,19,50,0);
- private var started:Boolean= false;
- [Bindable]
- private var historicalQuotes:ArrayCollection = new ArrayCollection();
- [Bindable]
- public var deck:ArrayCollection = new ArrayCollection();
- [Bindable]
- public var model:SensorModellocator = SensorModellocator.getInstance();
- public var inUse:Boolean = false;
- public var dateFormatter:DateFormatter = new DateFormatter();
- public function init():void{
- run()
- }
- function randomNumber(low:Number=0, high:Number=1):Number
- {
- return Math.floor(Math.random() * (1+high-low)) + low;
- }
- public function run():void {
- var qMyTimer:Timer = new Timer(9000);
- qMyTimer.addEventListener(TimerEvent.TIMER, startGenerator);
- qMyTimer.start();
- }
- public function startGenerator(e:TimerEvent):void{
- var quote:Object = new Object();
- var rand:int = randomNumber(0, 100);
- quote.bid = rand//.nextDouble() * 100;
- quote.ask = quote.bid + 1;
- quote.Volume = quote.ask - 0.5;
- quote.symbol = "MSFT";
- var myDate = new Date().getMinutes()
- quote.myDate = new Date(myDate);
- historicalQuotes.addItem(quote);
- var currentDate:Date = new Date()
- //Alert.show(""+getTime+ "</br>" +
- //quote.myDate)
- //pushDataToClients( quote );
- }
- /* private function dateAxis_labelFunc(item:Object, prevValue:Object, axis:CategoryAxis,categoryItem:Object):String
- {
- return (item as Date).date.toString();
- }
- private function formatDateLabel(value:Date,previousValue:Date,axis:DateTimeAxis):String
- {
- return value.toTimeString();
- } */
- ]]>
- </mx:Script>
- <mx:VBox width="100%" horizontalAlign="center" backgroundColor="#F9F6EC" height="115">
- <mx:Label text="Real time fuel stock..." textAlign="left" color="#865928" fontWeight="bold" fontSize="12"/>
- <mx:LineChart id="stockPriceChart" width="100%" height="79" dataProvider="{historicalQuotes}" showDataTips="true" >
- <!--<mx:backgroundElements>
- <mx:GridLines direction="vertical">
- <mx:horizontalFill>
- <mx:SolidColor color="0xCCCCCC" alpha=".3"/>
- </mx:horizontalFill>
- </mx:GridLines>
- </mx:backgroundElements>-->
- <mx:horizontalAxis>
- <mx:DateTimeAxis alignLabelsToUnits="false" dataUnits="minutes"/>
- </mx:horizontalAxis>
- <mx:verticalAxis>
- <mx:LinearAxis id="yAxis" title="Volume (ltrs)" baseAtZero="true" autoAdjust="true"/>
- </mx:verticalAxis>
- <mx:verticalAxisRenderers>
- <mx:AxisRenderer axis="{yAxis}" verticalAxisTitleAlignment="vertical">
- <mx:axisStroke>
- <mx:Stroke weight="1" color="#C0C0C0"/>
- </mx:axisStroke>
- </mx:AxisRenderer>
- </mx:verticalAxisRenderers>
- <mx:series>
- <mx:LineSeries displayName="Fuel Volume" yField="Volume" form="curve" >
- <mx:lineStroke>
- <mx:Stroke color="0x11538c" weight="2" alpha="1"/>
- </mx:lineStroke>
- </mx:LineSeries>
- </mx:series>
- </mx:LineChart>
- </mx:VBox>
- </mx:VBox>
- <mx:VBox width="100%" height="100%" id="Generatorevent">
- </mx:VBox>
- <mx:VBox width="100%" height="100%" id="gateevent">
- </mx:VBox>
- </mx:TitleWindow>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement