When comparing trends across multiple data, you may want to plot another series of data on a secondary axis. This allows you to plot data on different scales (i.e. 1-10 and 1-1000) and in different units (i.e. counts vs pct). This article tells you how to add a line to a column chart using a second data source (i.e. variable or table).
It will take you from a column chart like this...
...to one that looks like this
Requirements
To create a column chart with a line representing additional data, you will need either:
- A table with at least two rows and two columns of data (Method 1 below)
- Two tables with at least one row and two columns (or vice versa - Method 2 below):
- To use for the columns and the primary y-axis on the left.
- To use for the secondary y-axis on the right. At least one dimension in each table (rows or columns) should be labeled the same way. Otherwise, the second table used on the secondary axis should have numeric values as the corresponding row/column labels. When this is the case, the data will be plotted from left to right (or top to bottom) consecutively without trying to match labels.
Method 1 - From a single table
- With the table selected, from the object inspector, go to Visualization > Column > Column.
- Depending on the structure of your table, you may want to check the box Data > Data Manipulation > Switch rows and columns.
- Under Row Manipulations or Column Manipulations, depending on your table structure, specify the row or column(s) you want to show as columns in the visualization. Normally, this would exclude the data series that you want to show as a line.
- Under Data > Data Source - Second Y Axis > Data select the same table as in step 2.
- For the Data Manipulation - Second Y Axis, repeat steps 3 and 4 above to select the row or column to represent as a line, and (if needed) Switch rows and columns.
- To control the appearance of the line, change any settings you like under Chart > Second Values (Y) Axis. To control the appearance of the columns, change the settings under Values (Y) Axis.
Method 2 - from two different tables
1. Follow steps 1 to 3 in Method 1, above.
2. Under Data > Data Source - Second Y Axis > Data select a second table that has the same column headings as the table selected.
3. Follow steps 5 and 6 in Method 1, above.
Next
How to Create a Clustered Column Chart
How to Create a Stacked Column Chart
How to Create Several Column Charts Using Small Multiples
How to Customize the Color of a Single Category in a Bar, Column, or Pyramid Visualization
How to Apply a Gradient Palette to a Bar, Column, or Pyramid Visualization