Charts B
Radar comparison
Two series on the same radar, with the legend isolating one of them.
Example
Radar comparison
Two outline-only series on the same grid. The legend is live: hover a series to isolate it.
<article class="u-chartb-card">
<div class="u-chartb-panel" data-u="radar-compare" data-u-props="{"label":"Sessions","axes":["January","February","March","April","May","June"],"short":["Jan","Feb","Mar","Apr","May","Jun"],"max":300,"periods":[{"label":"H1","delta":4.8,"series":[{"name":"Web","values":[210,255,238,230,196,221]},{"name":"App","values":[120,147,127,141,142,153]}]},{"label":"H2","delta":3.2,"series":[{"name":"Web","values":[225,240,251,262,238,247]},{"name":"App","values":[131,158,149,171,164,180]}]},{"label":"Last year","delta":-0.8,"series":[{"name":"Web","values":[190,205,214,201,208,219]},{"name":"App","values":[88,102,97,110,121,126]}]}]}"></div>
<div class="u-chartb-copy">
<h3>Radar comparison</h3>
<p>Two outline-only series on the same grid. The legend is live: hover a series to isolate it.</p>
</div>
</article>Installation
Just this chart, with the core and the tokens:
curl -fsSL unslop.leallabs.dev/i | sh -s add radar-compareDependency 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-radar-compareFamily 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. |
max | number | computed | Top of the scale. |
periods | array | no default | List of {label, delta, series: [{name, values}]}, with two series. |
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.