Setting legend items explicitly

TeeChart for ActiveX, COM and ASP
Post Reply
MarkR
Newbie
Newbie
Posts: 8
Joined: Mon Dec 15, 2003 5:00 am
Location: Traverse City, MI
Contact:

Setting legend items explicitly

Post by MarkR » Sun Feb 01, 2004 12:08 am

Hello,

My apologies if I'm missing the obvious, but how do I go about setting legend items explicitly (in a pie graph) without affecting the point labels? In my pie graph, I want the pie slices to be labeled with text, but the legend items to use a different custom string.

Thanks for any assistance!

- Mark R.

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

Post by Pep » Mon Feb 02, 2004 11:22 am

Hi,

you can use the OnGetLegendText event to set your custom text :

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scPie
    .Series(0).FillSampleValues (5)
End With
End Sub

Private Sub TChart1_OnGetLegendText(ByVal LegendStyle As Long, ByVal ValueIndex As Long, LegendText As String)
If ValueIndex = 0 Then
    LegendText = "My custom text"
End If
End Sub

Post Reply