New to Telerik UI for WinForms? Download free 30-day trial

Change the color of bar depending on the value

Product Version Product Author
2019.2.618 RadGridView for WinForms [Dimitar Karamfilov]


You need to set the BackColor of each bar chart depending on the DataPoint value.


Iterate the series children and set the color. This should be done after the chart is initialized. The following example sets the color of the values depending on their value.

BarSeries barSeries = new BarSeries("Performance", "RepresentativeName");
barSeries.Name = "Q1";
barSeries.DataPoints.Add(new CategoricalDataPoint(177, "Harley"));
barSeries.DataPoints.Add(new CategoricalDataPoint(-128, "White"));
barSeries.DataPoints.Add(new CategoricalDataPoint(143, "Smith"));
barSeries.DataPoints.Add(new CategoricalDataPoint(-111, "Jones"));
barSeries.DataPoints.Add(new CategoricalDataPoint(118, "Marshall"));

foreach (BarPointElement item in radChartView1.Series[0].Children)
    var value = ((CategoricalDataPoint)item.DataPoint).Value;
    if (value.Value < 0)
        item.BackColor = Color.Green;
        item.BackColor = Color.Red;


Public Sub New()
    Dim barSeries As New BarSeries("Performance", "RepresentativeName")
    barSeries.Name = "Q1"
    barSeries.DataPoints.Add(New CategoricalDataPoint(177, "Harley"))
    barSeries.DataPoints.Add(New CategoricalDataPoint(-128, "White"))
    barSeries.DataPoints.Add(New CategoricalDataPoint(143, "Smith"))
    barSeries.DataPoints.Add(New CategoricalDataPoint(-111, "Jones"))
    barSeries.DataPoints.Add(New CategoricalDataPoint(118, "Marshall"))

    For Each item As BarPointElement In radChartView1.Series(0).Children
        Dim value = CType(item.DataPoint, CategoricalDataPoint).Value
        If value.Value < 0 Then
            item.BackColor = Color.Green
            item.BackColor = Color.Red
        End If

    Next item
End Sub

In this article