Page 1 of 1

custom Legend-like box

Posted: Tue Apr 29, 2008 5:32 am
by 9535493
Hello,

What is the best way for adding box with custom data to chart?

I have legend on the right side of chart and would like to have another
box under it.

I tried Rectangle Tool - but looks like it is not possible to define
its position from upper right corner, only from upper left.(It is needed to define position from upper right corner for me because I use chart on website with flexible size - it fits browser's window size)
(I use TeeChart Pro AX v7)
I also tried to add annotation tool, but I have already used annotation and can't
add another one.

pls, could you help me?
thanks

Posted: Tue Apr 29, 2008 8:11 am
by yeray
Hi adenin,

It's strange, you should be able to use more than one annotation tool in the same chart. Here you have an example of how you could use several annotation tools and several rectangle tools aligned with the legend.

Code: Select all

Private Sub Form_Load()
Dim i As Integer
  TChart1.AddSeries scLine
  
  TChart1.Series(0).FillSampleValues 10
  TChart1.Panel.MarginRight = 4
  
  TChart1.Environment.InternalRepaint
  
  For i = 0 To 4
    TChart1.Tools.Add tcAnnotate
  
    With TChart1.Tools.Items(i).asAnnotation
      .Text = Str$(i + 1) + ". ANNOTATION"
      .Left = TChart1.Legend.Left
      .Top = TChart1.Legend.ShapeBounds.Bottom + 20 + (i * 25)
    End With
  Next i
  
  For i = 5 To 9
    TChart1.Tools.Add tcRectangle

    With TChart1.Tools.Items(i).asRectangle
      .Text = Str$(i - 4) + ". RECTANGLE"
      .Left = TChart1.Legend.Left
      .Top = TChart1.Legend.ShapeBounds.Bottom + 20 + (i * 25)
      .Height = 20
      .Width = 85
    End With
  Next i
End Sub