Waffle chart
Show the share of a whole as a grid of square cells in a waffle chart, one panel per category, with the total on top and shares rounded to whole cells.
- React
import { WaffleChart } from 'boardplot/react/waffle';- Reference
- Data, options and sizing
- Use for
- One share of 100%, such as 30% of customers · Several shares side by side with one baseline · Stacked segments of one whole
Orders by delivery speed
Waffle grid of 100 squares split into same day 41.3%, next day 27.4%, later 18.3% and rest 13.0%, with a bracket showing 68.7% within a day.
Download SVG
Fixture ID
stacked-segments
JSON spec
This spec includes the theme shown and the options you selected.
{
"type": "waffle",
"data": {
"categories": [
{
"id": "orders",
"label": "Orders by delivery speed, % of all orders"
}
],
"series": [
{
"id": "same-day",
"label": "Same day",
"values": [
41.3
]
},
{
"id": "next-day",
"label": "Next day",
"values": [
27.4
]
},
{
"id": "later",
"label": "Later",
"colorRole": "series-4",
"values": [
18.3
]
}
]
},
"options": {
"title": "Two in three orders arrive within a day",
"source": "Illustrative data",
"format": "0.0%",
"variant": "cells",
"subtotal": {
"series": [
"same-day",
"next-day"
],
"label": "within a day"
},
"strings": {
"others": "Rest of orders"
},
"footnotes": [
"1 square = 1% of orders"
]
}
}Two customer shares side by side
Two 10 by 10 waffle grids: 30% of customers are high spenders and 64% are repeat buyers.
Download SVG
Fixture ID
two-panels
JSON spec
This spec includes the theme shown and the options you selected.
{
"type": "waffle",
"data": {
"categories": [
{
"id": "urban",
"label": "Share of high-spending customers out of all customers in the urban region"
},
{
"id": "rural",
"label": "Share of repeat buyers"
}
],
"series": [
{
"id": "share",
"label": "Share",
"values": [
30,
64
]
}
]
},
"options": {
"title": "Repeat buyers are twice as common as high spenders",
"source": "Illustrative data"
}
}Minimal spec
Save this spec as waffle.json and run the command.
{
"type": "waffle",
"data": {
"categories": [{ "id": "high-spend", "label": "Share of high-spending customers out of all customers" }],
"series": [{ "id": "share", "label": "High spenders", "values": [30] }]
},
"options": { "title": "Three in ten customers are high spenders", "source": "Illustrative data" }
}npx boardplot render waffle.json --out waffle.svg