Stacked Bar
Una barra divisa nelle parti di un totale, con traccia residua opzionale, legenda e un riepilogo per gli screen reader.
Angular: disponibile Vue: disponibile React: disponibile React Native: disponibile
Utilizzo
- 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>Importazione
import {
SoneStackedBarComponent,
} from "@surface-one/angular/stacked-bar";Riferimento API
SoneStackedBarComponentComponente
`<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.
| Nome | Tipo | Predefinito |
|---|---|---|
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` |