Everybody’s a Hacker

This post is based on a presentation that I originally created for the Auckland Tableau User Group (#AKLTUG) in December 2016 and then extended for the Tableau Fringe Festival APAC (#TFFAPAC) in August 2017. It’s best consumed as what it is: a talk! So I encourage you to watch the recording of the #TFFAPAC talk on Youtube. In this post I will also include links to the workbooks and scripts I have used to create all of this.

You can access the workbook I used in my talk here on Tableau Public, please be aware that the “pages” functionality does not work online and you will need to download it.

What actually constitutes a “Hacker”? If you do what most people do, when they want to get a definition for something, and google “Hacker” you will end up with pictures like the ones on the left; the typical image that the news, TV series and movies communicate: The shady, hooded guy (!) that hacks wearing a mask and has “The Matrix” references in every tool he (!) uses. And while I don’t want to rule out that there are people like this out there, I doubt that this is very accurate!

A hacker is not a Neo-like magician from a foreign country that hacks your email servers and leaks those emails. Instead, let’s have a look at Wikipedia and use this way more useful definition:

[Hackers are] individuals who enjoy the intellectual challenge of creatively overcoming limitations of [software] systems to achieve novel and clever outcomes.

https://en.wikipedia.org/wiki/Hacker_culture

I removed the term “software” because if you had a look at your Facebook or Twitter feed you probably came across one of the millions of life-hacking videos which never actually refer to software.

Hacking Tableau

How do you now apply this definition to Tableau?

If you ever created a donut chart, a lollipop chart, a slope chart or any of the other charts that you cannot see in the “Show me” section of Tableau, I would argue you already qualified as a hacker!

You typically create these charts by creating a dual axis chart with two different mark types. I am sure that the developers had chart types like combined bar and line charts in mind when they implemented this feature and didn’t think you could actually use it to create this nearly infinite number of other charts that we are all more or less familiar with now.

If you are still not convinced that this counts as hacking, have a look at one of these three examples. While they might be more or less straight forward to create, it requires a lot of creativity and determination to come up with the method of creating it.

I think depending on your experience and skill working with Tableau, all of these chart types fulfill the requirements for being a hack (challenge, creative, novel, clever), however they all have one thing in common: They use Tableau for what it was intended to be used! They create graphics that visualise a dataset in order to communicate some kind of information. So to go beyond Tableaus purpose, let’s see what Tableau, at its root, actually is: It’s a piece of software that displays an image based on input data and parameters. Your data source and the combination of Measures and Dimensions determine what the final image looks like. At its core, Tableau is a graphics engine!

Rendering arbitrary images in Tableau

So now let’s use it as one, let’s create a data source that displays a predefined image, rather than having a predefined data source that creates an image. This was a thought that occurred to me a few months after I started using Tableau and what I created was this stick figure. It looks very basic and the method of creating it was very crude as you can see from the Excel workbook that I used to create it. It was also a lot of work to draw just this figure, so creating a more detailed image would not go well with my generally tendency towards lazyness.

Instead I created a different kind of image (bitmap instead of vector for anybody who knows a bit about computer graphics). I wrote a simple Python script that scraped the colour information for each pixel, translated that into a Tableau data source and extracted the colours into a custom colour palette. This was a lot easier than drawing every line by hand and a lot more scalable.

Success! 

Rendering a movie

The next logical step was to try to get those images moving. A movie is nothing more than a sequence of images which we perceive as a fluent motion, so if we have a possibility to swap these images quickly enough, we should be able to create a similar effect in Tableau. The most basic way to do this would be a filter which we use to quickly filter on different image names, however luckily Tableau has a native feature for this called the “Pages Shelf”. It’s this not so hidden shelf next to your list of data sources that you probably never paid much attention to. With this we can automatically switch through dimensions at a given pace and therefore animate a given graph.

With this technique, I managed to have my stick figure move her hands and I was able to scrape the different frames from an animated gif with a python script (feel free to fork and improve!) to have super Mario jumping.

Success!

Creating an interactive game

For the last step, my colleague played around with trajectory equations in R and came up with a model that considers wind, gravity, draught and some other specifics to calculate a realistic path for an object that is thrown. With this as a basis and some adjustments we created a game that you might remember from games like Worms. It is interactive and looks less like a Tableau dashboard and more like a game!

The problem for now is that playing it is not straightforward. It is not possible to play it in the current version on Tableau Server because “pages” are not supported. Locally you will need to have an R server installed to run the calculations. If anybody has the possibility to host this dashboard on a Tableau Server with guest access and a connected R server, I would be happy to create a version that doesn’t rely on the pages shelf for others to play around with!

We also managed to implement another hack: Remember how Tableau advertises that the access is read-only and you will never alter the underlying data? Well…this is only true until you make Tableau alter the underlying data! In our example Tableau writes your score back to a CSV file, which then feeds back to the score board on the right.

This was realised via a line in the R code that outputs to the CSV file but only runs in case the Save Result parameter is set to “save”.

It’s by far not the first and definitely not the last game that was developed in Tableau, you can find Tic Tac Toe, Blackjack, Battleships and even text adventures that allow you to drill down into the Academy Awards.

Success!

Take-away

You might ask “How does this help me with my boss asking for an improved month end report?”. On the surface, it doesn’t look like developing a game helps at all with “normal” office tasks, however some of the experiences I made, apply across any use cases.

  • Everybody can hack everything! If something does not work for you, you can always try to make it work. That applies to Tableau as well as to anything other piece of software, process or object you use.
  • Step back to go forward! Finding a solution is not always easy and might require you to take a step back. I could have tried to improve my method of creating the vector image but instead I used a different visualisation technique. If your boss complains because you cannot 100% recreate that one chart in excel, step back and check what it actually does. More often than not you will see that it was itself a workaround or a “hack” which might not be needed anymore when moving to Tableau.
  • Iterate and try new approaches! Play around and iterate through what Tableau offers. You cannot break the data and you might end up with an unexpected visualisation that serves your insight. Try to apply known techniques to new situations and see what happens.

From my experience the quickest way to become familiar with the features and possibilities of Tableau to become more and more proficient is to:

  • Learn what Tableau can and cannot do. If you don’t know its boundaries, you cannot push them
  • Play with what is given to you (or look for challenges yourself) and stay curious for different applications
  • Talk to others and ask them for feedback or ideas, often outsiders have a fresh view on things that you might not have considered

Comments

3 responses to “Everybody’s a Hacker”

  1. But the problem is, Tableau web cannot run animation as in Tableau desktop, Correct me if I’m wrong.

    1. That is correct, unfortunately. Tableau decided to not support the pages functionality on Server. That said, the game itself could also work with just a “Show Result” button that displays the flight path.
      A lot of these things are experimental to see how far you can go, rather than creating something that could actually be productionised.

      1. I see, nice work, Alex!

Leave a Reply

Your email address will not be published. Required fields are marked *