Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thank you. It's already helped me greatly, and I enjoy just reading the inputs from the other members..."

Geography

Where in the world do Tek-Tips members come from?
fairfaxVB (Programmer)
27 Nov 05 11:37
Hi Friends,
How can I add a X and Y lable for this chart by VBscript?

Thanks for any help!

FairfaxVB


************source codes
<%@ Language=VBScript %>
<HTML>
<head><title>chart example</title></head>
<STRONG><CENTER> Calls Infomation</CENTER></STRONG>

<BODY>
<object id=ChartSpace1 classid=CLSID:0002E500-0000-0000-C000-000000000046 style="width:100%;height:480"></object>
<object id=Spreadsheet1 classid=CLSID:0002E510-0000-0000-C000-000000000046 style="width:100%;height:480"></object>

<script language=vbs>
Sub Window_OnLoad()

Dim oSheet
Set oSheet = Spreadsheet1.ActiveSheet
oSheet.Cells.Clear
oSheet.Range("A2:A10").Value = Array("06/06/2005","06/07/2005","06/08/2005","06/09/2005","06/10/2005","06/11/2005","06/12/2005","06/13/2005","06/14/2005")
oSheet.Range("B1:B10").Value = Array("OBC", 20,37, 200,40,18,57,120,167,145)

Dim oChart
ChartSpace1.Clear
Set oChart = ChartSpace1.Charts.Add

ChartSpace1.DataSource = Spreadsheet1

dim c
set c = ChartSpace1.Constants
dim oSeries


for i=1 to 1
   Set oSeries = oChart.SeriesCollection.Add
   oSeries.SetData c.chDimValues, 0, oSheet.Range(oSheet.Cells(2,2), oSheet.Cells(10,2)).Address


   oSeries.SetData c.chDimSeriesNames, 0, oSheet.Cells(1,1).Address
next
oChart.SetData c.chDimCategories, 0, "a2:a10"

oChart.Axes(c.chAxisPositionLeft).NumberFormat = "0.0"
oChart.Axes(c.chAxisPositionLeft).MajorUnit = 50

End Sub
</script>

</BODY>
</HTML>
BobRodes (Instructor)
28 Nov 05 19:44
I don't know how to do what you ask.  However, I looked up your classids and they come from OWC (Office Web Components).  These are designed for the .Net environment.  However, they are COM-compatible, which is why they work in your environment.  I'd read this first: http://aspnet.4guysfromrolla.com/articles/080603-1.aspx and then check the link to part 2.  Keep in mind that most of the code samples you're going to get are going to be VB.Net rather than VBScript.  You should be able to translate easily enough.

Another thing: you might be able to get better help from the Asp.Net forum.  Ask about the OWC.Chart object.

HTH

Bob

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close