At times it can be nice to define you own colors in charts. You may need to use a specific a corporate color scheme, make it easier to tell certain items apart or simply make the chart easier for the user to understand quickly.
It has always puzzled me how they chose the colors for some of the out-of-the-box system charts in Microsoft Dynamics CRM 2011.
Take the “Cases by Priority” chart for example.
At first glace this chart seems alright. Except when you look at how the series are colored, cases with “Normal” priority are red. In a chart like this red stands out more and most users would associate the red color with some kind of warning sign. On the other hand, the cases with priority high has the less alarming color blue.
Before we get into changing this specific chart, let’s look at some of our options for changing and modifying specific colors.
Export the charts xml file, open it and find the PaletteCustomColors property.
All the colors are listed as RGB colors, separated by a semicolon.
While Dynamics CRM add RGB colors to its custom palette it should be noted that Dynamics CRM accepts
- RGB Decimal (example: 97,142,206)
- RGB HEX (example: #4169E1)
- Named colors (example: Blue)
- ARGB (127,97,142,206)
The named colors could prove a lot easier to work with.
So instead of PaletteCustomColors=”97,142,206; 209,98,96; 168,203,104; etc.
we could write PaletteCustomColors=”Blue; Red; Green; etc.
Using the color names also makes it a lot easier to check if you have added them in the correct order.
This page contains an overview of the named colors available to use in charts.
Bonus: There’s one color missing from this list and that is “Transparent”. Transparent could prove very useful when you need to add data to a chart, but actually don’t want to show it. For example you may only want to display the value on a chart, but not have the bar or column visible.
Back to the example where we wanted to change the color scheme so High Priority Cases are red and Normal Priority Cases are Blue.
Since Dynamics CRM lists the series in reverse order (right to left) we know that Blue is the first color and therefore goes to the series for High Priority.
We want to change the the order of the colors so Red gets the first High Priority series. Then Blue and then Green.
Importing it back into Dynamics CRM we will get this result for the Cases By Priority Chart.
Now the High priority cases are appropriately Red and the Normal and Low priority cases have less alarming colors.
On some charts it is also possible to add specific colors to specific series, but I’ll save that for a later blog post.
Charts also support ARGB, which is similar to RGB, but there’s four values instead of three. The first value indicates the color’s Alpha transparency. 0 equals completely transparent. 255 is no transparency. 127 is 50% transparent etc.
Alpha transparency values are normally a percentage, but it has to be written in the RGB format which is a value between 0 and 255.