Creating a colored treemap using colormix
Treemaps were originally designed by Ben Shneiderman, a professor of Computer Science at the University of Maryland. They are a very effective way of displaying hierarchical data. Within QlikView, the basic implementation of the Treemap, using the size of the rectangles to encode a value, can be effectively rendered by using the block chart.
If you want to encode a secondary measure, you can use a color function such as colormix1
, along with an advanced aggregation statement.
In this recipe, we are going to compare sales values using the size of the rectangles and average order size using color
.
Getting ready
Load the following script:
LOAD * INLINE [ Country, City, Sales, Orders USA, San Diego, 24567, 546 USA, Dallas, 54962, 345 USA, New York, 67013, 678 USA, Boston, 45824, 365 UK, London, 64002, 743 UK, Birmingham, 44291, 572 UK, Manchester, 40320, 534 Germany, Berlin, 52912, 643 Germany, Frankfurt, 61832, 678 Germany, Munich...