VB icon

ASP bar chart

Submitted on: 1/2/2015 4:50:00 AM
By: Noah Gates (from psc cd)  
Level: Not Given
User Rating: By 5 Users
Compatibility: ASP (Active Server Pages)
Views: 6316
     This code is an example how to use a random color generator and a table to create a Bar Chart.
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
' Name: ASP bar chart
' Description:This code is an example how to use a random color generator and a table to create a Bar Chart.
' By: Noah Gates (from psc cd)
' Inputs:Numeric values to graph
' Assumes:The code is an example only. The user will need to adjust it to display the data which they wish to graph.

' This is a sample of how to create your own bar chart using ASP 
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Document Title</TITLE>
<basefont FACE="Arial, Helvetica, sans-serif" size=2>
<link REL="STYLESHEET" HREF="../../Stylesheets/MENUPAGES.css">
<body BACKGROUND="../../Images/Redside/Background/Back2.jpg" BGCOLOR="White">
<STYLE MEDIA="print">/* turn off navigation and ad bar */
#header, .menu, .header, #adbar, DIV#jumpbar, #navbar {display: none}
/* remove position of contents */#why {position: static; width: auto}
/* cleanup all the colors */#why H3, PRE, FONT {color: black}
/* cleanup the copyright */
DIV#why P.copyright {color: black; font: 10pt verdana}
/* display the print header */#printMessage {display: block} </STYLE>
Dim totals(30)
Dim Names(30) 
StatIndex = -1
<FORM ACTION="Inboundstats.asp" METHOD="POST" NAME="Inboundstats">
On Error Resume Next 
' Purpose: To generate random colors
Function rndcolor() 
DIM LightDarkRange 
LightDarkRange = 150 
forered = Int(Rnd * LightDarkRange) 
foregreen = Int(Rnd * LightDarkRange) 
foreblue = Int(Rnd * LightDarkRange) 
color = "#" & cstr(Hex(RGB(forered, foregreen, foreblue))) 
End Function 
<table border="0">
<td align="left"><img src="../../images/ac204.gif"></center></td>
<td align=center></td>
<td align="center"><h1><font color=blue>Inbound Calls </font><h1></td>
<table border="1">
for I = 0 to 20 
	vol = int(chartinfo(I)) 
	label = int(chartinfo(I))
<td align="center"> 
<td height="<% response.write vol %>" bgcolor="<% response.write rndcolor() %>" align="bottom"> 
<B><font color="#FFFFFF"><% response.write label %></B> 
for i = 0 to StatIndex
<%if totals(i) > 0 then%>
<td><FONT face="Small Fonts" size=1 color="blue"><strong> <%response.write names(i)%> <strong><font></td>
<%end if%>

Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.