Important alert: (current site time 7/15/2013 10:50:53 PM EDT)
 

VB icon

ASP bar chart

Email
Submitted on: 2/21/2000 1:00:00 PM
By: Noah Gates 
Level: Not Given
User Rating: By 5 Users
Compatibility: ASP (Active Server Pages)
Views: 31399
 
     This code is an example how to use a random color generator and a table to create a Bar Chart.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' 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
'
' 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 code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=1730&lngWId=4'for details.'**************************************

'-------------------------------------------------------------------------------
' This is a sample of how to create your own bar chart using ASP 
'-------------------------------------------------------------------------------
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<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>
</HEAD>
<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 
Randomize 
'-------------------------------------------------------------------------------
' 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))) 
rndcolor=color 
End Function 
%> 
<center>
<table border="0">
<td align="left"><img src="../../images/ac204.gif"></center></td>
<td></td>
<td align=center></td>
<td align="center"><h1><font color=blue>Inbound Calls </font><h1></td>
</table>
</center>
<center>
<table border="1">
<tr VALIGN=BOTTOM>
<% 
for I = 0 to 20 
	vol = int(chartinfo(I)) 
	label = int(chartinfo(I))
	
<td align="center"> 
<table> 
<td height="<% response.write vol %>" bgcolor="<% response.write rndcolor() %>" align="bottom"> 
<B><font color="#FFFFFF"><% response.write label %></B> 
</font></td></table></td> 
next 
%> 
</tr> 
<tr>
<%
for i = 0 to StatIndex
%>
<%if totals(i) > 0 then%>
<td>
<table>
<td><FONT face="Small Fonts" size=1 color="blue"><strong> <%response.write names(i)%> <strong><font></td>
</table>
<%end if%>
<%next%>
</td>
</tr>
</table>
</center>
</BODY>
</HTML>
ngates@partnershealth.com


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
9/6/2000 9:04:52 AMGene

Could you tell me where to find the images and the stylesheet?
(If this comment was disrespectful, please report it.)

 
10/15/2000 7:53:57 PMKevin

Where are the comments at? How about a option explicit? Spent some time with this and am having problems getting it going. Has anyone been successful with this?
(If this comment was disrespectful, please report it.)

 
6/10/2002 7:22:06 AMannie

can we generate graphs using aspPlease let me know how to do that
(If this comment was disrespectful, please report it.)

 
8/29/2002 9:50:15 PMFoo

These codes has the promise of meeting my simple bar-chart requirement. But, it's full of "bugs". Many things are missing, including "%>", css file, Inboundstats.asp? and whatever else. Noah, Will appreciate it if you can relook at the whole codes and include those missing files.
(If this comment was disrespectful, please report it.)

 
9/23/2002 4:44:35 AM

Can teach me how to draw bar charts using vbscript? Thanks
(If this comment was disrespectful, please report it.)

 
7/28/2004 4:11:24 PM

Hi looks like something missing somewhere...I would be pleased if you can help me by creating chart from data found in an Access database. Thanks.
(If this comment was disrespectful, please report it.)

 
5/7/2005 4:56:27 AM

Hi, Dear

Kindly inform to u that it is good code for Chat.

All the Best

Bye
Regards,
Ashok Kr. Gupta

(If this comment was disrespectful, please report it.)

 
4/29/2007 11:32:40 AMRaoof

Please tell where is image and style sheet
(If this comment was disrespectful, please report it.)

 
4/30/2007 3:54:35 AMRaoof

Could you tell me where to find the images and the stylesheet?

(If this comment was disrespectful, please report it.)

 

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.