📄 recordlinezchart.asp
字号:
<%
Dim conn,connstr,rs,rsstr,stcdno
stcdno=Session("NO")
'----------建立数据库链接对象
Set conn = Server.CreateObject("ADODB.Connection")
connstr ="Driver={SQL Server};server=(local);uid=sa;pwd=;database=master;"
conn.open connstr
Set rs = server.CreateObject("adodb.recordset")
rsstr = "select * from GW_Z_H where STCD="+stcdno
rs.open rsstr,conn,1,1
count=rs.recordcount
Dim min, max, scaleX,scaleY
min=CSng(rs("Z"))
max=CSng(rs("Z"))
ReDim data(count)
Dim timelist(6)
timelist(0)=rs("YMDHM")
interval=count/5
For i=1 To count
num=CSng(rs("Z"))
data(i-1)=num
If i Mod interval=0 Then
timelist((i-1)/interval)=rs("YMDHM")
End If
If min>num Then
min=num
End If
If max<num Then
max=num
End If
rs.movenext
Next
rs.moveprevious
timelist(5)=rs("YMDHM")
For i=0 To 5
tm=month(timelist(i))
if len(tm)=1 then tm="0" & tm
td=day(timelist(i))
if len(td)=1 then td="0" & td
str=year(timelist(i)) & tm & td
timelist(i)=str
Next
Height=2500
Width=4200
posX=200
posY=100
minY=Cint(min)-1
countY=Cint(max)+1
countY=countY-minY
countX=count
scaleX=CSng(Width/countX)
scaleY=CInt(Height/countY)
intervalX=CInt(width/5)
%>
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>历史水位埋深折线图</title>
</head>
<STYLE>
v\:* { BEHAVIOR: url(#default#VML) }
</STYLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="style.css" />
<script>
function drawLinesX(m)
{
miny=<%=minY%>
county=<%=countY%>
scaley=<%=scaleY%>
count=0; //画横坐标
var textPoint=miny;
for(var i=1;i<=county;i++){
var py=2700-i*scaley;
var strTo='4500'+" "+py;
if(county<50)
{
var newLine = document.createElement("<v:line from='200 "+py+"' to='"+strTo+"' style='position:absolute;z-index:8'></v:line>");
group1.insertBefore(newLine);
var newStroke = document.createElement("<v:stroke color='#c0c0c0'>");
newLine.insertBefore(newStroke);
var newShape= document.createElement("<v:shape style='position:absolute;left:0;top:"+(py-50)+";WIDTH:1000px;HEIGHT:200px;z-index:8' coordsize='21600,21600' fillcolor='white'></v:shape>")
group1.insertBefore(newShape);
textPoint++;
var newText = document.createElement("<v:textbox id='tx"+textPoint+"' inset='3pt,0pt,3pt,0pt' style='font-size:10pt;v-text-anchor:bottom-right-baseline'></v:textbox>");
newShape.insertBefore(newText);
newText.innerText=textPoint;
}
else
{
hei=county/10;
hei=parseInt(hei);
//alert(hei);
if(i%hei==0)
{
var newLine = document.createElement("<v:line from='200 "+py+"' to='"+strTo+"' style='position:absolute;z-index:8'></v:line>");
group1.insertBefore(newLine);
var newStroke = document.createElement("<v:stroke color='#c0c0c0'>");
newLine.insertBefore(newStroke);
var newShape= document.createElement("<v:shape style='position:absolute;left:0;top:"+(py-50)+";WIDTH:1000px;HEIGHT:200px;z-index:8' coordsize='21600,21600' fillcolor='white'></v:shape>")
group1.insertBefore(newShape);
textPoint=textPoint+hei;
var newText = document.createElement("<v:textbox id='tx"+textPoint+"' inset='3pt,0pt,3pt,0pt' style='font-size:10pt;v-text-anchor:bottom-right-baseline'></v:textbox>");
newShape.insertBefore(newText);
newText.innerText=textPoint;
}
}
}
}
</script>
<body onload="drawLinesX()">
<table align="center">
<tr>
<td align="center" class="title"><strong>测站<% response.write stcdno%>历史水位折线图(单位:m)</strong></td>
</tr>
<tr>
<td >
<v:group ID="group1" style="WIDTH:700px;HEIGHT:500px" coordsize="4900,3500">
<v:line from="200,100" to="200,2700" style="Z-INDEX:8;POSITION:absolute" strokeweight="1pt">
<v:stroke StartArrow="classic"/>
</v:line>
<v:line from="200,2700" to="4500,2700" style="Z-INDEX:8;POSITION:absolute" strokeweight="1pt">
<v:stroke EndArrow="classic"/>
</v:line>
<v:rect style="WIDTH:4700px;HEIGHT:3000px" coordsize="21600,21600" fillcolor="white" strokecolor="black">
<v:shadow on="t" type="single" color="silver" offset="4pt,3pt"></v:shadow>
</v:rect>
<v:shape style="position:absolute;left:0;top:2650;WIDTH:1000px;HEIGHT:200px;z-index:8" coordsize="21600,21600" fillcolor="white">
<v:textbox id="text1" inset="3pt,0pt,3pt,0pt" align="center" style="font-size:10pt;v-text-anchor:bottom-center-baseline"><%=minY%></v:textbox>
</v:shape>
<%For i=0 To 5%>
<v:line from="<%=posX+i*intervalX%>,<%=posY+Height+100+30%>" to="<%=posX+i*intervalX%>,<%=posY+100%>" style="Z-INDEX:8;POSITION:absolute" strokeweight="1pt"><v:stroke color='#c0c0c0'/></v:line>
<v:shape style="position:absolute;left:<%=posX+i*intervalX-200%>;top:<%=posY+Height+100+120%>;WIDTH:1000px;HEIGHT:200px;z-index:8" coordsize="21600,21600" fillcolor="white">
<v:textbox id="text1" inset="3pt,0pt,3pt,0pt" align="center" style="font-size:10pt;v-text-anchor:bottom-center-baseline"><%=timelist(i)%></v:textbox>
</v:shape>
<% Next %>
<%For i=0 To count-1%>
<% If i=0 then %>
<v:oval style='position:absolute;left:<%=posX%>;top:<%=posY+Height+100-scaleY*(data(0)-minY)%>;width:2px;height:2px;z-index:1' fillcolor="#FF0000" strokecolor="#FF0000"/>
<% Else %>
<v:line from="<%=posX+(i-1)*scaleX%>,<%=posY+Height+100-(data(i-1)-minY)*scaleY%>" to="<%=posX+i*scaleX%>,<%=posY+Height+100-scaleY*(data(i)-minY)%>" style="Z-INDEX:8;POSITION:absolute" strokeweight="1pt" strokecolor="#FF0000">
</v:line>
<%End If %>
<%Next %>
</v:group>
</td>
</tr>
</table>
<%
rs.close
Set rs=nothing
Set Conn=nothing%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -