Friday, 8 June 2012

Homage to Minard

It is amazing to me that I can work with a product like QlikView for 6 years and still come across new things all the time.

Recently, my good friends The QlikMonkey, posted a visualization about why the soccer team, Manchester United, lost the English Premier League:

They were also kind enough to share some other work that they had done to create similar parallel coordinate charts like this.

One of the things that I noticed about it was that some of the lines had different widths - I hadn't known that we could do this in QlikView!!!

I had always known about the different options that we could add expressions to under an expression in a chart, e.g. Background, Bar Offset, Text Color, etc.  One of those is "Line Style".  I had thought (and this is correct) that was to do with creating different types of line such as dashed.  I didn't realize that we could also use this property to dynamically change the widths of lines.

This is from the QlikView Help file:

"The relative width of the line can be controlled by including a tag <Wn> where n is a multiplying factor to be applied on the default line width of the chart. The number n must be a real number between 0.5 and 8. Example: <W2.5>."

It occurred to me that I might be able to use this feature to replicate one of the classic charts in visualization history - Charles Minard's chart of the losses suffered by Napoleon during the disastrous Russian campaign of 1812/13, which he drew in 1869.  Even Edward Tufte, one of the modern-day guru's of data visualization, described this as "probably the best statistical graphic ever drawn".

I created a data set of X, Y coordinates along with the volume of soldiers for each point (field called "Count").  A separate set for each direction (and spur line).  I then created the line chart and used a % of the Max value to calculate the appropriate "W" value for the line:

='<W' & Round(0.5+(Sum(Count)/Max(total Aggr(Sum(Count), X))*7.5),0.1) & '>'

And here are the results:

Obviously this is not an exact replica.  If I was doing it again, I would include more data points to get finer detail.  But as a proof-of-concept, I believe it is a good enough effort.

Stephen Redmond is CTO of CapricornVentis a QlikView Elite Partner
Follow me on Twitter: @stephencredmond


  1. Hi Stephen,

    Great job. I totally agree with you, there is always something new to learn with QlikView. I had seen the parallel coordinates chart with the insurance example. I think one of the QlikTech employee or Partners had created this one. It's great to way to show the power of QlikView.

    Thanks for sharing.


  2. This comment has been removed by a blog administrator.


Note: only a member of this blog may post a comment.