﻿---
title: Isomer charts
description: Chart primitives on one shared core, a dashboard grid, and an unsupported placeholder, published for hosts and materializers to build against.
url: https://docs-v3-preview.elastic.dev/isomer/primitives/charts
---

# Isomer charts
`@elastic/isomer-primitives-charts` is the published chart pack. It holds separate primitives per chart family over one shared core, a `grid` that lays nodes out as a Kibana dashboard does, and an `unsupported` placeholder for anything that cannot be shown.
A chart node is self-contained: its data is inline and typed, its data colors are concrete for both color schemes, and its formats come from one closed portable set. Whoever builds the node, a Kibana materializer or an agent, resolves everything a renderer would otherwise have to decide. Renderers translate; they never pick a data color or sort, and they format only through `formatAxisValue`, except a time axis with `twoRows`, which the engine labels on two rows as Lens does. The chart engine chooses ticks, domains, stacks and point density from the intent the Scene states.

| Primitive                                                                                        | Holds                                                                                                 |
|--------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
| [`metric`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/metric)                  | One headline value, or one tile per row, with an optional secondary value, progress bar or trend line |
| [`legacyMetric`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/legacy-metric)     | Large values with a label above or below each, as Lens's legacy metric draws them                     |
| [`xyChart`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/xy-chart)               | Lines, areas and bars over a shared x axis, with reference lines and annotations                      |
| [`dataTable`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/data-table)           | Rows and columns to read exactly, with colored cells, bars, sorting, paging and a summary row         |
| [`partitionChart`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/partition-chart) | Parts of a whole as a pie, donut, treemap, mosaic or waffle, in up to three layers                    |
| [`heatmap`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/heatmap)                | Cells by two dimensions, colored by value bands                                                       |
| [`gauge`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/gauge)                    | One value on a scale, as a bullet or a dial, with colored ranges and a goal                           |
| [`tagCloud`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/tag-cloud)             | Words sized by value                                                                                  |
| [`grid`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/grid)                      | Titled panels on a 48-column grid, in optional sections                                               |
| [`unsupported`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/unsupported)        | A visible placeholder with a reason and a link                                                        |

Every chart primitive shares the [chart core](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/core): `title`, `description`, `data`, `colors`, `source` and `losses`, and declares its [interactions](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/interactions).

## Entries


| Entry                                       | Holds                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|---------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@elastic/isomer-primitives-charts/schema`  | The contracts: Zod schemas, node types, catalog entries and named examples. It imports no renderer.                                                                                                                                                                                                                                                                                                                                                                               |
| `@elastic/isomer-primitives-charts/scene`   | The [Scene](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/scene) types every renderer reads, the event helpers, `formatAxisValue` for tick labels, the [`CHART_GLYPHS`](/isomer/primitives/charts/core#glyphs) table, the `SceneRenderer` interface, and the [style helpers](/isomer/primitives/charts/rendering#styling) a chart engine authors its own rules with: `createVarsModule`, `varStyle`, `px`, `cls`, and the `LocalVarGroup` and `StyleHandle` types. |
| `@elastic/isomer-primitives-charts/resolve` | [`resolveChart`](/isomer/primitives/charts/scene#resolvechart), which builds a Scene from a node.                                                                                                                                                                                                                                                                                                                                                                                 |
| `@elastic/isomer-primitives-charts`         | Everything above, plus the pack itself: `chartsPack`, [`createChartsPack`](https://docs-v3-preview.elastic.dev/isomer/primitives/charts/rendering), its render context types, and the [size spec](/isomer/primitives/charts/rendering#chart-size) a renderer draws an unsized chart at. It imports React.                                                                                                                                                                         |

```ts
import {
  metricExamples,
  metricSchema,
  type MetricNode,
} from '@elastic/isomer-primitives-charts/schema';
```

The schemas are object schemas for `definePrimitive`, which adds `id` and `surfaces` and closes each node to unknown keys; `grid` is a container and is bound to a composition's body-node union through `gridSchemaFor`. Validate a node inside a composition with a runtime that registers the pack, so nested nodes are checked against every pack the composition holds.

## Validate a node

Validate a node as the body of a composition, through a runtime that registers the pack:
```ts
import { chartsPack } from '@elastic/isomer-primitives-charts';
import type { MetricNode } from '@elastic/isomer-primitives-charts/schema';
import { createIsomerRuntime } from '@elastic/isomer-runtime';

const runtime = createIsomerRuntime({ packs: [chartsPack] });

const node: MetricNode = {
  type: 'metric',
  data: {
    columns: [
      {
        id: 'count',
        label: 'Count of records',
        type: 'number',
        role: 'metric',
      },
    ],
    rows: [[14074]],
  },
  value: { column: 'count' },
};

const { valid, errors } = runtime.validate({ type: 'view', body: [node] });

if (!valid) {
  for (const { path, message } of errors) {
    console.error(`${path}: ${message}`);
  }
}
```

`valid` is true when `errors` is empty. Each error has the `path` of the field at fault, from the composition's root, and a `message` that says what is wrong: a `value.column` of `nope` reports `body[0].value.column: Every column reference names a column in `data.columns`. No column is "nope".`
Parsing a node with its schema alone, such as `metricSchema.safeParse(node)`, is not validation: `definePrimitive` closes the top level, so a stand-alone parse strips unknown top-level keys and `id` instead of rejecting them.

## Adding a field

A chart node carries everything a faithful rendering needs, and drawing it is the engine's job. When a chart does not match its source, that is a gap in an engine, never missing information in the node. A field belongs on a primitive when:
- **It says what it draws, in Isomer's terms.** Its description gives the values, units and effect a reader can check, never "as Lens does". A name borrowed from a source, such as an Elastic Charts fit or an EUI icon, is fine once the field defines it.
- **It carries what a faithful rendering needs, even if one engine alone can draw it.** An engine that cannot draw a field documents its fallback; the field stays.
- **An agent can choose it from the catalog alone**, without knowing the product a node may come from.
- **Its default is Isomer's.** A materializer states its source's value rather than relying on the default to match.
- **A renderer reads it.** What only a host acts on, such as a saved object id, belongs in opaque `source` meta.


## Where each entry loads

`./schema` reaches only zod and the SDK's React-free `./schema` entry, `./scene` adds Distillate for the style helpers an engine authors its few elements with, and `./resolve` adds nothing more, so all three load in browsers and on servers without React. `pnpm check:module-graph` checks it on every change. A chart engine imports only `./scene`: it draws a Scene, and never formats, validates or resolves one. ESLint enforces it in every `@elastic/isomer-charts-*` package.

## Rules

`z.toJSONSchema` drops refinements, so each cross-field rule is stated word for word in the description an agent reads, and a test checks that each check states its rule there. The rules are on each primitive's page.