How to Change Bar Chart Color Based on Value in Database?
Hi,
I am no confirm, but please try as:
Do right click on Chart Series and go to its prpperties .
In properties , select Fill and select Expression tab as:
and in expression window you can use expression by using your dataset. if it works then i think it is possible.
Thanks
Avanish
November 9th, 2012 5:10am
Hi,
I am no confirm, but please try as:
Do right click on Chart Series and go to its prpperties .
In properties , select Fill and select Expression tab as:
and in expression window you can use expression by using your dataset. if it works then i think it is possible.
Thanks
Avanish
Free Windows Admin Tool Kit Click here and download it now
November 9th, 2012 5:10am
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.Crimson
End If
Next
Next
Hi,
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 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:
Can someone help me? i'm stuck at this at almost a week :(
November 11th, 2012 2:50am
Hi,
Please take o look on these useful links:
http://beyondrelational.com/modules/2/blogs/115/posts/11150/change-color-of-columnbar-in-ssrs-columnbar-chart-dynamically.aspx
http://ch1n2.wordpress.com/2011/03/21/how-to-assign-a-different-color-on-each-category-group-in-the-bar-chart-on-ssrs-2008r2-if-you-dont-have-any-series/
Regards
Avanish
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2012 3:05am
Hi, thank you for the suggestion :)
to make it clear, i bind the chart series with a different datasource for example in table A and for the condition value, i have to get it from the other datasource, table B.
So in the server-side code, how can I change the bar color with a condition value that I get from table B?
November 11th, 2012 4:36am
Hi,
I am no confirm, but please try as:
Do right click on Chart Series and go to its prpperties .
In properties , select Fill and select Expression tab as:
and in expression window you can use expression by using your dataset. if it works then i think it is possible.
Thanks
Avanish
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2012 5:26am
Hi Lulu,
Use the expression below to set the color of the bar.
=iif(fields!Status.Value="0","Blue",iif(fields!Status.Value="1","Red","Green"))
The report looks like below.
If you have any questions, please feel free to ask.
Regards,
Charlie LiaoCharlie Liao
TechNet Community Support
November 12th, 2012 3:40am
Hi Lulu,
Use the expression below to set the color of the bar.
=iif(fields!Status.Value="0","Blue",iif(fields!Status.Value="1","Red","Green"))
The report looks like below.
If you have any questions, please feel free to ask.
Regards,
Charlie LiaoCharlie Liao
TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
November 12th, 2012 3:40am