SSRS color coding charts
You can use a formula to set the color of each column, but this will work best if you know what the values โโof the individual rows ("databases"?) Mean.
Right click on the diagram and display its properties. Now go to the Data tab and select the first item in the list Values
. Click the button Edit...
to display properties for values โโ(columns) in the chart. The tab Appearance
has a button Series Style...
that takes you to another dialog box.
In this new dialog Style Properties
go to the tab Fill
. This is where you set the color for each of your columns. It could be a formula, so you can do something like:
=Switch(
Fields!Database.Value = "master", "Blue",
Fields!Database.Value = "msdb", "Red",
"Green")
If you do not know in advance which "databases" will be represented in the diagram, this method will not work very well. In this case, you can come up with a formula that hashes the name of the database and matches the color. This sounds like an interesting challenge, so add your own question if you need help with this.
Edit
I just have a hash color scheme working. This is a rather annoying piece of code, but I managed to get a unique color for each column (row). Maybe someone can come up with a better algorithm and post it here. Here's mine:
="#" & left(Hex(Fields!Database.GetHashCode()), 6)
So, to get the HashCode for a string (numeric value) and convert it to hex, then take the leftmost six characters and add a "#" to it. This gives us a string that looks like a color value (e.g. # AB12F0).
source to share