终于搞定了,owc制作k线图

80酷酷网    80kuku.com

  k线图终于搞定了,刚才我犯了一个极其低级的错误,真想给自己一个大嘴巴。

<% 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>
<head>
<title>Chart Example</title>
</head>

<body>

<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
  <td><font face=verdana,arial size=2 color=blue>Chart Example</font></td>
</tr>
<tr>
    <td width=60% collspan=2> <object id=ChartSpace1 classid=CLSID:0002E500-0000-0000-C000-000000000046

      <script language=vbs>
Sub var webSiteID = 6;window.onload()
Dim categories(4)
Dim valuesopen(4),valuesclose(4),valueshigh(4),valueslow(4)

    ' Create an array of strings representing the categories.
    categories(0) = "15/03/2000"
    categories(1) = "16/03/2000"
    categories(2) = "17/03/2000"
    categories(3) = "18/03/2000"

    ' Clear the contents of the chart workspace. This removes
    ' any old charts that may already exist and leaves the chart workspace
    ' completely empty. One chart object is then added.
    ChartSpace1.Clear
    ChartSpace1.Charts.Add
    Set c = ChartSpace1.Constants
ChartSpace1.Charts(0).Type = c.chChartTypeStockOHLC

    ' Add one serie to the chart.'

    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
    ' Make the chart legend visible, format the left value axis as percentage,
    ' and specify that value gridlines are at 10% intervals.
    ChartSpace1.Charts(0).HasLegend = True
    ChartSpace1.Charts(0).Axes(c.chAxisPositionLeft).MajorUnit = 1
End Sub
</script>
  </td>
  <td width=40%><font face=verdana,arial size=1 color=blue>This is a small
Chart Example</font></td>
</tr>
</table>

</body>
</html>



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: