Using the chart control in Office2000 in ASP

Source: Internet
Author: User
Tags chr microsoft frontpage microsoft help
Using the chart control in Office2000 in ASP
--Microsoft Office Chart 9.0 make a chart
A while ago in order to make a chart, see all the articles in the forum, but mostly with aspchart,shortgraph and other components, these components are mostly foreign development to money. If you use Office Ms Chart, the results are often unsatisfactory. If you've ever used an Excel chart in Office2000, you should be impressed by the first class effect. Want to move him to your website? No problem, now you can also use ASP and VBScript to achieve the powerful features and wonderful results of Microsoft Office Chart 9.0.
example, use the data in the ADO recordset to create a chart. You first create a tab-delimited string based on the returned recordset data, and then set the chart data by SetData the method and using this string.
Source file chart.asp:
(Refer to Microsoft Help example, add some of my own changes ...)
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft FrontPage 4.0" >
</HEAD>
<BODY>
<object Id=chartspace1 classid=clsid:0002e500-0000-0000-c000-000000000046 style= "width:80%;height:350" >< /object>
<object Id=adoconnection1 classid=clsid:00000514-0000-0010-8000-00aa006d2ea4></object>
<script language=vbscript>
Sub Window_onload ()
Dim RS, categories, values
Categories = ""
Values = ""
' Open the connection to execute the SQL query (establish the "Nwind.mdb" library and create a table named "Category Sales for 1995")
Adoconnection1.open "Driver={microsoft Access DRIVER (*.mdb)};D Bq=c:wind.mdb"
Set rs = Adoconnection1.execute ("select * FROM [Category Sales to 1995]")
' produces a tab-delimited string for each field record
Rs. MoveFirst
Do but not Rs. Eof
Categories = Categories & Rs. Fields (0). Value & Chr (9)
Values = values & Rs. Fields (1). Value & Chr (9)
Rs. MoveNext
Loop
Rs. Close
Adoconnection1.close
' Delete the delimiter at the end of the string
Categories = Left (categories, Len (categories)-1)
Values = Left (values, Len (values)-1)
' Create a series
ChartSpace1.Clear
ChartSpace1.Charts.Add
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.