This is a migrated thread and some comments may be shown as answers.

Change Color for Individual Bar in RadChart

1 Answer 164 Views
Chart
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 08 Mar 2013, 05:40 PM
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, 

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 12 Mar 2013, 08:06 AM
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.

Tags
Chart
Asked by
John
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or