magic rectangle when using .Tools.Add tcAnnotate

TeeChart for ActiveX, COM and ASP
Post Reply
Ghynna
Newbie
Newbie
Posts: 9
Joined: Mon Jun 06, 2005 4:00 am
Location: Canada

magic rectangle when using .Tools.Add tcAnnotate

Post by Ghynna » Thu Jun 23, 2005 6:03 pm

When i use this instruction
.Tools.Add tcAnnotate after drawing a curves on my chart, a small rectangle appears on the left top corner of the chart. I don't know where it comes from. help me

thanx

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

Post by Narcís » Mon Jun 27, 2005 8:07 am

Hi Ghynna,

That's what Annotation tool is about. The statement you mention is the one which creates that rectangle. For more information on TeeChart tools you could have a look at TeeChart tutorials, features demo and help files all available at TeeChart's program group.
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

Ghynna
Newbie
Newbie
Posts: 9
Joined: Mon Jun 06, 2005 4:00 am
Location: Canada

Post by Ghynna » Mon Jun 27, 2005 2:45 pm

Thank you for your answer, but i know that the Annotation tool is about that. The problem is that there is another small rectangle in the left top corner, in addition to the rectangle where i write my text. So there are 2 rectangles.
thank you in advance

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

Post by Narcís » Mon Jun 27, 2005 2:56 pm

Hi Ghynna,

Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroup.
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

Ghynna
Newbie
Newbie
Posts: 9
Joined: Mon Jun 06, 2005 4:00 am
Location: Canada

Post by Ghynna » Wed Jun 29, 2005 3:22 pm

i send you a the source code (which is a part a program) that causes problems.

Private Sub DrawKinetic() 'ByVal nbpoint As Integer
If (draw_alpha = True) Then
GraphFile.RemoveAllSeries
GraphFile.AddSeries scPoint '(scFastLine)
GraphFile.Series(0).Clear
GraphFile.Axis.Left.Title.Caption = "Temperature"
GraphFile.Series(0).FastLine.LinePen.Width = 2

Dim val
Dim tmp
For i = 0 To nb_points - 1
val = temp(i)
GraphFile.Series(0).AddXY time(i), val, "", vbBlue
Next i
Dim peak As Double
Dim index As Integer
index = Peak_TemperatureIndex()
peak = Calcul_Alpha_DAlpha.temp(index)
With GraphFile
.Tools.Add tcAnnotate
.Tools.Items(0).Active = True
With .Tools.Items(0).asAnnotation
.Shape.CustomPosition = True
.Shape.Left = 100
.Shape.Top = 200
.Shape.Gradient.Visible = True
.Shape.ShapeStyle = fosRoundRectangle
.Shape.Font.Name = "Verdana"
.Text = "Peak temperature =" + Format(CStr(peak), "#####0.0#") + "°K" + Chr(13) + "Reaction Enthalpy =" + Format(CStr(enthalpy), "#####0.0#") + "kJ"
End With
End With

End If
End Sub

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

Post by Narcís » Thu Jun 30, 2005 2:24 pm

Hi Ghynna,

It's hard to guess without being able to run your code as, in your snipet, you only add one Annotation tool. Would you be so kind to send us an example we can run "as-is" to reproduce the problem here so that we can reproduce the problem here and help you finding a solution?

Thanks in advance.
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

Ghynna
Newbie
Newbie
Posts: 9
Joined: Mon Jun 06, 2005 4:00 am
Location: Canada

Post by Ghynna » Mon Jul 04, 2005 2:18 pm

hi narcis
I send an example you can run "as-is" to reproduce the problem.
Thanx

ghynna

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

Post by Narcís » Mon Jul 04, 2005 3:19 pm

Hi ghynna,

I've been able to reproduce your problem here and I've found a solution for it. The problem was that every time you changed the series style you where adding a new Annotation tool to the chart. To reproduce this click ComboSeries and then go to the Tools tab at the chart editor. You'll notice one additional Annotation tool for every time you clicked the combobox. To prevent that I've added a IF statement checking if there already was an Annotation tool in the chart. See code below:

Code: Select all

Private Sub ComboSeries_Click()
  With TChart1
  'Look to see if there's already a Series in the Chart
  'Remove the existing Series
    .RemoveAllSeries
  'Add and randomly populate the new Series
  'eg. .AddSeries(scHorizBar) is the same as .AddSeries(2)
    .AddSeries (ComboSeries.ListIndex)
    .Series(0).FillSampleValues 15
  'Name the Series to visualise in the Chart Editor.
    .Series(0).Title = ComboSeries.List(ComboSeries.ListIndex) & "Series"
  'Modify the Chart Title
    .Header.Text(0) = .Series(0).Title

            If .Tools.Count <= 0 Then 'Added IF statement to prevent additional annotation tools.
                .Tools.Add tcAnnotate
                .Tools.Items(0).Active = True
                With .Tools.Items(0).asAnnotation
                    .Shape.CustomPosition = True
                    .Shape.Left = 100
                    .Shape.Top = 200
                    .Shape.Gradient.Visible = True
                    .Shape.ShapeStyle = fosRoundRectangle
                    .Shape.Font.Name = "Verdana"
                    .Text = "My text"
                End With
            End If
  End With
End Sub
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

Post Reply