you are better helper,your code is very useful.I refer to your code ,I have realize some functions.but now i want to draw like figure1 in vbscript,then figure is make by VB's paintbox
the Z-Axis is datetime,and with the time is changing,the new ArrayxyZ should be add into the chart,but hte new ArrayXYZ have the same Z,that's the time of NOW,and how to set the Zvalue-formatdatetime,at the same time ,how can i set MaxMinvalue of Z-axis.
Code: Select all
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" type="text/javascript">
<!--关键在这个函数-->
function GetData()
{
url="Wave.asp?IDval="+document.form2.selectCh.options(document.form2.selectCh.selectedIndex).id;//调用页面及通道ID
var http = new ActiveXObject("Microsoft.XMLHTTP");
http.open("POST",url,false);
http.send();
var str = http.responseText;
//loadcontent.innerHTML=str;
DrawWave(str);
}
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
</style>
</head>
<div id=loadcontent>Data is Loading……</div>
<body >
<table width="878" height="35" cellpadding="0" cellspacing="0" >
<tr>
<td><table width="732" cellpadding="0" cellspacing="0">
<tr>
<td width="160"> </td>
<td width="570"><table border="0"cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td><object
id="TChart1"
width="570"
height="405"
type="application/x-oleobject"
hspace="0"
vspace="0"
classid="CLSID:B6C10489-FB89-11D4-93C9-006008A7EED4"
codebase="http://www.envada.com.cn/en8000web/Teechart5.cab#version=5,0,4,0">
</object></td></tr></table></td>
</tr>
</table>
</td>
</tr>
</table>
<script language="vbscript">
<!--
Dim Sendstr,ChnStr
Dim FunFlag,RealFlag
Dim wavestr
sub Window_onload()
Dim tmpIndex
TChart1.Environment.IEPrintWithPage=True <!--sets up Chart to print from IE's print option -->
TChart1.AutoRepaint=True
TChart1.AddSeries(33)
<!-- 表头-->
TChart1.Header.Text.Clear
TChart1.Header.Text.Add("1瓦X向轴振")
TChart1.Header.Font.Bold=True
TChart1.Header.Font.Color=vbBlue
TChart1.Header.Font.Size=12
TChart1.Header.Alignment=2 '0-left,1-right,2-center,defause-2'
<!-- 表底-->
TChart1.Footer.Text.Clear
TChart1.Footer.Text.Add("周期:T")
TChart1.Footer.Font.Italic = False
TChart1.Footer.Font.Bold=True
TChart1.Footer.Font.Color=vbBlue
TChart1.Footer.Font.Size=8
TChart1.Footer.Alignment=1
TChart1.Aspect.Orthogonal =False
TChart1.Legend.Visible = False
TChart1.Aspect.Chart3DPercent =100
TChart1.Aspect.Zoom = 80
TChart1.Panel.Gradient.Visible=False
'TChart1.Series(0).asWaterfall.UsePalette=False'
TChart1.Series(0).asWaterfall.WireFrame=True
TChart1.Series(0).asWaterfall.Pen.Color=vbBlue
TChart1.Series(0).asWaterfall.WaterLines.Visible=False
TChart1.Walls.Left.Pen.Color=RGB(0,0,128)
TChart1.Walls.Left.Size=0
TChart1.Walls.Back.Color=RGB(242,242,242)
TChart1.Walls.Bottom.Size=1
TChart1.Axis.Bottom.Labels.Font.Size=12
TChart1.Axis.Bottom.Ticks.Width=2
TChart1.Axis.Bottom.Ticks.Color=RGB(200,150,200)
TChart1.Panel.BevelOffset=5
TChart1.Panel.Color=vbWhite '15921906'
TChart1.Zoom.Animated=True
TChart1.Zoom.Pen.Color= vbYellow
TChart1.TimerEnabled=True
TChart1.TimerInterval=1500
end sub
// the procedure Draw
sub DrawWave(wavestr)
dim rat,smplen,smpcyc,valnum
dim MyArray
dim MyValArray(),MyPhaArray(),My1XArray(),MyXArray(),MyYArray(),MyZArray()
dim i,j,k,n,m
dim MaxnX,MaxVal
dim tm
On Error Resume Next
MyArray=split(trim(wavestr),",",-1,1)
rat=Myarray(0)
smplen=MyArray(1)
smpcyc=MyArray(2)
valnum=MyArray(3)
n=CInt(valnum)
if n>0 then
Redim MyValArray(n),MyPhaArray(n),MynXArray(n)
for i=0 to n-1
MyValArray(i)=MyArray(3*i+4)/10
MyPhaArray(i)=MyArray(3*i+5)
MynXArray(i)=MyArray(3*i+6)
Next
MaxnX=CInt(MynXArray(0))
for i=1 to n-1
if MaxnX<CInt(MynXArray(i)) then
MaxnX=CInt(MynXArray(i))
end if
next
Redim MyXArray(MaxnX+smpcyc),MyYArray(MaxnX+smpcyc),MyZArray(MaxnX+smpcyc)
m=MaxnX+smpcyc
tm=now
for i=0 to m-1
MyXArray(i)=i/smpcyc
MyYArray(i)=FormatNumber(Rnd,2)
MyZArray(i)=tm
next
for i=0 to n-1
MyYArray(MynXArray(i))=MyValArray(i)
next
TChart1.Series(0).asWaterfall.IrregularGrid=True
TChart1.Series(0).asWaterfall.AddArrayXYZ MyXArray,MyYArray,MyZArray
MaxVal=TChart1.Axis.Left.MaxYValue+10
document.form1.textY.value=MaxVal
MaxXVal=TChart1.Axis.Bottom.MaxXValue
TChart1.Axis.Left.SetMinMax 0,MaxVal
TChart1.Axis.Bottom.SetMinMax 0, MaxXVal
TChart1.AutoRepaint=True
TChart1.Repaint
end if
end sub
sub TChart1_OnTimer()
dim temstr1,temstr2,temstr3,temstr
temstr1="10,1024,16,18,621,0,16,77,150,92,76,70,32,74,211,112,72,289,144,69,271,136,"
temstr2="69,190,104,68,230,120,67,129,88,66,90,40,65,30,8,63,249,128,63,100,20,62,107,48,62,"
tempstr3="308,152,61,55,12,61,169,96,55,50,24"
temstr=temstr1+temstr2+temstr3
TChart1.TimerEnabled=False
DrawWave(temstr)
TChart1.TimerEnabled=True
end sub
sub ShowPrints()
TChart1.Printer.ShowPreview
end sub
sub Exportbmp()
TChart1.Export.ShowExport
end sub
sub Pause()
if TChart1.TimerEnabled then
TChart1.TimerEnabled=false
document.form1.CmdPause.value="刷新"
else
TChart1.TimerEnabled=true
document.form1.CmdPause.value="暂停"
end if
end sub
<!-- 通道选择-->
sub SelectChannel()
dim headertext
TChart1.Series(0).Clear
TChart1.TimerEnabled=False
TChart1.AutoRepaint=False
headertext=document.form2.selectCh.options(document.form2.selectCh.selectedIndex).Value
TChart1.Header.Text.Clear
TChart1.Header.Text.Add(headertext)
TChart1.TimerEnabled=True
TChart1.AutoRepaint=True
end sub
sub TChart1_OnCursorToolChange(Tool, X, Y, XVal, YVal, Series, ValueIndex)
document.form1.textX.value=FormatNumber(XVal,1)+"T"
document.form1.textY.Value= FormatNumber(YVal,0)+"um"
end sub
-->
</script>
</body>
</html>