Hi,

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
                    Else
                        .Color = Color.LightCoral
                    End If

This is the example of outcome that I want:
bargraph

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

Edited 4 Years Ago by lulu79

Attachments graph.JPG 29.43 KB

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
        Next
    End Sub
This question has already been answered. Start a new discussion instead.