Listing of GIF_LINES.ASPX

This is a listing of most of the script that produces the line graph. It generates a line graph using all the data from the database. Instead of showing numbers along the x-axis it uses the names of the days.

Some of the component properties need to be set to calibrate the axes and set the sizes of the lines and the points. Calibrating the x-axis manually is usually required when text is used instead of the numeric values. The origin is moved upwards to allow room for the day names.

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 ORDER BY Day", AConnection)
AConnection.Open
Dim DataReader As OleDbDataReader = ACommand.ExecuteReader

While DataReader.Read
 Graph.AddPoint(DataReader.Item("Day"), DataReader.Item("Red"), "ff0000", "Red")
 Graph.AddPoint(DataReader.Item("Day"), DataReader.Item("Blue"), "0000ff", "Blue")
 Graph.AddPoint(DataReader.Item("Day"), DataReader.Item("Green"), "00ff00",_
 "Green")
 Graph.AddPoint(DataReader.Item("Day"), DataReader.Item("Yellow"), "ffff00",_
 "Yellow")
 Graph.AddXValue(DataReader.Item("Day"), DataReader.Item("DayName"))
End While

AConnection.Close

Graph.Title = "All the combined results"
Graph.TitleX = 100
Graph.YAxisText = "Total for each day"
Graph.OriginY = 220
Graph.XOffset = 1
Graph.XTop = 7
Graph.XGrad = 1
Graph.UseXAxisLabels = true
Graph.LineWidth = 2
Graph.PointSize = 3
Graph.PointStyle = 1
Graph.GraphType = 3

Graph.GraphToBrowser(1)