Create a stacked bar chart
The stacked bar chart represents an extension of the usual bar chart and allows, once the data has been segmented into shares (categorical variables), a second dimension of data to be visualized through a single dimension.
Each bar displays a total, which is broken down into subtotals. The bars are divided into sub-bars, stacked one on top of the other, and the sub-bars each represent a second dimension (categorical variable).
In LogAlto, it is possible to create vertical or horizontal stacked bar charts.
- When to use a stacked bar chart?
- Create a stacked bar chart
- Configuring the stacked bar chart
- Example
When to use a stacked bar chart?
The stacked bar chart is useful for comparing the relative amounts of 2 different categorical variables (dimensions) - such as comparing the number of people by gender and geographic region.
It is not useful for analyzing averages (if the calculation method is "average").
You need at least 1 numerical field (what will be calculated) and 2 categorical variables (what will be compared).
If a categorization/dimension needs to be compared, a bar chart would be more useful (article here).
If you need to compare several categorizations/dimensions, a radar chart (article here) or a pivot table would be better options (article here).
Create a stacked bar chart
To create a stacked bar chart:
- Select the "Analytics" module in the main menu (left)
- Click the "+" sign
- To create the new analytics report, you must:
- Enter a title
- Select a dataset
- Select an output type (in this case: Vertical stacked bar chart or Horizontal stacked bar chart)
- Save
- A draft data visualization will be displayed
- To configure your report:
- Click the "Toolbox icon" to open the configuration panel (top right-hand corner)
- Configure the chart to fit your needs
- Click "Generate" to view the result
- Click "Save" to save the report
- If you open this chart in the future, it will be automatically updated to reflect the newly added data. Therefore, if you wish to keep the report that reflects the current data, you need to export it.
Configuring the stacked bar chart
In the configuration panel of the stacked bar chart, you will see the following parameters:
Parameter | Details | Example or Link |
---|---|---|
Calculation method | Allows to select the calculation that will be applied (Average, Sum, Count, etc.). | For more details, you can read the "Calculation methods" article. |
Field | The field on which the calculation will be applied. | This must be a numerical field (number). |
Display the value as a percentage | If the labels are displayed, you will see the proportion of the slice. | Example: The dataset has 15 rows. 3 of them are in category A. Then if this box is checked, it will display "20%" instead of displaying "3" in the slice representing category A. |
X axis or bar groups | First field that will be compared (categories represented by bars placed side by side). | Example: gender/region/budget line, etc. |
Coloring of bars | Second field that will be compared (sub-categories represented by stacked sub-bars). | Example: gender/region/budget line, etc. |
Distinct values | Allows to count items only once and avoid duplicates. | Example: a participant could have attended multiple activities of the same type. If you need to count participations only once per attendee/type, then you need to select the Attendee field as a distinct value. For more details, you can read the "Distinct count" article. |
Position of labels | Allow to specify if you want to display the values on the chart. | Hide, inside at the end, or inside at the start of each bar. |
Dropdown lists: use predefined colors | Allows to colors sub-bars using the colors attributed to each category. Otherwise, colors will be attributed randomly. | For more details, you can read the "Manage system lists" article. |
Filters | Allows to filter out part of the dataset. | This is optional. |
Example
In this example, we want to compare the number of male vs female beneficiaries by country.
This example uses the data set of the "Beneficiaries" form.
Parameter | Chosen option for the parameter |
---|---|
Calculation method | Count |
Field | Not applicable (not used with the "count" method) |
Display the value as a percentage | Unchecked (no) |
Y axis or bar groups | Age groups |
Coloring of bars | Gender |
Distinct values | Not applicable - empty |
Position of labels | Inside and at the start of each bar |
Dropdown lists: use predefined colors | Checked (yes) |
Filters | Project = the project for which we want that information |