> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To set up Hatchmark for a user, follow https://hatchmark.dev/docs/get-started/agent-setup.md. Inside a Hatchmark project, prefer `hatchmark docs`: it prints the docs of the installed version.

# Bar list

> Ranks categories by one metric, each row with its rank, name, bar and value.

Ranks categories by one metric. Each row has its rank, its name, a bar and the value, so long
names stay readable and the order is the point.

```yaml theme={null}
type: bar_list
title: Software leads revenue again
metric: revenue
by: industry
span: 6
```

[Live preview of the bar-list component](https://components.hatchmark.dev/components/bar-list/?embed\&theme=light)

The preview above is the live component gallery. [Open it full size](https://components.hatchmark.dev/#/bar-list) to switch between desktop and phone widths.

## Options

| Field | Type | Default | Description |
| - | - | - | - |
| `metric` | metric name | required | Any metric: sums, counts, distinct counts, averages and ratios. |
| `by` | column | required | One row per value. |
| `limit` | 1–50 | `10` | Rows shown. The card says how many more there are. |
| `order` | `desc`, `asc` | `desc` | Highest first, or lowest first. |
| `span`, `title`, `id` | | | As for [every block](/docs/reference/dashboards.md#blocks). No `height`: the list is as tall as its rows. |

Use a pie when a few categories are parts of one whole, and a [bar chart](/docs/components/bar.md) to compare
several metrics or split by a second column.

## Examples

### The slowest first

```yaml theme={null}
type: bar_list
title: Five regions ship slower than two days
metric: avg_ship_days
by: region
order: desc
limit: 5
```

## Behavior

* Each row is the metric over that category's rows, recomputed in SQL, so ratios and distinct
  counts are right per row.
* A category is listed when at least one of its rows in the window passes the metric's own
  filters. With a filtered metric such as refunded orders, a country without a refunded order is
  left out of the list and out of "top 10 of 24". A category whose kept rows add up to 0 stays.
  A ratio lists a category when its numerator or its denominator keeps a row there.
* Ties share a rank (1, 2, 2, 4). Categories with no value come last, unranked. A null category is
  "(empty)".
* With `limit` the subtitle says "top 10 of 24", or "bottom" with `asc`.
* Bars scale to the largest absolute value. A negative value draws a lighter bar and keeps its sign.
* Long names wrap instead of being cut. The list grows with its rows instead of scrolling.
* The same list sits beside a [map](/docs/components/map.md).

## Checks

| Code | When |
| - | - |
| HM2024 | `span` is under 3; the list is drawn 3 columns wide. |

`hatchmark explain <code>` explains a check and how to fix it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.