This article tells you how to add a line to a column chart using data other than that represented by the columns.
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:
- Two or more variables.
- When using categorical variables, they should have the same categories/labels.
- Numeric variables can have any values, but should normally be on the same scale or within the same overall range.
- You cannot use variables of conflicting data types such as one categorical and one numeric variable.
- One table with at least two rows and two columns of data.
- Two tables with at least one row and two columns (or vice versa). At least one dimension in each table (rows or columns) should be labeled the same way.
Method 1 - from two variables
- Go to Visualization > Column > Column.
- Drag your cursor on the page to place the column visualization where you'd like it.
- In the object inspector, under Inputs > DATA SOURCE > Variables in 'Data' select the variable you want to represent as columns.
- Under Inputs > DATA SOURCE - SECOND Y AXIS > Variables in 'Data' select the variable you want to represent as a line.
- 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 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 Inputs > 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 Inputs > DATA SOURCE - SECOND Y AXIS > Output in 'Pages' select the same table as in step 2.
- For the 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 3 - from two different tables
1. Follow steps 1 to 3 in Method 2, above.
4. Under Inputs > DATA SOURCE - SECOND Y AXIS > Output in 'Pages' select a second table that has the same column headings as the table selected in step 2.
5. Follow steps 5 and 6 in Method 2, 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