Remove items from Legend?

TeeChart for ActiveX, COM and ASP
Post Reply
Craig
Newbie
Newbie
Posts: 25
Joined: Sat Aug 09, 2003 4:00 am
Location: Calgary, Alberta
Contact:

Remove items from Legend?

Post by Craig » Tue Apr 10, 2007 6:05 pm

My legend is set to show series values, it is a Map series. Is there any way to set some values to not show in legend?

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

Post by Pep » Sun Apr 15, 2007 9:26 pm

Hi,

the only available ways with the existing version are :
1) Using the OnGetLegendText event to set the LegendText of desited valueindex to "", like :

Code: Select all

Private Sub TChart1_OnGetLegendText(ByVal LegendStyle As Long, ByVal ValueIndex As Long, LegendText As String)
If ValueIndex = 1 Then
LegendText = ""
End If
End Sub
2) Setting the legend item text to "", like :
TChart1.Legend.Item(0).Text=""

The problem of these ways is that do not remove the symbol and the space of the line in the legend. This feature is on our wish list to be considered for further releases (alow to remove the item or make it invisible, recreating the legend).

A trick to do this could be to use a fake series (map series if you want) with just the data which must be displayed in the legend (this must be the first series created), and then hide the fale Serie in the Chart with :

Code: Select all

For i = 0 To TChart1.Series(0).asMap.Shapes.Count - 1
  TChart1.Series(0).asMap.Shapes.Polygon(i).Transparency = 100
Next

Post Reply