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

# nika:chart

> Usage, declared contract and source links for this Nika builtin.

[Builtins catalog](https://docs.nika.sh/reference/builtins.md) / `nika:chart`

> [card] Media
>
> Tool family from the canonical registry.

> [card] [invoke](https://docs.nika.sh/reference/language/words/invoke.md)
>
> Call this builtin through the invoke verb.

## Read this contract

This reference preserves the specification at the revision linked below. Source examples are **fragments**: their surrounding tasks, inputs and permissions are not supplied here. Consult [engine status](https://docs.nika.sh/reference/status.md) and `nika catalog --tools --json` for the installed implementation; a registry declaration is not a runtime qualification.

## Usage and behavior

The task binds the rows produced by `metrics` before invoking the chart.
`period` values are Unix epoch milliseconds when their semantic is `timestamp`.

```yaml illustration theme={"system"}
with:
  metrics: "${{ tasks.metrics.output }}"
invoke:
  tool: "nika:chart"
  args:
    data: "${{ with.metrics }}"   # rows · array of flat objects (strings + numbers) · or { path: <json file> }
    semantics: { period: timestamp, cost: usd, provider: category }
    chart:
      type: line                          # bar | line | area_band | scatter | heatmap (closed)
      x: period                           # field names · y_lo/y_hi = area_band bounds · y2 = actual overlay
      y: cost                             # color = series split (heatmap: the value field)
      title: "Cost over time"
    out: report/cost-over-time.svg        # .svg REQUIRED — SVG is the attestation surface
    compile_to: vega_lite                 # optional · also writes the .vl.json sibling
```

Pure compute + ONE permit-gated write (`out:` rides `permits.fs.write` ·
a `data.path` source rides `permits.fs.read`). No network, no clock, no
keys — identical `(spec, data)` produce **byte-identical SVG** on every
platform, re-runs are idempotent (hash-equal artifacts are never
rewritten), and `outputs:` carries the receipts: `path · sha256 ·
data_sha256 · width · height · bytes · wrote · warnings`.

The semantic map drives presentation (`usd` money grain · `duration_ms`
humanized · `tokens` k/M · `delta` ⇒ diverging palette anchored at 0 ·
`percent` · `timestamp` · `count` · `category` — closed set). Encoding
honesty is built in: bars always anchor zero · **predictions are dashed,
observations solid** (area\_band) · decimation (LTTB) keeps extremes and
warns — the DATA hash still covers every row.

Errors are `NIKA-BUILTIN-CHART-001..008` (001 empty data · 002 unknown
field · 003 non-finite · 004 invalid spec/closed-enum · 005 domain
collapsed · 006 type mismatch · 007 too many points · 008 I/O).

## Related concepts

> [card] [Arguments](https://docs.nika.sh/reference/language/words/args.md)
>
> Pass the values required by the tool contract.

> [card] [Permissions](https://docs.nika.sh/concepts/security.md)
>
> Understand authority before granting effects.

> [card] [Errors and recovery](https://docs.nika.sh/reference/error-codes.md)
>
> Read diagnostics and choose a recovery policy.

> [card] [Workflow templates](https://docs.nika.sh/guides/templates.md)
>
> Put the fragment inside a complete workflow.

## Contract provenance

[Read the pinned specification](https://github.com/supernovae-st/nika-spec/blob/5cd95cd25c0ff453be266794a03666e5e3f2d7a8/stdlib/builtins-v0.1.md#L697) · [Canonical registry](https://github.com/supernovae-st/nika-spec/blob/5cd95cd25c0ff453be266794a03666e5e3f2d7a8/canon/builtins.yaml).

Tool identity: `nika:chart`. Specification revision: `5cd95cd25c0f`.

> [card] [Documentation](https://docs.nika.sh/introduction.md)
>
> Guides, reference contracts and working examples.

> [card] [Language spec](https://github.com/supernovae-st/nika-spec)
>
> the nine-key envelope, Apache-2.0. The contract these docs explain.

> [card] [Engine source](https://github.com/supernovae-st/nika)
>
> Rust, AGPL-3.0-or-later. Every commit public.

> [card] [TypeScript SDK](https://docs.nika.sh/sdk/overview.md)
>
> Use one typed lifecycle locally or against authenticated nika serve HTTP.

> [card] [Editor extension](https://marketplace.visualstudio.com/items?itemName=supernovae.nika)
>
> The editor extension, frozen at 0.120 and not qualified with 0.124: use `nika lsp` and the JSON Schema.

> [card] [Homebrew tap](https://github.com/supernovae-st/homebrew-tap)
>
> `brew install supernovae-st/tap/nika` for the latest tagged CLI release.

> [card] [SuperNovae](https://supernovae.studio)
>
> The Paris studio crafting Nika. 🦋


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