How To: Shaded Slope Charts in Tableau

2/12/2017 Matt Chambers 0 Comments





I recently found an article showcasing 2016 in charts, and I really liked the slope charts with the area shaded between the two categories being compared.


I found this to be a really cool technique for making a point and telling the story.  I wanted to see if I could recreate this in Tableau, so here's how it's done.  I'm using the Superstore data in this example.

1.  Create a standard slope chart by setting the Year to discrete, filtering to two discrete years, adding the measure to the Rows and Category to the detail.


2. In this case, I want to show the difference in Profit between Technology and Furniture.  To create the shaded area, I need to isolate their respective profits.




3. Drag the newly-created Furniture Profit measure to the Rows, and then drag the Technology Profit pill to the left to create the Measure Values pill.



4. Create a dual axis and synchronize the axes, change the Measure Values to Area, and remove Category from the detail.



5. Move the Technology Profit measure to the top of the Measure Values list and change the Furniture Profit color to white.  I also went ahead and changed the Technology Profit color to blue.


6. Since we are using an area chart, the Technology Profit is being stacked on top of the Furniture Profit, which is pushing the shaded area up above the slope chart even when synchronized.  To fix this, we need to subtract the Furniture Profit from the Technology Profit.  I went ahead and edited the calculation in the shelf: SUM([Technology Profit]])-SUM([Furniture Profit]])


7. To color the dimensions I wanted to compare, I created a calculation to only color those dimensions.  Drag this dimension to the color and turn on the dotted line.




8. Hide headers and clean up the chart formatting. I also thickened the lines and set the area chart color to blue with 20% transparency in my example.


9. Finally, incorporate storytelling elements like using color to point out the categories being compared and annotations to highlight the gap.



Feel free to download the workbook and comment with any questions.

0 comments: