Trying to set height on RadCartesianChart Bars

2 posts, 0 answers
  1. mike
    mike avatar
    9 posts
    Member since:
    May 2015

    Posted 17 Mar 2016 Link to this post


    We are unable to vary the height of the bar series even though the below property is given properly. The bar series height and width gets adjusted by itself.
    The objective is the height of the Chart should remain same as well as the bar inside of it. When only one bar for example, the width of the bar should not auto adjust to be fat. 

      <telerik:RadCartesianChart Palette="Windows8"

                            <telerik:LinearAxis Title="Days" />
                            <telerik:CategoricalAxis />
                            <telerik:BarSeries PaletteMode="DataPoint"
                                               ItemsSource="{Binding LstRunningBatch}"




  2. Dinko
    Dinko avatar
    444 posts

    Posted 22 Mar 2016 Link to this post

    Hello Mike,

    Thank you for the provided information.

    You can set the MaxHeight property of the bars by creating a custom DataTemplate and set it to the PointTemplate property of the BarSeries.
    <Rectangle MaxHeight="30"
                    Fill="{Binding Converter={StaticResource DataPointToBrushConverter}}"/>
    Keep in mind that when you are using PointTemplate to customize the bar series, the Palette colors will not apply to the bars. In this case you can use an IValueConverter to get the fill color from the Palette and set it to the elements in the template. Note that, the DataContext passed to the PointTemplate is an object of type DataPoint which you can bind with the converter.  For your convenience, we have created a sample project where you can see how to implement this approach.

    Please, give this project a try and let us know if this works for you.

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top