Stacked Bar
将一根条形拆分为整体的各个部分,可选显示剩余轨道和图例,并为读屏软件生成摘要。
可用框架
Angular: 可用 Vue: 可用 React: 可用 React Native: 可用
用法
- Playback4.2 GB
- Masters2.8 GB
- Locked0.6 GB
- Working9
- Need attention2
- Optional3
<div class="demo-stack" style="max-width: 28rem">
<sone-stacked-bar
ariaLabel="Recording storage"
[segments]="storage"
[max]="limit"
[valueLabel]="gigabytes"
showLegend
/>
<sone-stacked-bar
size="sm"
ariaLabel="Health checks"
[segments]="health"
showLegend
/>
</div>导入
import {
SoneStackedBarComponent,
} from "@surface-one/angular/stacked-bar";API 参考
SoneStackedBarComponent组件
`<sone-stacked-bar>` — one bar split into the parts of a whole (storage by kind, checks by state). With `max` above the sum, the rest shows as the empty track. The bar is `role="img"` named by a generated summary ("Storage: Playback 4.2 GB (40%), …; 7.6 GB of 20 GB"); `valueLabel` formats the values (bytes, durations), `locale` the numbers and percentages.
| 名称 | 类型 | 默认值 |
|---|---|---|
segments | readonly SoneStackedBarSegment[] | [] |
maxThe whole the parts are measured against; `null` (default) = their sum. | number | null | null |
ariaLabelWhat the bar measures ("Storage"); starts the spoken summary. | string | null | null |
showLegend | boolean | false |
size | SoneStackedBarSize | "md" |
localeLocale for numbers and percentages; defaults to the active `$localize` locale. | string | null | null |
valueLabelFormats one value for the summary and the legend; default: a localized number. | SoneStackedBarValueFn | null | null |
emptyLabel | — | $localize`:Stacked bar with nothing to show:No data` |