Displaying Source Code(s)
|
|
MkGraph Function
--------------------------------------------------------------------------------
Description : The MkGraph function creates a simple HTML graph.
The graph only displays properly in Internet Explorer browsers.
There are seven required arguments.
Parameters:
==========
Required Argument Expects Description
-----------------------------------------------------------------------------
arraytograph array (values should be double) array of data
(numbers) to be graphed
arrayofnames array (values should be strings) array of strings
containing the name of each corresponding
value from arraytograph.
bordersize integer integer representing the size of the border
around the graph. Use 0 for no border.
alignment string ("left", "center" or "right") alignment of
the graph on the page. Acceptable values
are: "left", "center" or "right".
width integer (1-100) integer 1 - 100 representing a
percentage out of 100% the total width
of the graph. The overall width of the graph
is still dependent on the size of the bars.
If the percentage declared in width is
smaller than the longest bar, the longest
bar is used as the width.
color string (hexadecimal) color of the bars in the
graph. Color must be a html hexadecimal
color starting with "#" - example: #0000FF
for blue
title string Title of the graph
<%
Private Function MkGraph(ByVal arraytograph, ByVal arrayofnames,
_
ByVal bordersize, ByVal alignment, _
ByVal width, ByVal color, ByVal title)
Dim i, tmp
tmp = "<TABLE BORDER=" & bordersize & " ALIGN=""" & _
alignment & """ WIDTH=""" & width & "%""><TR><TD>" & vbCrLf
tmp = tmp & "<CENTER><B>" & title & "</B></CENTER>" & vbCrLf
tmp = tmp & "<TABLE WIDTH=""100%"" STYLE=""font-size:7pt;"" " &
_
"ALIGN=CENTER>" & vbCrLf
For i = 0 To UBound( arraytograph )
tmp = tmp & "<TR><TD ALIGN=LEFT WIDTH=""5%"" " & _
"NOWRAP>" & CStr( arrayofnames( i ) ) & _
"</TD><TD ALIGN=CENTER " & _
"WIDTH=""5%"" NOWRAP>[ " & _
CDbl( arraytograph( i ) ) & " ]</TD><TD WIDTH" & _
"=""90%""><SPAN BGCOLOR=""" & color & _
""" STYLE=""width:" & _
CLng( 2 * (arraytograph( i ) / _
UBound( arraytograph ) + 4) ) & _
";background-color:" & color & _
";"" WIDTH=""" & CLng( 2 * (arraytograph( i ) / _
UBound( arraytograph ) + 4) ) & _
"""> </SPAN></TD></TR>" & vbCrLf
Next
tmp = tmp & "</TABLE>" & vbCrLf
tmp = tmp & "</TD></TR></TABLE>" & vbCrLf
MkGraph = tmp
End Function
%>
|
|
|