Dot Waffle
Each part lights its share of a hundred dots in its own colour, in reading order, and with a total (a quota, a budget) the unused rest stays dark. The units always add up to exactly a hundred, and a sliver still gets a dot. The dots light in order when it comes into view, and a change flips the dots that change in a wave across the panel, like a flip-dot board. Point at a part, in the panel or the key, and the rest dims; the key gives every part's name, share and value in text.
Needs: None. Canvas 2D.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| data | { label: string; value: number }[] | required | The parts of the whole, in the order their colours should go. |
| total | number | – | The whole, when it's more than the parts add up to; the rest stays dark. |
| format | (value: number) => string | – | How a value reads in the key. |
| max | number | 5 | Most parts in colour; the smallest past this fold into “Other”. At most 5. |
| tones | string[] | – | A colour for each part, in order. The library's series colours by default. |
| unit | number | 16 | Size of one unit (one percent) in px. |
| label | string | "Parts of the whole" | What the whole is, for screen readers. |
| className | string | – | Class on the chart. |
| style | CSSProperties | – | Style on the chart. |