Create a stacked bar chart

The  stacked bar chart extends the standard bar chart from looking at numeric values across one dimension (categorical variable) to two. 

Each bar displays a total amount, broken down into sub-amounts. The bars are divided into a sub-bars stacked one above the other, the sub-bars represent a second dimension (categorical variable).

In LogAlto, you can create a vertical or horizontal stacked bar chart.

  1. When to use a stacked bar chart?
  2. Create a stacked bar chart
  3. Configure the stacked bar chart
  4. Example

When to use a stacked bar chart?

The stacked barchart is useful to  compare relative amounts of 2 different categorical variables (dimensions) - like compare number of persons per gender and region. 

It is generally not useful for averages (if the calculation method is "average").

It requires at least 1 numerical field (what will be calculated) and 2 categorical variables (what will be compared).

If you only need to compare 1 categorization/dimension, a bar chart (article here) would be more useful.

If you need to compare more categorizations/dimensions, maybe a radar chart (article here) or a pivot table would be a better idea (article here)


Create a stacked bar chart

To create a stacked bar chart:

  • Click "Analytics" in the main menu (left)
  • Click the + sign
  • To create the new analytics report, you must:
    • Enter a name
    • Select a dataset
    • Select an output type (in this case: Vertical stacked bar chart or Horizontal stacked bar chart)
    • Click Save
  • A draft data visualization will be displayed
  • Configure your report:
    • Click the "Toolbox icon" to open the configuration panel
    • Configure the chart to fit your needs
    • Click "Generate" see the result
  • Click "Save" to save the report
  • If you open this chart in the future, it will be updated to reflect newly added data. So if you need to keep the report that reflects the current data, you must export it.

Configure 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) (this could be gender/region/budget line, etc.)
Coloring of bars Second field that will be compared (sub-categories represented by stacked sub-bars) (this could be 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 "Beneficiaries" (form) dataset.

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