This is the second blog post of a three-part set that shows you how to create a color palette code, how to use it and then how to match the colors in a SSRS report’s chart and table (or matrix). In this blog post, Leonard Suares and I show you how to use the GetColor function. If you recall, Leonard showed you one of Enhansoft’s color palette codes with the GetColor function and he also showed you how to add the code to a report in, Color Palette Codes in SSRS Defined and Explained.
Why Use Your Own Color Palette?
The anwser is simple: make the information displayed in a report easier to read. One of the ways you can do this is by matching the colors between a chart and a table. In order to do that you need to use a function and a custom color palette. Without those two items it is impossible to match the colors between the two objects, but more on that later, in next week’s blog post. This post is all about how to use the GetColor function within a chart.
At Enhansoft, we follow a specific report sequence format and all of our “count” and dashboard reports usually display data in a chart associated with a table. The chart gives you a graphical representation of the data and the table below shows the values found in the chart.
You might be wondering why we use a table instead of a legend to explain the chart’s visuals. Doesn’t a table take up extra space? If your SCCM/ConfigMgr/MEMCM enviroment is in the hundreds or hundreds of thousands of comptuers, this could lead to hundreds of rows in a legend, so you’re not really saving any space. Also, legends tend not to display totals in a nice format, but tables, on the other hand, can be formated to include more details, make better use of the space on a page, and make it easier for drill throughs.
There are many decisions you need to make when it comes to designing SSRS reports. The first one is usually deciding what type of report style to use. Would you like to learn more about the different types of SSRS reports? Please see this post, What Are the Best Report Styles for SCCM?
Now, let’s get back to our main topic.
Before the GetColor Function is Added
Below is an example of a report that is using SSRS’ default color palette.

It’s easy in this simple chart and table to know which column corresponds with what value in the chart. But what if I told you that you could make it even easier?
Code
In the last blog post, Leonard showed you one of Enhansoft’s color palette codes which included the GetColor function. In order to use the GetColor function, it must be prefaced with Code. (see below).
=Code.GetColor(<column name>)
Let’s use this function within the chart.
Adding the Function to a Chart
Make sure your custom color palette code is already added to your report before proceeding to the next step.

Select one of the bars in the chart by right-clicking on it (#1) and then select Series Properties… (#2).

In the Series Properties select the Fill node (#3) and then select the function button (#4).

Next, paste =Code.GetColor in the expression window. Notice that I’m passing the Fields!Free_Space.Value to the function which will define the color for that column value.
Click on the OK button twice in order to close the open windows and return to the design tab.
After the GetColor Function is Added

As you can see from the screenshot above, after using the GetColor function with our custom color palette. The report is becoming easier to read and understand, but we’re not finished. Next week, in the third and final installment of this blog post set, Leonard shows you how to synchronize/match the colors in a chart with a table.
This blog post was co-written by both Leonard and myself, so please feel free to contact either of us via Twitter, Leonard Suares, GarthMJ, or leave a note in the comment section of this post.