Legend.Clicked not aware legend items have been cleared?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Charles Cruden
Newbie
Newbie
Posts: 9
Joined: Wed Nov 18, 2009 12:00 am

Legend.Clicked not aware legend items have been cleared?

Post by Charles Cruden » Tue Jan 12, 2010 8:30 pm

Using TeeChart.WPF.dll version 4.0.2009.35592, we setup some code that watches where a user's mouse goes and allows them to click on items in the legend to perform actions on the series in the chart. We include highlighting of the items in the legend to indicate which item they're about to click on, and do so by hooking into the MouseMove event and passing the point in MouseEventArgs in to TChart.Legend.Clicked to determine which item is being hovered over. We seem to have run into a problem when the user clears the chart. We clear the chart by calling:

Code: Select all

TChart trendControl;
...
trendControl.Axes.Custom.Clear();
trendControl.Series.Clear();
trendControl.Legend.Items.Clear();
(All our axes are custom axes, so this seems to be effective.) However, with a clear chart, the MouseMove event handler's calls to trendControl.Legend.Clicked are still receiving return values which are not -1, indicating that there are legend items to be highlighted (even though there aren't - trendControl.Legend.Items.Count is 0). We've worked around it by adding code which checks to see that Legend.Clicked(...) < Legend.Items.Count before proceeding, but is this proper behaviour? Shouldn't Legend.Clicked be returning -1 all the time if there are no items in the legend and it's not being displayed, or is there something else that needs to be called to properly clear out all the information in a chart?

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Legend.Clicked not aware legend items have been cleared?

Post by Yeray » Wed Jan 13, 2010 3:15 pm

Hi Charles,

Yes I've seen that the legend's clicked function was still returning values once the legend had been hidden. I've corrected it in the sources so it will be fixed for the next maintenance release (TF02014636).
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply