473,395 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

plotting graph using ASP or VB script ?

14
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 !
Sep 8 '08 #1
18 4901
DrBunchman
979 Expert 512MB
Hi Ugene,

Welcome to Bytes.com! Any of these any good to you?

Dr B
Sep 9 '08 #2
Ugene
14
hey DrBunchman ...thanks alot...this is a great site..
Sep 9 '08 #3
Ugene
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 ?
Sep 9 '08 #4
DrBunchman
979 Expert 512MB
How about this line graph example? Is that what you wanted?

Dr B
Sep 9 '08 #5
Ugene
14
Yes ! but i want to hardcode my figure in ..can i ?
Sep 10 '08 #6
Ugene
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 ?
Sep 10 '08 #7
Ugene
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 ?
Sep 10 '08 #8
Ugene
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 !
Sep 12 '08 #9
DrBunchman
979 Expert 512MB
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
Sep 12 '08 #10
Ugene
14
hi DrBunchman,i currently have these codes
---------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  2.  
  3. <%@ Language=VBScript %>
  4. <%
  5. ' Set Connection Params
  6. Set oConn = Server.CreateObject("ADODB.connection")
  7. oConn.Open "Driver={Microsoft Excel Driver (*.xls)}; DriverId=790;" &_
  8. "DBQ=C:\Inetpub\wwwroot\InfoWeb\14Apr08_NUS_hr_Data.xls;" &_
  9. "DefaultDir = C:\Inetpub\wwwroot\InfoWeb\"
  10.  
  11. Set RS=Server.CreateObject("ADODB.recordset")
  12.  
  13. ' Write the SQL Query
  14. RS.open "SELECT * FROM my_range", oConn
  15.  
  16. do until RS.EOF
  17. Response.Write ( RS("Item No") & " -- " & RS("Item Description") & "<br>")
  18. RS.movenext
  19. Loop
  20.  
  21. 'Close the recordset/connection
  22.  
  23. RS.Close
  24. oConn.Close
  25. Set RS = Nothing
  26. %>
  27.  
  28.  
  29.  
  30.  
  31. <html>
  32. <head>
  33.     <title>Pressure Chart</title>
  34. </head>
  35. <body>
  36.  
  37.  
  38. <applet codebase="new" code="linegraph.class" height=220 width=360>
  39.     <param name="title" value="Sales">
  40.     <param name="NumberOfVals" value="<%=sqlQuery.RecordCount%>">
  41.     <param name="NumberOfLabs" value="<%=sqlQuery.RecordCount%>">
  42.     <PARAM NAME=ymax VALUE=<%=(Fix(sqlQuery("M")/10000)+1)*10000%>>
  43.     <PARAM NAME=ymin VALUE=0>
  44.     <PARAM NAME=mode VALUE=0>
  45.     <PARAM NAME=border VALUE="20">    <PARAM NAME=Grid VALUE="true">
  46.     <PARAM NAME=LineColor_R_L1 VALUE=53>
  47.     <PARAM NAME=LineColor_G_L1 VALUE=153>
  48.     <PARAM NAME=LineColor_B_L1 VALUE=51>    
  49. <%
  50. i = 1
  51. while (not sqlQuery.EOF) %>
  52.     <param name="VAL<%=i%>_L1" value="<%=sqlQuery("SalesTotal")%>">
  53.     <param name="LAB<%=i%>" value="<%=MonthName(Month(sqlQuery("Date")))%>">
  54. <%
  55. i = i + 1
  56. sqlQuery.MoveNext
  57. wend %>
  58.  
  59. </APPLET><p>
  60.  
  61. </body>
  62. </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
Sep 18 '08 #11
Ugene
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..
------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <% Option Explicit %>
  2. <html>
  3. <body>
  4.  
  5. <%
  6. Dim objConn, objRS, strSQL
  7. Dim x, curValue
  8.  
  9. Set objConn = Server.CreateObject("ADODB.Connection")
  10. objConn.Open "DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=NO; "&_
  11.     "DBQ=C:\Inetpub\wwwroot\InfoWeb\14Apr08_NUS_hr_Data.xls;"
  12.  
  13. strSQL = "SELECT * FROM D1:D170"
  14. Set objRS=objConn.Execute(strSQL)
  15. Response.Write("<table border=""1"">")
  16. Response.Write("<tr>")
  17. For x=0 To objRS.Fields.Count-1
  18.    Response.Write("<th>" & objRS.Fields(x).Name & "</th>")
  19. Next
  20. Response.Write("</tr>")
  21. Do Until objRS.EOF
  22.     Response.Write("<tr>")
  23.     For x=0 To objRS.Fields.Count-1
  24.         curValue = objRS.Fields(x).Value
  25.         If IsNull(curValue) Then
  26.             curValue="N/A"
  27.         End If
  28.         curValue = CStr(curValue)
  29.         Response.Write("<td>" & curValue & "</td>")
  30.     Next
  31.     Response.Write("</tr>")
  32.     objRS.MoveNext
  33. Loop
  34. objRS.Close
  35. Response.Write("</table>")
  36.  
  37. objConn.Close
  38. Set objRS=Nothing
  39. Set objConn=Nothing
  40. %>
  41.  
  42. </body>
  43. </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 .
-------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <APPLET CODE="linegraph.class" HEIGHT=220 WIDTH=360>
  2. <PARAM NAME=NumberOfVals VALUE=36>
  3. <PARAM NAME=NumberOfLabs VALUE=4>
  4. <PARAM NAME=KeyWidth VALUE=70>
  5.  
  6. <PARAM NAME=LineColor_R_L1 VALUE=0>
  7. <PARAM NAME=LineColor_G_L1 VALUE=0>
  8. <PARAM NAME=LineColor_B_L1 VALUE=200>
  9.  
  10. <PARAM NAME=LineColor_R_L2 VALUE=200>
  11. <PARAM NAME=LineColor_G_L2 VALUE=0>
  12. <PARAM NAME=LineColor_B_L2 VALUE=0>
  13.  
  14. <PARAM NAME=yMax VALUE=30>
  15. <PARAM NAME=yMin VALUE=-10>
  16. <PARAM NAME=Mode VALUE=0>
  17. <PARAM NAME=Lines VALUE=2>
  18. <PARAM NAME=Title VALUE="NET PROFIT (K$)">
  19. <PARAM NAME=Border VALUE="30">
  20. <PARAM NAME=Grid VALUE="true">
  21.  
  22. <PARAM NAME=VAL1_L1 VALUE=10.3>
  23. <PARAM NAME=VAL2_L1 VALUE=11.0>
  24. <PARAM NAME=VAL3_L1 VALUE=14.5>
  25. <PARAM NAME=VAL4_L1 VALUE=12.20>
  26. <PARAM NAME=VAL5_L1 VALUE=15.0>
  27. <PARAM NAME=VAL6_L1 VALUE=12.5>
  28. <PARAM NAME=VAL7_L1 VALUE=20.5>
  29. <PARAM NAME=VAL8_L1 VALUE=22.5>
  30. <PARAM NAME=VAL9_L1 VALUE=18.8>
  31. <PARAM NAME=VAL10_L1 VALUE=24>
  32. <PARAM NAME=VAL11_L1 VALUE=27.8>
  33. <PARAM NAME=VAL12_L1 VALUE=29>
  34. <PARAM NAME=VAL13_L1 VALUE=26.9>
  35. <PARAM NAME=VAL14_L1 VALUE=22.4>
  36. <PARAM NAME=VAL15_L1 VALUE=18.0>
  37. <PARAM NAME=VAL16_L1 VALUE=14.8>
  38. <PARAM NAME=VAL17_L1 VALUE=7.5>
  39. <PARAM NAME=VAL18_L1 VALUE=3.2>
  40. <PARAM NAME=VAL19_L1 VALUE=-4.6>
  41. <PARAM NAME=VAL20_L1 VALUE=-2.0>
  42. <PARAM NAME=VAL21_L1 VALUE=1.8>
  43. <PARAM NAME=VAL22_L1 VALUE=2.5>
  44. <PARAM NAME=VAL23_L1 VALUE=-1.1>
  45. <PARAM NAME=VAL24_L1 VALUE=2.5>
  46. <PARAM NAME=VAL25_L1 VALUE=11.9>
  47. <PARAM NAME=VAL26_L1 VALUE=16.6>
  48. <PARAM NAME=VAL27_L1 VALUE=12.6>
  49. <PARAM NAME=VAL28_L1 VALUE=18.7>
  50. <PARAM NAME=VAL29_L1 VALUE=23.9>
  51. <PARAM NAME=VAL30_L1 VALUE=19.9>
  52. <PARAM NAME=VAL31_L1 VALUE=19.5>
  53. <PARAM NAME=VAL32_L1 VALUE=23.5>
  54. <PARAM NAME=VAL33_L1 VALUE=19.0>
  55. <PARAM NAME=VAL34_L1 VALUE=22.5>
  56. <PARAM NAME=VAL35_L1 VALUE=22.9>
  57. <PARAM NAME=VAL36_L1 VALUE=24.6>
  58.  
  59. <PARAM NAME=VAL1_L2 VALUE=14.3>
  60. <PARAM NAME=VAL2_L2 VALUE=12.0>
  61. <PARAM NAME=VAL3_L2 VALUE=11.5>
  62. <PARAM NAME=VAL4_L2 VALUE=17.20>
  63. <PARAM NAME=VAL5_L2 VALUE=12.0>
  64. <PARAM NAME=VAL6_L2 VALUE=13.5>
  65. <PARAM NAME=VAL7_L2 VALUE=25.5>
  66. <PARAM NAME=VAL8_L2 VALUE=21.5>
  67. <PARAM NAME=VAL9_L2 VALUE=11.8>
  68. <PARAM NAME=VAL10_L2 VALUE=14>
  69. <PARAM NAME=VAL11_L2 VALUE=17.8>
  70. <PARAM NAME=VAL12_L2 VALUE=19>
  71. <PARAM NAME=VAL13_L2 VALUE=16.9>
  72. <PARAM NAME=VAL14_L2 VALUE=22.4>
  73. <PARAM NAME=VAL15_L2 VALUE=28.0>
  74. <PARAM NAME=VAL16_L2 VALUE=24.8>
  75. <PARAM NAME=VAL17_L2 VALUE=9.5>
  76. <PARAM NAME=VAL18_L2 VALUE=6.2>
  77. <PARAM NAME=VAL19_L2 VALUE=4.6>
  78. <PARAM NAME=VAL20_L2 VALUE=12.0>
  79. <PARAM NAME=VAL21_L2 VALUE=8.8>
  80. <PARAM NAME=VAL22_L2 VALUE=9.5>
  81. <PARAM NAME=VAL23_L2 VALUE=11.1>
  82. <PARAM NAME=VAL24_L2 VALUE=7.5>
  83. <PARAM NAME=VAL25_L2 VALUE=14.9>
  84. <PARAM NAME=VAL26_L2 VALUE=15.6>
  85. <PARAM NAME=VAL27_L2 VALUE=16.6>
  86. <PARAM NAME=VAL28_L2 VALUE=11.7>
  87. <PARAM NAME=VAL29_L2 VALUE=21.9>
  88. <PARAM NAME=VAL30_L2 VALUE=16.9>
  89. <PARAM NAME=VAL31_L2 VALUE=13.5>
  90. <PARAM NAME=VAL32_L2 VALUE=25.5>
  91. <PARAM NAME=VAL33_L2 VALUE=19.9>
  92. <PARAM NAME=VAL34_L2 VALUE=22.9>
  93. <PARAM NAME=VAL35_L2 VALUE=22.1>
  94. <PARAM NAME=VAL36_L2 VALUE=24.1>
  95.  
  96. <PARAM NAME=LAB1 VALUE="1999">
  97. <PARAM NAME=LAB2 VALUE="2000">
  98. <PARAM NAME=LAB3 VALUE="2001">
  99. <PARAM NAME=LAB4 VALUE="2002">
  100.  
  101. <PARAM NAME=Key_L1 VALUE="ABC Corp">
  102. <PARAM NAME=Key_L2 VALUE="XYZ Corp">
  103.  
  104. </APPLET>
-----------------------------------------------------------------------
Sep 23 '08 #12
Ugene
14
hey DrBunchman,

did u miss my post?
Sep 29 '08 #13
DrBunchman
979 Expert 512MB
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
Sep 29 '08 #14
Ugene
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 ?
Sep 30 '08 #15
DrBunchman
979 Expert 512MB
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
Sep 30 '08 #16
Ugene
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..
Oct 2 '08 #17
DrBunchman
979 Expert 512MB
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
Oct 3 '08 #18
Ugene
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 :)


Expand|Select|Wrap|Line Numbers
  1. <% Option Explicit %>
  2. <html>
  3. <HEAD><TITLE>Line Graph Of Wind Speed</TITLE></HEAD>
  4. <body>
  5.  
  6. <APPLET CODE="linegraph.class" HEIGHT=400 WIDTH=900>
  7.  
  8.  
  9. <%
  10. Dim objConn, objRS, strSQL
  11. Dim x, i, curValue
  12.  
  13. Set objConn = Server.CreateObject("ADODB.Connection")
  14. objConn.Open "DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=NO; "&_
  15.     "DBQ=C:\Inetpub\wwwroot\InfoWeb\14Apr08_NUS_hr_Data.xls;"
  16.  
  17. %>
  18.  
  19.  
  20. <PARAM NAME=NumberOfVals VALUE="24">
  21. <PARAM NAME=NumberOfLabs VALUE="24">
  22.  
  23.  
  24. <PARAM NAME=LineColor_R_L1 VALUE=0>
  25. <PARAM NAME=LineColor_G_L1 VALUE=0>
  26. <PARAM NAME=LineColor_B_L1 VALUE=255>
  27.  
  28. <PARAM NAME=ymax VALUE=4>
  29. <PARAM NAME=ymin VALUE=0>
  30. <PARAM NAME="lines" VALUE=10>
  31. <PARAM NAME="borderright" VALUE=20>
  32. <PARAM NAME="borderleft" VALUE=30>
  33. <PARAM NAME="bordertop" VALUE=20>
  34. <PARAM NAME="borderbase" VALUE=20>
  35. <PARAM NAME="bg_r" VALUE=220>
  36. <PARAM NAME="bg_g" VALUE=240>
  37. <PARAM NAME="bg_b" VALUE=255>
  38. <PARAM NAME="border_r" VALUE=100>
  39. <PARAM NAME="border_g" VALUE=100>
  40. <PARAM NAME="border_b" VALUE=250>
  41. <PARAM NAME="linewidth" VALUE=2>
  42. <PARAM NAME="showpoints" VALUE=1>
  43. <PARAM NAME=fontsize VALUE=13>
  44. <PARAM NAME=Title VALUE="Wind Speed (m/s)">
  45. <PARAM NAME=Border VALUE="30">
  46. <PARAM NAME=Grid VALUE="true">
  47.  
  48. <PARAM NAME=LAB1 VALUE="0100">
  49. <PARAM NAME=LAB2 VALUE="0200">
  50. <PARAM NAME=LAB3 VALUE="0300">
  51. <PARAM NAME=LAB4 VALUE="0400">
  52. <PARAM NAME=LAB5 VALUE="0500">
  53. <PARAM NAME=LAB6 VALUE="0600">
  54. <PARAM NAME=LAB7 VALUE="0700">
  55. <PARAM NAME=LAB8 VALUE="0800">
  56. <PARAM NAME=LAB9 VALUE="0900">
  57. <PARAM NAME=LAB10 VALUE="1000">
  58. <PARAM NAME=LAB11 VALUE="1100">
  59. <PARAM NAME=LAB12 VALUE="1200">
  60. <PARAM NAME=LAB13 VALUE="1300">
  61. <PARAM NAME=LAB14 VALUE="1400">
  62. <PARAM NAME=LAB15 VALUE="1500">
  63. <PARAM NAME=LAB16 VALUE="1600">
  64. <PARAM NAME=LAB17 VALUE="1700">
  65. <PARAM NAME=LAB18 VALUE="1800">
  66. <PARAM NAME=LAB19 VALUE="1900">
  67. <PARAM NAME=LAB20 VALUE="2000">
  68. <PARAM NAME=LAB21 VALUE="2100">
  69. <PARAM NAME=LAB22 VALUE="2200">
  70. <PARAM NAME=LAB23 VALUE="2300">
  71. <PARAM NAME=LAB24 VALUE="0000">
  72.  
  73.  
  74. <%
  75. strSQL = "SELECT * FROM G2:G26"
  76. Set objRS=objConn.Execute(strSQL)
  77.  
  78. i=1
  79. Do Until objRS.EOF
  80.  
  81.     For x=0 To objRS.Fields.Count-1
  82. %>        
  83.     <PARAM NAME="VAL<%=i%>_L1" VALUE="<%=objRS.Fields(x).Value%>">
  84. <%    Next
  85.     i = i + 1
  86.     objRS.MoveNext
  87. Loop
  88. objRS.Close
  89. %>
  90.  
  91. <%
  92. objConn.Close
  93. Set objRS=Nothing
  94. Set objConn=Nothing
  95. %>
  96.  
  97.  
  98.  
  99.  
  100.  
  101. </APPLET>
  102.  
  103. </body>
  104. </html>
Oct 7 '08 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: KevinGPO | last post by:
I am making a monitor program for the PC. My monitor program will grab statistics about CPU and memory every 1 or 5 seconds. Then I want to store this data so I have a history and hence be able to...
12
by: Russ | last post by:
I'm interested in setting up a web page where live data can be displayed in real-time on the web page. For example: I would like to display a (nice looking) graph of some data value versus time...
11
by: Chapman | last post by:
Is it possible to plot the graph as an output of my program in C? It can be a simple graph as quadratic curves for example or a correlation between 2 variables only. Thanks
1
by: wayne | last post by:
i want to plot a line graph. The values that I obtain are the RGB value of a TIFF image. i m plotting RGB values vs value(1,2,3..) so when generated the RGB values, there will b a column of values...
3
by: i | last post by:
Hi, I'm working with an array of nodes, numbering roughly in the thousands. Each node has at least one, but up to four, references to another node - North, South, East, or West. I'm trying to...
7
by: diffuser78 | last post by:
My python program spits lot of data. I take that data and plot graphs using OfficeOrg spredsheet. I want to automate this task as this takes so much of time. I have some questions. 1. Which is...
4
by: Gouri | last post by:
Hi, Got a query regarding plotting a preview / thumbnail for a graph which reads data from a binary file. The preview should should take very less time, look exactly like the original graph i.e....
3
by: 9966 | last post by:
Greetings, I'm currently having problem in plotting a simple graph in C++. I learned that we can actually use koolplot to do it. My question is whether it is possible to plot, let's say the...
2
by: Durand | last post by:
Hi, I'm trying to plot a simple graph against date or time using matplotlib. I've read about date_plot but I'm not really sure how to use it. At the moment, I have some data arranged into lists,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.