Advertisement
Guest User

Untitled

a guest
Jul 4th, 2011
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.83 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:ns1="com.anychart.*" layout="absolute" width="806" height="468"
  3. 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">
  4. <mx:Script>
  5. <![CDATA[
  6. import mx.charts.CategoryAxis;
  7. import mx.formatters.DateFormatter;
  8. import com.anychart.axesPlot.scales.dateTime.DateTimeScale;
  9. import mx.collections.ArrayCollection;
  10. import mx.states.SetStyle;
  11. import mx.controls.Alert;
  12. import com.inspired.sensors.control.GetFuelTankVol;
  13. import com.inspired.sensors.model.EventConstants;
  14. import com.inspired.sensors.control.GetTankConsumptionInfoEvent;
  15. import com.adobe.cairngorm.control.CairngormEventDispatcher;
  16. import mx.managers.PopUpManager;
  17. import com.inspired.sensors.model.SensorModellocator;
  18. [Bindable] private var min:Date = new Date(2011,6,28,18,50,0);
  19. [Bindable] private var max:Date = new Date(2011,6,28,19,50,0);
  20. private var started:Boolean= false;
  21. [Bindable]
  22. private var historicalQuotes:ArrayCollection = new ArrayCollection();
  23. [Bindable]
  24.  
  25. public var deck:ArrayCollection = new ArrayCollection();
  26. [Bindable]
  27. public var model:SensorModellocator = SensorModellocator.getInstance();
  28. public var inUse:Boolean = false;
  29. public var dateFormatter:DateFormatter = new DateFormatter();
  30. public function init():void{
  31.  
  32.  
  33. run()
  34.  
  35.  
  36. }
  37.  
  38.  
  39.  
  40. function randomNumber(low:Number=0, high:Number=1):Number
  41. {
  42. return Math.floor(Math.random() * (1+high-low)) + low;
  43. }
  44.  
  45. public function run():void {
  46. var qMyTimer:Timer = new Timer(9000);
  47. qMyTimer.addEventListener(TimerEvent.TIMER, startGenerator);
  48. qMyTimer.start();
  49.  
  50.  
  51.  
  52. }
  53.  
  54. public function startGenerator(e:TimerEvent):void{
  55.  
  56.  
  57. var quote:Object = new Object();
  58.  
  59.  
  60.  
  61.  
  62. var rand:int = randomNumber(0, 100);
  63. quote.bid = rand//.nextDouble() * 100;
  64. quote.ask = quote.bid + 1;
  65. quote.Volume = quote.ask - 0.5;
  66. quote.symbol = "MSFT";
  67. var myDate = new Date().getMinutes()
  68. quote.myDate = new Date(myDate);
  69.  
  70.  
  71. historicalQuotes.addItem(quote);
  72. var currentDate:Date = new Date()
  73. //Alert.show(""+getTime+ "</br>" +
  74. //quote.myDate)
  75.  
  76. //pushDataToClients( quote );
  77.  
  78.  
  79. }
  80. /* private function dateAxis_labelFunc(item:Object, prevValue:Object, axis:CategoryAxis,categoryItem:Object):String
  81. {
  82.  
  83. return (item as Date).date.toString();
  84. }
  85. private function formatDateLabel(value:Date,previousValue:Date,axis:DateTimeAxis):String
  86. {
  87. return value.toTimeString();
  88. } */
  89.  
  90. ]]>
  91. </mx:Script>
  92.  
  93.  
  94. <mx:VBox width="100%" horizontalAlign="center" backgroundColor="#F9F6EC" height="115">
  95. <mx:Label text="Real time fuel stock..." textAlign="left" color="#865928" fontWeight="bold" fontSize="12"/>
  96. <mx:LineChart id="stockPriceChart" width="100%" height="79" dataProvider="{historicalQuotes}" showDataTips="true" >
  97. <!--<mx:backgroundElements>
  98. <mx:GridLines direction="vertical">
  99. <mx:horizontalFill>
  100. <mx:SolidColor color="0xCCCCCC" alpha=".3"/>
  101. </mx:horizontalFill>
  102. </mx:GridLines>
  103. </mx:backgroundElements>-->
  104. <mx:horizontalAxis>
  105. <mx:DateTimeAxis alignLabelsToUnits="false" dataUnits="minutes"/>
  106. </mx:horizontalAxis>
  107.  
  108. <mx:verticalAxis>
  109. <mx:LinearAxis id="yAxis" title="Volume (ltrs)" baseAtZero="true" autoAdjust="true"/>
  110. </mx:verticalAxis>
  111. <mx:verticalAxisRenderers>
  112. <mx:AxisRenderer axis="{yAxis}" verticalAxisTitleAlignment="vertical">
  113. <mx:axisStroke>
  114. <mx:Stroke weight="1" color="#C0C0C0"/>
  115. </mx:axisStroke>
  116. </mx:AxisRenderer>
  117. </mx:verticalAxisRenderers>
  118.  
  119. <mx:series>
  120. <mx:LineSeries displayName="Fuel Volume" yField="Volume" form="curve" >
  121. <mx:lineStroke>
  122. <mx:Stroke color="0x11538c" weight="2" alpha="1"/>
  123. </mx:lineStroke>
  124. </mx:LineSeries>
  125. </mx:series>
  126. </mx:LineChart>
  127. </mx:VBox>
  128.  
  129. </mx:VBox>
  130.  
  131. <mx:VBox width="100%" height="100%" id="Generatorevent">
  132.  
  133. </mx:VBox>
  134. <mx:VBox width="100%" height="100%" id="gateevent">
  135.  
  136. </mx:VBox>
  137.  
  138.  
  139. </mx:TitleWindow>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement