How can you determine which legend item has been clicked

TeeChart for ActiveX, COM and ASP
Post Reply
AR
Newbie
Newbie
Posts: 8
Joined: Thu Dec 16, 2004 5:00 am

How can you determine which legend item has been clicked

Post by AR » Tue Jan 24, 2006 3:37 pm

I have a legend on a chart with checkboxes. I have been looking through the ChartEvents but cant seem to find one that is fired when the checkbox for a series is changed, does such an event occur ?

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

Post by Narcís » Tue Jan 24, 2006 3:51 pm

Hi AR,

Yes, you can use OnClickLegend event and the legend clicked event to obtain the clicked item index as shown here:

Code: Select all

Private Sub TChart1_OnClickLegend(ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    TChart1.Header.Text.Clear
    TChart1.Header.Text.Add (CStr(TChart1.Legend.Clicked(X, Y)))
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

AR
Newbie
Newbie
Posts: 8
Joined: Thu Dec 16, 2004 5:00 am

Post by AR » Tue Jan 24, 2006 4:29 pm

Thanks that worked, I had found that event and dismissed it as it didnt provide a series index.

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

Post by Narcís » Wed Jan 25, 2006 8:37 am

Hi AR,

I'm glad to hear that did what you needed. Clicked method can be used to retrieve series points index in events where screen coordinates are provided.
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