 | 
September 8th, 2008, 05:22 PM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| | plotting graph using ASP or VB script ?
Does any one know how to plot this kind of graph ? Go to this kind to see the graph? http://www.ekopower.nl/index.htm
Help...help me !
| 
September 9th, 2008, 08:07 AM
|  | Moderator | | Join Date: Jan 2008 Location: Winchester, UK
Posts: 924
| |
Hi Ugene,
Welcome to Bytes.com! Any of these any good to you?
Dr B
| 
September 9th, 2008, 09:31 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
hey DrBunchman ...thanks alot...this is a great site..
| 
September 9th, 2008, 10:30 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
hey DrBunchman but i wanted to change my graph from histogram/bar graph to the zig-zag kind of graph...i find mostly is pie charts..how ?
| 
September 9th, 2008, 10:40 AM
|  | Moderator | | Join Date: Jan 2008 Location: Winchester, UK
Posts: 924
| |
How about this line graph example? Is that what you wanted?
Dr B
| 
September 10th, 2008, 03:17 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
Yes ! but i want to hardcode my figure in ..can i ?
| 
September 10th, 2008, 03:28 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
I tried by copying the database and the source code into the server side so then from the client side i unable to process the graph i saw it on the link u gave me ...how come ? Is it i have to change to file name and path and so on ?
| 
September 10th, 2008, 09:00 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
after i tried changing the path and stuff i only can get the graph by hardcoding the data..so i cannot get the data thru connecting the database given ..
but now i want to let it read the data from a excel file..how to read it ?how to set the connection ?
| 
September 12th, 2008, 02:45 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
hey DrBunchman do u know how to set the connection to read the figures on microsoft excel?i am able to set the and see the graph only when i hardcode in the figure...help !
| 
September 12th, 2008, 07:57 AM
|  | Moderator | | Join Date: Jan 2008 Location: Winchester, UK
Posts: 924
| |
Hi Ugene,
What code have you got so far? I presume that it is possible to use these graph objects with a connection so it's probably just a case of getting it set up correctly.
Dr B
| 
September 18th, 2008, 10:29 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
hi DrBunchman,i currently have these codes
--------------------------------------------------------------------------------------------------------------- - <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-
-
<%@ Language=VBScript %>
-
<%
-
' Set Connection Params
-
Set oConn = Server.CreateObject("ADODB.connection")
-
oConn.Open "Driver={Microsoft Excel Driver (*.xls)}; DriverId=790;" &_
-
"DBQ=C:\Inetpub\wwwroot\InfoWeb\14Apr08_NUS_hr_Data.xls;" &_
-
"DefaultDir = C:\Inetpub\wwwroot\InfoWeb\"
-
-
Set RS=Server.CreateObject("ADODB.recordset")
-
- ' Write the SQL Query
-
RS.open "SELECT * FROM my_range", oConn
-
-
do until RS.EOF
-
Response.Write ( RS("Item No") & " -- " & RS("Item Description") & "<br>")
-
RS.movenext
-
Loop
-
-
'Close the recordset/connection
-
-
RS.Close
-
oConn.Close
-
Set RS = Nothing
-
%>
-
-
-
-
-
<html>
-
<head>
-
<title>Pressure Chart</title>
-
</head>
-
<body>
-
-
-
<applet codebase="new" code="linegraph.class" height=220 width=360>
-
<param name="title" value="Sales">
-
<param name="NumberOfVals" value="<%=sqlQuery.RecordCount%>">
-
<param name="NumberOfLabs" value="<%=sqlQuery.RecordCount%>">
-
<PARAM NAME=ymax VALUE=<%=(Fix(sqlQuery("M")/10000)+1)*10000%>>
-
<PARAM NAME=ymin VALUE=0>
-
<PARAM NAME=mode VALUE=0>
-
<PARAM NAME=border VALUE="20"> <PARAM NAME=Grid VALUE="true">
-
<PARAM NAME=LineColor_R_L1 VALUE=53>
-
<PARAM NAME=LineColor_G_L1 VALUE=153>
-
<PARAM NAME=LineColor_B_L1 VALUE=51>
-
<%
-
i = 1
-
while (not sqlQuery.EOF) %>
-
<param name="VAL<%=i%>_L1" value="<%=sqlQuery("SalesTotal")%>">
-
<param name="LAB<%=i%>" value="<%=MonthName(Month(sqlQuery("Date")))%>">
-
<%
-
i = i + 1
-
sqlQuery.MoveNext
-
wend %>
-
-
</APPLET><p>
-
-
</body>
-
</html>
-------------------------------------------------------------------------------------------------------
So how do i set my range which i underline? there are error in the codes could you point out to me ? this is the error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[Microsoft][ODBC Excel Driver] The Microsoft Jet database engine could not find the object 'my_range'. Make sure the object exists and that you spell its name and the path name correctly.
/Infoweb/pressure.asp, line 15
Last edited by DrBunchman; September 18th, 2008 at 03:05 PM.
Reason: Added [Code] Tags - Please use the '#' button
| 
September 23rd, 2008, 04:14 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
hey DrBunchman..
Now i have got the connection correct..and now its able to display the data in the excel file on a browser in a table form..so now i have to plot it i alraedy got the applet working but now is how to get the connect between the applet with the data ?
below is the correct data for the connection between excel and ASP..so if any 1 need it can play around with it..
This is the working code between my ASP and excel..
------------------------------------------------------------------------------------------------------------ - <% Option Explicit %>
-
<html>
-
<body>
-
-
<%
-
Dim objConn, objRS, strSQL
-
Dim x, curValue
-
-
Set objConn = Server.CreateObject("ADODB.Connection")
-
objConn.Open "DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=NO; "&_
-
"DBQ=C:\Inetpub\wwwroot\InfoWeb\14Apr08_NUS_hr_Data.xls;"
-
-
strSQL = "SELECT * FROM D1:D170"
-
Set objRS=objConn.Execute(strSQL)
-
Response.Write("<table border=""1"">")
-
Response.Write("<tr>")
-
For x=0 To objRS.Fields.Count-1
-
Response.Write("<th>" & objRS.Fields(x).Name & "</th>")
-
Next
-
Response.Write("</tr>")
-
Do Until objRS.EOF
-
Response.Write("<tr>")
-
For x=0 To objRS.Fields.Count-1
-
curValue = objRS.Fields(x).Value
-
If IsNull(curValue) Then
-
curValue="N/A"
-
End If
-
curValue = CStr(curValue)
-
Response.Write("<td>" & curValue & "</td>")
-
Next
-
Response.Write("</tr>")
-
objRS.MoveNext
-
Loop
-
objRS.Close
-
Response.Write("</table>")
-
-
objConn.Close
-
Set objRS=Nothing
-
Set objConn=Nothing
-
%>
-
-
</body>
-
</html>
--------------------------------------------------------------------------
Below is the code of applet to plot the graph how to connect it?
that is a hardcoded in the applet.how to use this graph with the data displayed?
hope u could help me .
-------------------------------------------------------------------------
-----------------------------------------------------------------------
Last edited by DrBunchman; September 30th, 2008 at 08:09 AM.
Reason: Added [Code] Tags - Please use the '#' button
| 
September 29th, 2008, 02:23 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
hey DrBunchman,
did u miss my post?
| 
September 29th, 2008, 08:14 AM
|  | Moderator | | Join Date: Jan 2008 Location: Winchester, UK
Posts: 924
| |
Hi Ugene,
I've not used an applet like this before but I presume that you can build the applet dynamically using your asp code the same way that you have built a table from quering the excel spreadsheet.
Does this make sense?
Dr B
| 
September 30th, 2008, 02:55 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
DrBunchman ,
It sounds logical..to display in a table form is via <tr> & <td>. So what are the tags to display it into a line graph? It would be much easier as i don't have to pass it to another method. But do u konw how to go about doing this way ?
| 
September 30th, 2008, 08:11 AM
|  | Moderator | | Join Date: Jan 2008 Location: Winchester, UK
Posts: 924
| |
You have the tags already in your applet example.....rather than using <tr> & <td> you could maybe build the applet tags (e.g. <param />) using the server side code.
I don't know if this is actually possible - any other experts got any experience with this?
Dr B
| 
October 2nd, 2008, 01:53 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
hey DrBunchman ,
i manage to get the code out after playing around with it..thanks so much for the help and advise you gave me ! you have been a great help..
| 
October 3rd, 2008, 08:56 AM
|  | Moderator | | Join Date: Jan 2008 Location: Winchester, UK
Posts: 924
| |
Hey Ugene, I'm really pleased to hear you got it working. Perhaps you could let us know how you did it in case anyone else has a similar problem?
Thanks
Dr B
| 
October 7th, 2008, 09:28 AM
| | Newbie | | Join Date: Sep 2008
Posts: 14
| |
This is the final code which able to let user retrieve data from selected range of the excel file and plot it on a line graph. its here for any 1 that need :) |  |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|