Toan Hoang

Tableau QT: Curved Lines

This is a Quick Tip on how to build a Curved Line Chart in Tableau based on the Sigmoid Function, so less reading and more jumping in. We are going to spend 10 minutes or less building our Curved Line Chart in Tableau.

Note: As always never choose a data visualisation type and try to fit your data into it, instead, understand your data and choose the best visualization for your data consumers.

Data

Load the following data into Tableau Desktop / Public.

SegmentValuePath
A1000
A100101
B1500
B150101
C-800
C-80101
D-500
D-50101
E1000
E100101

Note: we require path and duplicate lines for densification.

Calculated Fields

We will start by creating the following calculated fields.

Path (bin)

Index

((INDEX()-1)*0.12)-6

Note: we want the index, used as the X-axis to have 100 points from -6 to 6.

TC_Value

WINDOW_MAX(MAX([Value]))

TC_Start Point

RUNNING_SUM([TC_Value])-[TC_Value]

TC_Running Sum

RUNNING_SUM([TC_Value])

Y

[TC_Start Point]
+((1/(1+EXP(-[Index])))*[TC_Value])

Note: 1/(1+EXP(i)) is the Sigmoid Curve function. We  this by value to give the desired height.

Now that we have created our Calculated Fields, we will build our Worksheet.

Worksheet

Now that we have our Calculated Fields and Bin object, let us create our Curve Line Chart:

If all goes well, you should see the following:

We will now add a little bit of magic by editing our Table Calculation for Y.

If all goes well, you should see the following:

Can you feel it? We are getting there and now need to adjust the cosmetics:

You should now have the following.

and boom, yes, this has been trickier than normal Quick Tip, but hey, it is all good. You can find my Curved Line Chart on Tableau Public at https://public.tableau.com/profile/toan.hoang#!/vizhome/CurvedLinesinTableau/CurvedLines

Summary

I hope you all enjoyed this article as much as I enjoyed writing it. Do let me know if you experienced any issues recreating this Visualisation, and as always, please leave a comment below or reach out to me on Twitter @Tableau_Magic.

If you like our work, do consider supporting us on Patreon, and for supporting us, we will give you early access to tutorials, exclusive videos, as well as access to current and future courses on Udemy:

Also, do be sure to check out our various courses:

Exit mobile version