Chart Legend

颜色色块和图表图例,图例项可切换系列的显示与隐藏。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 可用

用法

  • Playback4.2 GB
  • Masters2.8 GB
  • Locked640 MB
Me Others Trend

导入

ts
import {
  SoneChartLegendComponent,
  SoneSwatchDirective,
} from "@surface-one/angular/chart-legend";

API 参考

SoneChartLegendComponent组件

`<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.

选择器
sone-chart-legend
输入
名称类型 默认值
itemsreadonly SoneChartLegendItem[][]
orientationSoneChartLegendOrientation"row"
toggleablebooleanfalse
hidden双向

Keys of the series that are switched off.

readonly string[][]
shapeSoneSwatchShape"dot"
ariaLabel

Names the list (e.g. "Series"); optional.

string | nullnull
locale

Locale for numeric values; defaults to the active `$localize` locale.

string | nullnull
输出
名称类型
toggle

The key of the item the user toggled.

string

SoneSwatchDirective指令

`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`.

选择器
span[soneSwatch]
输入
名称类型 默认值
tonestring | null | undefined""
shapeSoneSwatchShape"dot"