Chart Legend
Muestras de color y una leyenda de gráfico cuyos elementos pueden mostrar u ocultar series.
Angular: disponible Vue: disponible React: disponible React Native: disponible
Uso
- Playback4.2 GB
- Masters2.8 GB
- Locked640 MB
<div class="demo-stack" style="max-width: 32rem">
<sone-chart-legend
[items]="kinds"
toggleable
[(hidden)]="hidden"
ariaLabel="Node kinds"
/>
<sone-chart-legend [items]="storage" orientation="column" shape="square" />
<div class="demo-row" style="font-size: var(--font-size-sm)">
<span soneSwatch tone="chart-1"></span> Me
<span soneSwatch tone="chart-2"></span> Others
<span soneSwatch tone="chart-4" shape="line"></span> Trend
</div>
</div>Importación
import {
SoneChartLegendComponent,
SoneSwatchDirective,
} from "@surface-one/angular/chart-legend";Referencia de la API
SoneChartLegendComponentComponente
`<sone-chart-legend>` — the key of a chart: a swatch, a label and an optional value per series. `toggleable` turns every item into a toggle button (`aria-pressed` = the series is shown) that updates `hidden` (two-way) and emits `toggle` with the item's key.
| Nombre | Tipo | Predeterminado |
|---|---|---|
items | readonly SoneChartLegendItem[] | [] |
orientation | SoneChartLegendOrientation | "row" |
toggleable | boolean | false |
hiddenbidireccionalKeys of the series that are switched off. | readonly string[] | [] |
shape | SoneSwatchShape | "dot" |
ariaLabelNames the list (e.g. "Series"); optional. | string | null | null |
localeLocale for numeric values; defaults to the active `$localize` locale. | string | null | null |
| Nombre | Tipo |
|---|---|
toggleThe key of the item the user toggled. | string |
SoneSwatchDirectiveDirectiva
`span[soneSwatch]` — the colour key of a series: a dot, a square or a short line. Decorative (`aria-hidden`); the text next to it carries the meaning. `tone` is a token suffix (`chart-3`, `graph-note`, `success`), a custom property name (`--brand`) or any CSS colour; empty uses `currentColor`. Size it with `--swatch-size`.
| Nombre | Tipo | Predeterminado |
|---|---|---|
tone | string | null | undefined | "" |
shape | SoneSwatchShape | "dot" |