Custom circle sizing in Tableau and Alteryx
This is a visualisation that I created based on an idea I had quite a few years ago, which I could never quite get to work how I wanted. I think I cracked it though so here is how I did it.
The idea is to show the comparison between the profits of Apple and the top 100 companies in the Forbes list of The World’s Biggest Public Companies – https://www.forbes.com/global2000/list/#tab:overall
I wanted to play on the Apple logo of a bite taken out of an apple by making the bite represent the size of the profit of the comparison company.
Firstly, here is the viz – https://public.tableau.com/profile/andrew.pick#!/vizhome/TakeabiteoutofApple2017/TakeabiteoutofApple
To create my data I used Alteryx and a fairly simple workflow
The first step was to compare the profits, so I applied a filter to the data to show just Apple, then I selected just the profit value and appended this onto all other rows. I can then create a formula which divides the relevant company profit by Apple’s profit. This will become the Radius. The idea being that Apple will have a radius of 1, a company with half the profit of Apple will have a radius of 0.5, one with double would be 2 etc
I then used a generate rows tool to create 360 rows for each company, numbered 0-359. One for each degree of a circle. As Alteryx trigonometry functions work in Radians rather than degrees I then converted the 0-359 into radians by multiplying the degree value by 0.0174532925. This can then be used in a formula tool with basic trigonometry to find the X and Y values for each point of the circle. Y = (SIN([Radians]))*[Radius]
X = (COS([Radians]))*[Radius]
I can then output this result to a csv.
I then connected to the csv file in Tableau. I inserted a background image to act as the constant Apple profit by following the Tableau guidelines – https://onlinehelp.tableau.com/current/pro/desktop/en-us/bkimages.html
I set this up as follows
As each circle is drawn with 0,0 as its centre, it will be half in the positive side of the x-axis and half on the negative side. I want the left hand side to “bite” the apple, so I want the apple to sit in the negative side of the x-axis and as Apple’s radius is 1 I have set the x coordinates to be between 0 and -1. The Y are set between 0.5 and -0.5.
The X and Y are then used on columns and rows respectively and the Path field is used on the path box in the marks card, once you have selected Polygon in the marks card drop down. This will draw the circle in the view.
I also created a parameter to allow you to choose one company to compare to, and this also filters the detail table at the bottom to give a little more insight into the figures for each company.