@blueprint-chart/docs 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/dist/api.d.ts +13 -0
  4. package/dist/api.js +29 -0
  5. package/dist/manifest.json +242 -0
  6. package/package.json +63 -0
  7. package/src/charts/area-stacked.md +64 -0
  8. package/src/charts/area.md +65 -0
  9. package/src/charts/bar-grouped.md +60 -0
  10. package/src/charts/bar-horizontal.md +71 -0
  11. package/src/charts/bar-multi.md +64 -0
  12. package/src/charts/bar-split.md +61 -0
  13. package/src/charts/bar-stacked.md +62 -0
  14. package/src/charts/bar-vertical.md +71 -0
  15. package/src/charts/column-stacked.md +57 -0
  16. package/src/charts/donut.md +66 -0
  17. package/src/charts/index.md +36 -0
  18. package/src/charts/line-multi.md +64 -0
  19. package/src/charts/line.md +65 -0
  20. package/src/charts/pie.md +63 -0
  21. package/src/guide/accessibility.md +196 -0
  22. package/src/guide/data-transforms.md +191 -0
  23. package/src/guide/dsl-editor.md +218 -0
  24. package/src/guide/embed.md +208 -0
  25. package/src/guide/getting-started.md +159 -0
  26. package/src/guide/palettes.md +207 -0
  27. package/src/guide/scenes.md +223 -0
  28. package/src/handbook/accessibility.md +109 -0
  29. package/src/handbook/annotations.md +143 -0
  30. package/src/handbook/anti-patterns.md +85 -0
  31. package/src/handbook/axes.md +116 -0
  32. package/src/handbook/choosing.md +120 -0
  33. package/src/handbook/color.md +141 -0
  34. package/src/handbook/design-principles.md +111 -0
  35. package/src/handbook/frame-elements.md +98 -0
  36. package/src/handbook/index.md +91 -0
  37. package/src/handbook/labels.md +117 -0
  38. package/src/handbook/tooltips.md +98 -0
  39. package/src/handbook/typography.md +93 -0
  40. package/src/reference/api/index.md +245 -0
  41. package/src/reference/dsl/annotations.md +135 -0
  42. package/src/reference/dsl/index.md +137 -0
  43. package/src/reference/dsl/properties.md +79 -0
  44. package/src/reference/dsl/scenes-and-transforms.md +97 -0
  45. package/src/reference/index.md +18 -0
@@ -0,0 +1,64 @@
1
+ ---
2
+ title: Multi-series bar chart
3
+ ---
4
+
5
+ # Multi-series bar chart
6
+
7
+ > Multi-series vertical bar chart for side-by-side comparison of a small group of series.
8
+
9
+ `bar-multi` places several series next to each other within each category, so readers can compare them at a glance. Honours `sort`, `sortMode`, `valueLabels`, and `valueLabelPosition`.
10
+
11
+ ## When to use
12
+
13
+ - Comparing 2–3 series across the same categories (e.g. medals by colour, revenue by product line)
14
+ - When individual series values matter more than their totals
15
+ - A small, fixed set of categories where the comparison is the story
16
+
17
+ ## When NOT to use
18
+
19
+ - More than 3–4 series per group — the clusters become unreadable
20
+ - When the total across series is the headline number — use [`bar-stacked`](./bar-stacked) or [`column-stacked`](./column-stacked)
21
+ - When the second dimension is itself a grouping (use [`bar-grouped`](./bar-grouped))
22
+
23
+ ## Example
24
+
25
+ ```bpc
26
+ chart bar-multi {
27
+ title = "USA tops Paris 2024 with 126 medals across all categories"
28
+ description = "2024 Paris Summer Games — top six nations"
29
+ source = "Olympics.com"
30
+ sourceUrl = "https://olympics.com"
31
+ colors = "#eeca3b, #c0c0c0, #cd7f32"
32
+ legendPosition = "top"
33
+ valueLabels = true
34
+ sort = descending
35
+
36
+ data {
37
+ _series = "Gold","Silver","Bronze"
38
+ "USA" = 40,44,42
39
+ "China" = 38,32,18
40
+ "Japan" = 27,14,17
41
+ "Great Britain" = 22,21,22
42
+ "Australia" = 17,7,22
43
+ "France" = 16,20,23
44
+ }
45
+ }
46
+ ```
47
+
48
+
49
+ ## Common pitfalls
50
+
51
+ - Too many bars per group overwhelms the reader; cap at 3–4 series
52
+ - Inconsistent colour encoding across charts in the same dashboard
53
+ - Sorting by the wrong series — make sure the sort matches the comparison you want readers to make
54
+
55
+ ## Related types
56
+
57
+ - [`bar-grouped`](./bar-grouped) — when the categories themselves cluster into a higher group
58
+ - [`bar-stacked`](./bar-stacked) — when the total across series is the headline
59
+ - [`column-stacked`](./column-stacked) — composition over a small number of discrete columns
60
+
61
+ ## See also
62
+
63
+ - [Choosing the right chart](/handbook/choosing)
64
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,61 @@
1
+ ---
2
+ title: Split bar chart
3
+ ---
4
+
5
+ # Split bar chart
6
+
7
+ > Diverging vertical bar chart for values around a shared baseline (positive/negative).
8
+
9
+ `bar-split` plots values that radiate out from a shared baseline — positive and negative, gain and loss, opinion for and against. It uses signed values directly; no explicit "diverging" toggle is required.
10
+
11
+ ## When to use
12
+
13
+ - Net change scenarios where some values are positive and some are negative (sentiment, election swing, year-on-year deltas)
14
+ - Polling spreads and ranges around a central estimate
15
+ - Comparing a small group of categories where direction is part of the story
16
+
17
+ ## When NOT to use
18
+
19
+ - All-positive datasets — a regular [`bar-vertical`](./bar-vertical) reads more cleanly
20
+ - When the absolute total is what matters, not the spread
21
+ - Many categories with subtle differences — the diverging baseline amplifies noise
22
+
23
+ ## Example
24
+
25
+ ```bpc
26
+ chart bar-split {
27
+ title = "Phoenix summers hit 37 °C while Chicago winters drop below zero"
28
+ description = "Mean monthly temperature (°C), NOAA 30-year climate normals 1991–2020"
29
+ source = "NOAA"
30
+ sourceUrl = "https://www.ncei.noaa.gov/products/land-based-station/us-climate-normals"
31
+ valueLabels = true
32
+
33
+ data {
34
+ _series = "Winter (Jan)","Spring (Apr)","Summer (Jul)"
35
+ "Miami" = 20,26,29
36
+ "Los Angeles" = 14,17,23
37
+ "Phoenix" = 13,24,37
38
+ "Seattle" = 5,10,19
39
+ "New York" = 1,12,25
40
+ "Chicago" = -4,10,24
41
+ }
42
+ }
43
+ ```
44
+
45
+
46
+ ## Common pitfalls
47
+
48
+ - Forgetting that the chart is encoding sign; readers should be able to tell what zero means without reading the axis label
49
+ - Mixing categories that don't share the same scale or meaning around the baseline
50
+ - Sorting that hides the diverging pattern — sort by net change, not by absolute value
51
+
52
+ ## Related types
53
+
54
+ - [`bar-vertical`](./bar-vertical) — when all values share the same sign
55
+ - [`bar-multi`](./bar-multi) — when you need side-by-side comparison rather than divergence
56
+ - [`bar-stacked`](./bar-stacked) — when the parts of each bar sum to a meaningful total
57
+
58
+ ## See also
59
+
60
+ - [Choosing the right chart](/handbook/choosing)
61
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,62 @@
1
+ ---
2
+ title: Stacked bar chart
3
+ ---
4
+
5
+ # Stacked bar chart
6
+
7
+ > Stacked horizontal bar chart for composition within a category, emphasising the total.
8
+
9
+ `bar-stacked` segments horizontal bars into subcategories, showing both the individual parts and the total. Honours `stackMode` and `stackPercent` — flip to a 100 % view for pure composition.
10
+
11
+ ## When to use
12
+
13
+ - Showing how a total breaks down into parts
14
+ - Comparing totals across categories while keeping the composition visible
15
+ - 100 % stacked view (`stackPercent = true`) when relative proportions matter more than absolute values
16
+ - Categories with long labels that suit the horizontal orientation
17
+
18
+ ## When NOT to use
19
+
20
+ - When comparing individual segments across categories — only the segment on the baseline is easy to read
21
+ - When there are many small segments — they become invisible
22
+ - When precise segment-to-segment comparison is needed (use [`bar-multi`](./bar-multi) or [`bar-grouped`](./bar-grouped))
23
+
24
+ ## Example
25
+
26
+ ```bpc
27
+ chart bar-stacked {
28
+ title = "India's working-age population now surpasses China's"
29
+ description = "Millions of people, 2023"
30
+ source = "UN Population Division"
31
+ sourceUrl = "https://population.un.org"
32
+ horizontalGridStyle = none
33
+ horizontalLabelPosition = off
34
+
35
+ data {
36
+ _series = "0-14","15-64","65+"
37
+ "China" = 249,987,191
38
+ "India" = 365,948,100
39
+ "USA" = 60,215,58
40
+ "Indonesia" = 66,191,18
41
+ "Brazil" = 42,150,22
42
+ }
43
+ }
44
+ ```
45
+
46
+
47
+ ## Common pitfalls
48
+
49
+ - Segments not on the baseline are nearly impossible to compare accurately — put the most important segment first
50
+ - Too many segments create visual noise without insight — cap at 3–5 and group the rest into "Other"
51
+ - Inconsistent segment ordering across bars breaks the visual rhythm
52
+
53
+ ## Related types
54
+
55
+ - [`column-stacked`](./column-stacked) — vertical equivalent for time-like x-axes
56
+ - [`bar-multi`](./bar-multi) — when you'd rather compare series side by side than stack them
57
+ - [`bar-horizontal`](./bar-horizontal) — single-series horizontal bars
58
+
59
+ ## See also
60
+
61
+ - [Choosing the right chart](/handbook/choosing)
62
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,71 @@
1
+ ---
2
+ title: Vertical bar chart
3
+ ---
4
+
5
+ # Vertical bar chart
6
+
7
+ > Single-series vertical bar chart for ranked categorical comparison, small N.
8
+
9
+ `bar-vertical` compares discrete categories using the height of rectangular bars. It honours `sort`, `sortMode`, `valueLabels`, and `valueLabelPosition`. The alias `vertical-bar` is registered against the same renderer so `.bpc` documents can read either way.
10
+
11
+ ## When to use
12
+
13
+ - Comparing quantities across a small number of categories (< 12)
14
+ - Ranking items when the category labels are short enough to fit horizontally
15
+ - A few data points over time (e.g. annual totals for 5 years)
16
+
17
+ ## When NOT to use
18
+
19
+ - Continuous data distributions (no built-in histogram type)
20
+ - Many time periods — use [`line`](./line) for trends
21
+ - Long category labels that would need rotation — use [`bar-horizontal`](./bar-horizontal)
22
+
23
+ ## Example
24
+
25
+ ```bpc
26
+ chart bar-vertical {
27
+ title = "Brazil produces more coffee than the next three countries combined"
28
+ description = "Million 60-kg bags, 2023/24 crop year"
29
+ source = "International Coffee Organization"
30
+ sourceUrl = "https://ico.org"
31
+ colorPalette = "Harvey"
32
+ valueLabels = true
33
+ valueLabelPosition = "auto"
34
+
35
+ data {
36
+ "Brazil" = 66.4
37
+ "Vietnam" = 29
38
+ "Colombia" = 11.4
39
+ "Indonesia" = 9.9
40
+ "Ethiopia" = 8.7
41
+ "Honduras" = 6.3
42
+ }
43
+
44
+ colorize "Brazil" {
45
+ color = "#a4432d"
46
+ }
47
+
48
+ transform sort {
49
+ column = "value"
50
+ direction = descending
51
+ }
52
+ }
53
+ ```
54
+
55
+
56
+ ## Common pitfalls
57
+
58
+ - Truncating the y-axis exaggerates differences and misleads readers — always start at zero
59
+ - Too many categories create visual clutter; group small ones into "Other"
60
+ - 3D effects distort the encoding — Blueprint Chart doesn't offer them, and you shouldn't fake them
61
+
62
+ ## Related types
63
+
64
+ - [`bar-horizontal`](./bar-horizontal) — when labels are long or you want a ranked list
65
+ - [`bar-multi`](./bar-multi) — when you need to compare two or more series side by side
66
+ - [`bar-stacked`](./bar-stacked) — when the parts of each bar sum to a meaningful total
67
+
68
+ ## See also
69
+
70
+ - [Choosing the right chart](/handbook/choosing)
71
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: Stacked column chart
3
+ ---
4
+
5
+ # Stacked column chart
6
+
7
+ > Stacked vertical column chart for composition over discrete columns; supports percent stacking.
8
+
9
+ `column-stacked` is the vertical sibling of [`bar-stacked`](./bar-stacked) — each column breaks down into segments. It's the right choice when the x-axis represents a small number of ordered steps (quarters, fiscal years, study cohorts). Honours `stackMode` and `stackPercent`.
10
+
11
+ ## When to use
12
+
13
+ - Composition over a small number of discrete columns (5–10 quarters, years, or stages)
14
+ - When both the total and the breakdown matter for each column
15
+ - 100 % stacked view (`stackPercent = true`) when readers should focus on relative share
16
+
17
+ ## When NOT to use
18
+
19
+ - More than ~10 time points — switch to [`area-stacked`](./area-stacked)
20
+ - Data with negative values — stacking breaks down
21
+ - When precise segment-to-segment comparison is needed across columns
22
+
23
+ ## Example
24
+
25
+ ```bpc
26
+ chart column-stacked {
27
+ title = "Software revenue grew steadily while hardware spiked in Q4"
28
+ description = "Quarterly revenue in millions, 2024"
29
+ source = "Annual report"
30
+
31
+ data {
32
+ _series = "Hardware","Software","Services"
33
+ "Q1" = 120,85,45
34
+ "Q2" = 135,92,48
35
+ "Q3" = 128,98,52
36
+ "Q4" = 155,105,58
37
+ }
38
+ }
39
+ ```
40
+
41
+
42
+ ## Common pitfalls
43
+
44
+ - Stacking too many series — the top layers float and lose their baseline
45
+ - Switching to `stackPercent = true` without telling the reader hides the change in absolute total
46
+ - Inconsistent segment ordering between columns destroys the visual flow
47
+
48
+ ## Related types
49
+
50
+ - [`bar-stacked`](./bar-stacked) — horizontal equivalent for long category labels
51
+ - [`area-stacked`](./area-stacked) — same idea with many time points
52
+ - [`bar-multi`](./bar-multi) — when you want side-by-side comparison instead of stacking
53
+
54
+ ## See also
55
+
56
+ - [Choosing the right chart](/handbook/choosing)
57
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,66 @@
1
+ ---
2
+ title: Donut chart
3
+ ---
4
+
5
+ # Donut chart
6
+
7
+ > Circular part-to-whole chart with a central label slot.
8
+
9
+ `donut` is a pie chart with the centre removed, opening a slot for a total, key metric, or icon. Honours `displayAsPercentage`, `showTotal`, `showLabels`, `showValues`, `sliceMax`, and `sliceGroupLabel`.
10
+
11
+ ## When to use
12
+
13
+ - Same situations as a [`pie`](./pie) chart, but where a central metric adds context (total value, share of target, KPI badge)
14
+ - Editorial layouts where the modern aesthetic suits the surrounding design
15
+ - When arc length needs to read slightly more cleanly than wedge area
16
+
17
+ ## When NOT to use
18
+
19
+ - More than 5–6 slices — use `sliceMax` to merge the tail into "Other"
20
+ - Comparing several donut charts against each other (small multiples of bar charts win)
21
+ - When precise value reading matters
22
+
23
+ ## Example
24
+
25
+ ```bpc
26
+ chart donut {
27
+ title = "Coal still generates a third of the world's electricity"
28
+ description = "Share by source, 2024"
29
+ source = "IEA"
30
+ sourceUrl = "https://iea.org"
31
+ byline = "Pierre Romera"
32
+ note = "Percentages may not sum to 100 due to rounding"
33
+ colors = "#76b7b2, #4e79a7, #59a14f, #f28e2b, #edc949, #e15759, #b07aa1"
34
+ legendPosition = "right"
35
+ tooltips = true
36
+ displayAsPercentage = true
37
+
38
+ data {
39
+ "Coal" = 34.2
40
+ "Natural Gas" = 22.1
41
+ "Hydro" = 14.8
42
+ "Nuclear" = 9.4
43
+ "Wind" = 9.5
44
+ "Solar" = 6.2
45
+ "Other" = 3.8
46
+ }
47
+ }
48
+ ```
49
+
50
+
51
+ ## Common pitfalls
52
+
53
+ - Filling the centre slot with decoration instead of a meaningful metric wastes the chart's main affordance
54
+ - Inner radius too thin reads like a pie; too thick collapses the ring into a stripe
55
+ - Same caveats as a pie: too many slices, similar sizes, and side-by-side comparisons all hurt readability
56
+
57
+ ## Related types
58
+
59
+ - [`pie`](./pie) — when there's no central metric worth showing
60
+ - [`bar-horizontal`](./bar-horizontal) — when precise comparison matters
61
+ - [`bar-stacked`](./bar-stacked) — composition across several totals
62
+
63
+ ## See also
64
+
65
+ - [Choosing the right chart](/handbook/choosing)
66
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: Chart Types
3
+ ---
4
+
5
+ # Chart Types
6
+
7
+ Blueprint Chart ships 13 chart types organized into four families: bar, line, area, and part-to-whole.
8
+
9
+ ## Bar family
10
+
11
+ - [`bar-vertical`](./bar-vertical) — single-series vertical bars; ranked categorical comparison
12
+ - [`bar-horizontal`](./bar-horizontal) — single-series horizontal bars; long labels
13
+ - [`bar-multi`](./bar-multi) — multi-series side-by-side bars
14
+ - [`bar-grouped`](./bar-grouped) — grouped clusters across a second dimension
15
+ - [`bar-split`](./bar-split) — diverging values around a shared baseline
16
+ - [`bar-stacked`](./bar-stacked) — stacked horizontal bars; composition emphasising the total
17
+ - [`column-stacked`](./column-stacked) — stacked vertical columns; supports percent stacking
18
+
19
+ ## Line family
20
+
21
+ - [`line`](./line) — single-series trend over an ordered domain
22
+ - [`line-multi`](./line-multi) — multi-series time-series comparison
23
+
24
+ ## Area family
25
+
26
+ - [`area`](./area) — single-series magnitude over time
27
+ - [`area-stacked`](./area-stacked) — composition over time; supports percent stacking
28
+
29
+ ## Part-to-whole
30
+
31
+ - [`pie`](./pie) — circular part-to-whole, very small N
32
+ - [`donut`](./donut) — circular part-to-whole with a central label slot
33
+
34
+ ::: tip Choosing the right chart
35
+ Not sure which type fits your data? Start with the decision framework in the [choosing the right chart](/handbook/choosing) handbook entry.
36
+ :::
@@ -0,0 +1,64 @@
1
+ ---
2
+ title: Multi-line chart
3
+ ---
4
+
5
+ # Multi-line chart
6
+
7
+ > Multi-series line chart for comparing several time series or trends.
8
+
9
+ `line-multi` plots two or more series on shared axes so readers can see divergence, convergence, and ranking shifts over an ordered domain. Supports `interpolation`, `lineSymbols`, `crosshair`, and `tooltips`.
10
+
11
+ ## When to use
12
+
13
+ - Comparing trends across 2–4 series on the same scale
14
+ - Showing divergence or convergence between groups over time
15
+ - Highlighting one key series against grey "context" lines
16
+
17
+ ## When NOT to use
18
+
19
+ - More than 5–6 series — the chart becomes a spaghetti tangle
20
+ - Series with very different scales (avoid dual axes; consider small multiples instead)
21
+ - Composition over time, where readers need to see how parts add up (use [`area-stacked`](./area-stacked))
22
+
23
+ ## Example
24
+
25
+ ```bpc
26
+ chart line-multi {
27
+ title = "Germany stagnated while the US and China bounced back"
28
+ description = "Annual percentage change in real GDP"
29
+ source = "IMF World Economic Outlook"
30
+ sourceUrl = "https://imf.org"
31
+ colorPalette = "SolLeWitt"
32
+ legend = false
33
+ tooltips = true
34
+
35
+ data {
36
+ _series = "United States","China","Germany"
37
+ "2018" = 2.9,6.7,1.0
38
+ "2019" = 2.3,6.0,1.1
39
+ "2020" = -2.8,2.2,-3.7
40
+ "2021" = 5.9,8.4,3.2
41
+ "2022" = 2.1,3.0,1.8
42
+ "2023" = 2.5,5.2,-0.1
43
+ "2024" = 2.8,5.0,-0.2
44
+ }
45
+ }
46
+ ```
47
+
48
+
49
+ ## Common pitfalls
50
+
51
+ - Five or more lines crossing each other defeats the chart — either highlight one and grey the rest, or split into small multiples
52
+ - Two y-axes with different scales imply a correlation that may not exist
53
+ - Inconsistent colour assignment between charts in the same story confuses readers
54
+
55
+ ## Related types
56
+
57
+ - [`line`](./line) — when you only need a single series
58
+ - [`area-stacked`](./area-stacked) — when the running total across series matters
59
+ - [`bar-grouped`](./bar-grouped) — when the x-axis is categorical, not continuous
60
+
61
+ ## See also
62
+
63
+ - [Choosing the right chart](/handbook/choosing)
64
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,65 @@
1
+ ---
2
+ title: Line chart
3
+ ---
4
+
5
+ # Line chart
6
+
7
+ > Single-series line chart for continuous trend over an ordered domain.
8
+
9
+ `line` connects data points to show how a single measure changes across an ordered axis — typically time. It supports `interpolation`, `lineSymbols`, `crosshair`, and `tooltips`.
10
+
11
+ ## When to use
12
+
13
+ - Showing trends, patterns, or changes over time
14
+ - Continuous data where the order matters
15
+ - Revealing rate of change — the slope communicates speed
16
+ - A single series; readers focus on direction rather than precise totals
17
+
18
+ ## When NOT to use
19
+
20
+ - Categorical data with no inherent order — lines imply sequence
21
+ - When the cumulative magnitude matters more than the trend (use [`area`](./area))
22
+ - When you want to compare two or more series (use [`line-multi`](./line-multi))
23
+
24
+ ## Example
25
+
26
+ ```bpc
27
+ chart line {
28
+ title = "2024 was the hottest year on record"
29
+ description = "Deviation from the 1951–1980 average, in °C"
30
+ source = "NASA GISS"
31
+ sourceUrl = "https://data.giss.nasa.gov/gistemp/"
32
+ colors = "#e15759"
33
+ interpolation = "monotoneX"
34
+ lineSymbols = true
35
+ lineSymbolShowOn = "firstLast"
36
+ tooltips = true
37
+
38
+ data {
39
+ "1980" = 0.26
40
+ "1990" = 0.45
41
+ "2000" = 0.42
42
+ "2010" = 0.72
43
+ "2020" = 1.02
44
+ "2024" = 1.29
45
+ }
46
+ }
47
+ ```
48
+
49
+
50
+ ## Common pitfalls
51
+
52
+ - Aggressively truncating the y-axis exaggerates small movements
53
+ - Forcing the y-axis to start at zero when the data sits in a narrow band flattens the trend — unlike bars, line charts don't require a zero baseline
54
+ - Smoothing with `basis` interpolation can overshoot the data; prefer `monotoneX` when fidelity matters
55
+
56
+ ## Related types
57
+
58
+ - [`line-multi`](./line-multi) — when you need to compare two or more series on the same axes
59
+ - [`area`](./area) — when the magnitude of the value matters as much as the trend
60
+ - [`bar-vertical`](./bar-vertical) — when the x-axis is categorical, not continuous
61
+
62
+ ## See also
63
+
64
+ - [Choosing the right chart](/handbook/choosing)
65
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,63 @@
1
+ ---
2
+ title: Pie chart
3
+ ---
4
+
5
+ # Pie chart
6
+
7
+ > Circular part-to-whole chart for very small N.
8
+
9
+ `pie` divides a circle into proportional slices, each representing a category's share of the whole. Honours `displayAsPercentage`, `showTotal`, `showLabels`, `showValues`, `sliceMax`, and `sliceGroupLabel`.
10
+
11
+ ## When to use
12
+
13
+ - Simple proportional splits with 2–5 categories
14
+ - Values near visually meaningful fractions (25 %, 50 %, 75 %)
15
+ - General audiences where the chart needs to carry emotional weight
16
+ - Sidebar or callout context — not the main analytical chart
17
+
18
+ ## When NOT to use
19
+
20
+ - More than 5 categories — small slices become meaningless; consider grouping with `sliceMax` and `sliceGroupLabel`
21
+ - Comparing similar-sized portions — the human eye is poor at judging angles
22
+ - Comparing multiple pie charts against each other (use small multiples of bar charts instead)
23
+ - When precise values matter — a bar chart is almost always more readable
24
+
25
+ ## Example
26
+
27
+ ```bpc
28
+ chart pie {
29
+ title = "Asia is home to nearly 60% of the world's population"
30
+ description = "Estimated share, 2024"
31
+ source = "United Nations"
32
+ sourceUrl = "https://population.un.org"
33
+ colorPalette = "Klimt"
34
+ legendPosition = "right"
35
+ tooltips = true
36
+
37
+ data {
38
+ "Asia" = 59.4
39
+ "Africa" = 18.3
40
+ "Europe" = 9.3
41
+ "Latin America" = 8.2
42
+ "North America" = 4.8
43
+ }
44
+ }
45
+ ```
46
+
47
+
48
+ ## Common pitfalls
49
+
50
+ - Too many slices destroy readability — cap at five and use `sliceMax` to merge the tail
51
+ - Exploded or 3D pie effects distort proportions; Blueprint Chart doesn't render them, and you shouldn't approximate them elsewhere
52
+ - As Edward Tufte famously noted: the only thing worse than a pie chart is several of them
53
+
54
+ ## Related types
55
+
56
+ - [`donut`](./donut) — same encoding with a central slot for a total or label
57
+ - [`bar-horizontal`](./bar-horizontal) — almost always more readable for precise comparison
58
+ - [`bar-stacked`](./bar-stacked) — when you want composition across several totals
59
+
60
+ ## See also
61
+
62
+ - [Choosing the right chart](/handbook/choosing)
63
+ - [Design principles](/handbook/design-principles)