Page 1 of 1

Setting legend items explicitly

Posted: Sun Feb 01, 2004 12:08 am
by 9080243
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.

Posted: Mon Feb 02, 2004 11:22 am
by Pep
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