Listing of GIF_BARSBYDAY.ASPX

This is a listing of the script that generates a bar chart for each record. The calling page calls this script with a URL variable called "Day", which is used to select the correct record from the database.

The csASPNetGraph AddData method is called for each field and the data value is read directly from the database. It uses all the default property settings which simplifies the script although it could be preferable to specify the top of the YAxis and the graduations (YTop and YGrad) to ensure that each graph uses the same scale.

Dim Graph As New GraphClass

Dim AConnection As OleDbConnection = _
 New OleDbConnection("PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" &_
 Server.Mappath("data.mdb"))
Dim ACommand As OleDbCommand = _
 New OleDbCommand("SELECT * FROM Table1 WHERE Day=" & Request.QueryString("Day"),_
 AConnection)
AConnection.Open
Dim DataReader As OleDbDataReader = ACommand.ExecuteReader
DataReader.Read

Graph.AddData("Red", DataReader.Item("Red"), "ff0000")
Graph.AddData("Blue", DataReader.Item("Blue"), "0000ff")
Graph.AddData("Green", DataReader.Item("Green"), "00ff00")
Graph.AddData("Yellow", DataReader.Item("Yellow"), "ffff00")
Graph.Title = "Results for day " Request.QueryString("Day")
Graph.TitleX = 100
Graph.GraphType = 1

AConnection.Close

Graph.GraphToBrowser(1)