I am trying to make a stacked bar chart with code gathered from asp101. The only problem I am having is that it will not take into account the first record, nor does it add the small numbers. Please take a look at part of my code. I am pulling these numbers from a database, sorting through the data, then adding it together. Where I have put the response.write statements I am checking the data. Here is the sample data I am using.
code snipit:
dim stack
dim col
with oraRecSet
iNumStacks = 4
iNumColumns = .recordcount - 1
reDim aValues(iNumColumns)
reDim aLabels(iNumColumns)
reDim aTooltip(iNumStacks)
reDim aColors(iNumStacks)
reDim abars(iNumStacks,iNumColumns)
.movefirst
col = 0
do while not .eof
for stack = 0 to iNumStacks
' get the data for the stacked bars
aBars(stack,col) = .fields(stack).value
' get the total height of each column
aValues(col) = int(aValues(col)) + int(aBars(stack,col))
next
' get the labels for the chart
aLabels(col) = .fields(5).value
response.write aLabels(col) & "--" & aValues(col) & "<BR>"
.movenext
col = col + 1
loop
.close
end with
set oraRecSet = Nothing
Code:
0 1 2 3 4 5
a 110 19 1 3
b 1 1
c 17 6 51 1 4
d 2 5
e 9
f 7 5
g
dim stack
dim col
with oraRecSet
iNumStacks = 4
iNumColumns = .recordcount - 1
reDim aValues(iNumColumns)
reDim aLabels(iNumColumns)
reDim aTooltip(iNumStacks)
reDim aColors(iNumStacks)
reDim abars(iNumStacks,iNumColumns)
.movefirst
col = 0
do while not .eof
for stack = 0 to iNumStacks
' get the data for the stacked bars
aBars(stack,col) = .fields(stack).value
' get the total height of each column
aValues(col) = int(aValues(col)) + int(aBars(stack,col))
next
' get the labels for the chart
aLabels(col) = .fields(5).value
response.write aLabels(col) & "--" & aValues(col) & "<BR>"
.movenext
col = col + 1
loop
.close
end with
set oraRecSet = Nothing