' 这段代码可以粘贴到一个Form的 Load
' 事件中,该Form包含名为“MSChart1”的
' MSChart 控件。
Dim arrPrices(1 to 10)
Dim i As Integer
For i = 1 to 10
arrPrices(i)= i * 2
Next i
MSChart1.ChartData = arrPrices
要创建更复杂的多系列图表,必须创建多维数组,如下例所示:
' 系列的数目是由第二个维数决定的。
' 在本例中,图表将有两个系列,
' 每个系列有五个数据点。
Dim arrPriceQuantity(1 to 5, 1 to 2)
Dim i as Integer
For i = 1 to 5
arrPriceQuantity(i, 1) = i ' Series 1
arrPriceQuantity(i, 2) = 0 - i ' Series 2
Next i
MsChart1.ChartData = arrPriceQuantity