Change Individual Bar Colour If Higher Than Same Category In Another Series

2 posts, 0 answers
  1. Vale
    Vale avatar
    9 posts
    Member since:
    Feb 2016

    Posted 30 Aug 2016 Link to this post


    I have 2 series of data as shown in the picture. The green bar is the target time to complete a task and the blue bar is actual time taken. I need to make the blue bars turn red if they are higher than the green bars? Can this be done?



  2. Dimitar
    Dimitar avatar
    2983 posts

    Posted 30 Aug 2016 Link to this post

    Hi Shane,

    Thank you for writing.

    You can iterate the elements after the series are added to the chart:
    foreach (BarPointElement item in barSeries.Children)
        var point1 = ((CategoricalDataPoint)item.DataPoint);
        foreach (CategoricalDataPoint point in barSeries2.DataPoints)
            if (point1.Category == point.Category)
                if (point1.Value > point.Value)
                    item.BackColor = Color.Red;

    Let me know if you have additional questions.

    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Back to Top