Creating a Donut Chart - Transcript
s1042 Tableau: Building a Dual-Axis Donut Chart
A donut chart is a sophisticated variation of a pie chart that utilizes a "hole" in the center to display aggregate totals or labels. This guide outlines the technical steps to create this effect using Dual-Axis overlays and Placeholder Fields to achieve a professional, layered visual.
Phase 1: Configuring the Dual-Axis Foundation
If you want to create a donut effect, then you must stack two separate pie charts on top of each other using a dual-axis configuration.
Action: Create two placeholder fields on the Columns shelf (e.g., MIN(0) or AVG(0)).
Implementation: Right-click the second placeholder and select Dual Axis to synchronize the views.
Result: This provides two independent Marks cards, allowing you to control the inner and outer "rings" of the donut separately.
Phase 2: Constructing the Outer Ring
To define the primary data segments, utilize the first Marks card to build the outer ring of the donut.
Mark Type: Set the Mark Type to Pie.
Color Logic: Drag the dimension you wish to segment (e.g., Region) onto the Color tile.
Size & Details: Place your measure (e.g., Sales) on the Angle tile and add percentage of total to the Label tile for clarity.
Phase 3: Creating the Inner "Hole" with LODs
Because the center of the donut should remain clean while displaying high-level aggregates, you should use the second Marks card to create a white "inner pie".
Action: Switch to the second Marks card and set the color to white.
LOD Calculation: Use a Fixed Level of Detail (LOD) expression to calculate the total sales across the entire data set.
Sizing: Adjust the Size slider on this Marks card to be slightly smaller than the outer ring, creating the "donut hole" effect.
Center Label: Drag your total sales LOD field onto the Label tile of this second card to display the grand total in the center of the chart.
Phase 4: Formatting and Final Polish
To achieve a professional output, remove technical artifacts and refine the labels.
Clean Up: Right-click the view and uncheck Show Header for your placeholder axes to hide the zero lines.
Number Formatting: Open the context menu for your labels and format them as percentages with two decimal places for precision.
Label Alignment: Use the Label tile settings to ensure the text is centered within both the segments and the center hole.
s1042