Sparkline
Un grafico a linea, area, barre o calore grande quanto una parola, senza assi, in un unico SVG allungato; decorativo di default o un’immagine con un riepilogo letto.
Angular: disponibile Vue: disponibile React: disponibile React Native: disponibile
Utilizzo
- Meetings
- Talk time
- Focus
- Streak
<dl class="demo-stack" style="display: grid; grid-template-columns: auto minmax(0, 10rem); align-items: center; gap: var(--space-3) var(--space-4); max-width: 22rem; margin: 0">
<dt>Meetings</dt>
<dd style="margin: 0"><sone-sparkline [values]="meetings" type="bar" /></dd>
<dt>Talk time</dt>
<dd style="margin: 0"><sone-sparkline [values]="minutes" type="area" tone="chart-2" /></dd>
<dt>Focus</dt>
<dd style="margin: 0"><sone-sparkline [values]="minutes" tone="chart-3" /></dd>
<dt>Streak</dt>
<dd style="margin: 0">
<sone-sparkline [values]="meetings" type="heat" [decorative]="false" summary="Meetings per day, last 30 days" />
</dd>
</dl>Importazione
import {
SoneSparklineComponent,
} from "@surface-one/angular/sparkline";Riferimento API
SoneSparklineComponentComponente
`<sone-sparkline>` — a word-sized chart with no axes: a line, an area, bars or a heat strip in one stretched `<svg>`. Decorative by default (next to a number that already says it); pass `[decorative]="false"` to make it an image with a spoken summary.
| Nome | Tipo | Predefinito |
|---|---|---|
valuesThe series, oldest first. | readonly number[] | [] |
type`line` | `area` | `bar` | `heat` (cells on the sequential ramp). | SoneSparklineType | "line" |
minThe bottom of the scale. | number | 0 |
maxThe top of the scale; defaults to `niceCeiling(values, 4)`. | number | null | undefined | undefined |
toneThe colour (`heat` uses the sequential ramp instead). | SoneChartTone | "accent" |
decorativeHidden from assistive technology (default); `false` makes it `role="img"`. | boolean | true |
summaryThe spoken text when not decorative; defaults to “n values, peak x, total y”. | string | null | null |