Stylized Bar Charts in Tableau
In 2023, Francis Gagnon shared a bar chart from the New York Times, with some notes on why he thought it was an effective design. I really liked the design and wanted to use it again someday, so I bookmarked it for later.
Over a year later, and I’ve finally recreated this chart type in Tableau. As far as custom charts go, it’s fairly simple but requires some effort in the formatting panes. It’s simple enough that I’d use at my day job, and not just for creative Tableau Public work.
Without further ado, let’s build!
Note: this is a very step-by-step walkthrough, with screenshots, so it’s a bit of a scroll. Feel free to skip to the end for the downloadable version/my commentary on why I like this variation on the good ole bar chart.
About the data source
For this walkthrough, I’m using the number of farmable pieces of land in Stardew Valley farms. Stardew Valley is one of my favorite games, and it just released an update which includes a new farm type. When starting to play the game, you get to choose your farm type-which determines how much land you actually can ‘farm’ in terms of planting and harvesting crops. Some farms have less farmable land, but are optimized for fishing and other activities. You can find out more about the farm maps here: https://stardewvalleywiki.com/Farm_Maps. You can use any data source with a measure and dimension to build this chart.
1. Build a bar chart
However you’d like to do it, whether via drag and drop or the show me feature, create a bar chart. In this case, I’ve got Farm on Rows, and Sum(Tillable Tiles) on Columns.
2. Create an in-line calc
If you double click in the columns shelf, you can type in any calc you’d like. Here, we are creating what is going to be our ‘bold’ bar that will end up being at the beginning of our bar. You want something that will be skinnier than your full bars. I’ll take a guess and go with Avg(50) as my calculation. Don’t worry to much about what number you pick now, we can adjust it later.
3. Create a dual axis chart
We want the bars to overlap each other, so click on the down arrow in your new calculation, and select “Dual Axis”
4. Synchronize the Axis
Now we have both things on the same axis, but we need our calculated field to be at the front, not at the end. Right click on either axis, and click “Synchronize Axis”
5. Make sure your bars are…bars
If they aren’t already, change the mark type for both measures to bars. You should end up with something like this:
6. Time to add color
In this case, I want to color each bar based on the farm type. I want our small bar to be bold, and the full bar to be more muted. I’ll drag Farm onto Color for all marks, and then adjust the opacity for sum(tillable tiles) to something lighter.
7. Label the Bold Bar
To label the bold bar, we can drag Farm to the Label for our avg(50) bar. I’ll go ahead and make this bold and 12 point font.
8. Get rid of unnecessary headers and labels.
If you haven’t already, now is a great time to go to Format>Workbook, and in the panel that comes up, turn Grid Lines off.
For each axis, right click and uncheck “Show Header”
You should end up with something like this:
9. More formatting
I’m going to switch the view of this chart from “standard” to “entire view”. Now time to get rid of some more lines, and put a few back in to get the look I want.
I’ll right click in the white space of the canvas and click “format” to bring up the formatting pane on the left.
Modify at the sheet level:
- Row Divider: Pane: None
- Column Divider: Pane: None
Now go to Format Lines.
Modify at the sheet level:
- Grid Lines: None
- Zero Lines: None
At the Row Level
- Grid lines: This is where I do want a grid line to replicate the look of the original chart. I’m choosing the thinnest solid line in a light grey. The result should look similar to the below screenshot.
10. Adjust the Bar Sizes to fill up the space
I don’t want my bars to be floating in between the grid lines, I want them to take up the full space. I’ll adjust the size of both bars by using the size slider in “all” in the marks card.
That wraps up the fancy bars! Now on to creating another sheet which I’ll use for my number labels.
11. Duplicate the sheet
I don’t feel like doing all that formatting of lines over again, so I’ll right click on my sheet and duplicate it for this next step. Then I’ll drag off sum(tillable tiles) so I’m just left with our avg(50) calc.
12. Change the Mark type and get rid of extra lines
I’ll change the mark type from bar to square, and swap out the label from Farm to sum(tillable tiles)
We’re going to be placing this sheet right next to the other one on our dashboard — but we don’t want any vertical lines in between. To solve this, we’ll go back to formatting lines, and at the sheet level, set axis rulers to none.
13. Make our squares disappear with opacity
On the color card, set opacity to zero. At this point, you can also make any modifications you’d like to the label itself.
14. Put both sheets on a dashboard
I’ll make a dashboard, and put both our sheets into a horizontal container. At first, it will look something like this:
15. Get rid of the legend and the gap
We’ve directly labeled our bars, so the legend isn’t necessary. Delete it! Now to get rid of the gap between our sheets. By default, Tableau adds 4 pixels of outer padding to every object. To close our gap, we’ll want to adjust the outer padding on the right side of Sheet 1 to 0, and padding on the left side of our second sheet to 0.
16. Make final dashboard adjustments
Now you can adjust the width of the sheets to get the sizing you’d like. Also, if you want to change the width of your bold bar, you can adjust your avg(50) calc to something that makes sense for your data and how it renders on the dashboard vs the sheet.
And there we have it, a pretty close replica of the original chart! Adding in a title, some explainer text, and headers with text boxes, the final result:
You can view the published version and download it for yourself here: https://public.tableau.com/app/profile/brrosenau/viz/StardewTillableTiles/StardewTillableTiles?publish=yes
Further Thoughts:
Can I do this all in one sheet?
Sure! I did something similar in my Iron Viz entry where I put a shape on min(1) instead of splitting it out to a separate sheet. In the above walkthrough, I found it a little easier to get the sizes how I wanted to look in the final result by splitting it into two sheets. It’s up to you!
Why do I like this chart type?
I’ve seen (and created) implementations of a stylized bar-in-bar with the bold part on the end. Sometimes it looks good, other times something about it feels a bit off or unbalanced to me. I like that by putting the bold bar at the beginning of the line, it anchors it to the end, and gives a buffer of space before the label starts.
I also think this is a great way to use some bold colors without it overwhelming the chart. This could be handy if your brand colors are saturated, but you don’t want to make the full area that rich of a color. It could also work if a client is requesting a pop of color but you know it would be a better visual if overall it was more muted.
I think this is one of the few times I’m okay with gridlines, as I follow them across the page to find the corresponding numbers. It’s also nice that the numbers are all aligned in a column instead of staggered at the ends of the bars.
Also, since the bars are directly labeled with their categories, there’s no need for a legend. I also have to worry a little less about color issues because it’s not the only way the bars are encoded.
What don’t I like about this chart type?
It does take a bit of manual adjustment to get the width of the bold bar to look just right. If I was making this in a work dashboard to hand off, I would not use an in-line calculation, but write out an actual calculation properly commented/documented what it’s use is.
I think this is probably better suited to a more static chart / one where I know the values won’t fluctuate beyond a certain range to make sure it keeps the look I want. Also, it can look wonky if some of your labels are longer than the bars.
And of course, because this is colored on category, I think it has it’s own limits. Getting beyond a handful of colors is really tough to do effectively.
How did I pick the colors for this chart?
Eagle eyed Stardew Valley players will note that I stole the colors from the house icon for each farm :) https://stardewvalleywiki.com/Farm_Maps