Simple But Effective Geographic Heat Map Technique

Readers from the UK may well have noticed the newly re-designed Channel 4 Weather map (http://www.channel4.com/weather/), it certainly looks striking and in my opinion is quite effective in quickly getting information across to viewers (Therer are a few issues with it I agree):

So; time for my usual refrain: ‘That can be done in Qlikview’…and in this case better and in a more useful (to Qlikview Developers at least) way and below is the result showing Regional Sales performances:

I’m sure 90% of you will instantly see how this has been done; the principal is about as easy as it gets; the blocks are simply Text Objects with the Background colour controlled by an expression – simple but in my opinion very effective and in many ways more use that the Googlemaps mashup. For me the Googlemaps integration into Qlikview works really well; it allows selections to be made based on geographical location as well as showing hotspots of activity; all good but it’s not too good at showing accurate Regional activity, try gauging what Sales for the East Midlands were from a Googlemaps chart; it’s impossible. This is where this chart comes in; once set up it quickly and easily shows how each Region is performing either against a KPI, Target or other Regions; yes it looks a little strange at first but think it through; it’s showing things that other charts can’t.

Firstly the really easy bits: I’ve tweaked the arrangement of the regional blocks to make the British Isles more recognisable as the original is barely recognisable to me and I’ve been looking at maps of the UK for years. The layout of course isn’t fixed so; to a certain extent can be tailored to fit existing Regional Splits but as with the Googlemaps Mashup your data will probably need a little mapping to associate the data to the correct Regions but that should’t prove too onerous (a search on Google should provide some useful PostCode > Region datasets to start with).

The layout of the Text Object is simply set to have the text at the bottom right instead of centred (Properties > General > Layout > Horizontal / Vertical Alignment). The text is a simple expression to sum the sales for that particular Region eg:

=sum(if(Region=’Wales’,Sales)

I’ve added the ‘k’ at the end to simplify the display which is easily done using: (Akin to showing the figure in ‘000’s)

=floor(sum(if(Region=’Wales’,Sales))/1000)&’k’

Now; at this stage I bet some people are thinking ‘I can’t be bothered setting the expression for every single Region’ – well if that’s the case then quite frankly you’re being lazy; it doesn’t take that long once the first one’s done and come on admit it; how long did you spend messing around with the Googlemaps integration!

The trickiest part of this chart is setting the colour of the blocks, there are various ways of doing this as all you need to end up with is the correct rgb() or argb() code, here I’m going to outline how to set the colours (Red & Green – Green for strong sales, Red for weak) by making comparisons between each Region and the best performing Region.

First create a Variable; ‘vColourControl’ with the expression:

=250/max(aggr(sum(Sales),Region))

And a second Variable ‘vColourThreshold’ that is linked to an input box; this will be the point at which we switch from light green to light red, it could easily be made automitic to say switch at the lowest Quartile.

In the colour expression box of the Text Objects use the expression:

=if(sum(if(Region=’Wales’,Sales))>vColourThreshold,argb(sum(if(Region=’Wales’,Sales))*vColourControl,0,255,0),argb((((vColourThreshold-Sum(if(Region=’Wales’,Sales)))+1*(250/vColourThreshold)),255,0,0))

Bit of a beast of an expression but apart from the name of the Region it’s generic across all blocks. The reason for the size of the expression is that we need to have stronger Green the higher the Sales but stronger Red the lower the Sales below the colour threshold. As I stated; this is just my version; there are many methods that could be used for this; of course there’s no need to use 2 colours; it’s alot easier to just use one…but I’m experimenting! (I used a similar technique – with a single colour, in my recent Activity Ribbon Chart: https://qvdesign.wordpress.com/2012/01/18/activity-ribbon-chart/)

So there we have it; I admit it’s a little labourious to set up in the first place but once done it will happily, effectively and graphically show it’s info all day long with no intervention and requires little ‘data skill’ from the viewer to interpret. The addition of vColourTheshold makes it really easy to highlight under performing Regions, also what can’t be seen in the above images is that each Text Objects Help Text is being used as a Popup to display further info which could also be shown by adding additional transparent Text Objects over each Region in much the same way as Channel 4 have done in the larger version of the map.

I really want to emphasize; the difficult thing here isn’t complexity it’s simply the time needed to set it up in the first place – I’ve created a generic template for my use so it’s ready to deploy a little quicker when the appropriate situation presents itself.

It is of course possible to create versions for different countries and regions simply by arranging the blocks in the appropriate manner; I’ve made a European version that also works quite well (unlike the real EU at the moment).

Hope you can put it to use, the chart looks fantastic integrated into a full dashboard.

All the best,

Matt

 

Comments
6 Responses to “Simple But Effective Geographic Heat Map Technique”
  1. Lewis Johnson says:

    Another nice idea and once you have the first region set up the rest are almost a copy and paste exercise (with a bit of tweaking). Next step is to implement a selection box for the user to set there own measures so that the map can be changed dynamically!

    • qvdesign says:

      Totally agree, it’s good exactly because it is so simple which makes it very flexible.

      In fact just tinking of the top of my head it would be possible to add an Action to each region to ‘Select in Field’ agains the Region; meaning that if you click on Wales then ‘Wales’ is selected in the data model…mmmm, time for some experimentation.

      All the best,

      Matt

      • Lewis Johnson says:

        Nice idea! have fun with that one…

        The nice thing also when you change the Threshold value it almost cascades through all the text boxs to make the changes – looks cool!

  2. Carter says:

    Hi Matt,

    question: where does the 250 stand for in the first set expression:
    =250/max(aggr(sum(Sales),Region))?
    What does that number represent?

    Carter

    • qvdesign says:

      Carter,

      The 250 (or maybe it should be 255??) controls the opacity of the colour when using argb(): the lower the number the more ‘see through’ it is and when using a white background this makes it appear lighter or darker.

      You could also use the colormix() function to do something similar.

      All the best,

      Matt

Trackbacks
Check out what others are saying...


Leave a reply to Mapa Térmico « QlikView – My View Cancel reply