Data
Chart <pm-chart>
Chart: bar, line, area and donut charts drawn as SVG, with no dependencies. Colours come from the theme's roles, so charts follow every theme, mode and tone.
States
Each state is one attribute.
LoadingOverview
Data: labels (categories) and series ([{ name, values, tone? }]), as properties or JSON attributes. For one series, values="4,8,6" is enough. A donut uses the first series: one slice per label.
Reading values: hover or tap shows a tooltip; focus the chart and use the arrow keys to step through the data (Home/End jump, Escape clears). The same data is offered to screen readers as a table.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
type | 'bar' | 'line' | 'area' | 'donut' | — | bar (default), line, area or donut. |
label | string | — | Accessible name and table caption, e.g. "Revenue by month". |
labels | string[] | [] | Category names along the x axis (or donut slices): labels="Jan,Feb,Mar" or an array. |
series | ChartSeries[] | [] | One or more data series: [{ name, values, tone? }]. |
values | number[] | — | Shorthand for a single series. |
height | number | — | Plot height in pixels (default 240; 200 for a donut). |
stacked | boolean | — | Stack bars or areas instead of placing them side by side. |
hide-legendprop: hideLegend | boolean | — | Hide the legend (shown by default for two or more series and for donuts). |
value-prefixprop: valuePrefix | string | — | Text before each value, e.g. "$". |
value-suffixprop: valueSuffix | string | — | Text after each value, e.g. "%". |
loading | boolean | — | Show a placeholder while data loads. |
empty-textprop: emptyText | string | — | Message when there is no data (default "No data"). |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-select | onPmSelect | A data point was clicked or chosen with Enter. detail.values has one value per series. |