Appearance
OrigamChartSparkline
A tiny inline chart for table cells, KPI cards, and dashboards. Renders a single numeric series as a compact visualization with no axes, no legend, and no grid.
Quick start
vue
<OrigamChartSparkline
:series="[{ name: 'Sales', data: [18, 22, 19, 25, 32, 28, 33, 30, 36, 39, 42, 45] }]"
type="line"
color="primary"
:width="120"
:height="30"
/>Props
Visual
| Prop | Type | Default | Description |
|---|---|---|---|
type | TChartSparklineKind | 'line' | Rendering mode: 'line', 'area', 'column', 'bar' |
color | TIntent | string | 'primary' | Stroke / fill colour — intent token or raw CSS |
lineWidth | number | 1.5 | Stroke width (SVG pixels) — line and area only |
width | number | string | 120 | Container width in px or CSS string |
height | number | string | 30 | Container height in px or CSS string |
Markers
| Prop | Type | Default | Description |
|---|---|---|---|
showMarkers | boolean | false | Show a filled circle at every data point |
showMin | boolean | false | Highlight the minimum value in red |
showMax | boolean | false | Highlight the maximum value in green |
showLast | boolean | true | Highlight the last data point in the series colour |
markerSize | number | 2.5 | Radius of highlighted marker circles (SVG pixels) |
Behaviour
| Prop | Type | Default | Description |
|---|---|---|---|
series | Array<IChartSeries> | required | Single data series. Data must be Array<number> |
showTooltip | boolean | false | Enable a minimal value tooltip on hover |
animated | boolean | false | ⛔ Sans effet sur ce composant — no animation is ever emitted — neither a CSS class nor an inline animation declaration. La prop reste declaree (elle est heritee d'IChartBaseProps) et emet un avertissement de developpement si elle est passee. Voir #426. |
animationDuration | number | 600 | ⛔ Sans effet sur ce composant — nothing is animated, so there is no duration to apply. La prop reste declaree (elle est heritee d'IChartBaseProps) et emet un avertissement de developpement si elle est passee. Voir #426. |
Layout (inherited from IChartBaseProps)
| Prop | Type | Default | Description |
|---|---|---|---|
margin | TMargin | — | Outer spacing |
padding | TPadding | — | Inner spacing |
rounded | TRounded | — | Border radius token |
elevation | TElevation | — | Shadow token |
bgColor | TIntent | string | — | Background colour |
minWidth / maxWidth / minHeight / maxHeight | number | string | — | Dimension bounds. The root consumes the full IDimensionProps surface through useDimension(props).dimensionStyles, so all seven dimension props take effect — not just width / height. |
title | string | — | Accessible title. Rendered as no visible header at all: it feeds the root aria-label, the SVG aria-label, and the SVG <title>. When absent, falls back to the translated name of the active type (origam.chart.sparkline.aria_label_{type} — e.g. "Line sparkline"), so the accessible name follows the active locale. |
aspectRatio | string | — | ⛔ Sans effet sur ce composant — the root sizes itself from width / height; no aspect-ratio declaration is emitted. La prop reste declaree (elle est heritee d'IChartBaseProps) et emet un avertissement de developpement si elle est passee. Voir #426. |
subtitle | string | — | ⛔ Sans effet sur ce composant — a sparkline renders no header, neither title nor subtitle. La prop reste declaree (elle est heritee d'IChartBaseProps) et emet un avertissement de developpement si elle est passee. Voir #426. |
categories | Array<string> | — | ⛔ Sans effet sur ce composant — a sparkline is a bare trend line: it draws no axis and no labels. La prop reste declaree (elle est heritee d'IChartBaseProps) et emet un avertissement de developpement si elle est passee. Voir #426. |
fontSize | TFontSize | — | ⛔ Sans effet sur ce composant — a sparkline renders no text at all. La prop reste declaree (elle est heritee d'IChartBaseProps) et emet un avertissement de developpement si elle est passee. Voir #426. |
fontWeight | TFontWeight | — | ⛔ Sans effet sur ce composant — a sparkline renders no text at all. La prop reste declaree (elle est heritee d'IChartBaseProps) et emet un avertissement de developpement si elle est passee. Voir #426. |
Emits
| Event | Payload | Description |
|---|---|---|
point-click | (point: IChartPoint, event: MouseEvent | KeyboardEvent) | Fired when a data point is activated — click anywhere on the SVG (nearest point), or click / Enter / Space on a rendered marker, special (min/max/last) marker, or bar |
Slots
| Slot | Bindings | Description |
|---|---|---|
tooltip | { point: IChartPoint, series: IChartSeries, index: number } | Replace the default hover tooltip body |
empty | — | Render when series is empty or contains no numeric data |
Behaviour notes
Responsive drawing surface (#1324). The SVG viewBox follows the measured box (useChartSize, a ResizeObserver), 1 unit = 1 px, and preserveAspectRatio="none" is gone: stroke widths stay constant and markers stay round whatever the width / height. Until measured (SSR, first paint) the 120 × 30 fallback is used, so hydration is unchanged.
- Point interaction — every rendered marker (
showMarkers), special marker (showMin/showMax/showLast), and bar (type="column"/type="bar") is a point of the chart's single tab stop (roving tabindex, #1333: arrows move between marks,Home/Endjump to the ends, see theOrigamChartpage;role="button", a value-carryingaria-label) and activates on click, Enter, or Space. Clicking anywhere else on the SVG — e.g. a plainline/areasparkline with no markers shown — falls back to the nearest data point by horizontal position, sopoint-clickstays reachable by mouse even with no visible marks.
Types
ts
type TChartSparklineKind = 'line' | 'area' | 'column' | 'bar'Defined in src/types/Chart/chart-sparkline-kind.type.ts.
Rendering modes
| Mode | Shape | Use case |
|---|---|---|
line | Polyline connecting data points | Trend over time |
area | Line with translucent fill below | Emphasise volume |
column | Vertical bars proportional to value | Discrete periods |
bar | Horizontal bars proportional to value | Ranked comparison |
Colour behaviour
Unlike full chart families, sparklines use a single color prop — no palette cycling. Passing a TIntent ('primary', 'success', 'danger', …) resolves to the matching design token. Raw CSS strings pass through untouched.
Special markers (showMin, showMax) override the colour locally:
- Min →
feedback.danger.bgtoken (red) - Max →
feedback.success.bgtoken (green) - Last → same as the series
color
Accessibility
The component uses a <figure> root (semantic landmark for a self-contained chart), an SVG with role="group", aria-label, <title>, and <desc> for screen reader support.
Accessibility — the <desc> summary is localised AND agrees in number. The <desc> text is not an English literal: it resolves through the DS t() mechanism against origam.chart.sparkline.desc*, and the grammatical form is chosen by Intl.PluralRules for the ACTIVE locale — never by a count === 1 test in the component. A translator supplies only the forms their language needs (_one / _other cover en and fr; a Russian translation adds _few with no component change), and a category a locale does not define falls back to _other rather than leaking the raw key.
Usage examples
Embedding in a table
vue
<table>
<tbody>
<tr v-for="row in data" :key="row.id">
<td>{{ row.name }}</td>
<td>{{ row.latestValue }}</td>
<td>
<OrigamChartSparkline
type="line"
:series="[{ name: row.name, data: row.history }]"
:color="row.trend >= 0 ? 'success' : 'danger'"
:width="100"
:height="28"
:show-last="true"
/>
</td>
</tr>
</tbody>
</table>KPI card with area sparkline
vue
<div class="kpi-card">
<span class="kpi-value">$42,500</span>
<OrigamChartSparkline
type="area"
:series="[{ name: 'Revenue', data: monthlyRevenue }]"
color="success"
:show-max="true"
:show-last="true"
:width="160"
:height="40"
/>
</div>With custom tooltip slot
vue
<OrigamChartSparkline
type="line"
:series="[{ name: 'Price', data: prices }]"
:show-tooltip="true"
:width="200"
:height="48"
>
<template #tooltip="{ point, index }">
<div>
<strong>Day {{ index + 1 }}</strong>
<span>${{ point.y.toLocaleString() }}</span>
</div>
</template>
</OrigamChartSparkline>Caveats
- Only the first entry of the
seriesarray is rendered. Multi-series is not supported — use<OrigamChartCartesian>for that. - Data must be
Array<number>. Object-form entries ({ x, y }) are accepted and theyvalue is extracted, but thexis ignored (no X axis). animatedis inert, not merely defaulted tofalse. There is no animation path in this component at all — no CSS class, no inlineanimationdeclaration — so settinganimated="true"does nothing beyond raising a dev-build warning.animationDurationis inert for the same reason. See the Props table above and #426.- The tooltip (
showTooltip) tracks the nearest column index by horizontal proximity; it does not snap to the exact SVG circle — this is intentional for the tiny surface area.