Charts B
Radar
One series on radial axes, with the point and axis highlighted on hover.
Example
Radar chart
Filled polygon over a hexagonal grid. Hover an axis and the title counts up to its value, with the matching tile highlighted.
<article class="u-chartb-card">
<div class="u-chartb-panel" data-u="radar" data-u-props="{"label":"Active users","axes":["January","February","March","April","May","June"],"short":["Jan","Feb","Mar","Apr","May","Jun"],"max":450,"periods":[{"label":"H1","values":[310,402,365,371,338,394],"delta":4.8},{"label":"H2","values":[352,331,398,420,377,405],"delta":6.1},{"label":"Last year","values":[270,298,311,286,305,322],"delta":-1.9}]}"></div>
<div class="u-chartb-copy">
<h3>Radar chart</h3>
<p>Filled polygon over a hexagonal grid. Hover an axis and the title counts up to its value, with the matching tile highlighted.</p>
</div>
</article>Installation
Just this chart, with the core and the tokens:
curl -fsSL unslop.leallabs.dev/i | sh -s add radarDependency Pulls in b-shell (shell for B charts). The installer downloads it and puts it in the right order.
The full card from the example, as HTML ready to paste:
curl -fsSL unslop.leallabs.dev/i | sh -s add chart-radarFamily B: shell u-chartb-card > the data-u with the u-chartb-panel class, then div.u-chartb-copy with h3 and p.
Props
They go in data-u-props, as JSON. Each item in periods becomes an option in the picker and the chart animates from the old data to the new.
| Prop | Type | Default | What it does |
|---|---|---|---|
label | string | no default | Small label at the top of the card. |
axes | array | no default | Name of each axis. |
short | array | no default | Short name for each axis, optional. |
max | number | computed | Top of the scale. Without it, the highest value is rounded up. |
periods | array | no default | List of {label, delta, values}. |
period | number | 0 | Index of the period that opens selected. |
Accessibility and keyboard
State and roles
| Where | Attribute | What it says |
|---|---|---|
| chart svg | role="img" and aria-label | "Radar chart". |
| period list | role="listbox", role="option" | Opens with aria-expanded and marks the option in aria-selected. |
Keyboard
| Key | Does |
|---|---|
| Enter or Space | opens the period list |
| Up and down arrows | moves through the options |
| Esc | closes without changing |
| Tab | closes and moves focus on |
Events and API
No public events. The period change happens inside the card.