News:

GinGly.com - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

Main Menu

MkGraph Function

Started by ganeshbala, Mar 21, 2009, 09:44 PM

Previous topic - Next topic

ganeshbala

MkGraph Function
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
%>