I have a bar chart to display information.
I also have a vertical line indicate the limit of Y-value.
For example, I set the limit to 25.

So now I want the color of column bar to change to red color if the column exceed the limit.

I tried this but the result, i get all column color changed, not only column that exceed the limit.

    Dim maxAlert = GetMax() \\ get maximum column value.

                    If maxAlert > 25 Then
                        .Color = Color.Crimson  \\if max value exceed 25, the color changed
                        .Color = Color.LightCoral
                    End If

This is the example of outcome that I want:

How can I changed the column color to red when it exceed the limit? Thank you :)

This problem solved. Thank you :)

    Private Sub Chart1_Customize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Chart1.Customize
        For Each dp As DataPoint In Chart1.Series("Wilma").Points
            If dp.YValues(0) > 25 Then
                dp.Color = Color.Red
            End If
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.