Legend position code

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

Legend position code

Post by Nemko EMC » Mon Nov 08, 2004 8:03 am

Hi,

Can anyone provide a simple code example to place the legend inside and infront of the grid, located at the top-right corner of the grid?

I need it to stay there even when resizing the window/chart...

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Nov 08, 2004 8:49 am

Hi,

you can use similar code to the following :

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scLine
    .Series(0).FillSampleValues (10)
    .Legend.LegendStyle = lsSeries
    .Legend.CustomPosition = True
    .Axis.Top.Visible = True
    .Aspect.View3D = False
    .Environment.InternalRepaint
End With
End Sub

Private Sub TChart1_OnAfterDraw()
    TChart1.Legend.Left = TChart1.Axis.Right.Position - (TChart1.Legend.ShapeBounds.Right - TChart1.Legend.ShapeBounds.Left)
    TChart1.Legend.Top = TChart1.Axis.Top.Position
End Sub

Post Reply