Sparkline

单个拉伸 SVG 中的迷你折线、面积、柱状或热力图,无坐标轴;默认仅作装饰,也可作为带朗读摘要的图像。

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

用法

Meetings
Talk time
Focus
Streak

导入

ts
import {
  SoneSparklineComponent,
} from "@surface-one/angular/sparkline";

API 参考

SoneSparklineComponent组件

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

选择器
sone-sparkline
输入
名称类型 默认值
values

The series, oldest first.

readonly number[][]
type

`line` | `area` | `bar` | `heat` (cells on the sequential ramp).

SoneSparklineType"line"
min

The bottom of the scale.

number0
max

The top of the scale; defaults to `niceCeiling(values, 4)`.

number | null | undefinedundefined
tone

The colour (`heat` uses the sequential ramp instead).

SoneChartTone"accent"
decorative

Hidden from assistive technology (default); `false` makes it `role="img"`.

booleantrue
summary

The spoken text when not decorative; defaults to “n values, peak x, total y”.

string | nullnull