top of page
Search
  • Writer's pictureJames Goodall

Tableau Bitesize: Diamond Heatmap with LOD Ranks

This blog post will go through the process of how to create a diamond shaped heatmap, using LODs to calculate rankings



If you read my previous blog post on how I created ‘The Effect of COVID-19 on Crime in Surrey’ viz, you may have already picked some bites of this, but for those looking for a bitesize edition, or for a bit more information about creating the LOD ranks, this one is for you!


While not necessarily best practice, I feel this chart type does look very nice and can certainly help to draw viewers in to the story you’re telling.


Start off by connecting to the data source attached below:


census_religion_in_surrey
.csv
Download CSV • 195B

We’ll then need to create some fields to calculate the respective ranks based on the ‘Value’ field


DISCLAIMER: this is a little tedious and definitely not dynamic, but should help you produce rankings where this cannot be completed using a table calculation


Start off this process by creating a field called ‘Highest Value’



Next, create another field called ‘2nd Highest Value’



Then create another called ‘3rd Highest Value’



And so on (substituting in the previously created field) until you create the last one – ‘9th Highest Value’



With all of those fields created, we can now calculate the rank – create a field called ‘LOD Rank’ as follows:



Alright – now we have the ranks, we can position where our ‘diamonds’ are going to fit on a sheet


To do this we’ll first need to visualise where these need to sit



We need to create 2x calculated fields, one called ‘X’ which will have our horizontal coordinates and one called ‘Y’ which will have our vertical coordinates and in this case we want the positioning to go from bottom to top. In the data rank ‘1’ is the lowest value, so this will sit on coordinates -2, 0 then rank 2 sitting on -1, -1, rank 3 on -1, 1 etc


Create a calculated field called ‘X’ set up as follows:



Then create another called ‘Y’:



And that’s all of the calculated fields we need to create!


Drag ‘X’ onto ‘Columns’ and ‘Y’ onto ‘Rows’ (both as dimensions)



Change the chart type to ‘Shape’, pick a diamond shape and increase the size



Drag the ‘LOD Rank’ field to ‘Colour’ and pick a palette, then drag the ‘Religion’ and ‘Value’ fields onto ‘Label’ and format to your choosing. Also remove all lines and borders at this stage, and hide the headers



Now create a dashboard and drag the sheet on


If you had previously set your size of the shapes to the maximum it might look something like this



And when you come to reduce the size, then play around with the size of the sheet to make it line up, this might happen



To resolve this, I multiplied the X and Y values on the shelves by 100, to give some more granularity to the view to allow for more precise positioning



You should then be able to find a shape size and sheet size combination that works for you. It’s then just a case of adding in a title or source info to the dashboard and you’re good to go!


Version on Tableau Public:




201 views0 comments

Recent Posts

See All
bottom of page