Problem of "Subscript out of range "
I have the the follwing ASP code for create Graph (use OWC object)
<%
' 2D array
Dim Vals(2,5)
Vals(0,0)=1
Vals(0,1)=2
Vals(0,2)=3
Vals(0,3)=4
Vals(0,4)=5
Vals(1,0)=10
Vals(1,1)=20
Vals(1,2)=30
Vals(1,3)=40
Vals(1,4)=50
' Create a Chart Object
Set oChart = CreateObject("OWC.Chart")
Set c = oChart.Constants
sCaption = "This is Graph "
oChart.Charts.Add
oChart.Charts(0).Type = oChart.Constants.chChartTypeColumnClustered
oChart.Charts(0).SeriesCollection.Add
oChart.Charts(0).SeriesCollection(0).Caption = sCaption
oChart.Charts(0).SeriesCollection(0).SetData c.chDimCategories, c.chDataLiteral, Categories
oChart.Charts(0).SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, Vals
%>
"Vals" is 2D array, I want to cteate Graph with 2 columns in each category (I have 5 categories). For Example: in the first category will be 2 columns, one with value 1 and seconed with value 10.
It's show me an ERROR of "Subscript out of range " on the line:
"oChart.Charts(0).SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, Vals"
Why? What's I did wrong?
What's the problem in my code? How to fix it??
|