Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
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.

Full screen

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/chart'; </script> <pm-chart type="bar" label="Revenue and costs by month" value-prefix="$" labels="Jan,Feb,Mar,Apr,May,Jun" series='[{"name":"Revenue","values":[4200,5100,4800,6300,7200,8100]},{"name":"Costs","values":[2800,3000,3100,3300,3600,3900]}]'></pm-chart> <pm-chart type="donut" label="Traffic by source" labels="Search,Direct,Social,Referral" values="46,28,16,10" value-suffix="%"></pm-chart>

States

Each state is one attribute.

Loading

Overview

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

AttributeTypeDefaultDescription
type'bar' | 'line' | 'area' | 'donut'—bar (default), line, area or donut.
labelstring—Accessible name and table caption, e.g. "Revenue by month".
labelsstring[][]Category names along the x axis (or donut slices): labels="Jan,Feb,Mar" or an array.
seriesChartSeries[][]One or more data series: [{ name, values, tone? }].
valuesnumber[]—Shorthand for a single series.
heightnumber—Plot height in pixels (default 240; 200 for a donut).
stackedboolean—Stack bars or areas instead of placing them side by side.
hide-legend
prop: hideLegend
boolean—Hide the legend (shown by default for two or more series and for donuts).
value-prefix
prop: valuePrefix
string—Text before each value, e.g. "$".
value-suffix
prop: valueSuffix
string—Text after each value, e.g. "%".
loadingboolean—Show a placeholder while data loads.
empty-text
prop: 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

EventReact / Svelte propDescription
pm-selectonPmSelectA data point was clicked or chosen with Enter. detail.values has one value per series.

Used in templates

Overview dashboardTraffic analyticsCustomer 360Landing page