BarSeries in a RadCartesianChart left aligned

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    3 posts
    Member since:
    Jul 2014

    Posted 27 Jul 2017 Link to this post

    Hi everyone,

    i wanna left align a BarSeries with a CategoricalAxis in a RadCartesianChart (barseries_target). Per default the BarSeries is using the whole space (barseries_origin).

    Is there any possibility to get the left align worked?


    Thanks in advance.



  2. Martin Ivanov
    Martin Ivanov avatar
    1549 posts

    Posted 28 Jul 2017 Link to this post

    Hello Thomas,

    In RadChartView there is no notion for series alignment. When you have a BarSeries, which is a categorical series, the chart will create a category slot on the CategoricalAxis for each distinct category value. In your case those are 2, 5, 6, 8, 16, 32. 

    To achieve your requirement and display categories from 1 to 28 you will need to add dummy data points in the BarSeries ItemsSource (or DataPoints) after you load the original data (from 2 to 32). The dummy points can have set their Value to null and Category to the corresponding category from 1 to 28.

    Note that the chart won't allow you to have categories with the same value. For example, if you have two items with category set to 2 the chart will combine them in the same category. So, you can't have duplicate category slots drawn on the axis. To resolve this you can set the categories of the data items to unique names and use LabelTemplate for the CategoricalAxis to display text differen than the original category value. 

    I prepared a small example demonstrating such approach. I hope it helps.

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