Ryan Sleeper
Dumbbell or DNA charts provide an engaging and practical way to display comparisons. This video shows you how to take this chart type to the next level by mapping dimension members using custom shape palettes.
Hi. This is Ryan with Playfair Data TV. And in this video, I’m going to show you how to make a dumbbell, or some people refer to them as DNA charts, in Tableau. But I’m also going to show you how to integrate images from outside of Tableau to make dumbbell, or DNA, charts even better.
First, how to make a dumbbell chart in Tableau. You can make this with any combination of measures and dimensions that you would like. But I’m going to start with sales by sub-category and look at it per year. So my first rule of thumb whenever I’m making charts is I always start with my measure. So I’m just going to double-click on Sales to add it to the view. And then I’ll double-click on my dimension to slice and dice that measure by my dimension.
Dumbbell, or DNA, charts are called that because they look like little dumbbells or strands of DNA, which are in a horizontal orientation. So I almost always, if I’m making this chart type, swap these axes so that it starts out in a horizontal orientation. And you can do that by just clicking this button in the top ribbon.
I’ll also fit the entire view so that we can see these a little bit better. The next thing I will do is color these bars by the year that they are in by dragging the Order Date dimension to the Color Marks Card. The default date part in Tableau is year. So when I do that, we should see one color for each of the four years in the Sample Superstore data set. And that’s exactly what we see.
At this point, we have a stacked bar chart, which is probably my least, if not one of my least for sure, favorite chart types in Tableau. Because unless you are that slice right on the bottom, it’s very hard to interpret the trend of everything else. So unless you’re 2019 on the bottom, it’s hard to tell the size of 2018, 2017, and 2016. Because everything’s being stacked up on top of each other. So it’s really hard to see their true location, their performance, on this x-axis.
So my minimum tip for you, if you don’t take anything else away from this video, is if you make a stacked bar chart similar to this scenario, I encourage you to at least change the mark type from Bar to Circle. And I’ll make these a little bit bigger. And now we can see a truer representation of where each year stands on the location of the x-axis.
Dumbbell, or DNA, charts can also be made with more than two comparison points. But whenever I’m making this, I tend to limit it to two. So I’m going to go ahead and filter out the years 2017 and 2016. So I’ll select 2018 and 2019 on the color legend and click Keep Only, so that I’m left with a year over year comparison is what we have.
The next step to creating dumbbell, or DNA, charts is to duplicate the measure that’s being used on the Columns Shelf. This is another application of my favorite shortcut in Tableau, which is to hold down the Control key while I click on a pill and drag it right next to itself. And that creates a copy of that pill. Now that we have two measures on the Columns Shelf, they each get their own set of Marks Cards. And those Marks Cards can be edited independently of each other.
So I can leave the left side as is, but navigate to the Marks Shelf that’s controlling the marks on the right side of the chart. And I can make some changes. I’m going to first change the mark type to Line. So that I’ve got a dot plot, it’s called, on the left and a line graph on the right. But it’s kind of strange how Tableau is connecting the dots by default here. It looks like a line graph. But the lines are connecting the dimension members, the sub-categories in this case. It’s not connecting anything over time.
We need to change the direction in which Tableau is connecting those dots. Instead of it going from top to bottom, we need it to go from left to right. So that it eventually connects our red and blue dots. The easiest way that I have found to change the direction in which Tableau connects those dots is to just drag the pill that’s currently on the Color Marks Card. And I know that because of this color palette icon right next to the pill. Drag that pill directly to the Path Marks Card. And when you do that, you’ll see those nice, crisp horizontal lines begin to come together.
The last couple steps, the last big step, is to convert what we’ve got here into a dual-axis combination chart. There are several ways to do that. Most people learn to do this by clicking on the second pill and clicking the third option from the bottom to make this dual axis. I’ll show you a shortcut to save you one click. If you hover near the bottom of the right side, a green triangle will appear on its axis. You can left-click and drag that axis up to the opposite axis. The dashed line will show you where it’s going to draw the axis. When I let go, we’ve converted this to a dual-axis combination chart.
Both of these x-axes should be on the same scale. So I highly recommend you right-click on either one of the axes and choose Synchronize Axis. This will be very subtle. But the gray lines are not quite lined up in the center of the circles at this point. Once I click that button, you’ll see a tiny shift. And now, everything is lined up perfectly. The ends of our gray lines should be right in the center of both the 2018 circle and the 2019 circle.
One last thing, it’s another thing that’s kind of subtle. But right now, the gray lines are on top of the colored circles. And I would rather that gray line be behind those circles. In order to move the gray lines to the back, you right-click on the axis controlling those gray lines. And there is an option halfway down to move the marks to back. Once I click that, we’ve got these nice looking dumbbell charts. We no longer need the top x-axis. That’s actually repetitive. So to finalize it, I will right-click and deselect Show Header.
So this is already a nice chart. It looks very engaging. What I like about dumbbell charts is it implies to the end user which direction they should read the chart. Without those gray connecting lines, this just looks like a scatter plot with a bunch of red and blue circles. And it takes your users a moment to orient themselves with the chart to figure out, is this really a scatter plot? Am I trying to find correlations? Or am I trying to see how the circles move from left to right year over year? And the gray lines help with that.
So I’m already a big fan of this chart. But the other part of this tip is I’m going to show you how to make this even better using custom shapes. So I personally like the color here between the years. But I’ve been gravitating a lot towards making these in brand. And I like to have one circle that represents last year be an open circle. And the circle for this current year, or whatever current period I’m using, to be a closed end circle. It implies to the user that these are different. It’s yet another way to imply to them what direction they should be reading this chart.
But let’s see what the options are with these circles. If I click on the mark type dropdown and choose Shape instead of Circle, we’ll get these open circles. And I can click on the Shape Marks Card now that we’ve got some shapes. And I can assign some different shapes to it. But the open circle, you can see the issue there on the screen, is they’re hollow. The centers are hollow. So I can see through them. I would rather that those circles be opaque. But that is not an option with the default Shapes palette in Tableau.
Well fortunately, we can make custom shape palettes in Tableau. Let me show you where that resides on your computer. Whenever you install Tableau Desktop, it automatically installs what’s called your Tableau Repository. On a PC in Windows, that’s in the Documents project. So if you navigate to Documents, there will be something called My Tableau Repository. If you click on that, one of the folders within the Tableau Repository is a Shapes folder. I double-click on that. These are all the palettes associated with the Shape Marks Card.
So if I click Shape and More Shapes, those folders should coincide with what we see in this dropdown. So each palette you see on this dropdown will have an associated folder in your Tableau Repository. And you can actually add palettes to that. Before I started recording, I added a folder called Dumbbells. So you could do something very similar just by right-clicking anywhere in this Shapes folder. Hover over New. Click Folder. And I will open up Dumbbells.
And there are my two custom shapes. We’ve got a dumbbell end that is a closed shape and a dumbbell end that is an open shape. You can create these in a design program such as Adobe Photoshop or Adobe Illustrator. You can also just make them in PowerPoint. It’s very simple. It’s very flexible. But to get the best possible performance out of your custom shapes, I do recommend you try to make image types that end with the extension .PNG and that have a transparent background. That way if you ever use these shapes on a background other than white, some of the background will be transparent.
But that’s a discussion for another day. This technique I’m showing you now will work as long as your background is white, which in most dashboards that I make that is the case. And when you need a background to be white, this is a lot easier. You can just make this in PowerPoint no problem.
But I’ve got these two shapes. So back over here on my dumbbell chart, I’m going to drag Year of Order Date to the Shape Marks Card. So I’ll drag that to Shape, which will allow me to assign a unique shape per year. You saw my color legend changed into a shape legend. Now I can double-click on that shape legend and assign those custom shapes that I just added to my Tableau Repository. I had a palette called Dumbbells. I’ll click on that. To assign the shapes, you first have to click on the dimension member and then click on the shape.
I’ll click on the second dimension member and assign the closed circle. Any time you see the Apply button, you can preview the change by just clicking on that. You can already see that coming together in the background. I’ll click OK. Maybe one last thing I’ll do, because that blue on the line is a default blue, I’ll navigate back to my Marks Shelf for that axis. Click Color and choose a blue that’s more in brand.
But point being, this is just a variation of how you could design this. I’m now using custom shapes. I didn’t like how the default circle shape is hollow and I could see the gray line behind it. This is much more in brand, engaging. And I just added a little bit of professional polish to this dumbbell, or DNA, chart in Tableau.
This has been Ryan with Playfair Data TV – thanks for watching!