Including GridBand Tool

TeeChart for ActiveX, COM and ASP
Post Reply
uptime
Newbie
Newbie
Posts: 5
Joined: Fri Nov 15, 2002 12:00 am

Including GridBand Tool

Post by uptime » Mon Sep 27, 2010 3:33 pm

I'm trying to add the GridBand Tool to a VBScript, but the docs show examples for visual basic. Here's the code I have:

HTML (object within a table cell):

Code: Select all

<object id="TChart1" CODEBASE="/chart/teechart7.cab#Version=7,0,0,0" TYPE="application/x-oleobject" width="100%" height="100%" classid="CLSID:FAB9B41C-87D6-474D-AB7E-F07D78F2422E" ></object>
within VBScript tag

Code: Select all

Sub Window_onload()
With TChart1
    .AddSeries scBar
    .Series(0).FillSampleValues 6
    
    .Tools.Add tcGridBand
    With .Tools.Items(0).asGridBand
        .Axis = TChart1.Axis.Left
        .Band1.Color = 16250354
        .Band2.Color = 16116201
    End With
End With
End Sub
When I run this code, I get an access violation by IE 8.0.7600 and crashes the browser with message "Access violation at address 504F6CB8 in module 'teechart7.ocx'. Read of address 0000015A". Which seems to come from the ".Axis = TChart1.Axis.Left" line. Omitting that gives "Unexpected call to method or property access.".

I suspect that I haven't added the GridBand properly to the chart. Does anyone know how to add a the GridBand tool to a chart within VBScript? or any tool for that matter?

Thanks in advance!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Including GridBand Tool

Post by Narcís » Wed Sep 29, 2010 9:31 am

Hi uptime,

Problem could be that you are using TChart1.Axis.Left within a With TChart1 clause, try using this:

Code: Select all

        .Axis = .Axis.Left
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

uptime
Newbie
Newbie
Posts: 5
Joined: Fri Nov 15, 2002 12:00 am

Re: Including GridBand Tool

Post by uptime » Wed Sep 29, 2010 12:53 pm

Thanks for your suggestion Narcís.

After making that change I'm getting this: Object required: 'Axis'

Also I noticed that it added the Cursor tool (maybe it was added by default because GridBand Tool in vbScript it's not called 'tcGridBand'?)

Can anyone post an example HTML page with a chart with GridBand Tool using vbScript?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Including GridBand Tool

Post by Narcís » Thu Sep 30, 2010 12:02 pm

Hi uptime,

Find attached a VBScript working example with your code.
Attachments
GridBandASP.zip
(1.99 KiB) Downloaded 596 times
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

uptime
Newbie
Newbie
Posts: 5
Joined: Fri Nov 15, 2002 12:00 am

Re: Including GridBand Tool

Post by uptime » Thu Sep 30, 2010 1:32 pm

Hello Narcis thank you for your response.

Unfortunately I need this to be all in HTML and vbScript (no ASP).

I was able to come up with a trimmed down html page as a better example:

Code: Select all

<html><head><title>GridBand chart</title></head>
<body>
<script language="VBScript">
Sub Window_onload()
With TChart0
    .AddSeries scBar
    .Series(0).FillSampleValues 6
    
    .Tools.Add tcGridBand
    With .Tools.Items(0).asGridBand
        .Axis = .Axis.Left
        .Band1.Color = 16250354
        .Band2.Color = 16116201
    End With
End With
End Sub
</script>

<object id="TChart0" CODEBASE="teechart7.cab#Version=7,0,0,0" TYPE="application/x-oleobject" width="100%" height="100%" classid="CLSID:FAB9B41C-87D6-474D-AB7E-F07D78F2422E" ></object>
</html>
If you take this code, you will see an error from Line 11 "Object required: 'Axis'" and also there is a Cursor tool added. I also attached a screenshot to show the Cursor on the chart.
Attachments
GridBandChartWithCursor.JPG
GridBandChartWithCursor.JPG (69.68 KiB) Viewed 7982 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Including GridBand Tool

Post by Narcís » Wed Oct 06, 2010 11:27 am

Hello uptime,

You need to do as in the code snippet below as some constants might not be defined.

Code: Select all

    <html><head><title>GridBand chart</title></head>
    <body>
    <script language="VBScript">
    Sub Window_onload()
    With TChart0
        .AddSeries scBar
        .Series(0).FillSampleValues 6
       
        .Tools.Add 16 'tcGridBand
        With .Tools.Items(0).asGridBand
            .Axis = 0 'aLeft
            .Band1.Color = 16250354
            .Band2.Color = 16116201
        End With
    End With
    End Sub
    </script>

    <object id="TChart0" CODEBASE="teechart7.cab" TYPE="application/x-oleobject" width="100%" height="100%" classid="CLSID:FAB9B41C-87D6-474D-AB7E-F07D78F2422E" ></object>
    </html>
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

uptime
Newbie
Newbie
Posts: 5
Joined: Fri Nov 15, 2002 12:00 am

Re: Including GridBand Tool

Post by uptime » Thu Oct 07, 2010 4:18 pm

Yes that worked!

Thank you very much Narcis for all your feedback. It's very much appreciated :)

Post Reply