This article describes how to create a stacked bar chart from an existing table like this:
To a chart like this:
The same process can be used to create a bar chart where the total does not add up to 100%. For example, the below chart was created using the same data as above, but replacing the percentages with the count for each cell:
Requirements
At least one of the following:
- A table with at least two columns and one row.
- Two variables
Method 1 - via the visualization menu
- Select Visualization > Bar > Stacked Bar.
- Click on the page where you'd like to place the visualization.
- Under Inputs > DATA SOURCE > Output in 'Pages' select the table that you want to base the chart on. Alternatively, select the variable you'd like to base the rows of the chart on from Inputs > DATA SOURCE > Variables in 'Data'.
- Under Inputs > DATA SOURCE > Groups, select the variable you'd like to "stack" the rows on.
- OPTIONAL: If using variable inputs, go to DATA MANIPULATION, and tick Convert to percentages/proportions, unless you would like the total to not add up to 100%.
- OPTIONAL: Under Chart make additional changes to update the appearance of the visualization.
- Click Calculate and/or ensure that Automatic is checked.
Method 2 - using an existing table
- Select the table.
- From the object inspector, go to Visualization > Bar > Stacked Bar.
- OPTIONAL: Under Chart make additional changes to update the appearance of the visualization.
- Click Calculate and/or ensure that Automatic is checked.
Note
Important information about editing captions:
Visualization caption edits may not be retained when a visualization with a nested table is switched back to table. Normally, this only occurs when you double-click the caption and edit the text directly. As a workaround, we recommend using Properties > CAPTION > Edit caption to edit your captions.
Next
How to Create a Bar Chart from a Table
How to Create a Clustered Bar Chart
How to Create Several Bar 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