<%sub displayverticalgraph(strtitle,strytitle,strxtitle,avalues,alabels) '************************************************************************ ' user customizeable values for different formats ' of the graph ' FREEWARE!! ' Just tell me if you are going to use it - info@cool.co.za '************************************************************************ const GRAPH_HEIGHT = 300 'set up the graph height const GRAPH_WIDTH = 400 'set up the graph width const GRAPH_SPACING = 0 const GRAPH_BORDER = 0 'if you would like to see the borders to align things differently const GRAPH_BARS = 2 'loops through different colored bars e.g. 2 bars = gold,blue,gold,blue const USELOWVALUE = FALSE 'this uses the low value of the array as the value of origin (default = 0) const SHOWLABELS = TRUE 'set this to toggle whether or not the labels are shown const L_LABEL_SEPARATOR = "|" ' |Label const R_LABEL_SEPARATOR = "|" ' Label| const LABELSIZE = -4 const GRAPHBORDERSIZE = 1 const INTIMGBORDER = 1 'border around the bars Const ALT_TEXT = 3 'Changes the format of the alternate text of the bar image '1 = Labels ,2 = Values , 3 = Labels + Values , 4 = Percent '************************************************************************ 'array of different bars to loop through 'you can change the order of these 'Count = 10 '"dark_green","red","gold","blue","pink","light_blue","light_gold","orange","green","purple" 'cut and paste from here and insert into the agraph_bars array below Make sure the 'number specified in the const GRAPH_BARS is the same as or less than that in the array ' 7 graph_bars <= 7 elements in array '************************************************************************ agraph_bars = array("dark_green","red","gold","blue","pink","light_blue","light_gold","orange","green","purple") intmax = 0 'find the maximum value of the values array for i = 0 to ubound(avalues) if cint(intmax) < cint(avalues(i)) then intmax = cint(avalues(i)) next if uselowvalue then intmin = avalues(0) for i = 0 to ubound(avalues) if cint(intmin) > cint(avalues(i)) then intmin = cint(avalues(i)) next end if 'establish the graph multiplier graphmultiplier = round(graph_height-100/intmax) imgwidth = round(300/(ubound(avalues)+1)) if imgwidth > 16 then imgwidth = 16 %> width:100% height=<%=graph_height%>> <% count = 0%>
<%=strytitle%> height=50 align="center">

<%=strtitle%>

cellpadding = 0 cellspacing = <%=graph_spacing%>> <% '*******************MAIN PART OF THE CHART************************************ for i = 0 to ubound(avalues) strgraph = agraph_bars(count) if alt_text = 1 then stralt = alabels(i) elseif alt_text = 2 then stralt = avalues(i) elseif alt_text = 3 then stralt = alabels(i) &" - " &avalues(i) elseif alt_text = 4 then stralt = round(avalues(i) /intmax *100,2) &"%" end if if uselowvalue then %> <%else%> <%end if if count = graph_bars-1 then count = 0 else count = count + 1 end if next 'write out the border at the bottom of the bars also leave a blank cell for spacing on the right response.write "" if showlabels then %> <%for i = 0 to ubound(avalues)%> <%next%> <%end if%>
<%=intmax%>
<%if uselowvalue then response.write cstr(intmin) else response.write "0" end if %>
<%=strAlt%> <%=strAlt%> 
  " _ &"
   >" &l_label_separator &alabels(i) &r_label_separator %>
height=50 align="center"><%=strxtitle%>
<%end sub %> <% aMonthValues = array(1,9,0,23,28,31,13,22,31,7,1,14) aMonthNames = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") displayverticalgraph "TEST GRAPH","Y-AXIS","X-AXIS",aMonthValues,aMonthNames %>