Legend click

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

Legend click

Post by Aravind » Fri Aug 25, 2006 1:38 pm

i have to execute somefunction when user click on the legend (each series)

i am not using teelistbox1

is there any event available to know where the user is clicked on the legend ....?


if i use the teelistbox then can linked to the chart legend , so that only tee listbox appears and when user changes the legend alignment ...? can teelistbox also changes

pls advise me
aravind

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Aug 25, 2006 2:36 pm

Hi Aravind,

Yes, you can do it using OnClickLegend event and using legend's Clicked method as shown here:

Code: Select all

Private Sub Form_Load()
    For i = 0 To TChart1.SeriesCount - 1
        TChart1.Series(i).FillSampleValues 10
        TChart1.Series(i).Color = vbBlue
    Next
End Sub

Private Sub TChart1_OnClickLegend(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    Index = TChart1.Legend.Clicked(X, Y)
    
    If (Index <> -1) Then
        For i = 0 To TChart1.SeriesCount - 1
            If (i = Index) Then
                TChart1.Series(i).Color = vbRed
            Else
                TChart1.Series(i).Color = vbBlue
            End If
        Next
    End If
End Sub
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply