Workout Wednesday: Parallel Coordinates

This was originally posted on my first blog, Data vs Food, in December 2018

Who am I to ignore a challenge?

If you don’t know what Workout Wednesday is, click here.

The challenge for week 49 involved recreating the below Parallel Coordinate chart by Ann Jackson and you can find all the requirements here

Ann’s original viz

My recreation

My Approach

When approaching one of these challenges. Before I even open Tableau. I have a play with the viz on Tableau Public and see what it does. 

I’ll also ask myself some questions: 

with the answers for this viz in italics

What do the tooltips show? 

Fairly straightforward values already in the Superstore dataset. Likely a calculation involved in the first part of the tooltip.

What sort of interactivity is there? 

There’s a highlight action on the text/legend using hover. This acts on the main viz. Doing this also causes labels to appear on the lines. These labels aren’t just at the ends of the lines.

What sort of interactivity is there? 

There’s a highlight action on the text/legend using hover. This acts on the main viz. Doing this also causes labels to appear on the lines. These labels aren’t just at the ends of the lines.

What sort of marks are on show? 

Lots of lines. The little circle markers at each grey line can be switched on in the colour marks card.

Do I think there’s a dual axis involved? 

Possibly? But what I’ve seen so far perhaps could be done using marks/gridlines/zero lines/etc.

What does clicking do? 

The vertical grey bars can be selected, so they’re clearly a type of mark. I’m thinking it could be a dual axis now.

Click on bits of the dashboard and drag your mouse across, where do the sheets finish? 

Doing this allows me to go past what at first appeared to be headers. Now I know they aren’t. Potentially labels on the ends of the vertical lines? There’s almost certainly a dual axis.


Tableau Time

Now I actually open Tableau and start throwing some measures and dimensions about – I know I’ll need sales, profit ratio, and count of customer name.

Ok, I can see what Ann means when she says we have to sort out these different magnitudes.

If I’m going to get these differing values consistent, I’ll need everything to be on the same scale. I think I’ll aim to try and get all the values to sit between 0 and 1.

I did a bit of maths on some paper (I always have some handy when doing Workout Wednesday) and tried the following table calculation computed using sub-category. I did the same for Sales, Profit Ratio, and count of Customer Name – this makes three separate calculations with the same overall pattern.

Hmm, not quite what I was hoping for.

It’s almost there, but why am I getting figures above 1 and below 0? I did a little bit of research and found some information on normalising values. Turns out I forgot to subtract the minimum value from the numerator. Here’s a new version of the calculation (which I replicated for all 3 measures).

Let’s see what this does.

Much better! Everything is between 0 and 1. I added in actual values for sales, profit ratio and customers to the tooltips so I can check my viz matches Ann’s. Everything looks good so far.

 

Now the vertical grey lines need to be added in. This one is nice and straight forward.

Duplicate measure values on the rows shelf

Put sub-category onto the paths card.

Ta da!

At this point it would make sense to dual and synchronise the axis, but that’s an easy step I can do at the end. At this point I want to keep everything separate in case anything goes wrong, it’ll hopefully mean I can spot it sooner.

Colouring In

The colours of the lines and the colour legend are going to be the same calculation. The requirements state:

Color the lines based on which measure the sub-categories have the highest value in.

Letting Ann’s spelling of colour slide 😉 , I’ll be reusing the three calculations from earlier and comparing them to see which of the normalised values are highest.

This field is placed onto the colour marks card using the viridis colour palette and will later be used for the legend.

(As I’m writing this I’ve realised that my calculation doesn’t account for any values that are identical. To avoid any nulls appearing I’d probably add another couple of if statements to catch these).


Labeling Lines

The grey lines have labels that are always visible and sit at the top and bottom of each line.

Because of how I named my three calculated fields from earlier, I placed Measure Names onto the labels card and changed the following settings:

Alignment: centre

Marks to label: Min/Max

Scope: Line/Pie

Field: Measure Values (on my original version I left this as automatic and put measure values onto label then removed it from the actual label text. Setting the field value is far easier.)

This sorts out the name of each line. For the values, I created three calculated fields all based on the following structure.

They check if the normalised value is either 1 or 0 and then returns the relevant actual value, in this case it would be the maximum and the minimum.

I placed these onto the labels card making sure they were all on the same line in the label dialogue box. This was so the value displayed in the correct place on the dashboard.


Legend

The legend looks simple enough, but if you hover over the words you’ll notice they underline when highlighted. This tells me we’re looking at using text as the mark type. You might also notice that each part of the legend is positioned close to the others, they aren’t evenly distributed. This means the columns shelf is almost certainly left empty. I know I’ll be using the colour calculated field from earlier and likely the sub category as it’s used in one of the nested calculations.

I played around with the fields, I even placed index onto the rows and columns shelves and ended up with this.

Definitely not what I wanted but looking at the tooltips gave me an idea. I could put sub-category onto filter and just show the values I wanted. So I did that and removed index from rows/columns, and like magic I’ve got a legend!


The Details

Getting the formatting just right is half the fun of Workout Wednesday. There are a lot of tiny details that can be easy to miss, things like the grey lines sit below the other lines and the other lines have circular markers at the ends and at vertices.

When the labels appear using a hover action, they appear at the ends of the lines and at the vertices.

Image 14.png

The fonts used for labeling measure names and the values have different weights, sizes, and colours.

As a slight aside, this last one can be the hardest to spot. Yet I would say is one of the most important things. Choosing the appropriate font, size, weight, colour, justification, etc. can really make the difference between something that looks good, and something that looks great.

The hover action was straightforward to implement.

The only bit that had me briefly confused was how to get the labels to appear all along the lines. Turning the sub-category label into an attribute fixed this.

Definitely an interesting chart to make and something I can see myself using again. If you haven’t done already, take part in Workout Wednesday and learn something new.

Thanks for reading this far. This blog post got away from me a bit, so here’s some bread I baked yesterday.

 
img_7473.jpg