Recreating Fitbit Style Rounded Bars with Goal Icons in Tableau
I started the year with a nasty a bout of bronchitis that pretty much reset my physical activity level to zero. While I’ve steadily increased my activity since then, working a desk job makes it easy to be fairly sedentary most of the day. With Tableau Conference on the horizon, I know that’s an event that requires a lot of walking- so I’ve been intentional about ramping up my physical activity, and paying more attention to my Fitbit data.
In the Fitbit app, one of the chart styles caught my eye — monochrome rounded bars with goal indicators, accompanied by a table with the actuals. I think this chart combo is both aesthetically pleasing and informative, so I set about recreating it in Tableau.
Building the Rounded Bars
First up is building out the rounded bar charts. As usual, I’ll screenshot step by step but if you prefer a video tutorial, I recommend Andy Kriebel’s walkthrough for this portion here: https://www.youtube.com/watch?v=qMcKwbCVFXY
Step 1: Create a bar chart. I’m using steps per day for this chart.
Step 2: Double click into the rows shelf, and type avg(0) to create a placeholder calc that we’ll use for creating the rounded bars
We end up with a chart looking like this:
Step 3: Click and drag the avg(0) pill onto the axis for the steps till you see a double ruler appear like the screenshot below.
Now you should have something that looks like the following:
(Note: I had to make sure the “measure names” pill appeared after the date field in my rows shelf)
Step 4: Change mark type from Bar to Line
Step 5: Drag the “Measure Names” pill from the Rows shelf to “Path” in the Marks card
Step 6: Increasing the size will reveal our nice rounded bar shape
Adding Icons to the Rounded Bars
Step 1: Let’s swap the rows and columns to create a vertical bar chart
Step 2: Let’s add the sum(steps) again into rows, which will give us our original chart on the top, and a new chart on the bottom.
Step 3: Instead of just circles, I actually want our second sum(steps) to be on shape. In the workbook, I’ve created a calculated field called “Goal Shape Indicator”
IF SUM([Steps])>[Goal] THEN 'Met'
ELSE 'Unmet'
END
Now we set the “Goal Shape Indicator” field on shape and choose our shapes. For this to work as intended, I have two circular shapes of the same size. One contains a white checkmark in the middle of the circle, and the other is solid. You can create your own shapes, I used one from the Noun Project: https://thenounproject.com/icon/verified-4241028/
Step 4: Change the chart to a dual axis chart, and synchronize your axis
Once you match your colors from your shapes to your bars, and adjust the sizing of the marks, you should have something like the following:
Step 5: Format the gridlines and axes how you wish (I’ve gotten rid of them) and add a reference line — in this case, I’ve tied the reference line to my Goal parameter in the same color, but lower opacity as my bars.
Bonus: Text Table and KPI Title
Text Table
The Fitbit native chart has a table of numbers showing the actuals per day, with an indicator for if the goal was met.
In this case, I’ve created a copy of my “Goal Shape Indicator” field, applying the checkmark to days where the goal is met, and a transparent shape to the unmet goal days. The actual steps are then formatted as a label.
One small formatting item— I’ve kept white lines on in between rows, which will be clear once we add our colored background.
Rounded corners background
This part is going the extra mile — a rounded corner background for the text table. I prefer creating entirely in Tableau whenever possible (especially for dashboards in a business setting) so that I don’t need to worry about handing down files to folks to maintain dashboards.
This tip is curtesy of Irene Diomi who first made me aware of this technique — you can see here tempate here: https://public.tableau.com/app/profile/irene7753/viz/RoundedcornersnativelyintableaumethodbyIreneDiomi/Dashboard\
I’ve created a sheet, put sum(steps) on the circle mark, and then made the circle as small as possible and transparent. I then right clicked the sheet and selected Annotate -> Area. You don’t actually have to add any text to the annotation, but can format it how you like, with a background color and rounded colors. Then, float this sheet behind whatever part of your dashboard you want to have a rounded border colored background.
KPI Title
To pull it all together, I want a dynamic title to spell out the KPIs I’m interested in — average steps, total steps, and number of goal days met.
Step 1: Create an exact date. You can right click your date field, create, custom date. From there, select “Exact Date”.
Step 2: Create a field for the number of goal days met
IIF({ FIXED [Date (Exact)]:SUM([Steps])}>[Goal],1,0)
The above is a fixed LOD (level of detail calculation) wrapped in an if statement. In plain English, this reads as: for every date, if the sum of steps is greater than the goal, then 1, else zero.
Step 3: Profit. (just kidding). Add sum(Steps), avg(steps), and sum(Number of Goal Met Days) to the text mark.
Step 4: Click Text, and then the three dots to bring up the “Edit Label” dialogue box. From there, I’ve formatted the fields to be colored in blue, and added extra explanatory text to make the header read like a sentence.
Putting it all Together
Time to put it all together — in this case I’ve tiled the main dashboard items, and floated the rounded background behind the text table.
In this example I’ve gone with a bold blue for all bars, and an indicator on goal met. I could see this technique expanded, for example keeping the bars grey and coloring on meets or misses the goal, as well as adding other reference lines in place of an explicit axis.
I had fun building out this chart, and can see myself using it in a business context without having to worry too much about maintenance. If you end up using this style on the job or for a portfolio piece, feel free to drop me a note! In the meantime, I encourage you to take chart and dashboard inspiration from the everyday interfaces in your daily life.
P.S.
I’ll be in sunny San Diego for Tableau Conference April 15–17. If you’ll be there as well, please say hi if you see me! I won’t be presenting, but I’ll be attending sessions, cheering at Iron Viz, and hanging out in the Data Village. I’ll also be running (ba dum tss) the 4th annual Tableau Conference Step Tracker — and this year I’m bringing stickers. If you’d like to learn more about how to participate (in person or virtually) + give me feedback for this initiative, check out the blog post below. Hope to see you there!