Friday, April 19, 2013

Workaround: How to export video from Tableau

Quick disclaimer: I'm running Tableau in VirtualBox on a mac. Much of this trick relies on the ability of OS X's Automator to convert pages of a PDF to multiple PNG files, and I also use a mac app called FrameByFrame. I'm sure there are Windows-only ways of doing this, but you'll need to do some additional googling.

If you drag something to the Pages shelf in Tableau, there are lots of options that would be useful in animation. Animation may or may not be appropriate for your tasks and data, but we'll assume for this post that it is. As useful as some of the tools are, though, each page is updated straight from the data, making for choppy playback that's difficult to tune. Worse, you can only export pages one at a time via Worksheet -> Export -> Image...

Here's the workaround to get a video you can control; it involves a couple external programs. As mentioned above, you'll need something that will convert the pages of a PDF to images, and you'll also need FrameByFrame (which is free). You'll probably also need a healthy amount of free hard drive space if this thing is going to be very long.

In Tableau, go to File -> Page Setup... and check "Show all pages"

As we're going to sneak this out of Tableau via printing to PDF, realize your page size will determine the final shape and resolution of your video. You may want to tweak Layout setting here as well.

Next, go to File -> Print to PDF... Again, you'll want to choose a page size that has the right proportions. Because it has to render every frame, this step will take a while after you click "Ok".

Once you've gotten your .pdf, create this workflow in Automator (please don't use .jpg, or you'll have an ugly mess!):

After running it on your .pdf, you'll have a lot of .png files named something like "results 012.png".

Now open FrameByFrame. Go to Edit -> Import Images... Select all the images you just generated. FrameByFrame gives you options for creating your animation - play with these settings until you're satisfied:

In my case, I actually want a low (3 fps) frame rate, but the awesome thing here is now you have control - the number of frames is data-driven in Tableau, and the actual playback speed can be tuned for perception. When you're done, go to File -> Export... to save your video. Here's one I generated, showing the last 30 days of earthquake data.

No comments:

Post a Comment