2/17/2015
Bursting Your Bubble in Tableau


Back in June 2013, I recreated Hans Rosling's famous Gapminder visualization from his TED talk. My Tableau visualization is posted here as well as Moritz Stefaner's Remixing Rosling, which I also recreated in Tableau here. Unfortunately, there are no "play" controls on Tableau Public, so I also posted a YouTube video demonstrating the play movement in the visualization here.

A few months later, Mec Analytics posted a comment on YouTube asking, "If I want to split the bubble into smaller bubbles representing nations, how can I do that?" What this person is asking refers to a point in Hans Rosling's presentation, here, where he bursts the bubbles into Countries.

I was reminded of this again last semester when a student in the data visualization class at the University of Cincinnati asked me a similar question. The team ended up using another visualization altogether, so I put the question aside. Circling back to this idea, I will outline my approach below on how to do this. For this demonstration, I will use the "World Bank Indicators" data that is available in Tableau, using a bubble chart with [Region] and bursting that into [Country].

My first thought was to use "Dashboard Actions", but those actions are limited to: Filter, Highlight, and URL. None of these actions will change a selected dimension from [Region] to [Country], so I utilized a parameter control to handle the bursting.



Instructions to build the visualization
(click the Download button above to download the Tableau workbook)

Step 1: Build a bubble chart

   Open Tableau and select the "World Bank Indicators" data
   Move Health exp/cap (curr $) to Columns
   Move Life exp female (years) to Rows
   Move Region to Color
   Change Marks to Circles
   Move Population (count) to Size and change Measure to SUM
   Add Date (year) to Filters and select 2010
   Add Region to Filters and remove Other
   Right-Click on X-Axis and Click Edit
   Change Axis to Fixed with Start 10 and End 10,000
   Check Logarithmic under Scale
   Click Tick Marks Tab and Select Fixed and Powers of 10
   Click OK
   Right-Click X-Axis and click Format
   Change Numbers format in Scale to Currency (Custom) with zero decimal places
   Right-Click Y-Axis and click Edit Axis
   Change Axis to Fixed with Start 40 and End 100
   Click Tick Marks Tab and Select Fixed and Every 10
   Change the colors of the Regions as desired
   Adjust Size of bubbles as desired

You should now have a bubble chart of the Regions. Now we will add our bubble bursting functionality.

Step 2: Create Some Calculated Fields and a Parameter

   Calculated Field Name: Region-Country
   Formula: [Region] + "-" + [Country / Region]

   Calculated Field Name: Burst - Africa
   Formula: IF LEFT([Region-Country],6) = "Africa" THEN [Region-Country] ELSE [Region] END

   Calculated Field Name: Burst - Asia
   Formula: IF LEFT([Region-Country],4) = "Asia" THEN [Region-Country] ELSE [Region] END

   Calculated Field Name: Burst - Europe
   Formula: IF LEFT([Region-Country],6) = "Europe" THEN [Region-Country] ELSE [Region] END

   Calculated Field Name: Burst - Middle East
   Formula: IF LEFT([Region-Country],11) = "Middle East" THEN [Region-Country] ELSE [Region] END

   Calculated Field Name: Burst - Oceania
   Formula: IF LEFT([Region-Country],7) = "Oceania" THEN [Region-Country] ELSE [Region] END

   Calculated Field Name: Burst - The Americas
   Formula: IF LEFT([Region-Country],12) = "The Americas" THEN [Region-Country] ELSE [Region] END

   New Parameter Name: Burst Bubble
     Select Data Type of String
     Add from Field Region
     Manually add the values of NONE and ALL (Slide NONE to the top of the list)
     Click OK
     Right-Click on Burst Bubble parameter and select Show Parameter Control

   Calculated Field Name: Burst Dimension
   Formula:
   IF [Burst Bubble] = 'NONE' THEN [Region]
     ELSEIF [Burst Bubble] = 'Africa' THEN [Burst - Africa]
     ELSEIF [Burst Bubble] = 'Asia' THEN [Burst - Asia]
     ELSEIF [Burst Bubble] = 'Europe' THEN [Burst - Europe]
     ELSEIF [Burst Bubble] = 'Middle East' THEN [Burst - Middle East]
     ELSEIF [Burst Bubble] = 'Oceania' THEN [Burst - Oceania]
     ELSEIF [Burst Bubble] = 'The Americas' THEN [Burst - The Americas]
     ELSEIF [Burst Bubble] = 'ALL' THEN [Region-Country]
   END

Step 3: Build bubble bursting functionality

   Move Burst Dimension to Details
   Click Edit Sizes for the Circle Sizes
   Check boxes for Start value in legend and End value in Legend
   Click OK

You should now have a working parameter control which will burst the bubbles. You can select NONE for the original bubble chart by Region. Select an individual Region and it will burst only that Region. Select ALL and it will burst all of the Regions at once.

This is a relatively easy solutions, using only a few calculated fields and a single parameter control.

I hope you find this helpful. If you have any questions feel free to email me at Jeff@DataPlusScience.com

Jeffrey A. Shaffer
Follow on Twitter @HighVizAbility

Edited by Breanne LaCamera 2/25/2015 and posted 2/25/2015