Author avatar

Recnac

Tableau Playbook - Dual Axis Line Chart with Dot

Recnac

  • Jul 22, 2019
  • 7 Min read
  • 26 Views
  • Jul 22, 2019
  • 7 Min read
  • 26 Views
Data
Tableau

Introduction

This is the second part of a four-part series on Tableau Playbook - Dual Axis Line Chart. In the first part, we delved into basic concepts of the dual axis line chart when it is combined with a line. Check it out in case you missed it.

In this guide, we will focus on another dual axis line chart: Line Chart Dual Axis with Dot. By analyzing a real-life dataset: Rossmann Store Sales, we will focus on how to build it step by step. Meanwhile, we will draw some conclusions from Tableau visualization.

Line Chart Dual Axis with Dot

We’ll sample a representative store for each StoreType and analyze their weekly sales trends. In this example, we’ll use the dual axis technique to emphasize individual store samples.

  1. Create a set for store samples. The specific sampling results are: a - 238, b - 512, c - 897, d - 94.

    1. Right-click "Store" and choose Create -> Set... to open the Create Set dialog.
    2. Update the Set Name as "StoreSample".
    3. Since it is hard to check in the 856 stores list, we’ll choose Custom value list to add. Input the Store Id then press Ctrl+Enter.

    line chart dual axis with dot 1

  1. First, create a discrete line chart:

    1. Drag "Date" into Columns Shelf.
    2. Drag "Sales" into Rows Shelf.
    3. Right-click "YEAR(Date)" and change the type to Weekday from discrete Date Parts.
    4. Aggregate by median which we have discussed before. Right-click "SUM(Sales)" and choose Measure -> Median.
    5. For a discrete chart, we'd better switch to Entire View for a nicer visualization.

    line chart dual axis with dot 2

  1. Display "StoreSample" as color in this line chart.

    1. Drag "StoreSample" from Sets into Marks - Color.

    2. In Tableau, a Set shows IN/OUT by default. It reflects a Boolean relationship. The IN is everything that is inside of my set (i.e. these four store samples) and the OUT is everything that does not qualify for my set.

      In this chart, we intend to show the items in the set, so we right-click StoreSample and choose Show Members in Set. We can see a filter is added automatically.

  1. Here we introduce the second way to build the dual axis.

    line chart dual axis with dot 3

    1. Hold down the Control key (Command key in Mac) and drag "MEDIAN(Sales)" to its right side on the Rows Shelf which means making a copy.
    2. Right-click on the new "MEDIAN(Sales)" and check Dual Axis.
    3. Convert the second axis to Shape type. Right-click again and choose Mark Type -> Shape. Of course, we can also use the previous way: change type in the Marks Card.
  1. Add shapes to dots to emphasize on individuals of store samples.

    line chart dual axis with dot 4

    1. Here we choose "StoreType" to represent the shape. Actually "StoreSample" and "StoreType" are the same in this example because "StoreSample" is sampled according to "StoreType"'.

      Drag "StoreType" into Marks - Shape in the second Marks card.

    2. Click the inverted triangle in shape Legend and choose Edit shape...

    3. Select Filled in the Shape Palette.

    4. Edit the data items to fill shapes one by one.

  1. Optimize the shapes:

    line chart dual axis with dot 5

    1. You may notice that the positions of the dots and lines are somewhat mismatched. That is because the axis has not been synchronized yet. So, we right-click the right y-axis and check the Synchronize Axis.
    2. Since the two y-axes are synchronized, we can hide the right axis by unchecking Show Header.
    3. Expand the Size Card in Marks and slide to adjust it to a more appropriate size. We should resize the lines as well.
  1. Put on the finishing touches:

    1. Edit the Title to "Weekly Sales Trend of Store Samples".
    2. Right-click on "Date" and choose Hide Field Labels for Columns.
    3. Further optimization includes combining these two legends and customizing a colored shape legend. We can achieve this by another creating another chart and then combining them in a dashboard. We are not going to expand on this here.

    line chart dual axis with dot 6

Analysis:

We use four typical stores to represent the corresponding StoreType. Aided by the dual axis with dot, we can distinguish individuals more clearly with shapes and colors.

With a quick scan, we can draw some conclusions. For example, only Store 512 opens on Sunday. Store 94 and Store 238 have similar sales and trends. They both have the highest sales on Monday and continuously go down the rest of the week until Saturday.

Related Charts

With the help of the dual axis technique, a line chart can be combined with a variety of mark types, such as line, dot, area, and bar. By combining a line chart with other visual elements, we can see the strength of both for different scenarios:

  • Use Dual Axis with Line when you need to compare two trends from different data series. Synchronization of y-axes is strongly recommended.
  • If you want to emphasize on individuals while displaying the trends, you may consider Dual Axis with Dot to enhance data points.
  • Choose Dual Axis with Area when you need to pay extra attention to the difference between the two lines. It highlights the margin for easy analysis.
  • When you are not only concerned about the overall trend but also want to focus on the categories comparison, Dual Axis with Bar is the best practice.

Here is a visual comparison between the variations of the dual axis line chart:

variations of dual axis line chart

Conclusion

In this part, we have learned how to create a line chart dual axis with dot. First, we created a set for store samples. Then, we built a raw discrete line chart. Next, we used the dual axis with dot and customized the shape. In the end, we dug out useful information from this chart.

In the third part, we will practice the line chart dual axis with area.

You can download this example workbook Line Chart and Variations from Tableau Public.

In conclusion, I have drawn a mind map to help you organize and review the knowledge in this guide.

line chart dual axis with dot - mind map

I hope you enjoyed it. If you have any questions, you're welcome to contact me at [email protected]

0