How to limit number of categories in ChartView CategoricalAxis

3 posts, 0 answers
  1. Chris
    Chris avatar
    7 posts
    Member since:
    Apr 2012

    Posted 04 Jun 2017 Link to this post

    We are trying to use a ChartView with a LinearAxis for the vertical axis and a CategoricalAxis for the horizontal axis. Our issue is that we can't find a way to limit the number of category items in the horizontal view of the ChartView. We'd like to have a max of 14 items in the view before requiring the user to scroll to see more category items, but as it stands now, the more items that are added to the ChartView, the smaller and smaller the items get until their labels overlap.

    Is there a way to limit the view of the ChartView to a max of 14 items so that the user can scroll to the right to see more items?


  2. Martin Ivanov
    Martin Ivanov avatar
    2445 posts

    Posted 05 Jun 2017 Link to this post

    Hello Chris,

    The chart will plot a category slot for each distinct category in its data source. You cannot limit this without removing items from the data. Anyway, you can achieve your requirement using the chart's pan and zoom behavior. This way you can limit the visible area of the chart and scroll to see the rest of the data.

    You can use the chart's HorizontalZoomRangeStart and HorizontalZoomRangeEnd to limit the viewport. Note that the properties work in relative units between 0 and 1.

    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Pavel
    Pavel avatar
    1 posts
    Member since:
    Dec 2016

    Posted 12 May Link to this post

Back to Top