flex linechat使用日

3171 ワード

 private function mydatafunction(s:String):Date{
        	com.carlcalderon.arthropod.Debug.log(s.toString());
        
        	var arr:Array=s.split(":");
        	//var data:Date=new Date(arr[0],arr[1],arr[2]);
        	var data:Date=new Date(arr[0],arr[1],arr[2],arr[3],arr[4],arr[5])//,arr[3],arr[4],arr[5]);
        	return data;
        }	
        
        
        function labelfunction(labelValue:Object, previousValue:Object, axis:IAxis):String 
        {
        	
        	var date:Date=new  Date(labelValue.toString());
        	return date.day+" "+date.hours+" "+date.minutes+" "+date.milliseconds+" ";
        }

            
        ]]>
    </mx:Script>
	<mx:HBox>
		 <mx:LineChart id="linechart" color="0x323232" height="100%"
            showDataTips="true" dataProvider="{this._stock.stockInfo.stockchats}">
            <mx:horizontalAxis>
            	
            	<mx:DateTimeAxis dataUnits="milliseconds">
            		<mx:labelFunction>
            			labelfunction
            		</mx:labelFunction>
            		<mx:parseFunction>
            			mydatafunction
            		</mx:parseFunction>
            	</mx:DateTimeAxis>
            </mx:horizontalAxis>
          <mx:verticalAxis>
                <mx:LinearAxis baseAtZero="false" />
            </mx:verticalAxis>

           <mx:series>
                <mx:LineSeries xField="StockChat.as
package cn.isvi.entity
{
	import com.carlcalderon.arthropod.Debug;
	
	[Bindable]  
	[RemoteClass(alias="cn.isvi.entity.StockChat")] 
	public class StockChat
	{
		public var id:int;
		public var stockId:int;
		private var _flexdata:Date;//flexDate          
		
		private var _dateToString:String;
		
		public var money:Number;
		
		public function StockChat()
		{
		}
		public function set flexdata(v:Date):void{
			//com.carlcalderon.arthropod.Debug.log("javatoflex date"+v.toString());
			this._flexdata=v;
			this._dateToString=v.fullYear+":" + 
					""+(v.month)+":"+v.day+":"+v.hours+":"+v.minutes+":"+v.seconds;
		}
		public function get flexdata():Date{
			return this._flexdata;
		}
		public function set dateToString(v:String):void{
			this._dateToString=v;
		}
		public function get dateToString():String{
			return this._dateToString;
		}

	}
} " yField="money" displayName="AAPL"/>
                
            </mx:series>

        </mx:LineChart>
        
        <mx:Legend dataProvider="{linechart}" color="0x323232"/>