Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help with code. Not adding small numbers

Status
Not open for further replies.

jlindahl

Programmer
Sep 23, 2003
46
US
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:
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
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) & &quot;--&quot; & aValues(col) & &quot;<BR>&quot;
.movenext
col = col + 1
loop
.close
end with
set oraRecSet = Nothing
 
Can you show what numbers that is producing and how they are not what you want?

It seems ok..

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
i just figured out what was wrong. it must be something to do with the int() function and NULLs. after further testing, i made changed the NULL to 0 and it looks like it is now working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top