<<
############################################################ /#
# BAR GRAPH /#
# This page takes a text file and converts it to a bar /#
# chart made out of HTML table elements. For educational /#
# purposes. Can be used along with live Polls or data /#
# exported from databases or spreadsheets. No Java. /#
# By Keith Jamison /#
# Features: /#
# -- Turn on/off vertical or horizontal rules /#
# -- Set colors and fonts as needed /#
############################################################ /#
############################################################ /#
# Edit parameters below to modify look of chart /#
############################################################ /#
show.datafile="chart1.txt" # comma-delimited data file /#
# horizontal data is placed in column one and heights /#
# are placed in column 2. See the file "chart1.txt" /#
k_chart.width = 150 # chart width /#
k_chart.height = 150 # chart height /#
bgcolor = '#c4c4c4' # chart background color /#
show.barwidth=20 # width of chart bar /#
show.barcolor="#FF0000" # color of chart bar /#
show.verticalrule = "FALSE" # Show vertical scale, if TRUE /#
show.horizontalrule = "TRUE" # Show horizontal Scale, if TRUE /#
show.value = "TRUE" # Show data values, if TRUE /#
show.verticalface = "arial" # font of vertical scale /#
show.verticalsize = "2"
show.verticalcolor = "black"
show.valueface = "arial" # font of data values /#
show.valuesize = "1"
show.valuecolor = "blue"
show.horizontalface = "arial" # font of horizontal scale /#
show.horizontalsize = "1"
show.horizontalcolor="purple"
############################################################ /#
>>
<html>
<body bgcolor=#ffffff>
<<
################################/#
# PLACE THIS OVERLAY WHERE YOU /#
# WISH TO DISPLAY YOUR CHART /#
################################/#
copy file=show.datafile ts="," to trap /copy
tp = getcol(trap,1)
tp2 = getcol(trap,2)
k_chart = merge(tp2,tp)
tmp="0"
FOR NAME=k_chart ROWNAME=k_chart_row DO
IF tmp=0 THEN
min_x=k_chart_row[1,1]
max_x=k_chart_row[1,1]
tmp="1"
ELSE
IF k_chart_row[1,1] < min_x THEN min_x=k_chart_row[1,1] /IF
IF k_chart_row[1,1] > max_x THEN max_x=k_chart_row[1,1] /IF
/IF
/FOR
tmp = 0.75*(k_chart.height/max_x)
tmp1 = tmp*max_x
display
'<table border=0 bgcolor=#c4c4c4 cellspacing=0 width='+
k_chart.width+' height='+k_chart.height+'><tr>'
/display
if show.verticalrule="TRUE" then
display '<td valign=bottom align=right rowspan=1>' /display
display '<table border=0 height='+k_chart.height+'>' /display
i=round(k_chart.height/50)
while i>1 do
display
'<tr><td valign=bottom align=right><font face='+
show.verticalface+' size='+show.verticalsize+
' color='+show.verticalcolor+'>'+
roundsig((i/round(k_chart.height/50))*max_x,1)+
'</font></td></tr>'
/display
i=i-1
/while
if i=1 then
display
'<tr><td valign=center align=right><font face='+
show.verticalface+' size='+show.verticalsize+
' color='+show.verticalcolor+'>'+
roundsig((i/round(k_chart.height/50))*max_x,1)+
'</font></td></tr>'
/display
/if
display '</table></td>' /display
else
display '<td> </td>' /display
/if
tmp = 0.9*(k_chart.height/max_x)
for name=i value=1 to rows(k_chart) do
if show.value = "TRUE" then tmp2=k_chart[1,i] /if
display
'<td valign=bottom align=center><font face='+
show.valueface+' size='+show.valuesize+
' color='+show.valuecolor+'>'+roundsig(tmp2,1)+'</font><br>'
/display
display
'<table border=0 width='+show.barwidth+' height='+tmp*k_chart[1,i]+'>'+
'<tr><td bgcolor='+show.barcolor+'> </td></tr></table>'
/display
/for
display '</tr>' /display
if show.horizontalrule="TRUE" then
display '<tr><td> </td>' /display
for name=i value=1 to rows(k_chart) do
display
'<td align=center><font face='+show.horizontalface+
' size='+show.horizontalsize+' color='+
show.horizontalcolor+'>'+roundsig(k_chart[2,i],1)+
'</td>'
/display
/for
display '</tr>' /display
/if
display '</table>' /display
>>
</html>