Thursday, 25 April 2013

Colour me right

So here's the scene.

You've spent some time getting the data into a sensible format, connected it to it with Tableau and created beautiful dashboard. It's got parameters, filters, actions and works brilliantly. You've used all the correct analytical techniques and only used the approved chart types and followed best practice. The three sheets tell the story of the data and provide real insight into the underlying detail within. So you publish it and send it to the customer for review/feedback.

Time passes, you read a book, get a coffee, and then the feedback arrives. It's really great but can we change the colours of the bars to match the corporate scheme? Yes, for some reason they don't want to use the a palette in Tableau; they want to have it fuchsia, orchid and a shade of green that might best be described as moss. You explain that the colour palettes in Tableau  were chosen as they work well together, lots of time and money went into finding that out. They think that's great, but they still want their corporate colours. So what do you do?

Well it's actually pretty simple to customize Tableau so that it will fit with any existing scheme. You need to get a few bits of information and know where to put them. So first let's get the colours.

Now the way you select colours on a computer can vary depending on the program you are using. Typically this is either the RGB values or the Hex values.

RGB values are a set of 3 numbers from 0 to 255

0,0,0 is black
255,255,255 is white
255,0,0,0 is pure red
0,255,0 is pure green
0,0,255 is pure blue.

So combinations of these numbers make every colour available.

Hex values work in a similar way but are written in a single string eg

#000000 is black
#ffffff is white
#ff0000 is red
#00ff00 is green
#0000ff is blue

If you already know the RGB or hex values of you required colours then you can skip ahead a bit......

Ok if you are still here then I will assume that all you have is the company logo.
Load up the logo image into Paint and select the colour picker tool (it looks like a medicine dropper) and pick up one of the colours from the logo. This is now selected as colour 1. Now click on the edit colours and this brings up the colour editor dialogue with out selected colour already highlighted. On the right hand side are the RGB values for our selected colour. Make a note of these 3 values and repeat for all the colours that you want to use.

So for example
247 53 232
108 72 183
24 149 6

Now, Tableau uses the hex values for its palette so we need to convert our RGB values into hex. This is a good website for doing just that :

http://www.colorpicker.com/

Just enter your RGB values and it displays the corresponding hex value, make a note of these for your scheme

#F735E8
#6C48B7
#189506

We've now got our colours in the correct format so we can now enter them into Tableau.
If you go into your "My Tableau Repository" directory (which on my machine is in the My Documents folder) you will find a file called Preferences.tps. Right click and open it up in notepad (or whatever text editor you want to use), this is where we will add our colour scheme.

You need to add the following bit of code to the file within the <preferences></preferences> lines (and here’s a tip, copy and paste the code that is currently in the preferences file and modify it for the name of the palette and the hex values, in the order you would like them displayed) :



<color-palette name="Our Company Colours" type="regular">
      <color>#F735E8</color>
      <color>#6C48B7</color>
      <color>#189506</color>
</color-palette>



The name of the palette is what will appear in Tableau so make it something that makes sense to you. In-between the <color></color> you put your own hex values that you found earlier. Save this file and launch Tableau.
Now when we drag our dimension onto the colour shelf, click edit colours and select the palette we see :



Select your new palette, click assign palette, OK and the new company colour are now in the viz.

This palette will always be available to you, providing you don't change the preference file. If you want another new palette just copy and paste the code you used before but change the name. If you then publish this to server and someone else downloads and edits it, then they will also need to have the settings in their preference file as well. The palette is linked to your desktop install, not the workbook.

The community forum on tableausoftware.com is an excellent resource for more information on color palettes. Thanks to Michael Cristiani for this reference http://community.tableausoftware.com/thread/117530 on using Color Brewer’s palettes in Tableau.  Twitter, user groups,  and the Tableau community forum are all great resources to get help.

You can check to see if your custom palette will be good for those with color blindness by checking it here http://www.vischeck.com/

So you know you know how to bend or break the colour rules, go forth and create beautiful dashboards based on sound colour principles or garish monstrosities.




Matt

Author & Editor

Tableau Zen Master, Social Ambassador, Wrangler of Data, Vizzer of Data

8 comments :

  1. Matt, nicely done. The one addition I'd make (that isn't readily apparent to newcomers) is that you don't actually have to create a palette, or even use a palette, to set up custom colors. As you know, once you're in the Edit Color dialog box, double-clicking one of your colors on the right will bring up a color wheel, so you can assign whatever garish color you like -- sort of a custom color palette on the fly.

    Cheers,

    Shawn

    ReplyDelete
  2. Oops, I meant "...colors on the left"

    ReplyDelete
  3. Hi Shawn! Lowest common denominator here. Do you have steps to reproduce? Where exactly am I editing the color to get the color wheel to show up? And can it be reused or when I have a color palette on the fly, is it only available for that workbook?
    Thanks!!

    ReplyDelete
  4. http://wannabedatarockstar.blogspot.com/

    ReplyDelete
  5. great technology found via your article and it's more interest to do first sight visitors also. keep do more interested thing via design article.
    School Logo Design UK

    ReplyDelete
  6. great tips thanks for your impressive enhancement of getting unique style of design a website. and it much more wonderful information to me. keep share many different ideas.
    best GMAT coaching classes in chennai

    ReplyDelete



  7. Privileged to read this informative blog on Tableau. Commendable efforts to put on research the data. Please enlighten us with regular updates on Tableau. Friends if you're keen to know more about Tableau you can watch this amazing AI tutorial on the same.
    https://www.youtube.com/watch?v=ZB78DglzyZY

    ReplyDelete

 
biz.