Bar Chart

用于短序列的柱状图,带刻度标签、悬停和聚焦时的提示、方向键导航,以及供屏幕阅读器使用的隐藏数据表。

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

用法

Meetings per day, last 30 days
DayMeetings
Sep 100
Sep 111
Sep 120
Sep 132
Sep 143
Sep 151
Sep 160
Sep 170
Sep 182
Sep 194
Sep 203
Sep 211
Sep 220
Sep 230
Sep 241
Sep 252
Sep 265
Sep 273
Sep 282
Sep 290
Sep 300
Oct 11
Oct 23
Oct 34
Oct 42
Oct 51
Oct 60
Oct 70
Oct 82
Oct 93

导入

ts
import {
  SoneBarChartComponent,
} from "@surface-one/angular/bar-chart";

API 参考

SoneBarChartComponent组件

`<sone-bar-chart>` — a column chart for a short series (a day per bar). Bars are HTML boxes, not a stretched SVG: crisp edges and real rounded corners at any width, and hover, focus and tooltip positioning are plain CSS. One Tab stop with a roving focus (Left/Right/Home/End); each bar is an image named by its tooltip, and a visually hidden table carries the data for screen-reader browsing.

选择器
sone-bar-chart
输入
名称类型 默认值
data

The bars, left to right (oldest first for a time series).

readonly T[][]
height

The plot height in CSS pixels (ticks sit below it).

number132
yMax

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

number | null | undefinedundefined
tick

The axis label under a bar, or `null` for none; no function, no axis row.

SoneBarChartTick<T> | null | undefinedundefined
tooltip

A bar's tooltip and accessible name; defaults to “label: value”.

SoneBarChartTooltip<T> | null | undefinedundefined
zero

How a zero value draws: a flat stub (`baseline`) or nothing (`gap`).

SoneBarChartZero"baseline"
tone

The bar colour.

SoneChartTone"accent"
ariaLabel

Names the chart and captions its data table (“Meetings per day, last 30 days”).

string""
valueFormat

Formats values in the default tooltip and the data table.

SoneBarChartFormatdefaultFormat
categoryHeader

The data table's category column header.

—$localize`Category`
valueHeader

The data table's value column header.

—$localize`Value`