Multiple colors for BarSeries

2 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Aug 2011

    Posted 10 Aug 2012 Link to this post


    I want to use mutiple colors for one BarSeries in a RadCartesianChart.
    Do I really have to create a DataTemplate / PointTemplate for every color I want to use?

    Since there are about 20 colors I want to support, this would really look ugly in XAML.
    Is there any other way?

    Thanks and best regards

  2. Evgenia
    Evgenia avatar
    1396 posts

    Posted 10 Aug 2012 Link to this post

    Hello David,

     You can achieve this by using a single PointTemplate where the Fill of the Rectangle in it is bound to a Brush property of your business object. For instance:

    <telerik:RadCartesianChart x:Name="RadChartView1">
        <telerik:BarSeries ValueBinding="Value" ItemsSource="{Binding Data}"  >
                    <Rectangle Fill="{Binding DataItem.Color}"/>

    Color is a property of type Brush, just like Value , so that it is specific for each DataItem. You may review the sample I prepared and attached to demonstrate what I mean. 

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
Back to Top