I have an ssrs report where I have many pie charts with the fields pass and fail as well as up to 3 other miscellaneous fields and I wish to be able to color the pass always green and the fail always red but the other fields could be a default value. Is this even possible to do? I have seen code examples with code for custom color in pie charts but I have no clue how to do this and have not found where I would put my custom code. What im trying to do is slightly different from what all those other examples do whith only defining a few fields.
Below you can find colors reference of text to command when running node.js application:
console.log('\x1b[36m%s\x1b[0m', 'I am cyan'); //cyan console.log('\x1b[33m%s\x1b[0m', stringToMakeYellow); //yellow
%s is where in the string (the second argument) gets injected.
\x1b[0m resets the terminal color so it doesn't continue to be the chosen color anymore after this point.
Reset = "\x1b[0m" Bright = "\x1b[1m" Dim = "\x1b[2m" Underscore = "\x1b[4m" Blink = "\x1b[5m" Reverse = "\x1b[7m" Hidden = "\x1b[8m" FgBlack = "\x1b[30m" FgRed = "\x1b[31m" FgGreen = "\x1b[32m" FgYellow = "\x1b[33m" FgBlue = "\x1b[34m" FgMagenta = "\x1b[35m" FgCyan = "\x1b[36m" FgWhite = "\x1b[37m" BgBlack = "\x1b[40m" BgRed = "\x1b[41m" BgGreen = "\x1b[42m" BgYellow = "\x1b[43m" BgBlue = "\x1b[44m" BgMagenta = "\x1b[45m" BgCyan = "\x1b[46m" BgWhite = "\x1b[47m"
\x1b[31m is an escape sequence that will be intercepted by your terminal and instructs it to switch to the red color. In fact,
\x1b is the code for the non-printable control character
escape. Escape sequences dealing only with colors and styles are also known as ANSI escape code and are standardized, so therefore they (should) work on any platform.
Wikipedia has a nice comparison of how different terminals display colors https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
Finally I ended up using function call, so I get flexibility to change color at 1 place instead of changing expression in all the coloumns (if business decides to change color). And my code is as below
Public Function RankColour(ByVal Value As Integer, ByVal MinValue As Integer, ByVal MaxValue As Integer) As String Dim strColor As String Select Case Value Case MaxValue strColor = "Salmon" Case MinValue strColor = "LightGreen" Case Else strColor = "White" End Select Return strColor End Function
And then expression used in column cell as below:
=Code.RankColour(me.value, Min(Fields!AbsenteeismRank.Value, "dataset1"), Max(Fields!AbsenteeismRank.Value, "dataset1"))