Wrapped bars: a Tableau implementation

Click here to see the interactive version of the wrapped bar chart.

wrapped with colour

Click here to see the interactive version of the wrapped bar chart.

When I saw the wrapped bars paper, I thought it would be good to see if Tableau could cope with these. Below is my best attempt. I must say at the outset that the implementation is complex and probably too complex to be considered a practical implementation of wrapped bars. My motivation was just to see how far I could push Tableau.

I have also posted my thought on the Wrapped Bars in a separate post.

I initially figured I could reuse the principles I used to make Panel Charts a couple of years back. This requires use of the INDEX() calculation along with some modulus arithmetic. It didn’t take long to implement that, but there’s a big problem:

wrapped bars using columns

What’s the problem? Tableau’s columns are all the same size. You can’t dynamically set the size of each column differently.

That had me stumped and, pretty much defeated. So I went for a walk: that’s where I do my best thinking. A solution came to me: Gantt charts. Using Gantt charts I could position each bar anywhere along an x axis. But at a price: huge calculated field complexity! In principle I needed to calculate three things (see the figure below)

wrapped bar calcs

1. The number of rows in each column

This is pretty straightforward: Size of each column

2. The length of the first (the biggest) bar in each column

Max in this column

3. The position on the x-axis to start each column

This one was a stinker!


Once the calcs were built, making the chart itself was a breeze.

Is this practical? 

I’ll let you decide that – let me know what you think in the comments or on twitter (@acotgreave)


Leave a Reply