# Stacked bar chart (/core/build/charts/chart-types/stacked-bar-chart)





<CalloutContainer type="info">
  <CalloutDescription>
    **Target Audience**: Non-technical users and builders configuring charts in the Library.
  </CalloutDescription>
</CalloutContainer>

<img alt="Stacked bar chart example" src="__img0" />

## Overview [#overview]

A stacked bar chart shows how a **total** splits into **segments** within each category. **Bar category** defines each bar; **Bar segment** defines stack layers; **Bar height** sets segment size.

* **Dimension:** **Bar category** and **Orientation** (vertical or horizontal).
* **Measure:** **Bar segment** (required) and **Bar height** with optional **Aggregation**.

In the **Library**, enable **Manual Edit**, set **Type** to **Stacked bars**, and map columns under **Data**.

Shared fields (**Title**, **Narrative**, **Data**) are in [Chart types](/core/build/charts/chart-types#shared-chart-level-settings).

## When to use it [#when-to-use-it]

**Good fit**

* Part-to-whole within each category (revenue by month split by product line).
* Compare segment mix across teams, regions, or periods.
* Survey or funnel answers stacked per question.

**Prefer another chart**

* Side-by-side category comparison → [Bar chart](/core/build/charts/chart-types/bar-chart).
* Trend over time → [Line chart](/core/build/charts/chart-types/line-chart).
* Few slices as % of one total → [Circular chart](/core/build/charts/chart-types/circular-chart).
* Raw row listing → [Table](/core/build/charts/chart-types/table).

**Examples:** revenue by month and product line, headcount by team and contract type.

<CalloutContainer type="warning">
  <CalloutDescription>
    Limit **Bar segment** to a modest number of categories so stacks stay readable.
  </CalloutDescription>
</CalloutContainer>

**Common setups**

* **Vertical stacks:** **Bar category** + **Bar segment** + **Bar height** (e.g. Sum).
* **Over time:** date **Bar category** + **Date granularity** + segment column.
* **Horizontal:** set **Orientation** to **Horizontal**, then same fields.

## Configuration options [#configuration-options]

Open the chart in the **Library**, turn on **Manual Edit**, select **Data**, then set **Type** to **Stacked bars**. Panels: **Dimension** and **Measure** (*More dimension options* / *More measure options*).

Prerequisites: [connected database](/core/build/data-connections/how-to/add-a-database), Manual Edit ([how-to](/core/build/charts/how-to/customize-a-chart-manually)).

### Dimension [#dimension]

| Option               | How it works                                                                                               |
| -------------------- | ---------------------------------------------------------------------------------------------------------- |
| **Orientation**      | **Vertical** (default) or **Horizontal** stacked layout.                                                   |
| **Bar category**     | Column for each bar (category or time axis).                                                               |
| **Date granularity** | Only shown when **Bar category** is a date column. **Year**, **Quarter**, **Month**, **Week**, or **Day**. |
| **Date format**      | How date labels appear on the category axis.                                                               |
| **Order bars**       | *More dimension options.* Sort by a column, ascending or descending.                                       |
| **Show all labels**  | *More dimension options.* Label under each bar.                                                            |

### Measure [#measure]

| Option                       | How it works                                                           |
| ---------------------------- | ---------------------------------------------------------------------- |
| **Bar segment**              | Column whose values become stack segments (e.g. status, product type). |
| **Bar height**               | Column for segment size. Often numeric; use **Aggregation** as needed. |
| **Aggregation**              | On **Bar height** after the column is selected.                        |
| **Format number**            | Shown when **Bar height** is numeric (after aggregation).              |
| **Show value on bar**        | *More measure options.* Values on segments (on by default).            |
| **Automatic y-axis scaling** | *More measure options.* On by default; off for **Min** / **Max**.      |

**Aggregations on Bar height**

| Aggregation                 | Typical column types |
| --------------------------- | -------------------- |
| Sum, Cumulated sum, Average | Integer, float       |
| Minimum, Maximum            | Integer, float, date |
| Count rows, Count distinct  | All types            |
| Standard deviation          | Integer, float       |

The AI assistant can pre-fill these fields; use **Manual Edit** to adjust.

**Suggested next steps:** [Chart types](/core/build/charts/chart-types) · [Bar chart](/core/build/charts/chart-types/bar-chart) · [Customize a chart manually](/core/build/charts/how-to/customize-a-chart-manually) · [Create a chart with AI](/core/build/charts/how-to/create-a-chart-with-ai)
