See the viz at Tableau Public

Sometimes it happens that you want to arrange objects in a circle. Whether it is in a landing page where you have different dashboards as symbols or perhaps the sales of the last 12 months or something else. But how do you create these circles dynamically and use them in a dashboard?

Let's start.

 

Step 1: Preparing the Dataset

We need a foundation that we can use in Tableau. Our data source. In our example I created an Excel table with only one column. Later I want to see 60 points in my circle and so I simply wrote the numbers from 1 to 60 in my column. Of course, we can also use the names of dashboards or anything else.

Simple data set

 

Step 2: Creating the coordinates for X

Create your Tableau circle

 

In this step we will have to deal a bit with sinus, cosinus and pi to understand how a circle works at all. Let's have a look at the circle. The first point should be at the top. But we also see that we cannot simply place the points from 1 to 60 on our X-axis, but have to find a way to arrange the points differently.

All dots on one axis


Think of the circle without the values on the Y-axis. We see that the distances of the points to the edges decrease and become smaller. In addition, each point on the X axis has two points on the Y axis. One positive and one negative. So we need a function that allows us to arrange the points as shown.

Change the x-axis

 

SInus function Tableau

Let's have a look at the sinus function. The sinus takes the values between 1 and -1 on the Y-axis if I have values between 0 and 2PI on the X-axis. In addition, the distances between the points become smaller the closer I get to 1 or -1. So the sinus is exactly what we need.

First we have to divide our 60 points so that they are between 0 and 2Pi. We use the Index function in Tableau and get a value for each point. This value must then be divided by the highest value of all points. So we get 1/60 for the first point and 60/60 for the last point, so exactly 1. We have to take these values * 2Pi and get our 60 values between 0 and 2Pi.

If we now take the sinus of these values, for each point we get a value on the Y-axis between 1 and -1. We also see that the distribution of the points on our new Y-axis is exactly the same as the distribution we are looking for in our circle.

 

So let's finally create our X-axis:

  • Create a parameter for the radius. We can use this later to increase or decrease the radius of the circle. I simply called the parameter 'Radius'.

  • Create a calculated field and call it 'X'. In this write the following formula:

    [radius]*sin((index()/SUM({COUNTD([Dots])}))*2*PI())

  • Drag the field with the dimension of your points to details and then X to columns.

  • Go to 'Edit Table Calculation' at X and do the same as in the following image.

    Table Calculation Tableau

 

What exactly did we do? We know that we need 60 values between 0 and 2*Pi to create our curve. Therefore we take the index() and calculate it via our Dots (name of the column in our dataset). Then we divide the value by the total number of dots. So we get 60 values between 0 and 1. Let's take it times 2*PI and get 60 values between 0 and 2*PI. Then we take the sinus on these values and get the values for our X axis. We can take everything again times the radius parameter so that we can adjust the size later.

 

Step 3: Creating the coordinates for Y

The coordinates for our Y-value are created very similar to those for our X-values. But let's have another look at the X-values. We notice that the first value is near 0. This is different for our Y-value and we want the first value to be close to 0 on the X-axis but close to 1 on the Y-axis. Therefore we cannot take the sinus any more but have to change to the cosinus. The following graph shows very well that our smallest value, 1/60, with the cosine no longer gives 0 but rather 1.

Create the y-axis

  • Creates a calculated field and call it 'Y'. Then inserts the formula:

    [radius]* cos((index()/SUM({COUNTD([Dots])}))*2*PI()

  • Put Y on rows and go to 'Edit Table Calculation' at Y and do the same as for X

 

Step 4: Rotate around the X-axis to create a 3D effect

Add a 3D effect

In the last step we want to create a 3D effect and rotate our circle on the X-axis by a certain degree. The example shows that a rotation on the X-axis changes the height of the points on the Y-axis.
So we have to find a way to influence our values on the Y-axis.
Imagine a point that is 1 on Y and we want to rotate it. The radius this point rotates around the X-axis is also 1. If we now rotate this point by a certain angle, the point will no longer be 1 at Y, but will become a smaller value.

How the system works

Now let's say we want to rotate the dot 40 degrees. The Y value of the new point is then calculated by the radius of the point * COS(Degree). If we use our values now, the new Y value is 1*COS(40). But in Tableau we have a problem. We cannot enter the angle in our cosinus, only the radian measure. This is calculated by Degree / 180*PI(). Tableau also gives us a function with which we can convert the angle into the radian measure. RADIANS(Degree).

Our formula to change the Y value is:

Radius of the point * COS(RADIANS(Degree)).

But what exactly is the radius of the point and which point do we mean exactly? The radius for each point is exactly the value that we have already calculated with our Y. The radius for each point is exactly the value that we have already calculated with our Y. The radius for each point is exactly the value that we have calculated with our Y. So we can simply take our formula for Y and extend it with COS(RADIANS([Rotation])). So as a result we get a Y value that is always shifted by the angle we specified.

cos(RADIANS([Rotation])) * [radius] * cos((index()/SUM({COUNTD([Dots])})) * 2 * PI())

We should fix the axes and set a value from -1.2 to 1.2. If we now change our parameter for the angle, we will also see a change in our Y values.

pages Tableau functionality

 

Alex

 

Empower your organization with intuitive analytics

Tableau is designed to put the user first because data analysis should be about asking questions and not about learning software. With built-in visual best practices, Tableau enables limitless visual data exploration without interrupting the flow of analysis.

As the market-leading choice for modern business intelligence, the Tableau platform is known for taking any kind of data from almost any system and turning it into actionable insights with speed and ease. It’s as simple as dragging and dropping.

We are a full-stack provider and integrator, relying on extensive experience and best practices to find your unique optimal set-up allowing you to tell the data stories you are eager to tell.

Get in touch

 

Author
Alexander Philipeit

Alexander Philipeit

I help you get insights from your data. Easier. Faster.

Read more articles of this author
Let's discuss your data challenges

Join our community of data enthusiasts

Get industry insights, expert tips and Biztory news sent straight to your inbox with our monthly newsletter.