Search
  • bkornell

Line Charts! Tackling Week 2 of "Back 2 Viz Basics"

Week 1 of "Back 2 Viz Basics" produced some amazing interactive scatterplots... but it also prompted a participant complaint that "these aren't really basic". So for Week 2 of #B2VB, I intentionally reined it in and produced a single chart that practiced core techniques (but I'll talk about other options).


First, Sanity Checks


Tableau makes it easy as pie to produce a line chart of the data. Four steps:

  1. Drag [Date] to Columns.

  2. Click [Date] and change it to Continuous Months (the second option for Months). The pill will turn green, and you'll get an axis along the bottom.

  3. Drag [Unemployment Rate] to Rows.

  4. Drag [Country Name] to Detail. This splits out the data into the 36 countries.

A promising start! I hovered over those big humps in the 2010s and saw that they were Spain and Greece, two countries that I remember had big economic crises then.


Except... then I looked at the axis, which tops out at 80%. Things were bad in those countries, but nowhere near 80% unemployment.


The data set repeats three times based on the [Gender] field: ALL, MEN, and WOMEN. By not limiting the data to "ALL", I was adding together all three versions. Putting on that limit shows those two countries topping out near 28% unemployment: really bad, and in line with what I remember of the Great Depression in the United States.


Always do a sanity check on your axis. Think about the data and if it feels reasonable to you. Do a few minutes of background research if you don't know much about the topic.



Viz Options


This chart is a pile of spaghetti. With 36 countries, it's impossible to focus on much of anything other than the two "humps" I mentioned before. There are at least 3 good options available:

  1. Focus on one country, and push everything else to the background.

  2. Filter the data to focus on a smaller story (for instance, unemployment in Western Europe).

  3. Split the data up into separate graphs, one per country ("small multiples").

I went with #1 this week, but I've seen lots of great vizzes that use the other approaches. For instance, @d_kungu put together a great version of #3. If you're interested in trying this kind of chart, check out the video by Andy Kriebel (@VizWizBI).



Fixing the Spaghetti Chart


I used color and size to pop a selected country out from the others.


1. Create a parameter called [Country Name Parameter], using the values from [Country Name]. the names of all the countries.


2. Create a calculation called [Selected Country] with the formula

[Country Name Parameter] = [Country Name].

It's a Boolean variable (true/false), but that's fine.


3. Put [Selected Country] on the Color Shelf.


4. Change the colors so True is a bright color, and False is gray. My go-to is the lightest of the Seattle Grays palette (the 4th one down). I actually wanted it even lighter, so I double-clicked the gray square next to False and pulled up the slider on the vertical bar on the right.


5. This is getting there. The bright line is behind the gray lines, but you can just drag "True" above "False" in the legend to fix it.

6. I wanted to use size, too. This was another computed item called [Line Size] with the formula of

if [Selected Country] then 10 else 1 END


7. Put [Line Size] on the Size shelf, and then adjust the Size shelf so it's not quite so chunky.

This was what I was going for: one line jumping out from all the noise.


That Pesky Menu


I like adding functionality to my dashboards. I decided that I wanted people to be able to change the country (the parameter), the year range (so they could zoom in), or turn off the gray lines (a second parameter).


Here are some different options of where to put the filters and parameters:


#1 is terrible. The top left is your most valuable real estate. So don't waste it on filters.


#2 is where I usually put filters for business dashboards. Generally, users don't know they can interact with the viz unless you make it obvious for them. So it's solid, but I thought it was a little intrusive here.


#3 is also workable, and if I only have one filter or parameter, I like this location.


#4 is okay, but best if you have a ton of filters (as some business users insist on).


I decided on #3, and I put it in a hidden menu to keep the viz minimal. I'm honestly not sure that's the right decision, because of what I said about users missing functionality that isn't apparent. But I did feel that the hamburger menu (you know, the three bars) was easy to spot, floating by itself at the top right. Users are getting more used to what the hamburger icon means, because it's common on mobile apps.


The hamburger (default in Tableau if you use the Show/Hide Button):



I did find one problem with this, which was that depending on how you filter the viz, the floating menu can overlap the line. So I solved this by adding a light gray border and 80% opacity to the floating box with the filters, so the viz appears behind it.


That's the core of the viz and the menus. Did I make the right choices? Drop me a line on Twitter or LinkedIn and let me know.






25 views0 comments