# Bar

> Single-series weekly volume, thin rounded-end bars on a recessive grid.

- Group: Charts
- HTML page: https://design.ipmnx.com/charts/bar/
- Spec: https://design.ipmnx.com/design/#charts

## Usage

Load tokens.css, kit.css and behavior/charts.js (after behavior/util.js), then draw into an empty element. The chart is an inline SVG that re-themes with data-theme, dir and data-nx-product.

```js
NXCharts.renderBar(el, dataset, a11y);
NXCharts.tableForBar(el, dataset, a11y.tableSummary);
```

## Dataset

```json
{
  "labels": [
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
    "Sun"
  ],
  "series": [
    {
      "name": "Volume",
      "color": "--nx-chart-1",
      "values": [
        32,
        58,
        41,
        67,
        52,
        30,
        22
      ]
    }
  ]
}
```

## Classes

| Class | Description |
| --- | --- |
| `.nx-chart` | SVG chart root, sets base font-size |
| `.nx-grid line` | Recessive gridlines |

## Accessibility

- Accessible name (role="img" with aria-label): Weekly volume, bar chart, Monday through Sunday
- Data table summary (visually hidden table for screen readers): Weekly volume by day: Mon 32, Tue 58, Wed 41, Thu 67, Fri 52, Sat 30, Sun 22.

## Do / Don't

- Do: Label the peak value directly on its bar.
- Don't label every single bar. That defeats the point of direct labels.

---

Source: registry.js (NX Design System)
