Hi,
How can i change the bar chart color after I click a button?

Here is the senario. I have a bar chart to show line progress. Here is the 3 condition for the bar chart:
1) Before the bar chart reach maximum limit, the color will set to blue.
2) When the bar chart reach maximum limit, the color will set to red.
3) When someone fill in countermeasure form in another page and click button submit, the bar chart will change to green.

For the first one, i just set the color in the server-side code :

.Color = Color.DodgerBlue

For the second one, i use Chart1_Customize to change the color when reach maximum limit. For example i set maximum limit to 25.

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.Crimson
            End If
        Next
    End Sub

Now for the third one, how can I change the color to green after the user click a submit button on the second page?

Hi,
Is this to go on a web page? or a Windows form?

On a webpage - you will have to have the webform reload itself on a timer via client side script as you can not force a users browser to reload and webpages are "static" until they reload / refresh. You will need to have captured that the other user has filled in the countermeasure in a place that the webform can check e.g. a database table

On a Windows form it will be much easier assuming that we are talking about two forms running on the same machine in the same instance of the Application. If not, you face the same problem of how does one form running under a certain instance on a certain machine know what a user on another instance or machine is doing?

This article has been dead for over six months. Start a new discussion instead.