HTML Calculated Column and Unicode Graphics

The number one application of the “HTML Calculated Column” method is the display of visual indicators in SharePoint lists. You’ll find many examples on my blog:
KPIs
Progress bars
Color gradients
– etc.

If you haven’t used this method yet, you’ll need to learn it to take advantage of these tutorials. For the latest information on the HTML Calculated Column, start with this post… or attend one of our live online workshops.

Most examples are about color coding backgrounds or text. But what if you want to take it a little further? For example display:
– up/down arrows
– check marks
– star ratings ✭✭✭✭✭
– traffic lights
– etc.

What immediately comes to mind is to use a set of icons. But the above examples offer a lighter solution: welcome to the world of unicode graphics!

Unicode is an international standard that references character sets. This includes some graphics, see for example the page below:
http://www.alanwood.net/unicode/index.html
For the graphics, scroll down to the “Symbols” category.

Some benefits of unicode, compared to icons:
– unlimited choice of colors, for both the graphic and the background.
– the rendering is not bound to an external image. This means better performance. Also, it makes it easier to save the SharePoint list as template for reuse in other environments (I’ll provide such a template in an upcoming post).

An example: traffic lights

As an example, here is the formula I used in a calculated column to generate the above traffic lights:

="<span style='background-color:black;font-size:24px;'><span style='padding:-10px;color:"&IF([Color]="Green","green;'>✹","gray;'>✹")&"</span><span style='padding:-10px;color:"&IF([Color]="Amber","RGB(255, 191, 0);'>✹","gray;'>✹")&"</span><span style='padding:-10px;color:"&IF([Color]="Red","red;'>✹","gray;'>✹")&"</span></span>"

Where the [Color] column can take the values Green, Amber or Red.

How about Wingdings?

Why use unicode characters, and not simply fonts like Webdings, Wingdings, or Zapf Dingbats? Those too offer graphics, but there is a downside: these fonts are not standard, and they don’t work cross-browser (and never will, from what I read). Such graphic fonts could still work for you if you are in a corporate environment where your internal policy enforces the use of Internet Explorer.

Unicode seems to work in all modern browsers. I tested it in IE7, IE8, Firefox, Chrome and Safari.