TeeChart for ActiveX, COM and ASP
-
Russ
- Newbie

- Posts: 18
- Joined: Thu Nov 02, 2006 12:00 am
- Location: Chattanooga, TN
-
Contact:
Post
by Russ » Sun Nov 19, 2006 8:52 pm
Hi: I have a simple plot of x-y data. I want to add two vertical bars (making a window) a specific number of x-axis units apart. How can I do this?
This picture should show what I'm after.

-
Narcís
- Site Admin

- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Mon Nov 20, 2006 9:14 am
Hi Russ,
The easiest way to achieve that is using ColorBand or ColorLine tools.
-
Russ
- Newbie

- Posts: 18
- Joined: Thu Nov 02, 2006 12:00 am
- Location: Chattanooga, TN
-
Contact:
Post
by Russ » Mon Nov 27, 2006 8:31 pm
Hi: I am having difficulty in figuring out how to draw two vertical bars on an x-y chart. I can't find much in the way of examples of ColorBand useage. Here is some code that I have attempted but it results in an access violation in "TeeChart7.ocx" as seen in the attached picture (with the code).
Best Regards,
russ
-
Narcís
- Site Admin

- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Tue Nov 28, 2006 8:46 am
Hi Russ,
The same code works fine here using v7.0.1.3, which is the latest version available at the client area, provided bottom axis, at least, ranges from 25 to 75. Otherwise the band is not visible.
Which TeeChart version are you using? If the problem persists could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can post your files at news://
www.steema.net/steema.public.attachments newsgroup.
Thanks in advance.
-
Russ
- Newbie

- Posts: 18
- Joined: Thu Nov 02, 2006 12:00 am
- Location: Chattanooga, TN
-
Contact:
Post
by Russ » Wed Nov 29, 2006 2:32 pm
I finally figured out what the problem was. The line of code ".Tools.Items(0).asColorband.Axis" made specific reference to tool 0 of the present set of tools for this particular chart. Well, the ColorBand tool wasn't my only tool so I was referencing the wrong tool by the "Items(0)" part.
Is there a way to reference the ColorBand tool without using the "Items(0)" method?
Thanks a bunch for your help. I have been very please with your software and support.
Regards,
russ
-
Narcís
- Site Admin

- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Wed Nov 29, 2006 3:41 pm
Hi Russ,
Thank you very much. I'm glad to hear it works fine for you.
Regarding your question, at the snippet below you have 2 example on how to do that:
Code: Select all
Private Sub Form_Load()
Dim ColorBandIndex As Integer
Dim ColorBand As IColorBandTool
TChart1.Series(0).FillSampleValues 100
ColorBandIndex = TChart1.Tools.Add(tcColorband)
With TChart1.Tools.Items(ColorBandIndex).asColorband
.Axis = TChart1.Axis.Bottom
.StartValue = 10
.EndValue = 20
.ResizeEnd = True
.ResizeStart = True
End With
'or
TChart1.Tools.Add tcColorband
Set ColorBand = TChart1.Tools.Items(TChart1.Tools.Count - 1).asColorband
With ColorBand
.Axis = TChart1.Axis.Left
.StartValue = 100
.EndValue = 150
End With
End Sub