473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

chart using html

hii...i am creating a chart using html and asp
the code for it is :
Expand|Select|Wrap|Line Numbers
  1.  
  2. <%@ LANGUAGE="VBSCRIPT" %>
  3. <% Option Explicit %>
  4.  
  5. <%
  6. Dim data1Array(3)
  7. data1Array(0) = 5
  8. data1Array(1) = 15
  9. data1Array(2) = 25
  10. data1Array(3) = 50
  11.  
  12.  
  13. Dim data2Array(3)
  14. data2Array(0) = 5
  15. data2Array(1) = 10
  16. data2Array(2) = 20
  17. data2Array(3) = 25
  18.  
  19.  
  20. Dim labelArray(15)
  21. labelArray(0) = "1"
  22. labelArray(1) = "2"
  23. labelArray(2) = "2"
  24. labelArray(3) = "2"
  25. labelArray(4) = "2"
  26. labelArray(5) = "2"
  27. labelArray(6) = "7"
  28. labelArray(7) = "8"
  29. labelArray(8) = "9"
  30. labelArray(9) = "1"
  31. labelArray(10) = "11"
  32. labelArray(11) = "12"
  33. labelArray(12) = "13"
  34. labelArray(13) = "14"
  35. labelArray(14) = "15"
  36. labelArray(15) = "16"
  37.  
  38. %> 
  39.  
  40. <%
  41. 'How many pixels high we want our bar graph
  42. Const graphHeight = 300
  43. Const graphWidth = 450
  44. Const barImage = "bluebar.gif"
  45. Const barImage1 = "redbar.gif"
  46. 'h 300 , w 450
  47.  
  48. sub BarChart(data1 , data2, labels, title, axislabel)
  49.     'Print heading
  50.     Response.Write("<TABLE CELLSPACING=0 CELLPADDING=2 BORDER=1 WIDTH=" & graphWidth & ">" & chr(13))
  51.     Response.Write("<TR><TH COLSPAN=" & UBound(data1) - LBound(data1) + 2 & ">" & chr(13))
  52.     Response.Write("<FONT SIZE=+2>" & title & "</FONT></TH></TR>" & chr(13))
  53.     Response.Write("<TR><TD VALIGN=TOP ALIGN=RIGHT>" & chr(13))
  54.  
  55.     'Find the highest value
  56.     Dim hi
  57.     hi = data1(LBound(data1))
  58.  
  59.     Dim i
  60.     for i = LBound(data1) to UBound(data1)
  61.         if data1(i) > hi then hi = data1(i)
  62.     next
  63.  
  64.  
  65. 'calculating  highest value for the second array
  66.     Dim hi1
  67.     hi1 = data2(LBound(data2))
  68.  
  69.     Dim j
  70.     for j = LBound(data2) to UBound(data2)
  71.         if data2(j) > hi1 then hi1 = data2(j)
  72.     next
  73.  
  74. 'Response.Write("the hightest value")
  75. 'Response.Write(hi1)
  76.  
  77.  
  78.     'Print out the highest value at the top of the chart
  79.     'Response.Write(hi & "</TD>")
  80.  
  81.     Dim widthpercent
  82.     widthpercent = CInt((1 / (UBound(data1) - LBound(data1) + 1)) * 100)
  83.     'response.Write(widthpercent)
  84.  
  85.     'Response.Write(data2(0))
  86.     'Response.Write(hi1)
  87.     'Response.Write(graphHeight)
  88.     'Response.Write(cint(data2(0)/hi1 * graphHeight))
  89.     'Response.End
  90.  
  91.     For i = LBound(data1) to UBound(data1) 
  92.         Response.Write("<td> </td>")
  93.         Response.Write(" <TD VALIGN=BASELINE ROWSPAN=2 WIDTH=" & widthpercent & "% >" & chr(13))
  94.         Response.Write(" <IMG SRC=""" & barImage & """ WIDTH=100% align= bottom HEIGHT=" & CInt(data1(i)/hi * graphHeight)  & "/>" & chr(13))
  95.         response.Write(Cint(data1(i)/hi*graphHeight))
  96.         Response.Write(" <TD VALIGN=BASELINE ROWSPAN=2 WIDTH=" & widthpercent & "% >" & chr(13))
  97.  
  98.         'response.end
  99.         Response.Write(" <IMG SRC=""" & barImage1& """ WIDTH=100% align= bottom  HEIGHT=" & CInt(data2(i)/hi1 * graphHeight)  & "/>" & chr(13))
  100.         response.Write(Cint(data2(i)/hi*graphHeight))
  101.         Response.Write(" </TD>" & chr(13))
  102.         'Response.Write("<td> </td>")
  103.         'Response.Write("<td> </td>")
  104.          'response.Write("<br>")
  105.          '
  106.          'response.Write("<br>")    
  107.     Next
  108.     'response.end
  109.  
  110.  
  111.     Response.Write("</TR>")
  112.     Response.Write("<TR><TD VALIGN=BOTTOM ALIGN=RIGHT>0</TD></TR>")
  113.  
  114.     'Write footer
  115.     Response.Write("<TR><TD ALIGN=RIGHT VALIGN=BOTTOM>" & axislabel & "</TD>" & chr(13))
  116.     for i = LBound(labels) to UBound(labels)
  117.         Response.Write("<TD VALIGN=BOTTOM ALIGN=CENTER>" & labels(i) & "</TD>" & chr(13))
  118.     next
  119.     Response.Write("</TR>" & chr(13))
  120.     Response.Write("</TABLE>")
  121. end sub
  122.  
  123.  
  124. %>
  125.  
  126. <HTML>
  127. <BODY>
  128. <CENTER>
  129. <% Call BarChart(data1Array,data2Array,labelArray,"Telephone Sales","Date") %>
  130. </CENTER>
  131. </BODY>
  132. </HTML>
  133.  
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
Expand|Select|Wrap|Line Numbers
  1. Response.Write(" <TD VALIGN=BASELINE ROWSPAN=2 WIDTH=" & widthpercent & "% >" & chr(13))
  2. Response.Write(" <IMG SRC=""" & barImage & """ WIDTH=100% align= bottom HEIGHT=" & CInt(data1(i)/hi * graphHeight)  & "/>" & chr(13))
  3. Response.Write(" <TD VALIGN=BASELINE ROWSPAN=2 WIDTH=" & widthpercent & "% >" & chr(13))
  4. Response.Write(" <IMG SRC=""" & barImage1& """ WIDTH=100% align= bottom  HEIGHT=" & CInt(data2(i)/hi1 * graphHeight)  & "/>" & chr(13))
  5.  
i am attatching a image file to make my problem more clear..
thank's..
Attached Images
File Type: jpg result.jpg (12.5 KB, 235 views)
Mar 25 '09 #1
2 1984
drhowarddrfine
7,435 Expert 4TB
Without the generated html and css, we won't be able to help you.
Mar 25 '09 #2
@drhowarddrfine
thanks....
its working fine now..............
Mar 26 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mick Turner | last post by:
I have connected to SQL Server database (server-side vbscript) and read some data from the tables. This works correctly. I now have the data in an array (server-side). I have to draw a...
3
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
9
by: Patrick.O.Ige | last post by:
I have a code below and its a PIE & BAR CHART. The values now are all static but I want to be able to pull the values from a database. Can you guys give me some ideas to do this? Thanks ...
8
by: LB | last post by:
Hello everybody I'm learning how to create pie chart using OWC. I'm able now to create a pie. But I can not figure out how to do the following : - for each pie, when mousing over, I would like...
18
by: Marcel Saucier | last post by:
Hello, I want to use the above characters codes chart but I dont know how to set the typeface (documentation: The characters that appear in Windows above 127 depend on the selected typeface). ...
3
by: C Did | last post by:
What's the best cheapest way to get pie charts on the web with my setup? Thanks!!
2
by: RoseW | last post by:
I suggested to a friend that a css controlled table would be preferrable to the existing chart produced in Excel stored at http://www.delmarcottages.ca/cottages/bookings/cottagebookings.htm They...
1
by: cubekid | last post by:
I am using OWC 11 in my new web application for displaying charts. Is it possible in OWC 11 to combine and display a column and a line graph (Looking like they overlap each other)? I tried it using...
1
by: aashishn86 | last post by:
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
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.