欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

如何制作K线图?

程序员文章站 2022-04-15 09:19:24
<%@ language=vbscript %><%response.buffer=truer...

<%@ language=vbscript %>
<%
response.buffer=true
response.expires = 0
response.expiresabsolute = now() - 1
response.addheader "cache-control","private"
response.addheader "pragma","no-cache"
%>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

<html>
<body>
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
  <td> <p align="center"><font color="#008000" size="4" face="
黑体">精彩春风之k线图</font></td>
</tr>
<tr>
    <td width=60% collspan=2> <object id=chartspace1 classid=clsid:0002e500-0000-0000-c000-000000000046
style="width:100%;height:350">
        <embed>
        </embed>
      </object>
      <script language=vbs>
sub window_onload()
dim categories(4)
dim valuesopen(4),valuesclose(4),valueshigh(4),valueslow(4)

    categories(0) = "17/10/2001"
    categories(1) = "18/10/2001"
    categories(2) = "19/10/2001"
    categories(3) = "20/10/2001"

' 创建一个字符串数组表明分类.
    chartspace1.clear
    chartspace1.charts.add
    set c = chartspace1.constants
chartspace1.charts(0).type = c.chcharttypestockohlc

' 清空线图工作区已存在的内容,以添加新的.

    '
添加一个serie到图表.

    chartspace1.charts(0).seriescollection.add

redim values(4,4)

valuesopen(0) = 10
valuesopen(1) = 18
valuesopen(2) = 9
valuesopen(3) = 16

valuesclose(0) = 16
valuesclose(1) = 21
valuesclose(2) = 11
valuesclose(3) = 17

valueshigh(0) = 17
valueshigh(1) = 29
valueshigh(2) = 16
valueshigh(3) = 16

valueslow(0) = 9
valueslow(1) =15
valueslow(2) = 9
valueslow(3) = 11


chartspace1.charts(0).seriescollection(0).caption = "ativo x"
chartspace1.charts(0).seriescollection(0).setdata c.chdimcategories, c.chdataliteral, categories
chartspace1.charts(0).seriescollection(0).setdata c.chdimopenvalues, c.chdataliteral, valuesopen
chartspace1.charts(0).seriescollection(0).setdata c.chdimhighvalues, c.chdataliteral, valueshigh
chartspace1.charts(0).seriescollection(0).setdata c.chdimlowvalues, c.chdataliteral, valueslow
chartspace1.charts(0).seriescollection(0).setdata c.chdimclosevalues, c.chdataliteral, valuesclose


    chartspace1.charts(0).haslegend = true
    chartspace1.charts(0).axes(c.chaxispositionleft).majorunit = 1

' 让线图说明可见, 坐标轴从左起以百分比格式表示,以每10%为间隔.
end sub
</script>
  </td>
  <td width=40%>

' 线图总宽.

</td>
</tr>
</table>
</body></html>

[1]