hii...i am creating a chart using html and asp
the code for it is :
<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit %>
<%
Dim data1Array(3)
data1Array(0) = 5
data1Array(1) = 15
data1Array(2) = 25
data1Array(3) = 50
Dim data2Array(3)
data2Array(0) = 5
data2Array(1) = 10
data2Array(2) = 20
data2Array(3) = 25
Dim labelArray(15)
labelArray(0) = "1"
labelArray(1) = "2"
labelArray(2) = "2"
labelArray(3) = "2"
labelArray(4) = "2"
labelArray(5) = "2"
labelArray(6) = "7"
labelArray(7) = "8"
labelArray(8) = "9"
labelArray(9) = "1"
labelArray(10) = "11"
labelArray(11) = "12"
labelArray(12) = "13"
labelArray(13) = "14"
labelArray(14) = "15"
labelArray(15) = "16"
%>
<%
'How many pixels high we want our bar graph
Const graphHeight = 300
Const graphWidth = 450
Const barImage = "bluebar.gif"
Const barImage1 = "redbar.gif"
'h 300 , w 450
sub BarChart(data1 , data2, labels, title, axislabel)
'Print heading
Response.Write("<TABLE CELLSPACING=0 CELLPADDING=2 BORDER=1 WIDTH=" & graphWidth & ">" & chr(13))
Response.Write("<TR><TH COLSPAN=" & UBound(data1) - LBound(data1) + 2 & ">" & chr(13))
Response.Write("<FONT SIZE=+2>" & title & "</FONT></TH></TR>" & chr(13))
Response.Write("<TR><TD VALIGN=TOP ALIGN=RIGHT>" & chr(13))
'Find the highest value
Dim hi
hi = data1(LBound(data1))
Dim i
for i = LBound(data1) to UBound(data1)
if data1(i) > hi then hi = data1(i)
next
'calculating highest value for the second array
Dim hi1
hi1 = data2(LBound(data2))
Dim j
for j = LBound(data2) to UBound(data2)
if data2(j) > hi1 then hi1 = data2(j)
next
'Response.Write("the hightest value")
'Response.Write(hi1)
'Print out the highest value at the top of the chart
'Response.Write(hi & "</TD>")
Dim widthpercent
widthpercent = CInt((1 / (UBound(data1) - LBound(data1) + 1)) * 100)
'response.Write(widthpercent)
'Response.Write(data2(0))
'Response.Write(hi1)
'Response.Write(graphHeight)
'Response.Write(cint(data2(0)/hi1 * graphHeight))
'Response.End
For i = LBound(data1) to UBound(data1)
Response.Write("<td> </td>")
Response.Write(" <TD VALIGN=BASELINE ROWSPAN=2 WIDTH=" & widthpercent & "% >" & chr(13))
Response.Write(" <IMG SRC=""" & barImage & """ WIDTH=100% align= bottom HEIGHT=" & CInt(data1(i)/hi * graphHeight) & "/>" & chr(13))
response.Write(Cint(data1(i)/hi*graphHeight))
Response.Write(" <TD VALIGN=BASELINE ROWSPAN=2 WIDTH=" & widthpercent & "% >" & chr(13))
'response.end
Response.Write(" <IMG SRC=""" & barImage1& """ WIDTH=100% align= bottom HEIGHT=" & CInt(data2(i)/hi1 * graphHeight) & "/>" & chr(13))
response.Write(Cint(data2(i)/hi*graphHeight))
Response.Write(" </TD>" & chr(13))
'Response.Write("<td> </td>")
'Response.Write("<td> </td>")
'response.Write("<br>")
'
'response.Write("<br>")
Next
'response.end
Response.Write("</TR>")
Response.Write("<TR><TD VALIGN=BOTTOM ALIGN=RIGHT>0</TD></TR>")
'Write footer
Response.Write("<TR><TD ALIGN=RIGHT VALIGN=BOTTOM>" & axislabel & "</TD>" & chr(13))
for i = LBound(labels) to UBound(labels)
Response.Write("<TD VALIGN=BOTTOM ALIGN=CENTER>" & labels(i) & "</TD>" & chr(13))
next
Response.Write("</TR>" & chr(13))
Response.Write("</TABLE>")
end sub
%>
<HTML>
<BODY>
<CENTER>
<% Call BarChart(data1Array,data2Array,labelArray,"Telephone Sales","Date") %>
</CENTER>
</BODY>
</HTML>
now the problem is even tough in the following lines, i pass same value for the HEIGHT ATTRIBUTE with data1(0) and data2(0) ARRAYS the displayed height of the image is not same.
SIMILARLY THE HEIGHT SHOWN WITH OTHER ELEMENTS IS ALSO NOT PROPER
Response.Write(" <TD VALIGN=BASELINE ROWSPAN=2 WIDTH=" & widthpercent & "% >" & chr(13))
Response.Write(" <IMG SRC=""" & barImage & """ WIDTH=100% align= bottom HEIGHT=" & CInt(data1(i)/hi * graphHeight) & "/>" & chr(13))
Response.Write(" <TD VALIGN=BASELINE ROWSPAN=2 WIDTH=" & widthpercent & "% >" & chr(13))
Response.Write(" <IMG SRC=""" & barImage1& """ WIDTH=100% align= bottom HEIGHT=" & CInt(data2(i)/hi1 * graphHeight) & "/>" & chr(13))
i am attatching a image file to make my problem more clear..
thank's..