4. if u give code with some basic example, it will be beyond price for me
Ok, here is what I worked up:
-
<% option explicit %>
-
<!-- #include virtual="common/adovbs.inc" -->
-
<%
-
dim objConn, objRS, query, file, names(5), hours(5), i
-
-
names(0) = "George"
-
names(1) = "Freeda"
-
names(2) = "Hercules"
-
names(3) = "Agatha"
-
names(4) = "Francois"
-
hours(0) = 17
-
hours(1) = 25
-
hours(2) = 40
-
hours(3) = 12
-
hours(4) = 36
-
-
file = "graphAspTest.xls"
-
set objConn = server.createobject("ADODB.connection")
-
objConn.open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source="&_
-
server.mapPath(File)&"; Extended Properties=Excel 8.0;"
-
-
query = "SELECT * FROM [data$]"
-
query = query & " ORDER BY nums"
-
set objRS = server.createobject("adodb.recordset")
-
objRS.open query, objConn, adopenDynamic, adlockOptimistic
-
-
for i = 0 to 4
-
objRS("names") = names(i)
-
objRS("hoursWorked") = hours(i)
-
objRS.update
-
objRS.movenext
-
next
-
-
objRS.close
-
objConn.close
-
response.redirect "graphAspTest.xls"
-
%>
-
So I made an Excel file with one worksheet titled "data" which had just a few columns ("names" and "hoursWorked"). I entered dummy data that Excel could use to generate a graph, then put the graph on as a separate sheet. I saved it with the graph showing.
Then when I run the asp, it opens the Excel file, changes the dummy data to the actual data I want to graph, and closes it, then redirects the user to open the excel file (which opens showing the graph page).
I tested it at the following URL:
www.worksonline.org/temp/graphAspTest.asp
The drawbacks are that you need the excel file and the graph to already exist. I tried to re-size the number of data points on the graph, but I couldn't get it to work. Sorry. It looks like if you ever need a different number of data points, you will need to modify the excel file using MS Excel.
I don't know if there is any other way to do this, maybe you could look up the data format for a WMF (recognized by all of the MS office software, and can be used to store graphs) and generate one that way, but I'm not sure many browsers would be able to handle it.
Please let me know if this helps.
Jared