What is a Sunburst chart?
Sunburst chart a.k.a Multi-level pie chart or ring chart is ideal for visualizing hierarchical data structures. The hierarchy starts from the inner circle to the outer circle and shows how it relates to each other .
How to create a simple Sunburst chart?
One of the easiest methods to create a Sunburst chart is by using the map layers. This feature allows to add multiple mark layers and each layer can be controlled and formatted independently with different size, shape and color. You can also show/hide the layers as per your need.
Here is the step by step instructions on making the sunburst chart to show profit across Category, sub-category and segment using the Superstore dataset.
Step 1: Create a calculated field and write
This creates a spatial object (stores location as object) constructed using latitude and longitude. Let’s name this calculated field as ‘Point’.
Step 2: Double click or drag and drop ‘Point’ to the Rows. A small dot appears on a null geolocation like the below image.
Step 3 : Change the chart type to pie in the Marks tab. Let’s drag and drop the profit in Angle and Category under color.
We get a pie chart here.
Maximize the chart using Shift+control+B or in Mac Shift+Command+B.
Step 4: Drag the ‘Point’ layer to the top left corner of the sheet. An option named ‘Add a Mask Layer’ will appear, drop point in it to create a new layer. Let’s rename the new layer as ‘Segment layer’.
Whenever a new layer is created it gets added on top of the previous one. So the first layer ‘Category’ will be under the Segment layer. But we can change the hierarchy and the size of the layers anytime.
Now change the chart type of Segment layer to pie and add profit to the angle and Segment to the color.
Under Marks, drag and move the Segment layer below the Category layer. Adjust the size to get a pie chart inside a pie chart.
To correlate the layers, under Segment layer which is the the outer circle drag and drop the category (which is the inner circle) from dimension into Detail.
Click on the detail icon and change it to color.
Move the Category color above the Segment color. So the Category and Segment will be color coordinated in the chart.
Step 5 : Let’s divide or draw a line between the circles. Create a new layer by Drag and drop ‘Point’ in the mask layer. Name this layer as ‘Border 1’.
Change the chart type to circle and color to white. Move Border 1 in between Category and Segment layers.
Now adjust the size of the ‘Border’ layer to make it look like a white line with the thickness that suits your chart.
Step 6: Repeat step 4 to create another layer named ‘Sub-category’. Change it to pie-chart and add the profit to the angle and sub-category to the color. Move this layer below the segment layer and adjust the size.
Repeat step 5 to add a line between Segment and Subcategory circles.
You can add as many layers as needed and each layer can be formatted individually. Here I have added a new layer in the middle to show the total profit. For easy understanding the layers go from Inner circle to outer circle under Marks.
Step 7 : Remove the Map in the background.
Let’s clear the lines and axis on the sheet. Right click the background and click ‘Format’ to remove the Grid lines and Zero lines.
Right click on the X and Y axis to remove the header.
Now we get a simple yet detailed Sunburst chart using a single calculated field. Have fun exploring more vizzes!