Being a part of UHG (UnitedHealth Group – the largest health and well-being services provider in the United States) these days, most of my dashboards are specific to healthcare data where I need to use donut chart. Maybe you have a strong dislike for pie charts, and donut charts alike. As a supporting visual to a KPI, they do come in handy from time to time though. I saw a watch "half-donut" chart in one of my fitness apps and it struck a good balance between visual appeal and optimized screen real estate when compared to a full donut. Special thanks to my fellow colleague here Hendrik Kleine who always guided me with his exceptional Tableau skills and suggested me to come up with new Visuals http://pykmax.com/video/crazy-pykmax-demo/ . You are truly a champ Hendrik.
In this post I'll walk you through the making of the below visual in Tableau.
Some background on why I structured the data the way I did.
Since there is no Arc/Half-Donut out of the box in Tableau, we'll need to create a normal Donut first, and then we will continue to work with the assumption that the top half equals 100%, rather than 50% in a full donut.
We'll color the bottom half white later on, so it won't be visible.
Next, we need to be aware that although we visualize the left point of the arc as 0% and the right as 100%, Tableau still sees this as a full circle, so our values/calculations need to take that into consideration.
With that in mind, we need to create the following data in Excel:
[Section] divides the circle into 4 parts.
[Value_Arc] presents the value we are visualizing, assuming the half circle equates to 100%.
[Value_Pie] is the actual value Tableau needs, which assumes the entire circle equates to 100%.
Step 1. Prepare and Connect Your Data
The hard work for this visual lies in your data Preparation.You only need to create “Section” in the excel File as per the below image.
Rest other values like Value Arc and Value Pie can be generated via Tableau. Refer the below Image.
Create a calculated field that will generate the Value Arc in tableau.
Create another calculated Field for the Value_Pie.
Step 2. Create Calculated Fields
Create a text calculated field which will generate the Label for the Donut value.
Step 3. Create Visual
- Add [Number of Records] to the Rows shelf twice. Set the aggregation to MIN
- Right-Click on the rightmost [Number of Records] > Dual Axis-> Synchronize Axis
- On the Marks card, select the First (MIN(Number of Records)) shelf and Change the chart type to Pie
- Drag [Section] to Color and [Pie] to Angle
Your current view:
5. Right click on the “Section” placed on the Color shelf and Click Sort.Perform the manual sorting (Clockwise) as per the below sequence
- [Bottom half]
- [0 to 50]
Once manual sorting is done, you can set the desired color.
*Note: Make Sure “Bottom Half” always matches with your background Color. In this case my background is white, so I have assigned White color to "Bottom Half"
Something like this:
6. On the Marks card, select the last shelf (MIN(Number of Records)) and Change the chart type to Circle and drag [KPI Label] to Label
6.1. Use the Size slider to reduce the circle so the underlying Pie becomes visible
Your current view:
Step 4. Format
Apply your best formatting and you're done!
Leave a comment
You must be logged into post a comment.