Filtering chart data via legend or series click

2 posts, 0 answers
  1. Sean
    Sean avatar
    1 posts
    Member since:
    Feb 2017

    Posted 11 Jan 2018 Link to this post

    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

  2. Lance | Manager Technical Support
    Admin
    Lance | Manager Technical Support avatar
    1195 posts

    Posted 11 Jan 2018 Link to this post

    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
Back to Top