How can I change the color of bar chart based on value in database column?
For example, in table "STATUS" in my database, I have 3 type of value. What I want is:
1) If the value = 0, then color will change to blue.
2) If the value = 1, then color will change to red.
3) If the value = 2, then color will change to green.
I use MSChart to create the chart.
I set the default color as blue.
I tried to store STATUS value in dataset and do for loop to retrieve the value.
If i found value = 2, then it will change to green.
Else the color will be red.
But its not worked.
Here is the code:
For Each dp As DataPoint In Chart1.Series("Wilma").Points For i As Integer = 0 To grpDT.Rows.Count - 1 If (grpDT.Rows(i).Item("Status").ToString() = "2") Then dp.Color = Color.Green Else dp.Color = Color.Red End If Next Next
Can someone help me please. I'm stuck at this almost a week :(