@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 pirhoo and Blueprint Chart contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # @blueprint-chart/docs
2
+
3
+ Public documentation for [Blueprint Chart](https://blueprintchart.com) — handbook, guide, BPC DSL spec, and lib API reference.
4
+
5
+ This package serves two consumers:
6
+
7
+ 1. **The VitePress site** at [`docs.blueprintchart.com`](https://docs.blueprintchart.com) — `pnpm dev` / `pnpm build`.
8
+ 2. **Programmatic access** for tooling such as `@blueprint-chart/mcp`:
9
+
10
+ ```ts
11
+ import { listDocs, getDoc } from '@blueprint-chart/docs'
12
+
13
+ const handbookPages = listDocs('handbook')
14
+ const { entry, content } = getDoc('handbook', 'design-principles')
15
+ ```
16
+
17
+ Each `dist/manifest.json` entry has `{ slug, group, title, blurb, mdPath }`. Markdown content lives under `src/` and is shipped in the published package.
18
+
19
+ ## Groups
20
+
21
+ - `handbook` — dataviz pedagogy (design principles, color, typography, ...)
22
+ - `guide` — usage guides (scenes, palettes, data transforms, ...)
23
+ - `charts` — per-chart-type docs (bar, line, area, ...)
24
+ - `reference/dsl` — BPC DSL specification
25
+ - `reference/api` — `@blueprint-chart/lib` API reference
26
+
27
+ ## License
28
+
29
+ MIT
package/dist/api.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ export type DocGroup = 'handbook' | 'guide' | 'charts' | 'reference/dsl' | 'reference/api';
2
+ export interface DocEntry {
3
+ slug: string;
4
+ group: DocGroup;
5
+ title: string;
6
+ blurb: string;
7
+ mdPath: string;
8
+ }
9
+ export declare function listDocs(group?: DocGroup): DocEntry[];
10
+ export declare function getDoc(group: DocGroup, slug: string): {
11
+ entry: DocEntry;
12
+ content: string;
13
+ };
package/dist/api.js ADDED
@@ -0,0 +1,29 @@
1
+ import { readFileSync, existsSync } from 'node:fs';
2
+ import { join, dirname } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const PKG_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
5
+ let cached;
6
+ function loadManifest() {
7
+ if (cached) {
8
+ return cached;
9
+ }
10
+ const manifestPath = join(PKG_ROOT, 'dist', 'manifest.json');
11
+ if (!existsSync(manifestPath)) {
12
+ throw new Error(`@blueprint-chart/docs: manifest.json not found at ${manifestPath}. `
13
+ + `Did you run \`pnpm --filter @blueprint-chart/docs build\`?`);
14
+ }
15
+ cached = JSON.parse(readFileSync(manifestPath, 'utf8'));
16
+ return cached;
17
+ }
18
+ export function listDocs(group) {
19
+ const all = loadManifest().entries;
20
+ return group ? all.filter(e => e.group === group) : all;
21
+ }
22
+ export function getDoc(group, slug) {
23
+ const entry = loadManifest().entries.find(e => e.group === group && e.slug === slug);
24
+ if (!entry) {
25
+ throw new Error(`@blueprint-chart/docs: no doc at ${group}/${slug}`);
26
+ }
27
+ const content = readFileSync(join(PKG_ROOT, 'src', entry.mdPath), 'utf8');
28
+ return { entry, content };
29
+ }
@@ -0,0 +1,242 @@
1
+ {
2
+ "entries": [
3
+ {
4
+ "slug": "accessibility",
5
+ "group": "handbook",
6
+ "title": "Accessibility",
7
+ "blurb": "> Accessible charts are honest charts. CVD simulation, sufficient contrast, meaningful alt text, keyboard and screen-reader support, legible typography, and — above all — never encoding information in",
8
+ "mdPath": "handbook/accessibility.md"
9
+ },
10
+ {
11
+ "slug": "annotations",
12
+ "group": "handbook",
13
+ "title": "Annotations",
14
+ "blurb": "> Annotations guide the reader to the story in the data. They explain design elements, highlight significant values, and provide context the chart alone cannot convey. Used well, they do most of the s",
15
+ "mdPath": "handbook/annotations.md"
16
+ },
17
+ {
18
+ "slug": "anti-patterns",
19
+ "group": "handbook",
20
+ "title": "Anti-Patterns",
21
+ "blurb": "> A catalog of what goes wrong: misleading practices that distort the truth, design anti-patterns that obscure the story, and the statistical integrity rules that keep charts honest.",
22
+ "mdPath": "handbook/anti-patterns.md"
23
+ },
24
+ {
25
+ "slug": "axes",
26
+ "group": "handbook",
27
+ "title": "Axes & Grid Lines",
28
+ "blurb": "> When zero matters, when it doesn't, how grid lines should whisper rather than shout, how to format numbers, when to use logarithmic scales, and how aspect ratio silently changes a chart's story.",
29
+ "mdPath": "handbook/axes.md"
30
+ },
31
+ {
32
+ "slug": "choosing",
33
+ "group": "handbook",
34
+ "title": "Choosing the Right Chart",
35
+ "blurb": "> Before picking a visualization type, answer three questions about goal, content, and audience. Then pick the simplest chart that answers the question. Increase complexity only when the simpler form ",
36
+ "mdPath": "handbook/choosing.md"
37
+ },
38
+ {
39
+ "slug": "color",
40
+ "group": "handbook",
41
+ "title": "Color & Palettes",
42
+ "blurb": "> Palette types, seven key rules, the perceptual-uniformity trap (HCL vs. HSL), ten techniques for reducing color usage, dark mode adjustments, and the components of an organizational palette system.",
43
+ "mdPath": "handbook/color.md"
44
+ },
45
+ {
46
+ "slug": "design-principles",
47
+ "group": "handbook",
48
+ "title": "Design Principles",
49
+ "blurb": "> The core principles behind every good chart: purposefulness, clarity, data-ink ratio, restraint, consistency, starting with grey, the power of comparisons, and the refusal to use 3D.",
50
+ "mdPath": "handbook/design-principles.md"
51
+ },
52
+ {
53
+ "slug": "frame-elements",
54
+ "group": "handbook",
55
+ "title": "Frame Elements",
56
+ "blurb": "> A well-structured chart frame has a clear information hierarchy: title, description, chart area, annotations, axis labels, note, source, and credit. Each element has a role and a style treatment tha",
57
+ "mdPath": "handbook/frame-elements.md"
58
+ },
59
+ {
60
+ "slug": "labels",
61
+ "group": "handbook",
62
+ "title": "Labels & Legends",
63
+ "blurb": "> Direct labeling beats legends wherever possible. When you must use a legend, place it where it helps. Use value labels when precision matters and the layout allows.",
64
+ "mdPath": "handbook/labels.md"
65
+ },
66
+ {
67
+ "slug": "tooltips",
68
+ "group": "handbook",
69
+ "title": "Tooltips & Interaction",
70
+ "blurb": "> Tooltips progressively disclose detail, they never replace critical information. Interaction must be consistent, accessible, and keyboard-reachable. Crosshairs and hover states support — not replace",
71
+ "mdPath": "handbook/tooltips.md"
72
+ },
73
+ {
74
+ "slug": "typography",
75
+ "group": "handbook",
76
+ "title": "Typography",
77
+ "blurb": "> Type in charts must be small, sharp, and legible at a glance. Use sans-serifs with unambiguous character shapes, size ruthlessly, never rotate, prefer sentence case, and left-align.",
78
+ "mdPath": "handbook/typography.md"
79
+ },
80
+ {
81
+ "slug": "accessibility",
82
+ "group": "guide",
83
+ "title": "Accessibility",
84
+ "blurb": "> WCAG contrast checks, colour-vision-deficiency simulation, and palette-safety audits — built into the library.",
85
+ "mdPath": "guide/accessibility.md"
86
+ },
87
+ {
88
+ "slug": "data-transforms",
89
+ "group": "guide",
90
+ "title": "Data Transforms",
91
+ "blurb": "> A composable pipeline that shapes raw tabular data into the rows the chart actually renders.",
92
+ "mdPath": "guide/data-transforms.md"
93
+ },
94
+ {
95
+ "slug": "dsl-editor",
96
+ "group": "guide",
97
+ "title": "DSL Editor",
98
+ "blurb": "> The BPC source editor — CodeMirror 6, a Lezer-generated grammar, syntax highlighting tuned for prose-shaped charts, and two-way sync with the visual panels.",
99
+ "mdPath": "guide/dsl-editor.md"
100
+ },
101
+ {
102
+ "slug": "embed",
103
+ "group": "guide",
104
+ "title": "embed",
105
+ "blurb": "Blueprint Chart is **static-first**: every chart is a self-contained artifact independent of any vendor server. There are three ways to put one on a page, and they all run entirely in the browser.",
106
+ "mdPath": "guide/embed.md"
107
+ },
108
+ {
109
+ "slug": "getting-started",
110
+ "group": "guide",
111
+ "title": "getting started",
112
+ "blurb": "Blueprint Chart is published as three packages on NPM. Pick the one that matches what you're building.",
113
+ "mdPath": "guide/getting-started.md"
114
+ },
115
+ {
116
+ "slug": "palettes",
117
+ "group": "guide",
118
+ "title": "Palettes",
119
+ "blurb": "> 50+ curated categorical palettes, plus the helpers to resolve, audit, and adjust them for the background you render against.",
120
+ "mdPath": "guide/palettes.md"
121
+ },
122
+ {
123
+ "slug": "scenes",
124
+ "group": "guide",
125
+ "title": "Scenes",
126
+ "blurb": "> Same chart, different states — composed into a story that a reader can step through.",
127
+ "mdPath": "guide/scenes.md"
128
+ },
129
+ {
130
+ "slug": "area-stacked",
131
+ "group": "charts",
132
+ "title": "Stacked area chart",
133
+ "blurb": "> Multi-series stacked area chart for composition over time; supports percent stacking.",
134
+ "mdPath": "charts/area-stacked.md"
135
+ },
136
+ {
137
+ "slug": "area",
138
+ "group": "charts",
139
+ "title": "Area chart",
140
+ "blurb": "> Single-series area chart for magnitude over time; pairs with `areaFill`.",
141
+ "mdPath": "charts/area.md"
142
+ },
143
+ {
144
+ "slug": "bar-grouped",
145
+ "group": "charts",
146
+ "title": "Grouped bar chart",
147
+ "blurb": "> Multi-series grouped vertical bar chart for grouped categorical comparison across a second dimension.",
148
+ "mdPath": "charts/bar-grouped.md"
149
+ },
150
+ {
151
+ "slug": "bar-horizontal",
152
+ "group": "charts",
153
+ "title": "Horizontal bar chart",
154
+ "blurb": "> Single-series horizontal bar chart for long category labels and ranked bars.",
155
+ "mdPath": "charts/bar-horizontal.md"
156
+ },
157
+ {
158
+ "slug": "bar-multi",
159
+ "group": "charts",
160
+ "title": "Multi-series bar chart",
161
+ "blurb": "> Multi-series vertical bar chart for side-by-side comparison of a small group of series.",
162
+ "mdPath": "charts/bar-multi.md"
163
+ },
164
+ {
165
+ "slug": "bar-split",
166
+ "group": "charts",
167
+ "title": "Split bar chart",
168
+ "blurb": "> Diverging vertical bar chart for values around a shared baseline (positive/negative).",
169
+ "mdPath": "charts/bar-split.md"
170
+ },
171
+ {
172
+ "slug": "bar-stacked",
173
+ "group": "charts",
174
+ "title": "Stacked bar chart",
175
+ "blurb": "> Stacked horizontal bar chart for composition within a category, emphasising the total.",
176
+ "mdPath": "charts/bar-stacked.md"
177
+ },
178
+ {
179
+ "slug": "bar-vertical",
180
+ "group": "charts",
181
+ "title": "Vertical bar chart",
182
+ "blurb": "> Single-series vertical bar chart for ranked categorical comparison, small N.",
183
+ "mdPath": "charts/bar-vertical.md"
184
+ },
185
+ {
186
+ "slug": "column-stacked",
187
+ "group": "charts",
188
+ "title": "Stacked column chart",
189
+ "blurb": "> Stacked vertical column chart for composition over discrete columns; supports percent stacking.",
190
+ "mdPath": "charts/column-stacked.md"
191
+ },
192
+ {
193
+ "slug": "donut",
194
+ "group": "charts",
195
+ "title": "Donut chart",
196
+ "blurb": "> Circular part-to-whole chart with a central label slot.",
197
+ "mdPath": "charts/donut.md"
198
+ },
199
+ {
200
+ "slug": "line-multi",
201
+ "group": "charts",
202
+ "title": "Multi-line chart",
203
+ "blurb": "> Multi-series line chart for comparing several time series or trends.",
204
+ "mdPath": "charts/line-multi.md"
205
+ },
206
+ {
207
+ "slug": "line",
208
+ "group": "charts",
209
+ "title": "Line chart",
210
+ "blurb": "> Single-series line chart for continuous trend over an ordered domain.",
211
+ "mdPath": "charts/line.md"
212
+ },
213
+ {
214
+ "slug": "pie",
215
+ "group": "charts",
216
+ "title": "Pie chart",
217
+ "blurb": "> Circular part-to-whole chart for very small N.",
218
+ "mdPath": "charts/pie.md"
219
+ },
220
+ {
221
+ "slug": "annotations",
222
+ "group": "reference/dsl",
223
+ "title": "annotations",
224
+ "blurb": "Two families of named blocks that target specific data values to draw the eye: **color directives** (`colorize`, `highlight`, `areafill`) recolor or emphasize parts of the chart, and **annotations** (",
225
+ "mdPath": "reference/dsl/annotations.md"
226
+ },
227
+ {
228
+ "slug": "properties",
229
+ "group": "reference/dsl",
230
+ "title": "properties",
231
+ "blurb": "Value-bearing constructs in a `.bpc` document: key/value properties on the chart, the `data` block carrying values, and `series` overrides for per-series visual control. See [DSL overview](/reference/",
232
+ "mdPath": "reference/dsl/properties.md"
233
+ },
234
+ {
235
+ "slug": "scenes-and-transforms",
236
+ "group": "reference/dsl",
237
+ "title": "scenes and transforms",
238
+ "blurb": "Story-level constructs: **scenes** compose multiple visualisation states into a stepable narrative, and **transforms** describe data-pipeline operations applied before rendering. Scenes can override a",
239
+ "mdPath": "reference/dsl/scenes-and-transforms.md"
240
+ }
241
+ ]
242
+ }
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@blueprint-chart/docs",
3
+ "version": "0.1.18",
4
+ "description": "Public documentation for Blueprint Chart — handbook, guide, BPC DSL spec, and lib API reference.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "pirhoo",
8
+ "homepage": "https://docs.blueprintchart.com",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/blueprint-chart/blueprint-chart.git",
12
+ "directory": "packages/docs"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/api.d.ts",
17
+ "import": "./dist/api.js",
18
+ "default": "./dist/api.js"
19
+ },
20
+ "./manifest.json": "./dist/manifest.json"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "src/handbook",
25
+ "src/guide",
26
+ "src/charts",
27
+ "src/reference",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "provenance": true
34
+ },
35
+ "scripts": {
36
+ "dev": "vitepress dev src --host 0.0.0.0 --port 4445",
37
+ "build:vitepress": "vitepress build src",
38
+ "build:manifest": "tsx scripts/build-manifest.ts",
39
+ "build:api": "tsc --project tsconfig.api.json",
40
+ "build": "pnpm run build:vitepress && pnpm run build:manifest && pnpm run build:api",
41
+ "preview": "vitepress preview src --host 0.0.0.0 --port 4445",
42
+ "test": "vitest run"
43
+ },
44
+ "devDependencies": {
45
+ "@blueprint-chart/lib": "workspace:*",
46
+ "@blueprint-chart/ui": "workspace:*",
47
+ "@types/node": "^22.10.0",
48
+ "@fontsource-variable/geist": "^5.2.8",
49
+ "@fontsource-variable/geist-mono": "^5.2.7",
50
+ "@fontsource/dm-serif-display": "^5.2.8",
51
+ "@iconify-json/ph": "^1.2.2",
52
+ "@vue/test-utils": "^2.4.6",
53
+ "@vueuse/core": "^14.2.1",
54
+ "gray-matter": "^4.0.3",
55
+ "jsdom": "^26.1.0",
56
+ "tsx": "^4.19.2",
57
+ "typescript": "^5.7",
58
+ "unplugin-icons": "^23.0.1",
59
+ "vitepress": "^1.5.0",
60
+ "vitest": "^3.2.4",
61
+ "vue": "^3.5"
62
+ }
63
+ }
@@ -0,0 +1,64 @@
1
+ ---
2
+ title: Stacked area chart
3
+ ---
4
+
5
+ # Stacked area chart
6
+
7
+ > Multi-series stacked area chart for composition over time; supports percent stacking.
8
+
9
+ `area-stacked` layers multiple series on top of each other so readers can see both the individual trends and the cumulative total. Set `stackPercent = true` to switch to a 100 % normalised view. Supports `interpolation`, `lineSymbols`, `crosshair`, and `tooltips`.
10
+
11
+ ## When to use
12
+
13
+ - Showing how composition changes over time
14
+ - When the overall total matters as much as the individual parts
15
+ - Datasets with at least ~10 time points (use [`column-stacked`](./column-stacked) for fewer)
16
+ - 100 % stacked view (`stackPercent = true`) when relative share is the story
17
+
18
+ ## When NOT to use
19
+
20
+ - Data with negative values (stacking breaks down)
21
+ - Precise comparison of individual series — stacking obscures the readings above the baseline
22
+ - More than ~5 series — the layers become unreadable
23
+
24
+ ## Example
25
+
26
+ ```bpc
27
+ chart area-stacked {
28
+ title = "Renewables rose from 18 % to 23 % of global energy since 2000"
29
+ description = "Share of primary energy by source, 2000–2023"
30
+ source = "Our World in Data"
31
+ sourceUrl = "https://ourworldindata.org/energy-mix"
32
+ stackPercent = true
33
+ areaSortMode = descending
34
+ areaFillOpacity = 0.85
35
+
36
+ data {
37
+ _series = "Coal","Oil","Gas","Renewables"
38
+ "2000" = 25,36,21,18
39
+ "2005" = 27,35,22,16
40
+ "2010" = 29,33,23,15
41
+ "2015" = 28,32,24,16
42
+ "2020" = 26,30,25,19
43
+ "2023" = 24,29,24,23
44
+ }
45
+ }
46
+ ```
47
+
48
+
49
+ ## Common pitfalls
50
+
51
+ - Series above the baseline are hard to compare — put the most important one at the bottom
52
+ - Too many small categories disappear in the stack; consolidate into "Other"
53
+ - 100 % stacking hides absolute change; pair it with a separate total chart if the magnitude matters
54
+
55
+ ## Related types
56
+
57
+ - [`area`](./area) — single-series area
58
+ - [`line-multi`](./line-multi) — when individual trends matter more than the total
59
+ - [`column-stacked`](./column-stacked) — same idea, but for 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,65 @@
1
+ ---
2
+ title: Area chart
3
+ ---
4
+
5
+ # Area chart
6
+
7
+ > Single-series area chart for magnitude over time; pairs with `areaFill`.
8
+
9
+ `area` is a line chart with the region below the line filled in, emphasising the magnitude of a single series rather than just its direction. Honours `areaFill`, `areaFillOpacity`, and custom `areaFills: AreaFillConfig[]`. Supports `interpolation`, `lineSymbols`, `crosshair`, and `tooltips`.
10
+
11
+ ## When to use
12
+
13
+ - When the cumulative total or visual volume matters, not just the trend
14
+ - A single series where the filled region adds emotional weight to the story
15
+ - Editorial contexts where the chart needs to read at a glance
16
+
17
+ ## When NOT to use
18
+
19
+ - Overlapping multiple un-stacked series — filled regions obscure each other
20
+ - When readers need precise value reading (the fill blurs the line)
21
+ - When you have multiple series — use [`area-stacked`](./area-stacked) instead
22
+
23
+ ## Example
24
+
25
+ ```bpc
26
+ chart area {
27
+ title = "Apple stock climbed 36 % through 2024"
28
+ description = "Monthly closing price in USD"
29
+ source = "Yahoo Finance"
30
+ sourceUrl = "https://finance.yahoo.com"
31
+
32
+ data {
33
+ "Jan" = 183
34
+ "Feb" = 182
35
+ "Mar" = 171
36
+ "Apr" = 170
37
+ "May" = 192
38
+ "Jun" = 210
39
+ "Jul" = 222
40
+ "Aug" = 229
41
+ "Sep" = 233
42
+ "Oct" = 225
43
+ "Nov" = 237
44
+ "Dec" = 249
45
+ }
46
+ }
47
+ ```
48
+
49
+
50
+ ## Common pitfalls
51
+
52
+ - The y-axis must start at zero — the filled area encodes magnitude
53
+ - A fully opaque fill hides the line itself; keep `areaFillOpacity` around 0.2–0.3
54
+ - Don't stack two area charts by overlapping them; reach for [`area-stacked`](./area-stacked)
55
+
56
+ ## Related types
57
+
58
+ - [`line`](./line) — when the trend matters and the magnitude doesn't
59
+ - [`area-stacked`](./area-stacked) — when you have multiple series to compose
60
+ - [`bar-vertical`](./bar-vertical) — when the x-axis is categorical
61
+
62
+ ## See also
63
+
64
+ - [Choosing the right chart](/handbook/choosing)
65
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,60 @@
1
+ ---
2
+ title: Grouped bar chart
3
+ ---
4
+
5
+ # Grouped bar chart
6
+
7
+ > Multi-series grouped vertical bar chart for grouped categorical comparison across a second dimension.
8
+
9
+ `bar-grouped` clusters bars from several series under each category, exposing a second dimension of comparison. Honours `sort`, `sortMode`, `valueLabels`, and `valueLabelPosition`.
10
+
11
+ ## When to use
12
+
13
+ - Comparing 2–3 series across categories where the second dimension matters (revenue by product by quarter, capacity by source by region)
14
+ - When individual series values matter more than their sum
15
+ - A small, fixed list of groups — the structure stays legible
16
+
17
+ ## When NOT to use
18
+
19
+ - More than 3–4 series per group — the clusters become unreadable
20
+ - When the cumulative total per group is the story (use [`bar-stacked`](./bar-stacked))
21
+ - When series share the same units and you want a direct comparison without a grouping dimension (use [`bar-multi`](./bar-multi))
22
+
23
+ ## Example
24
+
25
+ ```bpc
26
+ chart bar-grouped {
27
+ title = "Asia Pacific holds more renewable capacity than all other regions combined"
28
+ description = "Installed capacity in gigawatts (GW)"
29
+ source = "IRENA"
30
+ sourceUrl = "https://www.irena.org"
31
+ valueLabels = true
32
+
33
+ data {
34
+ _series = "Solar","Wind","Hydro"
35
+ "Asia Pacific" = 680,540,840
36
+ "Europe" = 250,300,200
37
+ "North America" = 200,180,190
38
+ "Latin America" = 30,50,200
39
+ "Africa" = 15,10,40
40
+ }
41
+ }
42
+ ```
43
+
44
+
45
+ ## Common pitfalls
46
+
47
+ - Too many bars per group overwhelms the reader — keep series to three or fewer
48
+ - Inconsistent colour encoding across groups or across charts in a dashboard
49
+ - Sorting by the wrong dimension when both groups and series carry meaning
50
+
51
+ ## Related types
52
+
53
+ - [`bar-multi`](./bar-multi) — side-by-side series without a grouping dimension
54
+ - [`bar-stacked`](./bar-stacked) — when the total per group matters
55
+ - [`column-stacked`](./column-stacked) — vertical composition over discrete columns
56
+
57
+ ## See also
58
+
59
+ - [Choosing the right chart](/handbook/choosing)
60
+ - [Design principles](/handbook/design-principles)
@@ -0,0 +1,71 @@
1
+ ---
2
+ title: Horizontal bar chart
3
+ ---
4
+
5
+ # Horizontal bar chart
6
+
7
+ > Single-series horizontal bar chart for long category labels and ranked bars.
8
+
9
+ `bar-horizontal` is the same encoding as a vertical bar chart turned on its side — categories run down the left, bars extend to the right. It honours `sort`, `sortMode`, `valueLabels`, and `valueLabelPosition`. The alias `horizontal-bar` is registered against the same renderer.
10
+
11
+ ## When to use
12
+
13
+ - Category labels are long (country names, survey responses, product names)
14
+ - Ranking displays — high-to-low from top to bottom reads intuitively
15
+ - Mobile-friendly layouts — horizontal bars grow vertically, adapting to narrow screens
16
+
17
+ ## When NOT to use
18
+
19
+ - Time-based data (the horizontal axis conventionally represents time — use [`line`](./line))
20
+ - A handful of categories with short labels — [`bar-vertical`](./bar-vertical) is more compact
21
+
22
+ ## Example
23
+
24
+ ```bpc
25
+ chart bar-horizontal {
26
+ title = "Japan leads in life expectancy while the US lags behind"
27
+ description = "Selected countries, years (2023)"
28
+ source = "World Bank"
29
+ sourceUrl = "https://data.worldbank.org"
30
+ note = "Figures are estimates and may differ from national statistics"
31
+ sort = descending
32
+ colors = "#59a14f"
33
+ horizontalLabelPosition = off
34
+ horizontalGridStyle = none
35
+
36
+ colorize "United States" {
37
+ color = "#e15759"
38
+ }
39
+
40
+ data {
41
+ "Japan" = 84.8
42
+ "Switzerland" = 83.8
43
+ "Australia" = 83.5
44
+ "Sweden" = 83.1
45
+ "Canada" = 82.7
46
+ "France" = 82.5
47
+ "Germany" = 81.4
48
+ "United Kingdom" = 81.2
49
+ "United States" = 78.5
50
+ "China" = 78.2
51
+ }
52
+ }
53
+ ```
54
+
55
+
56
+ ## Common pitfalls
57
+
58
+ - Forgetting to sort — an unranked horizontal bar chart loses most of its power
59
+ - Mixing the horizontal axis with time, which reads as a flipped line chart
60
+ - Long labels still cause issues at very narrow widths; truncate or shorten before publishing
61
+
62
+ ## Related types
63
+
64
+ - [`bar-vertical`](./bar-vertical) — when labels are short and you have room horizontally
65
+ - [`bar-stacked`](./bar-stacked) — when each bar should break down into segments
66
+ - [`bar-split`](./bar-split) — when values can be positive or negative
67
+
68
+ ## See also
69
+
70
+ - [Choosing the right chart](/handbook/choosing)
71
+ - [Design principles](/handbook/design-principles)