Radial treemaps & bar charts in Tableau

In this year’s last post, I want to put a little spin on the bar charts and tree maps : )

While in a lot of cases pie charts aren’t great, they nicely convey the part-whole relationship, work reasonably well as long as the number of slices are small and used very commonly including by Tableau users. I recently came across two blog posts that took it a step further and built donut charts (1, 2) out of pie charts.  Both of these posts used overlay methods to hide the center of the pie chart which makes them easy to replicate (and that is what’s great about them) however they either have misalignment issues  or when you interact with the donut e.g. by clicking on it or hovering the z-order changes and your pie chart floats above the overlay so it is no longer a donut chart.

I wanted to do something that doesn’t have any of these issues and while doing that also enable stacking in various ways so it can also be used to generate radial bar charts and radial tree maps (also known as sunburst charts).

I also wanted to add some customizability such as the thickness of the bands and spacing between them. Below is resulting radial tree map. You can click HERE or on the image to play with the interactive version published on Tableau Public and download the Tableau workbook to take a closer look at how it works and apply to your own data if you like.

Radial tree map in Tableau (click to view in Tableau Public)

I created some imaginary sales data broken into categories: Furniture, Electronics and Food and then further into sub-categories e.g. Security Systems, Home Theater, Baked Goods etc. In the image above, the 3 major categories are represented by the inner-most ring. Each outer ring represents an immediate subcategory of the adjacent inner ring hence creating a hierarchical tree-view when read from the center outward.

The chart is created using the polygon mark type. Each point that make up the polygon are computed on the fly using 9 table calculations that are nested inside each other.

Input data looks like the following :

Input data for Radial TreeMap

This table could be further simplified by counting the occurrences of > in Product Category column using a calculated field instead of having a Level field but I chose not to in case I wire this up to a live SQL query at some point and Category name contained a > that’s not properly escaped.

I used the same trick I showed in my Coxcomb chart and pictogram posts to generate extra rows that leverages custom SQL, binning and densification to hold the calculated coordinates since each arc is approximated using ~200 points to get a smooth curve while there is only 1 row in the input data for each category. Please take a look at the previous posts if you’re curious how this works. The rest it trigonometry.

If you put this inside a dashboard and add an action you can also display the sum of values for selected slices at the center of this chart. As I said, since the chart is parameterized, you can change the spacing etc. between layers which is what I did below to get a slightly different look.

Radial TreeMap inside a Tableau dashboard (click to view in Tableau Public)

I am not going to get into the details of how exactly each calculation works. Best way to recreate these charts with your data is to convert your data into the format used by the workbook (as shown in the Excel spreadsheet above) and replace the data source. This way, you won’t have to worry about calculation settings and it will just work.

Now to get a donut chart, all you need is data that doesn’t have multiple levels and same calculations will give you this result.

Donut chart in Tableau (click on the image to view in Tableau Public)

With slight modifications to 3 of the 9 calculations, it is also possible to generate radial bar charts using the same template. In the example below I also changed the sort order such that I get bars in ascending order from the center outward. The outer-most ring represents all of Furniture sales while inner rings represent sub-categories of furniture.

Radial bar chart in Tableau (click to view in Tableau Public)

And there you have it. One template to build 3 common radial charts in Tableau. I hope you find this useful.

Happy new year!

55 comments on “Radial treemaps & bar charts in Tableau

  1. Enrique Padilla says:

    I find this really cool! I just started using tableau and will be doing an internship trying to create reports for a company! Do you think you can make a youtube video of the steps for easier understanding?

  2. Chris Mc says:

    I’m trying to replicate the radial bar chart as well. I can’t convert my data into your required format because this graph is part of a larger dashboard and the data layout is already set (and works for everything else in the dashbaoard). I don’t know where I went wrong but I can’t get anything to display in the graph area, even though I’m pretty sure everything is in the right place with the right settings.

    How crucial is the level values ? If I only want to display values at the same level can that be ignored/removed ?

    • Bora Beran says:

      It is hard to tell without looking at your workbook. But level values are used to calculate what’s within the same level so the size of slices can be calculated correctly. They are also used to calculate the radius increments for stacking so circles don’t overlap with each other.

  3. Rahul Tiwari says:

    Hey Bora, This is really cool. But it will be good if you share more details may be each steps of this full chart creation. That will be more helpful.

  4. Krish says:

    Hey bora, this chart is awesome. I got an issue with the shape. I couldn’t get the exact circle and it is getting overlapped. Is there any option to view my dashboard to solve the issue. If so please help me.

    • Bora Beran says:

      Can you post it on Tableau forums by any chance if data is not private or somehow anonymized? If you @mention me on the forum I will get an e-mail alert so I can track down the thread easily.

    • Bora Beran says:

      I replied on the forums. The issue is with the data. The values don’t add up. Once you update the data, it will work. Boston, Miami and New York are the only 3 slices in the East region but they constitute less than 50% of it. If there is unaccounted data that really doesn’t belong on any of the cities, please add it as a separate category and things will align.

  5. […] The visual appeal in Chris Toomey’s entry made me want to dig deeper into his post and reference to radial treemaps. […]

  6. Anupam Das says:

    Hi Bora, Please share stepwise details for the full chart creation. It will be of great help.

  7. Suresh Kumar D says:

    Hi Bora, this chart is really awesome.
    I tried to re-create the ‘radial chart – fixed size’ view in a new sheet with your data itself.
    But I am missing something here and did not get the view.
    Could you please provide a step by step instruction or a youtube video on how to create this view?

    • Kieng Iv says:

      Hi Suresh. I took a shot at your question and the main issue is that the view is created with certain dimensions and measures set with certain table calculations so there are some details that are not shown in the chart (at least at on first glance). I have produced a video showing how to create it https://youtu.be/Gaj6x9UhtRY. Thanks Bora for creating this awesome visualization.

  8. Sherry says:

    Great post! Wondering if I can add an additional column to the source table, such as year and create a parameter for it, so that users can interact with the visualization by choosing a specific year from the filter and see the donut chart for this particular year.

    • Bora Beran says:

      You can definitely do that. If you add a parameter to the custom SQL and then expose it through a widget in Tableau that won’t require any modifications to the chart. You can also do the same by adding a quick filter and making it single select. If you add a multi-select filter,then you would need to make sure you have the right aggregations so you make sure you get the right results when several years are selected e.g. minimum values in those years vs sum of all or average..

  9. Tim says:

    Love the radial chart, but I’m having trouble re-creating it. I’ve downloaded your workbook, and tried to create a new worksheet and re-create yours but despite meticulously going through and copying all the settings I can’t get the radial chart to appear at all (so as far as I can tell, data, settings, etc) are identical). It seems that the chart type is the difference but besides using the selections in the show me tab – which don’t work – I’m stumped. Is there some kind of special instruction with regards to the chart type?

    • Tim says:

      Ok. I think I’ve figured it out. I’m using tableau on a mac which at this point doesn’t support the custom SQL. So while I can view and play around with the sheet you created, I can’t create my own. If I’m right, it all breaks down on the mac version because you’re using custom SQL to bin the Path number. Yours has path (bin) 1-203, mine just has 1 and 203 and nothing in between.

      Could you please post the custom SQL you are using? (I also can’t access that statement AFAIK) Maybe I can figure out a different way.

      Also, why are you only using 203 bins and not 365?



      • Bora Beran says:

        203 is an arbitrary number. It gives a good smooth curve, hence I picked it. Here is the SQL but it will only give you 1-203. You get the rest through the (bin). If you select the option “Show Missing Values” in the bin, it will have 203 bins even though the data only has two points : 1 and 203.

        SELECT [Sheet1$].[Level] AS [Level], [Sheet1$].[Parent Category Label] AS [Parent Category Label], [Sheet1$].[Product Category] AS [Product Category], [Sheet1$].[Sales] AS [Sales], 1 AS Path FROM [Sheet1$] UNION ALL SELECT [Sheet1$].[Level] AS [Level], [Sheet1$].[Parent Category Label] AS [Parent Category Label], [Sheet1$].[Product Category] AS [Product Category], [Sheet1$].[Sales] AS [Sales], 203 AS Path FROM [Sheet1$]

  10. Evan says:

    is the input file needed really just these 4 columns, or do you need to include ‘Path’ in there as well and just make those vales 1 and 203 (for the duplicate)? Also, shouldn’t it be ‘Parent Category Label’?

    • Evan says:

      I am also still getting ‘blanks’ when even trying to recreate the ‘imaginary sales data’ radial chart within your workbook as well much like the other user comments

  11. Anthony says:

    Is the total sales number in the center of your radial chart correct? I think it should be $5,600 instead of $15,000+. It appears like you are counting sales multiple times

  12. Arun Prakash says:

    Hi Bora Beran,

    I want to create a sun burst chart with 4 levels – Make of the car, Model of the car, Mobile Device Manufacturer and Model of the Mobile Device. We have like 10,000 rows of Data. It’s tough to create a data model in Excel like what you did. So, I cannot replace the data source like you suggested. Is there any other way to create a Sun Burst chart for my requirements?

    Thank You,
    Arun Prakash

    • Bora Beran says:

      Do you need to aggregate 10,000 rows of data first or do you need 10,000 slices in your sunburst chart? Also what is the data source. You should be able to generate a similar table structure by writing a SQL query that will return such results. If you can share a workbook, I can take a look. But probably Tableau forums is a better place for that so you can attach it to the forum thread and others can also benefit from the results.

  13. Arun Prakash says:

    Hi Bora,

    It would be greatly helpful if you can check out my previous post and help me ot in this.


  14. Eric Waschak says:


    Thank you for your inspirational work. This is truly impressive work. One question: How are the colors sequenced so that outer rings are hues based on the prior level? They seem to be responsive as the data set changes, but I haven’t discovered the mechanism. I assume it’s a more elegant solution than manual color selection.


  15. VJ says:

    Hi Bora, this is fantastic, very impressive ;

    I was wondering if you would answer two questions:

    1. is there a way to show on the bars what level it is for instance : electronics > alarm systems etc, so that it can be exported out with the level

    2. how would I go about removing the $ sign, if I am not plotting sales

    thanks much

  16. hirschferkel says:

    Dear Bora, i tried to replace your data – like it is displayed in tableau – copy it to Excel and import it in tableau again. But if i take exactly these data i see in tableau, it want work when i’m trying to replace the data source. A lot of parameters are missing this way.
    When i follow the way you described to arrange the date in an excel sheet e.g. it doesn’t work, too… Any help on this? All the best

    • Kieng says:

      Hi Hirshferkel – I am not sure if you have seen my video response to what I think was a similar question https://youtu.be/Gaj6x9UhtRY. Let me know if that helps.

      • hirschferkel says:

        Hi Kieng, thanks a lot. I didn’t find it while i was trying to import the table from Excel… and these days i didn’t find it on youtube, too. But that helps a lot… unfortunately it’s quite laborious! I did not expect it to be so complicated. I expected the calculations would be set up somehow automatically… or be more intuitive and easy to set up. I think the whole tableau idea does not inspire me quite much… but the sunburn chart is amazing!

  17. […] at the polar clock examples in both D3 and protovis and having studied Bora Beran‘s great radial treemap & bar chart post it seemed very possible to do this in Tableau with just a little incremental effort. I started […]

  18. Ryan K says:

    Um…. You’re like…. AMAZING! Thank you so much for sharing your brilliantly incredible Viz’! I’ve been searching for a mathematical approach to a donut chart and your Coxcomb chart is outstanding! Thank you very much!

  19. Manish says:

    Great job Bora…I always found outstanding dashboards in your blog.Please share your email ID so that I will share my sample twbx in this context.Actually the calculations you used is a bit complex for the curve/chart.Mainly I need to ask how should I prepare my data to get the desired D3 chart in tableau.

  20. Kendall says:

    Is it possible to replicate this using Superstore data?

  21. […] how he created a Radial Treemap in Tableau using table calculations and custom SQL inputs (link). Unfortunately, Bora doesn’t give too many details of how to reverse engineer his chart, and it […]

  22. Coby Benveniste says:

    Hi Bora! This chart is awesome, thanks for sharing everything! In my version, I added in a highlighting action so that when hovering over each block, it would highlight that block. I want to try and get the whole hierarchy to highlight, instead of just the block that I am hovering over, but I haven’t been able to figure this out yet. Any ideas?

  23. […] a detailed blog post with steps on how to create this, but if you can’t wait for it, read this and this, it’s a bit fiddly to put it mildly, but ask me questions below and I’ll do […]

  24. Shardul Dolas says:

    Hi Bora superb chart that was……I want to ask one thing, if we want to add the label to each slice, can we do that in sun burst chart.

    • Bora Beran says:

      It is possible but if you have lots of slices it may not look great. Polygons can’t have labels but lines could. So what you need to do is to duplicate one of the pills e.g. ctrl+drag Y next to itself. Then select dual axis from its context menu and then click the axis and select Synchronize.

      This would give you a marks card. Convert mark type from polygon to line for one of the cards. You will see that line has the Label shelf enabled. Then you can add a calculated field like this one

      IF INDEX()=INT(SIZE()/4) then WINDOW_MAX(ATTR([Parent Category Label])) END

      which would put the label roughly in the middle of the slice. You need to set Compute Using to Path(bin) for this calculated field.

  25. Simona Mazzotti says:

    My datasoure is Google Analytics.
    How can I create “Path” field?
    I think I can’t create a “New Custom SQL” query.
    Do you have any suggestion?

    Thanks in advance

    • Bora Beran says:

      Maybe you can piggy back on another existing field? E.g. create a Path calculated field like

      if [X]={fixed Category : MIN([X])} then 1 else if [X]={fixed Category : MAX([X])} then 203 end

  26. Heather Lewis says:

    The Path column is not in the picture of the excel document with the raw data. What is that supposed to be? Just 1s in the Path column in excel?

  27. Samatha says:

    This is a great post! I’m trying to use this template for a project. I’ve formatted my data to mimic your data source, but am unable to replace the data source (the option isn’t available. Do you know why that may be?

    • Bora Beran says:

      Do you have any other data sources in the workbook to replace with?

      • Samatha says:

        I do, it’s in the same format as the data you presented, and is in the same worksheet. For some reason the “replace data source” option is unavailable (I cannot click on it)

      • Samatha says:

        Hey Bora,

        I figured out how to replace the data source, but it’s saying that “Bin ‘[Path (bin)]’ depends on non-existent field ‘[Path]’, ignoring bin.” I formatted my data so it looks like the table above, do I have to make sure there are a specific number of categories?

  28. neeru says:

    Hi Bora

    what is the use of “path” field here in this chart?
    I have not any path field in my data and my data is connected to salesforce. Also have 3 measur fields that i need to show in form of radial bars.

  29. neeru says:

    if we don’t have “level” and “path” fields in our data then would it be necessary to take these fields as extra field?

    • Bora Beran says:

      You can add them via custom SQL. That’s the path the curves used in drawing the chart follows. Calculation follows the coordinates but to draw the proper curve, it needs to know in what order to connect the dots.

  30. […] in Tableau. I had general ideas on how to accomplish this from reading Chris Demartini & Bora Beran’s blogs. I ended up downloading a workbook Bora had published and completely dissected it to […]

  31. […] and attempted to mimic the Sunburst chart by Bora Beran. Bora’s blog can be found HERE and within is the link to the workbook on Tableau Public. Most people I know (including myself) […]

  32. […] is very easy to do by taking advantage of the technique I shared when building Coxcomb charts and radial treemaps. If you know the equation (or know how to get to it) and it can be described in Tableau’s […]

  33. […] like to point out that while this method is my own and differs in output, I was influenced by both Bora Beran’s radial tree maps and Interwork’s radial […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s