---
title: "Stacked bar"
description: "Composition per category. What the stacked bar is for, the data it needs and every option it has."
section: "Widgets"
canonical: "https://banksync.io/docs/widgets/chart-stacked-bar"
specs: ["dashboards"]
operationBindings: [{"capability":"dashboards","operation":"dashboards.author"}]
---

Composition per category. It sits in the **Comparison** group of the widget library.

![Example stacked bar on a BankSync dashboard](https://cdn.banksync.io/screenshots/docs/charts/stacked-bar.1694c5558ed81647.png)

## When to use it

Use a stacked bar when each category has a total made of parts: monthly spending split by category, balances per bank split by account, or income per quarter split by client. You see both the total and what drives it.

## When to pick something else

- Only the parts' shares matter? Use a **100% stacked bar**.
- Comparing the parts to each other precisely? Use a **Grouped bar**; only the bottom segment shares a baseline.
- Many dates? Use a **Stacked area**.

## The data it needs

Pick these in the **Data** tab of the inspector. BankSync suggests a column for each when your source has an obvious match.

| Field      | Needed   | Pick                 | Notes |
| ---------- | -------- | -------------------- | ----- |
| **X axis** | Yes      | a category or a date |       |
| **Y axis** | Yes      | a number             |       |
| **Series** | Optional | a category           |       |
| **Color**  | Optional | a category           |       |

Rows that share a category are combined before drawing: choose **Sum**, **Average**, **Count**, **Min** or **Max** on the value field. See [Binding data](/docs/widgets/binding-data).

## Stacked bar options

This chart has no options of its own; everything on its **Style** tab is the shared chart styling below.

## Shared chart styling

Every chart also has the shared styling options. These apply to this one:

- [Legend](/docs/widgets/chart-styling#legend): position, layout and which series show.
- [Axes](/docs/widgets/chart-styling#axes): titles, tick labels and number format.
- [Grid](/docs/widgets/chart-styling#grid), [title](/docs/widgets/chart-styling#title), [padding](/docs/widgets/chart-styling#padding) and [background](/docs/widgets/chart-styling#background).
- [Value labels](/docs/widgets/chart-styling#value-labels) on the marks.
- [Categories and labels](/docs/widgets/chart-styling#categories-and-labels): top N with "Other", sort order, readable labels, the handwritten callout.
- [Style](/docs/widgets/chart-styling#style): corner radius, line width, opacity and animation.
- [Tooltip](/docs/widgets/chart-styling#tooltip) on hover.
- Click to filter: clicking a mark can filter the rest of the dashboard. See [Filters and cross-filtering](/docs/dashboards/filters-and-cross-filtering).
- [Colours](/docs/widgets/chart-styling#palette): follow the dashboard palette or pick one for this chart.

## Messy data

- Without a series field it draws plain single bars.
- Negative parts stack below zero and positive parts above, so a month with refunds shows both.
- More than 8 series: the 7 largest keep their colour and the rest merge into **Other**.
- Categories that don't fit fold into one **Other (N)** bar; dates never fold.
- The tooltip lists each part plus a **Total**.

## On a phone

Stacked bars keep their meaning at phone width because the total still reads as one bar. The legend moves below the chart and may be cut to "+N more", so keep phone versions to about four parts.

## Related charts

- [Bar chart](/docs/widgets/chart-bar): Horizontal categorical bars
- [Column chart](/docs/widgets/chart-column): Vertical categorical bars
- [Grouped bar](/docs/widgets/chart-grouped-bar): Side-by-side bars per series
- [100% stacked bar](/docs/widgets/chart-normalized-stacked-bar): Composition as percentage
- [Lollipop](/docs/widgets/chart-lollipop): Bars with circle endpoints
- [Dot plot](/docs/widgets/chart-dot): Discrete category dots
- [Bullet chart](/docs/widgets/chart-bullet): Single value with target bands
