This is a migrated thread and some comments may be shown as answers.

Filtering chart data via legend or series click

1 Answer 14 Views
This is a migrated thread and some comments may be shown as answers.
Sean
Top achievements
Rank 1
Sean asked on 11 Jan 2018, 04:58 PM

Hi,

I am trying to filter my chart data by allowing the user to click on one or more legend items, but as far as I can tell Telerik doesn't have a click/selection event listener for the legend. The closet solution I could find is a series selection event on the chart series itself. Has anyone figured out how filter their chart data on legend click?

Thanks

Windows 10
Visual Studio 2017
Xamarin.iOS 11.6.1.2/Xamarin.Android 8.1.0.25
Telerik Xamarin UI -2017.3.1123.2

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 11 Jan 2018, 10:31 PM
Hello Sean,

You could try using a gesture recognizer and get the tap coordinate. With that coordinate, you can extrapolate which item the user chose (see here for a discussion on options for getting coordinates with gesture recognizers).

As we don't yet have a mechanism for selection, you cant get the actual LegendItem using this method. However, you can guess which one was clicked because we add the legend items in the same order they are in the chart.

If the Chart has three series, then a tap in the top 33% of the coordinate space would be the first series. If there are four series, a tap in between 25% to 50% of the area would be the second series, and so forth.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Sean
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or