Charts B
Heatmap
Intensity per day in a grid, with week, month and year tabs.
Example
Heatmap
Grid of rounded cells in five accent levels. The tabs switch the granularity with a transition and each cell has a hover tip.
<article class="u-chartb-card">
<div class="u-chartb-panel" data-u="heatmap" data-u-props="{"label":"Commits this year","noun":"commits","periods":[{"label":"This year","total":1312,"delta":9.2,"seed":7,"stats":[{"v":"41 days","l":"Longest streak"},{"v":"28","l":"Commits on the best day"},{"v":"6h 12m","l":"Longest session"},{"v":"186","l":"Merged pull requests"}]},{"label":"Last year","total":1203,"delta":3.1,"seed":19,"stats":[{"v":"33 days","l":"Longest streak"},{"v":"24","l":"Commits on the best day"},{"v":"5h 40m","l":"Longest session"},{"v":"161","l":"Merged pull requests"}]},{"label":"Two years ago","total":1046,"delta":-2.4,"seed":31,"stats":[{"v":"27 days","l":"Longest streak"},{"v":"19","l":"Commits on the best day"},{"v":"4h 55m","l":"Longest session"},{"v":"132","l":"Merged pull requests"}]}]}"></div>
<div class="u-chartb-copy">
<h3>Heatmap</h3>
<p>Grid of rounded cells in five accent levels. The tabs switch the granularity with a transition and each cell has a hover tip.</p>
</div>
</article>Installation
Just this chart, with the core and the tokens:
curl -fsSL unslop.leallabs.dev/i | sh -s add heatmapDependency 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-heatmapFamily 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. |
noun | string | contributions | Word for the count. |
tabs | array | [Semanal, Mensal, Anual] | Granularity tabs. |
tab | number | 0 | Tab it opens on. |
activity | string | no default | Title of the activity bar. |
periods | array | no default | List of {label, total, delta, seed, stats: [{v, l}]}. The cells come from seed: it's a visual pattern, not per-day data. All with the same number of stats. |
period | number | 0 | Index of the period that opens selected. |
Accessibility and keyboard
State and roles
| Where | Attribute | What it says |
|---|---|---|
| tabs | role="tablist", role="tab", aria-selected | Weekly, Monthly and Yearly. |
| period list | role="listbox", role="option" | Opens with aria-expanded and marks the option in aria-selected. |
| grid | aria-hidden="true" | The cells are decoration. Total and stats stay in text. |
Keyboard
| Key | Does |
|---|---|
| Left and right arrows | change the tab |
| 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.