All credit for the original template and method goes to Toan Hoang. Thanks for letting me create this!
Original Post: Double, Spaced Doughnut Chart Tutorial - Toan Hoang
Prep Template Build Video: Spaced Donut Chart Tableau Prep Template: Put Some Prep in Your Step - YouTube
Welcome back to another edition of Tableau Prep Templates! So far, we've been going through some popular viz templates from the Flerlage Twins. Here are the previous templates for you to check out: Curvy Bump Chart & Slope Chart - Tableau Prep Template (whattheviz.com) Coxcomb Chart - Tableau Prep Template (whattheviz.com)
The reception for these templates has been amazing. These are doing more than just helping others incorporate Prep, it's filling a need to make these vizzes easier to accomplish with real world data. I've used some templates already to help solve the problem of creating bespoke visualizations for clients! In talking with them, I've begun to understand how these need to function to be most useful.
Because of the opportunity to create a large resource, I've reached out to more folks in the community who are known for their bespoke templates and am excited to say that Toan Hoang has also given me permission to create templates for some of his amazing work. So today we take our first look at one of Toan's templates: the Spaced Donut Chart!
Check out the original blog: Double, Spaced Doughnut Chart Tutorial - Toan Hoang
What we're going to do this time is create the template in a way that you don't have to fill out an excel sheet. Ultimately, I want this to be as plug and play as possible. You will have to do a little bit of editing inside of Prep, but this should still be a simpler process than exporting your data and filling out an excel sheet, especially if we want this to be an updating viz.
I'm still including an excel template here just in case.
The Data In the excel template included, our data looks like this:
This might look familiar to you. It's a row-level copy of the Superstore - Sample data set included in Tableau, but with the Category column as 'Dimension' and the Sales column as 'Measure'. This is meant to show that this template will work with any row-level data set, you just have to define what column is going to be the measure and which is the dimension.
In the original post, the data is structured like this:
There are 4 rows for every value. 2 for each Path (1, 360) and 2 for each Position (1.3, 1.5) We're going to use 1 and 1.2 for our position.
The Path is used to give use 360 points for a circle, and the Position is used to define the length of each of the spaced lines in our donut chart. Our chart ends up looking like this:
Each of these charts represents a % of total, so that's what our Prep flow is going to output.
Prep Flow
When you open up the Prep template, you'll see this flow with some errors:
First you will connect to your data source and drag your table to each of the Position, Scaffold Range, and Remove/Rename steps. I have connected to the Sample - Superstore excel in the Tableau Repository to demonstrate.
The Remove/Rename field won't have any changes in it initially. You will use this step to remove everything you don't need. Identify one column you will use as the Dimension (What are you representing the % of total of?) and one you will use as the Measure. I identified Category as my Dimension and Sales as my Measure. I control-click both of those fields and select 'Keep Only'
Then I rename the fields to Dimension and Measure
Once you've completed that, the Prep flow does the rest of the work for you! It aggregates your measure to each dimension, calculates a % of total, and densifies the data. All you have to do now is output the data (This could be in a local file, or as a published data source if this is going to update regularly with real data!)
Next you'll open up the packaged workbook included here: Spaced Donut Chart Template - Google Drive
Connecting to Local File
When you open the workbook, you'll click on the Data Source tab. It might prompt you to click on the file you want to use. If it doesn't, right click the connection and choose Edit Connection
Connecting to Published Data Source
Open the workbook and find 'Data' in the tool bar. Select New Data Source. Click Tableau Server and sign in to your site.
Once you're signed in, choose your template data source
Now in the Data pane, right click your published data source and choose Replace
You may need to adjust your colors. For example, my grey colors changed to a teal.
I adjusted it back to grey, and that's it! You've transformed your data to create the viz with minimal work! and if you are using a published data source with Prep Conductor, you can refresh the data on a schedule!
I hope you are able to make use of this Prep template! If you'd like to learn how it was built, check out the video here: Spaced Donut Chart Tableau Prep Template: Put Some Prep in Your Step - YouTube
Comments