利用MSCHART画图的一段代码

1<object classid="clsid:5220cb21-c88d-11cf-b347-00aa00a28331" id="Microsoft_Licensed_Class_Manager_1_0">
2<param name="LPKPath" value="mschart5.lpk"/>
3</object>

<-- Here is where we are actually "instantiating" the
ActiveX control. I downloaded the file mschart5.cab from
Microsoft's website. It has been digitally signed. -->

1<object classid="CLSID:31291E80-728C-11CF-93D5-0020AF99504A" codebase="mschart5.cab" height="95%" id="MSChart1" width="100%">
2</object>
 1<script language="Vbscript">   
 2'Now, let's set the chart properties...!!!   
 3  
 4'This sets the chart to a line graph...   
 5MSChart1.ChartType = 3   
 6  
 7'Set the color and width of the line   
 8' This sets the pen color to black (0,0,0)   
 9' and width to 50 pixels.   
10MSChart1.Plot.SeriesCollection(1).Pen.VtColor.Set 0,0,0   
11MSChart1.Plot.SeriesCollection(1).Pen.Width = 50   
12  
13  
14'This sets the chart's labels to various formats,   
15' fonts, and sizes.   
16For i = 1 To MSChart1.Plot.Axis(1).Labels.Count   
17'Format the Chart labels to Currency   
18MSChart1.Plot.Axis(1).Labels(i).Format = "$0,###"   
19  
20'Set the font to Tahoma   
21MSChart1.Plot.Axis(1).Labels(i).VtFont.Name = "Tahoma"   
22  
23'Set the font size to 10pt   
24MSChart1.Plot.Axis(1).Labels(i).VtFont.Size = 10   
25Next   
26  
27  
28'This sets the # of rows in the chart   
29MSChart1.RowCount = 5;   
30  
31'This sets the number of columns per row.   
32MSChart1.ColumnCount = 2   
33  
34'This indicates to show the label   
35MSChart1.ShowLegend = True   
36  
37  
38for x = 1 to 5 'The number of rows we have   
39'This sets what current row we are editing   
40MSChart1.Row = x   
41  
42'This sets the row's label   
43MSChart1.RowLabel = "Row " & x   
44  
45'This plots the points for both columns (1 and 2)   
46'for the current row (x). The value being   
47'plotted is x*5 and x*10   
48call MSChart1.DataGrid.SetData(x, 1, x*5,nullFlag)   
49call MSChart1.DataGrid.SetData(x, 2, x*10,nullFlag)   
50next   
51  
52</script>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus