Utilizing some simple html and the output from an access db effective graphs can be produced without the need for third party components. The example data base contains the weekly highs (high), the week ending date (weekof) and stock split (split) info for Yahoo. The height of an image file (blue.jpg) is adjusted to the week ending high (high) and the alt for that image is set to the week ending date (weekof) and the value (high).
<%
accessdb="stocks"
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from yahoo order by weekof asc "
rs.Open sql, cn
%>
<div align="center">
<table cellspacing="0" cellpadding="0">
<tr>
<%
On Error Resume Next
rs.MoveFirst
' sets the low and high for the range equal to the 1st weeks high
low = rs("high")
high=rs("high")
do while Not rs.eof
%>
<td width="5" align="left" valign="bottom">
<img src="images/blue.jpg" width="5" height="<%= rs("high") %>"
alt="Week of <%= rs("weekof") %>, High was $<%= formatnumber(rs("high"),2) %>"></td>
<%
' if the current week is lower then the 1st or any lower week then place it in low
if low > rs("high") then
low = rs("high")
end if
' if the current week is higher then the 1st or any higher week then place it in high
if high < rs("high") then
high = rs("high")
end if
' what is the latest week
last_week=rs("weekof")
' counts the number of cells being used to generate the dynamic graph
count_cells=count_cells+1
' if there was a split add it to splits
if rs("split") <> "" then
splits= splits & "<br>" & rs("split") & "-" & rs("weekof")
end if
rs.MoveNext
loop
%>
<table cellspacing="0" cellpadding="0"><tr>
<td align="center" valign="top" width="<%= count_cells*5 %>">
<% rs.Movefirst %>
<br>
Yahoo Weekly Highs from <%= rs("weekof")%> to <%= last_week %>
<br>Low for this range : $<%= formatnumber(low,2) %>
<br>High for this range : $<%= formatnumber(high,2) %>
<br> <%= splits %>
</td></tr></table>
</div>
discuss this topic to forum
