flex实现股票行情走势图示例代码(flex股价)这都可以

随心笔谈2年前发布 编辑
164 0
🌐 经济型:买域名、轻量云服务器、用途:游戏 网站等 《腾讯云》特点:特价机便宜 适合初学者用 点我优惠购买
🚀 拓展型:买域名、轻量云服务器、用途:游戏 网站等 《阿里云》特点:中档服务器便宜 域名备案事多 点我优惠购买
🛡️ 稳定型:买域名、轻量云服务器、用途:游戏 网站等 《西部数码》 特点:比上两家略贵但是稳定性超好事也少 点我优惠购买

.font12{font-family:宋体;fontSize:15}

.lenchar{

bar-color:red;

}

.mypanelTitle {

color: #66ccff;

fontFamily: Comic Sans MS;

fontWeight: normal;

textDecoration: underline;

}

import flash.sampler.getMemberNames;

import mx.charts.chartClasses.IAxis;

import mx.charts.LinearAxis;

import mx.charts.HitData;

import mx.collections.ArrayCollection;

import mx.rpc.events.ResultEvent;

import mx.controls.Alert;

import mx.charts.renderers.CircleItemRenderer;

import mx.graphics.Stroke;

import mx.controls.DateField;

[Bindable]

private var myAmfurl:String=””; //用于连接到外部页面

[Bindable]

private var myAmtitle:String=””; //用于连接到外部页面

[Bindable]

public var testDatas:ArrayCollection=new ArrayCollection();

[Bindable]

private var expenses:ArrayCollection=new ArrayCollection();

[Bindable]

private var arr:Array=new Array();

[Bindable]

private var mintime:Date;

[Bindable]

private var maxtime:Date;

[Bindable]

private var smintime:Date;

[Bindable]

private var emaxtime:Date;

private var timer:Timer;

private var stocksb:Number;

private var dateVar:Date;

private var d: Date=new Date();

private function init():void{

// setInterval(torequest,2000);

myAmfurl=Application.application.parameters.myAmfurl; //风险追溯链接

myAmtitle=Application.application.parameters.myAmtitle;

timer=new Timer(1000);

timer.addEventListener(TimerEvent.TIMER, torequest)

timer.start();

}

public function torequest(et:Event):void{

setstyle();

realtimeservice.send();

}

//用于设置样式

public function setstyle():void{

}

private function formatDataTip(hitData:HitData):String

{

var s:String=hitData.item.date.toString();

var a:Array=s.split(“,”);

var str:String=a[3]+”:”+a[4];

str +=”\n”;

str +=hitData.item.value;

return str;

}

private function parseDate(value:String):Date{

var a:Array=value.split(“,”);

var newDate:Date=new Date(a[0],a[1],a[2],a[3],a[4]);

return newDate;

}

private function getResult(e:ResultEvent):void{

var min:String=””;

var pattern:RegExp=/,/gi;

for each (var resultXML:XML in e.result.item){

var tmpobj:Object=new Object();

tmpobj.value=resultXML.value;

tmpobj.date=resultXML.date;

tmpobj.sb=resultXML.sb;

stocksb=Number(tmpobj.sb);

var str=tmpobj.date;

var a:Array=str.split(“,”);

mintime=new Date(a[0],a[1],a[2],9,30);

smintime=new Date(a[0],a[1],a[2],11,30);

min=tmpobj.date;

maxtime=new Date(a[0],a[1],a[2],15,00);

emaxtime=new Date(a[0],a[1],a[2],13,00);

if(expenses.length==0){

expenses.addItem(tmpobj);

}else{

var check:int=0;

if(expenses.length>0){

for each(var subtempobj:Object in expenses){

if(String(subtempobj.date).replace(pattern,””)==String(tmpobj.date).replace(pattern,””)){

check=1;

}

}

}

if(check==0){

expenses.addItem(tmpobj);

check=0;

}

}

}

var tmpobj1:Object=new Object();

var tmpobj2:Object=new Object();

var a:Array=min.split(“,”);

tmpobj1.value=stocksb;

tmpobj1.date=a[0]+”,”+a[1]+”,”+a[2]+”,”+”9,30″;

tmpobj2.value=stocksb;

tmpobj2.date=a[0]+”,”+a[1]+”,”+a[2]+”,”+”15,00″;

testDatas.addItem(tmpobj1);

testDatas.addItem(tmpobj2);

}

private function mylabel(labelValue:Object, previousValue:Object, d:IAxis):String {

var temp:String=””;

var currvalue:Number=Number(labelValue.toString());

if(currvalue>stocksb){

temp=’‘+labelValue.toString()+’‘;

}else{

temp=’‘+labelValue.toString()+’‘;

}

return temp;

}

]]>

disabledDays=”{[0,6]}”

disabledRanges=”{[{rangeStart:smintime, rangeEnd:emaxtime}]}”

parseFunction=”parseDate” interval=”1″ minimum=”{mintime}” maximum=”{maxtime}” displayLocalTime=”true” dataInterval=”30″ dataUnits=”minutes” labelUnits=”minutes”

/>

© 版权声明

相关文章