日期:2008-08-20  浏览次数:21353 次

-->
<HTML XMLns:v>
<HEAD>
<STYLE>
v\:*{behavior:url(#default#VML);}

*{font-size:12px}
</STYLE>
</HEAD>
<BODY topmargin=0 leftmargin=0 bgcolor=#D7EEFF>

<DIV id=showdiv style="font-size:12px; Color:RED; DISPLAY: none; LEFT: 0px; PADDING-BOTTOM: 2px; PADDING-LEFT: 2px; PADDING-RIGHT: 2px; PADDING-TOP: 2px; POSITION: absolute; TABLE-LAYOUT: fixed; TOP: 0px; WHITE-SPACE: nowrap; Z-INDEX: 500"></DIV>
<script language="javascript">
<!--
//加速alt,title的显示
var oldtext="abc";

function window.onload(){
try{myid2.height=window.document.body.scrollHeight}
catch(e){}
}

function document.onmousemove(){
try{
if(event.srcElement.getAttribute('onMOver')){
showdiv.style.left=event.x-3;showdiv.style.top=event.y+document.body.scrollTop+18;if(event.srcElement.onMOver!=oldtext){oldtext=event.srcElement.onMOver;showdiv.innerText=oldtext;showdiv.style.backgroundColor='#FFF6FF'};if(showdiv.style.display=='none')showdiv.style.display=''
if(showdiv.style.posLeft+300>screen.width){showdiv.style.posLeft=520}
}
else{
if(showdiv.style.display=='')showdiv.style.display='none';}
}
catch(e){}
}
//-->
</SCRIPT>

<?XML:namespace prefix=v />
<%
'连接数据库
set conn=Server.CreateObject("Adodb.Connection")
connStr="Provider=SQLOLEDB;Data Source=(local);database=DBName;uid=user;pwd=pass;"
conn.Open connStr

'初始化,定义变量
BoardID=int(Request("BoardID"))
if Request("BoardID")="" then BoardID=1
PicWidth=720
PicHeight=300

'显示股票列表下拉菜单
sql="Select * from Board where BoardID in (Select BoardID From Stocks)"
set RsBoard=conn.execute(sql)
StockStr="<select onchange=""location.replace('Trend.ASP?BoardID='+this.value)"">"
do while not RsBoard.eof
if RsBoard("BoardID")=BoardID then
ChkStr=" selected"
else
ChkStr=""
end if
StockStr=StockStr&"<option value="&RsBoard("BoardID")&ChkStr&">"&RsBoard("BoardName")&"</option>"
RsBoard.movenext
loop
set RsBoard=nothing
StockStr=StockStr&"<select>"
response.write StockStr

'打开股票走势表
sql="Select * from StocksTrend where BoardID="&BoardID&" and CalTime>getDate()-1 and Day(CalTime)=Day(getDate()) order by ID"
set rs=Server.CreateObject("Adodb.Recordset")
rs.Open sql,conn,1,1

'获取股票价格列表至数组,并计算最高最低价
Rec=rs.RecordCount
redim Price(Rec)
Highest=0
Lowest=9999
for i=1 to Rec
Price(i)=rs("Price")
if Price(i)>Highest then Highest=Price(i)
if Price(i)<Lowest then Lowest=Price(i)
rs.movenext
next
set rs=nothing

'画时间点,间隔6小时
for i=0 to 24 step 6
X=Round(i/24*PicWidth)
DrawLine X,PicHeight,X,PicHeight+5,"#808080"
Printword X,PicHeight+15,i&":00"
next

'画走势图边框
DrawLine 0,0,PicWidth,0,"#000000"
DrawLine 0,0,0,PicHeight,"#000000"
DrawLine PicWidth,0,PicWidth,PicHeight,"#000000"
DrawLine 0,PicHeight,PicWidth,PicHeight,"#000000"

'画四等分线
DrawLine 0,PicHeight*1/4,PicWidth,PicHeight*1/4,"#AAAAAA"
DrawLine 0,PicHeight*2/4,PicWidth,PicHeight*2/4,"#AAAAAA"
DrawLine 0,PicHeight*3/4,PicWidth,PicHeight*3/4,"#AAAAAA"

'标明四等分线价格
Printword PicWidth+15, 0/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*0/4,2,-1,0,0)
Printword PicWidth+15, 1/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*1/4,2,-1,0,0)
Printword PicWidth+15, 2/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*2/4,2,-1,0,0)
Printword PicWidth+15, 3/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*3/4,2,-1,0,0)
Printword PicWidth+15, 4/4*PicHeight, FormatNumber(Highest-(Highest-Lowest)*4/4,2,-1,0,0)

'画走势图
for i=1 to Rec
if i=1 then
SX=0
SY=0
else
SX=X
SY=Y
end if
Y=PicHeight-Round((Price(i)-Lowe