Change Color for Individual Bar in RadChart

2 posts, 0 answers
  1. John
    John avatar
    3 posts
    Member since:
    Jan 2013

    Posted 08 Mar 2013 Link to this post

    Telerik,

    Our development team use your WPF controls, in particular, this issue deals with the RadChart control.  I have a need to change the color on an individual bar without changing the other bar colors in the data series, and I need to do this in code-behind.

    I've attached a picture of my chart output.  In the example, the y-axis is minutes and the x-axis is divided into four categories (3,10,11,18).  Each category could display up to three bars.  Based on a threshold per category/bar, a single bar could change color.  For example, bar 2 under category 3 may need to turn red, but I don't want any of the other bars to turn red (just that bar only).

    At the DataPoint level, I'm updating dp.YValue and dp.Tooltip for each bar, and it is at this level that I make a decision about the bar's color based on the YValue.

    The entire chart (RadChart) is being created in code-behind (no XAML).  How can I accomplish this task?

    Thanks, 
  2. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 12 Mar 2013 Link to this post

    Hello John,

     You may use our Custom Item Style delegate to achieve this. It allows you to create custom styles for the individual bar items depending on your custom logic. Additional information and a sample may be found in our online documentation, more specifically this help topic.

    Regards,
    Evgenia
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top