line graph
Hi all,
Im trying to draw a line graph using asp. Ive downloaded the required dll file, however whenever i try to run the code i get the error message 20/07/04 is not a valid floating point. Below is my code
<%@ language=vbscript %>
<%
Dim strConnect
%>
<!-- metadata type="typelib"
file="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
'This script generates a line graph using all the data from the database.
'It shows 4 different lines for the 4 different sets of values.
'Instead of showing numbers along the x-axis it uses the names of the days.
Response.Expires = 0
Response.Buffer = true
Response.Clear
'Use one of the following lines depending on the component version
'Set Chart = Server.CreateObject("csDrawGraph.Draw")
Set Chart = Server.CreateObject("csDrawGraphTrial.Draw")
Set objRS = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT * FROM tbl_furnace_test ORDER BY Date"
objRS.Open strSql, strConnect
While Not objRS.Eof
Chart.AddPoint CLng(CDate(objRS("Date"))), CInt(objRS("Case_Depth_Flank")), "ff0000", "Red"
Chart.AddPoint CLng(CDate(objRS("Date"))), CInt(objRS("Case_Depth_Root")), "0000ff", "Blue"
'Chart.AddXValue objRS("Date"), objRS("Date")
objRS.MoveNext
Wend
'Close the database at the first opportunity
objRS.Close
'The following component properties are set.
'XOffset starts the x-axis at 1 instead of 0.
'XTop and XGrad calibrate the x-axis instead of allowing the component to do it.
Chart.UseXAxisDates = true
Chart.Title = "Case Depth"
Chart.TitleX = 100
Chart.YAxisText = "Case Depth"
Chart.OriginY = 220
Chart.XOffset = CLng(CDate("19-07-04"))
Chart.XTop = CLng(CDate("24-07-04"))
Chart.XGrad = 1
Chart.UseXAxisLabels = true
Chart.LineWidth = 2
Chart.PointSize = 3
Chart.PointStyle = 1
'Finally the image is sent to the browser in GIF format
Response.ContentType = "image/gif"
Response.BinaryWrite Chart.GIFLine
Response.End
%>
Any help will be much appreciated, oh all the dates in the database are stored in the format dd-mm-yy. Is there any easier way of doing this?
many thanks
Paul
|