# letterChart

External component: a figure in the quarterly letter column. `data.chart` picks the kind: a bar chart, a line chart, an image, or a table. The entry `heading` is the figure title.

## Fields & Schema

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `externalComponentType` | Symbol | Yes | Must be `"letterChart"` (exact case) |
| `heading` | Text | No | Figure title. A trailing footnote marker is split off and linked to the disclosure. |
| `data.chart` | string | Yes | `bar`, `line`, `image` or `table`. Anything else (or invalid data for the kind) renders nothing. |

**`bar`**: `unit` (optional; `%` or any text), `categories` (non-empty strings), `series` (non-empty; each `{ "name"?, "values": [number] }` with exactly one number per category), `annotation` (optional `{ "afterCategory", "label" }`, a dashed divider after that category).

**`line`**: `unit` (optional; `$` or "billion" gives `$` axis ticks), `series` (non-empty; each `{ "name"?, "points": [{ "x": "YYYY-MM-DD", "y": number }] }`; `values` is accepted in place of `points`). Include a year (20xx) in the series name for the end label; otherwise the last point's year is used. Any bad point rejects the whole chart.

**`image`**: `src` (https URL on `images.ctfassets.net` or `downloads.ctfassets.net` only), `alt` (required), `width` and `height` (optional positive integers), `caption` (optional).

**`table`**: `columns` (non-empty strings), `rows` (non-empty; each `{ "cells": [string], "emphasis"?: boolean }` with exactly one cell per column), plus optional `kicker`, `asOf`, `groups` (`[{ "label", "span" }]`, spans must sum to the column count), `notes` (strings), `caption`, `stripe`, `stripeFirst` (booleans).

Renders only inside the letter layout (it is not shown in the letter footer tail section).

## Usage

```bash
# Add the component
cms-edit add "letterChart" --content-type externalComponent --target content

# Set the title and a bar chart
cms-edit set @ref heading "Share of returns by sector"
cms-edit set @ref data --json '{"chart":"bar","unit":"%","categories":["2024","2025"],"series":[{"name":"Fund","values":[12,18]}]}'

cms-edit save
```

`set data --json` replaces the whole object. Read the current `data` first and change only the key you mean to.
