@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.
- package/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/api.d.ts +13 -0
- package/dist/api.js +29 -0
- package/dist/manifest.json +242 -0
- package/package.json +63 -0
- package/src/charts/area-stacked.md +64 -0
- package/src/charts/area.md +65 -0
- package/src/charts/bar-grouped.md +60 -0
- package/src/charts/bar-horizontal.md +71 -0
- package/src/charts/bar-multi.md +64 -0
- package/src/charts/bar-split.md +61 -0
- package/src/charts/bar-stacked.md +62 -0
- package/src/charts/bar-vertical.md +71 -0
- package/src/charts/column-stacked.md +57 -0
- package/src/charts/donut.md +66 -0
- package/src/charts/index.md +36 -0
- package/src/charts/line-multi.md +64 -0
- package/src/charts/line.md +65 -0
- package/src/charts/pie.md +63 -0
- package/src/guide/accessibility.md +196 -0
- package/src/guide/data-transforms.md +191 -0
- package/src/guide/dsl-editor.md +218 -0
- package/src/guide/embed.md +208 -0
- package/src/guide/getting-started.md +159 -0
- package/src/guide/palettes.md +207 -0
- package/src/guide/scenes.md +223 -0
- package/src/handbook/accessibility.md +109 -0
- package/src/handbook/annotations.md +143 -0
- package/src/handbook/anti-patterns.md +85 -0
- package/src/handbook/axes.md +116 -0
- package/src/handbook/choosing.md +120 -0
- package/src/handbook/color.md +141 -0
- package/src/handbook/design-principles.md +111 -0
- package/src/handbook/frame-elements.md +98 -0
- package/src/handbook/index.md +91 -0
- package/src/handbook/labels.md +117 -0
- package/src/handbook/tooltips.md +98 -0
- package/src/handbook/typography.md +93 -0
- package/src/reference/api/index.md +245 -0
- package/src/reference/dsl/annotations.md +135 -0
- package/src/reference/dsl/index.md +137 -0
- package/src/reference/dsl/properties.md +79 -0
- package/src/reference/dsl/scenes-and-transforms.md +97 -0
- package/src/reference/index.md +18 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Choosing the Right Chart
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Choosing the Right Chart
|
|
6
|
+
|
|
7
|
+
> 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 cannot convey the insight.
|
|
8
|
+
|
|
9
|
+
## Start with the question, not the chart
|
|
10
|
+
|
|
11
|
+
Answer three questions *before* sketching a single axis:
|
|
12
|
+
|
|
13
|
+
1. **What is the goal?** — Analysis (exploring data) or communication (presenting a finding)?
|
|
14
|
+
2. **What do you want to show?** — A comparison, a trend, a proportion, a distribution, a relationship?
|
|
15
|
+
3. **Who is the audience?** — Executives want high-level dashboards; analysts need granular detail; general audiences need familiar forms.
|
|
16
|
+
|
|
17
|
+
Write the chart's main statement first. It becomes a compass for every design decision that follows.
|
|
18
|
+
|
|
19
|
+
## Decision framework by goal
|
|
20
|
+
|
|
21
|
+
| Goal | Primary chart types | Avoid |
|
|
22
|
+
|------|---------------------|-------|
|
|
23
|
+
| **Compare categories** | Bar (vertical/horizontal), grouped bar, dot plot, bullet graph | Pie (if > 5 categories) |
|
|
24
|
+
| **Show change over time** | Line, area, column, slope chart | Pie/donut (no time axis) |
|
|
25
|
+
| **Show proportions / part-to-whole** | Stacked bar (100%), donut, waffle, treemap | Line charts |
|
|
26
|
+
| **Show distribution** | Histogram, box plot, violin plot, density plot | Bar chart (categorical only) |
|
|
27
|
+
| **Show relationships / correlation** | Scatter plot, bubble chart, heatmap | Bar charts |
|
|
28
|
+
| **Show ranking** | Horizontal bar (sorted), lollipop, slope chart | Pie charts |
|
|
29
|
+
| **Show flow / movement** | Sankey diagram, alluvial diagram | Static charts |
|
|
30
|
+
| **Show hierarchy** | Treemap, sunburst, tree diagram | Flat charts |
|
|
31
|
+
| **Show geographic patterns** | Choropleth, symbol map, bubble map | Non-spatial charts |
|
|
32
|
+
| **Show deviation from baseline** | Diverging bar, bullet graph, surplus/deficit line | Standard bar |
|
|
33
|
+
|
|
34
|
+
## Decision by data shape
|
|
35
|
+
|
|
36
|
+
| Data shape | Chart types |
|
|
37
|
+
|------------|-------------|
|
|
38
|
+
| 1 numeric variable | Histogram, density plot, box plot |
|
|
39
|
+
| 1 categorical variable | Bar chart, lollipop, pie/donut |
|
|
40
|
+
| Numeric + categorical (1 observation per group) | Bar chart, lollipop, dot plot |
|
|
41
|
+
| Numeric + categorical (many observations per group) | Box plot, violin plot, grouped bar |
|
|
42
|
+
| 2 numeric variables | Scatter plot, line chart (if ordered) |
|
|
43
|
+
| 3+ numeric variables | Bubble chart, parallel coordinates, heatmap |
|
|
44
|
+
| Multiple series over time | Multi-line, stacked area, small multiples |
|
|
45
|
+
| Hierarchical categories | Treemap, sunburst, circle packing |
|
|
46
|
+
| Network / flow | Sankey, chord diagram, network diagram |
|
|
47
|
+
|
|
48
|
+
## Complexity escalation rule
|
|
49
|
+
|
|
50
|
+
::: tip
|
|
51
|
+
Start with the simplest chart that answers the question. A bar chart that communicates clearly is better than a beautiful but confusing stream graph.
|
|
52
|
+
:::
|
|
53
|
+
|
|
54
|
+
Increase complexity only when the simpler form cannot convey the insight. Stream graphs, sunbursts, radar charts, and chord diagrams are powerful — and dangerous. Each added dimension must earn its place.
|
|
55
|
+
|
|
56
|
+
## When a table is better
|
|
57
|
+
|
|
58
|
+
If you have fewer than 5 numbers to present, a table often communicates more effectively than a chart. Tables allow precise value comparison; charts excel at showing patterns, trends, and relationships.
|
|
59
|
+
|
|
60
|
+
::: info Example
|
|
61
|
+
To display "revenue this quarter vs. last quarter, and year-over-year growth" — that is three numbers. A small table beats any chart.
|
|
62
|
+
:::
|
|
63
|
+
|
|
64
|
+
## Worked example: two stories, two chart types
|
|
65
|
+
|
|
66
|
+
The same dataset rarely fits every story. The two samples below answer different questions about different shapes of data — and each picks the simplest form that works.
|
|
67
|
+
|
|
68
|
+
**Trend over time → line chart:**
|
|
69
|
+
|
|
70
|
+
```bpc
|
|
71
|
+
chart line {
|
|
72
|
+
title = "Bitcoin surged past $90,000 in 2024"
|
|
73
|
+
description = "USD, year-end closing price"
|
|
74
|
+
source = "CoinGecko"
|
|
75
|
+
colors = "#f7931a"
|
|
76
|
+
|
|
77
|
+
data {
|
|
78
|
+
"2016" = 963
|
|
79
|
+
"2020" = 28949
|
|
80
|
+
"2021" = 46306
|
|
81
|
+
"2022" = 16547
|
|
82
|
+
"2024" = 93429
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
::: info From `packages/lib/src/samples/bitcoin-price.bpc`
|
|
88
|
+
Position over time is what the reader needs — a line uses x-position for the date and y-position for the value. A bar chart of the same data would force length comparisons that obscure the trend.
|
|
89
|
+
:::
|
|
90
|
+
|
|
91
|
+
**Part-to-whole → donut chart:**
|
|
92
|
+
|
|
93
|
+
```bpc
|
|
94
|
+
chart donut {
|
|
95
|
+
title = "Chrome dominates with two-thirds of the desktop browser market"
|
|
96
|
+
description = "Worldwide, January 2025"
|
|
97
|
+
source = "StatCounter"
|
|
98
|
+
displayAsPercentage = true
|
|
99
|
+
|
|
100
|
+
data {
|
|
101
|
+
"Chrome" = 65.7
|
|
102
|
+
"Edge" = 13.1
|
|
103
|
+
"Safari" = 8.9
|
|
104
|
+
"Firefox" = 6.3
|
|
105
|
+
"Opera" = 3.1
|
|
106
|
+
"Others" = 2.9
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
::: info From `packages/lib/src/samples/browser-market.bpc`
|
|
112
|
+
Six categories summing to 100 % — the question is "how big a slice does Chrome own?" A donut answers it directly; a line chart cannot.
|
|
113
|
+
:::
|
|
114
|
+
|
|
115
|
+
## See also
|
|
116
|
+
|
|
117
|
+
- [Design Principles](/handbook/design-principles)
|
|
118
|
+
- [Anti-Patterns](/handbook/anti-patterns)
|
|
119
|
+
- [Frame Elements](/handbook/frame-elements)
|
|
120
|
+
- [BPC DSL Specification](/reference/dsl/)
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Color & Palettes
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Color & Palettes
|
|
6
|
+
|
|
7
|
+
> 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.
|
|
8
|
+
|
|
9
|
+
## Palette types
|
|
10
|
+
|
|
11
|
+
| Type | Use | Example |
|
|
12
|
+
|------|-----|---------|
|
|
13
|
+
| **Sequential** | Ordered data, low → high | Light blue → dark blue |
|
|
14
|
+
| **Diverging** | Data with a meaningful midpoint | Blue → grey → red |
|
|
15
|
+
| **Categorical** | Distinct categories, no order | Blue, orange, green, purple |
|
|
16
|
+
|
|
17
|
+
## Key rules
|
|
18
|
+
|
|
19
|
+
1. **Grey is the most important color.** Use it to de-emphasize supporting data, grid lines, and context elements.
|
|
20
|
+
2. **Maximum 7 categorical colors** before confusion sets in. Beyond that, consider grouping, small multiples, or a different chart type.
|
|
21
|
+
3. **Vary lightness across colors.** This ensures distinguishability in grayscale and for colorblind users.
|
|
22
|
+
4. **Blue-orange is the safest combination** — it works for colorblind users, prints well, and appears in top publications.
|
|
23
|
+
5. **Never max saturation + max brightness together.** It creates a neon, untrustworthy appearance.
|
|
24
|
+
6. **Avoid pure hues.** Shift 5-10 degrees from exact 0/60/120/180/240/300 positions on the color wheel.
|
|
25
|
+
7. **Color must encode meaning, not decoration.** If your color does not represent anything, don't use it.
|
|
26
|
+
|
|
27
|
+
## Perceptual uniformity
|
|
28
|
+
|
|
29
|
+
HSV/HSL color spaces are **not** perceptually uniform. Fully saturated yellow and blue have the same HSV "value" but appear dramatically different in brightness. Use CIELAB (L\*a\*b\*) or HCL (Hue-Chroma-Lightness) for interpolation instead.
|
|
30
|
+
|
|
31
|
+
**Tools:** Chroma.js for HCL interpolation, D3.js CIELAB plugin, ColorBrewer for pre-made safe palettes.
|
|
32
|
+
|
|
33
|
+
::: tip
|
|
34
|
+
Blueprint Chart uses chroma.js throughout the library and ships 50+ built-in palettes resolved through perceptually uniform interpolation.
|
|
35
|
+
:::
|
|
36
|
+
|
|
37
|
+
## Reducing color usage (10 techniques)
|
|
38
|
+
|
|
39
|
+
1. Remove color entirely when position already distinguishes items
|
|
40
|
+
2. Use shades of one hue instead of multiple hues
|
|
41
|
+
3. Highlight only key categories; grey everything else
|
|
42
|
+
4. Direct-label instead of using color legends
|
|
43
|
+
5. Merge minor categories into "Other"
|
|
44
|
+
6. Separate same-colored items with white strokes
|
|
45
|
+
7. Change chart type to encode by position instead of color
|
|
46
|
+
8. Use small multiples (one color per panel)
|
|
47
|
+
9. Add symbols, patterns, or dashes instead of colors (limit to 3-4)
|
|
48
|
+
10. Use tooltips for progressive disclosure
|
|
49
|
+
|
|
50
|
+
## Dark mode considerations
|
|
51
|
+
|
|
52
|
+
- Avoid pure black backgrounds; keep lightness between 10-25%
|
|
53
|
+
- Keep background saturation below 20%
|
|
54
|
+
- Colors that work on light backgrounds may need adjustment (different contrast dynamics)
|
|
55
|
+
- Increase saturation slightly for colors on dark backgrounds
|
|
56
|
+
|
|
57
|
+
## Organizational palette components
|
|
58
|
+
|
|
59
|
+
A complete chart color system includes:
|
|
60
|
+
|
|
61
|
+
- Categorical colors (5-7)
|
|
62
|
+
- An accent / highlight color
|
|
63
|
+
- Greys for data de-emphasis
|
|
64
|
+
- Greys for non-data elements (axes, grid lines)
|
|
65
|
+
- Sequential gradients
|
|
66
|
+
- Diverging gradients
|
|
67
|
+
- Optionally, map element colors
|
|
68
|
+
|
|
69
|
+
## How Blueprint Chart applies color
|
|
70
|
+
|
|
71
|
+
Blueprint Chart ships categorical, sequential, and diverging palettes — all derived via chroma.js with perceptually-uniform interpolation. Accessibility is enforced through helpers for WCAG contrast ratio and CVD simulation. See the [Accessibility](/handbook/accessibility) page for details on the contrast and color-vision-deficiency toolkit.
|
|
72
|
+
|
|
73
|
+
```bpc
|
|
74
|
+
chart line {
|
|
75
|
+
title = "Renewable capacity outgrew coal in 2024"
|
|
76
|
+
colors = "#2563A0" // single highlight; the rest defaults to grey
|
|
77
|
+
|
|
78
|
+
data {
|
|
79
|
+
"2020" = 10
|
|
80
|
+
"2021" = 14
|
|
81
|
+
"2022" = 19
|
|
82
|
+
"2023" = 27
|
|
83
|
+
"2024" = 35
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Worked example: a named palette for distinct categories
|
|
89
|
+
|
|
90
|
+
```bpc
|
|
91
|
+
chart donut {
|
|
92
|
+
title = "Chrome dominates with two-thirds of the desktop browser market"
|
|
93
|
+
description = "Worldwide, January 2025"
|
|
94
|
+
source = "StatCounter"
|
|
95
|
+
colorPalette = "Heep"
|
|
96
|
+
displayAsPercentage = true
|
|
97
|
+
|
|
98
|
+
data {
|
|
99
|
+
"Chrome" = 65.7
|
|
100
|
+
"Edge" = 13.1
|
|
101
|
+
"Safari" = 8.9
|
|
102
|
+
"Firefox" = 6.3
|
|
103
|
+
"Opera" = 3.1
|
|
104
|
+
"Others" = 2.9
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
::: info From `packages/lib/src/samples/browser-market.bpc`
|
|
110
|
+
Six unordered categories, so a categorical palette ("Heep") is the right tool — its hues vary in lightness, which means the donut survives a grayscale conversion. The rule "maximum 7 categorical colors" is exactly at the limit here.
|
|
111
|
+
:::
|
|
112
|
+
|
|
113
|
+
## Worked example: one accent hue, everything else grey
|
|
114
|
+
|
|
115
|
+
```bpc
|
|
116
|
+
chart line {
|
|
117
|
+
title = "2024 was the hottest year on record"
|
|
118
|
+
description = "Deviation from the 1951–1980 average, in °C"
|
|
119
|
+
colors = "#e15759"
|
|
120
|
+
verticalGridStyle = "dashed"
|
|
121
|
+
horizontalGridStyle = "none"
|
|
122
|
+
|
|
123
|
+
data {
|
|
124
|
+
"1980" = 0.26
|
|
125
|
+
"2000" = 0.42
|
|
126
|
+
"2015" = 0.9
|
|
127
|
+
"2024" = 1.29
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
::: info From `packages/lib/src/samples/temperature-anomaly.bpc`
|
|
133
|
+
A single red hue carries semantic weight (warming) while the dashed horizontal grid stays neutral. This is technique 3 from the "Reducing color usage" list: highlight one series, grey everything else.
|
|
134
|
+
:::
|
|
135
|
+
|
|
136
|
+
## See also
|
|
137
|
+
|
|
138
|
+
- [Accessibility](/handbook/accessibility)
|
|
139
|
+
- [Design Principles](/handbook/design-principles)
|
|
140
|
+
- [Anti-Patterns](/handbook/anti-patterns)
|
|
141
|
+
- [Axes & Grid Lines](/handbook/axes)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Design Principles
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Design Principles
|
|
6
|
+
|
|
7
|
+
> 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.
|
|
8
|
+
|
|
9
|
+
## Purposefulness
|
|
10
|
+
|
|
11
|
+
Every visual element must advance the communicative goal. If it doesn't help the reader understand the data, remove it. A decorative stroke, a background gradient, a stray shadow — each is a distraction tax. The test is simple: *delete it and see if anything is lost*.
|
|
12
|
+
|
|
13
|
+
## Clarity over aesthetics
|
|
14
|
+
|
|
15
|
+
Prioritize legibility and interpretation accuracy. A clear chart that looks plain is better than a beautiful one that misleads or confuses. Beauty follows from clarity, not the other way around.
|
|
16
|
+
|
|
17
|
+
## Data-ink ratio
|
|
18
|
+
|
|
19
|
+
Maximize the share of ink (pixels) devoted to data. Reduce grid lines, borders, backgrounds, and decorative elements. As Tufte prescribed: **erase non-data-ink**.
|
|
20
|
+
|
|
21
|
+
::: tip
|
|
22
|
+
If a line doesn't carry data, ask whether it can be lighter, thinner, or simply removed. Most grid lines can be dropped entirely when value labels sit on the data.
|
|
23
|
+
:::
|
|
24
|
+
|
|
25
|
+
## Restraint
|
|
26
|
+
|
|
27
|
+
- Remove redundant elements
|
|
28
|
+
- Use the minimum number of colors needed
|
|
29
|
+
- Avoid 3D effects, shadows, gradients, and decorative illustrations
|
|
30
|
+
- Do not add features, axes, or dimensions that don't serve the story
|
|
31
|
+
|
|
32
|
+
Restraint is the discipline that separates editorial charts from dashboard clutter. A chart is not a brochure.
|
|
33
|
+
|
|
34
|
+
## Consistency
|
|
35
|
+
|
|
36
|
+
- Use the same color for the same category across all charts in a dashboard
|
|
37
|
+
- Maintain consistent axis scales when comparing charts side by side
|
|
38
|
+
- Use the same number format throughout
|
|
39
|
+
|
|
40
|
+
Consistency reduces cognitive load. A reader who has learned that "blue = Q1" in chart A should not have to relearn it in chart B.
|
|
41
|
+
|
|
42
|
+
## Start with grey
|
|
43
|
+
|
|
44
|
+
::: tip
|
|
45
|
+
Grey everything out first. Then selectively add color and emphasis to the elements that carry the story. This forces intentional hierarchy.
|
|
46
|
+
:::
|
|
47
|
+
|
|
48
|
+
When grey is the default, color becomes meaningful. Every colored element must earn its place.
|
|
49
|
+
|
|
50
|
+
## Comparisons make the story
|
|
51
|
+
|
|
52
|
+
Data in isolation has no meaning. Data in context — compared to another time period, another category, a target, an average — becomes insight. The comparison you choose determines the story you tell.
|
|
53
|
+
|
|
54
|
+
::: info Example
|
|
55
|
+
"Unemployment is 4.1%" is a number. "Unemployment is 4.1%, down from 6.5% two years ago" is a story. The comparison does the work.
|
|
56
|
+
:::
|
|
57
|
+
|
|
58
|
+
## Avoid 3D
|
|
59
|
+
|
|
60
|
+
::: warning
|
|
61
|
+
Unanimously across all sources: **avoid 3D charts entirely**. Tilted surfaces create perceived differences where none exist. Accurate value reading requires mental projection against axis walls — a task humans perform poorly.
|
|
62
|
+
:::
|
|
63
|
+
|
|
64
|
+
No 3D bar charts. No 3D pie charts. No extruded columns. No perspective shading.
|
|
65
|
+
|
|
66
|
+
## Worked example: start with grey, then highlight one thing
|
|
67
|
+
|
|
68
|
+
```bpc
|
|
69
|
+
chart bar-vertical {
|
|
70
|
+
title = "Brazil produces more coffee than the next three countries combined"
|
|
71
|
+
description = "Million 60-kg bags, 2023/24 crop year"
|
|
72
|
+
source = "International Coffee Organization"
|
|
73
|
+
colorPalette = "Harvey"
|
|
74
|
+
valueLabels = true
|
|
75
|
+
verticalGridStyle = "none"
|
|
76
|
+
horizontalGridStyle = "none"
|
|
77
|
+
|
|
78
|
+
data {
|
|
79
|
+
"Brazil" = 66.4
|
|
80
|
+
"Vietnam" = 29
|
|
81
|
+
"Colombia" = 11.4
|
|
82
|
+
"Indonesia" = 9.9
|
|
83
|
+
"Ethiopia" = 8.7
|
|
84
|
+
"Honduras" = 6.3
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
colorize "Brazil" {
|
|
88
|
+
color = "#a4432d"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
transform sort {
|
|
92
|
+
column = "value"
|
|
93
|
+
direction = descending
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
::: info From `packages/lib/src/samples/coffee-production.bpc`
|
|
99
|
+
Five bars stay in muted neutrals; the `colorize "Brazil"` block lifts the one bar the title is about. `valueLabels = true` removes the need for a y-axis altogether — direct labels carry the precise numbers, and gridlines drop out entirely. Restraint, purposefulness, and "start with grey" applied in a single chart.
|
|
100
|
+
:::
|
|
101
|
+
|
|
102
|
+
## How Blueprint Chart applies these principles
|
|
103
|
+
|
|
104
|
+
These principles drive the project's visual defaults: grey axis lines, minimal grid, flat geometry, direct labeling where possible, and brand tokens that nudge toward restraint. The renderer leans toward removal — every default exists because it earns its place.
|
|
105
|
+
|
|
106
|
+
## See also
|
|
107
|
+
|
|
108
|
+
- [Color & Palettes](/handbook/color)
|
|
109
|
+
- [Anti-Patterns](/handbook/anti-patterns)
|
|
110
|
+
- [Axes & Grid Lines](/handbook/axes)
|
|
111
|
+
- [Frame Elements](/handbook/frame-elements)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Frame Elements
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Frame Elements
|
|
6
|
+
|
|
7
|
+
> 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 that reflects its priority.
|
|
8
|
+
|
|
9
|
+
## Frame hierarchy
|
|
10
|
+
|
|
11
|
+
| Element | Priority | Style guidance | Content |
|
|
12
|
+
|---------|----------|----------------|---------|
|
|
13
|
+
| **Title** | 1st (most prominent) | Largest, boldest, highest contrast | Main takeaway — state the insight, not just the topic |
|
|
14
|
+
| **Description** | 2nd | Medium size, regular weight | Context: what the reader sees, time period, units |
|
|
15
|
+
| **Chart area** | 3rd | Maximum visual space | The data itself |
|
|
16
|
+
| **Annotations** | 4th | Two hierarchy levels | Explanations, callouts, reference lines |
|
|
17
|
+
| **Axis labels** | 5th | Medium, consistent | Units, categories, formatted values |
|
|
18
|
+
| **Note** | 6th | Small, subdued | Methodology, caveats, definitions |
|
|
19
|
+
| **Source** | Last | Smallest, grey, low contrast | Data attribution |
|
|
20
|
+
| **Credit** | Last | Smallest, grey | Chart author / publication |
|
|
21
|
+
|
|
22
|
+
## Title strategy
|
|
23
|
+
|
|
24
|
+
- Write **declarative / takeaway titles** that state the insight: *"Housing prices doubled in five years"* not *"Housing prices 2019–2024"*
|
|
25
|
+
- Imagine describing the chart to a friend — use that conversational phrasing
|
|
26
|
+
- Question titles create uncertainty; save them for exploratory dashboards
|
|
27
|
+
- Keep titles short and impactful
|
|
28
|
+
|
|
29
|
+
::: info Example
|
|
30
|
+
**Topic title (weak):** "Quarterly revenue by region"
|
|
31
|
+
|
|
32
|
+
**Takeaway title (strong):** "APAC overtook EMEA for the first time in Q3"
|
|
33
|
+
:::
|
|
34
|
+
|
|
35
|
+
## Source and credit conventions
|
|
36
|
+
|
|
37
|
+
- Sources appear as small, grey text at the bottom
|
|
38
|
+
- Format: *"Source: [Organization/Dataset]"* and *"Chart: [Author/Publication]"*
|
|
39
|
+
- Always present, never competing with the data for attention
|
|
40
|
+
- Credit lines build institutional trust and enable verification
|
|
41
|
+
|
|
42
|
+
## Note vs. description
|
|
43
|
+
|
|
44
|
+
A **description** (or subtitle) sits near the top and tells the reader what they're looking at: units, period, scope. A **note** sits near the bottom and addresses caveats: methodology, excluded categories, data revisions. Keep them separate.
|
|
45
|
+
|
|
46
|
+
## How Blueprint Chart applies the frame
|
|
47
|
+
|
|
48
|
+
Blueprint Chart's `FrameOptions` matches this hierarchy almost one-to-one: title, description, note, source, and credit are all first-class frame fields. The frame layer is independent of the chart layer, so the same frame can wrap any chart type without changing the type's internals. See the [API reference](/reference/api/) for `createFrame` and the frame options.
|
|
49
|
+
|
|
50
|
+
A minimal BPC source illustrates the structure:
|
|
51
|
+
|
|
52
|
+
```bpc
|
|
53
|
+
chart bar-vertical {
|
|
54
|
+
title = "APAC overtook EMEA for the first time in Q3"
|
|
55
|
+
description = "Quarterly revenue, USD millions"
|
|
56
|
+
note = "Q3 figures preliminary; EMEA excludes Russia"
|
|
57
|
+
source = "Company filings"
|
|
58
|
+
credit = "Chart: Blueprint Chart"
|
|
59
|
+
|
|
60
|
+
data {
|
|
61
|
+
"AMER" = 142
|
|
62
|
+
"APAC" = 118
|
|
63
|
+
"EMEA" = 115
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Worked example: every frame slot, none wasted
|
|
69
|
+
|
|
70
|
+
```bpc
|
|
71
|
+
chart line {
|
|
72
|
+
title = "US inflation peaked at 9.1% before retreating to near 3%"
|
|
73
|
+
description = "Consumer Price Index, year-over-year change (%)"
|
|
74
|
+
source = "Bureau of Labor Statistics"
|
|
75
|
+
sourceUrl = "https://bls.gov/cpi/"
|
|
76
|
+
byline = "Pierre Romera"
|
|
77
|
+
note = "All items, seasonally adjusted, urban consumers"
|
|
78
|
+
colors = "#f28e2b"
|
|
79
|
+
|
|
80
|
+
data {
|
|
81
|
+
"Jan 2021" = 1.4
|
|
82
|
+
"Jun 2022" = 9.1
|
|
83
|
+
"Jan 2023" = 6.4
|
|
84
|
+
"Jan 2025" = 3.0
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
::: info From `packages/lib/src/samples/inflation-rate.bpc`
|
|
90
|
+
A declarative title carries the insight (`"…peaked at 9.1% before retreating to near 3%"`), `description` fixes the unit and time period, `note` confines the methodology footnote to the bottom, `source` plus `sourceUrl` form the attribution pair, and `byline` is the credit slot. Each field maps one-to-one onto `FrameOptions`.
|
|
91
|
+
:::
|
|
92
|
+
|
|
93
|
+
## See also
|
|
94
|
+
|
|
95
|
+
- [Typography](/handbook/typography)
|
|
96
|
+
- [Annotations](/handbook/annotations)
|
|
97
|
+
- [Design Principles](/handbook/design-principles)
|
|
98
|
+
- [BPC DSL Specification](/reference/dsl/)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Dataviz Handbook
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Dataviz Handbook
|
|
6
|
+
|
|
7
|
+
> An opinionated field guide for designing honest, clear, and accessible charts — the editorial principles behind Blueprint Chart, distilled into a working reference.
|
|
8
|
+
|
|
9
|
+
This handbook is not API documentation. It is the editorial point of view that shapes every default in Blueprint Chart: what to draw, what to strip, what to highlight, and what to refuse.
|
|
10
|
+
|
|
11
|
+
## What you'll find here
|
|
12
|
+
|
|
13
|
+
The handbook reflects how we think charts should be built for journalism, research, and any context where the reader's understanding matters more than the author's flourish.
|
|
14
|
+
|
|
15
|
+
- **Decision frameworks** for picking the right chart type before you sketch a single axis.
|
|
16
|
+
- **Visual rules** for axes, grid lines, color, typography, labels, and annotations.
|
|
17
|
+
- **A catalog of anti-patterns** — what to avoid and why.
|
|
18
|
+
- **Accessibility guidance** that treats CVD support, contrast, and keyboard reach as baseline, not bonus.
|
|
19
|
+
|
|
20
|
+
## The shape of a good chart
|
|
21
|
+
|
|
22
|
+
Every page in this handbook orbits the same set of principles:
|
|
23
|
+
|
|
24
|
+
- **Purposefulness** — every visual element earns its place.
|
|
25
|
+
- **Data-ink ratio** — maximize pixels devoted to data; whisper everything else.
|
|
26
|
+
- **Start with grey** — color becomes meaningful only when grey is the default.
|
|
27
|
+
- **Comparisons make the story** — data in isolation has no meaning.
|
|
28
|
+
- **No 3D, ever** — tilted surfaces lie.
|
|
29
|
+
|
|
30
|
+
If you read only one page, read [Design Principles](/handbook/design-principles). Everything else is the application of those rules to a specific surface of the chart.
|
|
31
|
+
|
|
32
|
+
## One chart that uses every principle
|
|
33
|
+
|
|
34
|
+
```bpc
|
|
35
|
+
chart line {
|
|
36
|
+
title = "2024 was the hottest year on record"
|
|
37
|
+
description = "Deviation from the 1951–1980 average, in °C"
|
|
38
|
+
source = "NASA GISS"
|
|
39
|
+
colors = "#e15759"
|
|
40
|
+
interpolation = "monotoneX"
|
|
41
|
+
showVerticalAxis = false
|
|
42
|
+
verticalGridStyle = "dashed"
|
|
43
|
+
horizontalGridStyle = "none"
|
|
44
|
+
lineSymbols = true
|
|
45
|
+
lineSymbolShowOn = "firstLast"
|
|
46
|
+
|
|
47
|
+
data {
|
|
48
|
+
"1980" = 0.26
|
|
49
|
+
"2000" = 0.42
|
|
50
|
+
"2015" = 0.9
|
|
51
|
+
"2024" = 1.29
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
annotation "2015" {
|
|
55
|
+
text = "2015 Paris Agreement to limit global warming to 1.5°C"
|
|
56
|
+
showLine = true
|
|
57
|
+
lineStyle = curve-right
|
|
58
|
+
showArrow = true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
::: info From `packages/lib/src/samples/temperature-anomaly.bpc`
|
|
64
|
+
A takeaway title states the insight; a single red hue carries meaning; gridlines whisper; an annotation points the reader at the moment that matters. Each principle on every page traces back to a chart like this one.
|
|
65
|
+
:::
|
|
66
|
+
|
|
67
|
+
## Where to start
|
|
68
|
+
|
|
69
|
+
| If you want to... | Read |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| Decide which chart fits your data | [Choosing the Right Chart](/handbook/choosing) |
|
|
72
|
+
| Internalize the foundations | [Design Principles](/handbook/design-principles) |
|
|
73
|
+
| Avoid the most common mistakes | [Anti-Patterns](/handbook/anti-patterns) |
|
|
74
|
+
| Structure the chart frame | [Frame Elements](/handbook/frame-elements) |
|
|
75
|
+
| Type for legibility | [Typography](/handbook/typography) |
|
|
76
|
+
| Pick safe, meaningful color | [Color & Palettes](/handbook/color) |
|
|
77
|
+
| Tame axes and grids | [Axes & Grid Lines](/handbook/axes) |
|
|
78
|
+
| Label directly | [Labels & Legends](/handbook/labels) |
|
|
79
|
+
| Tell the story with annotations | [Annotations](/handbook/annotations) |
|
|
80
|
+
| Design interaction honestly | [Tooltips & Interaction](/handbook/tooltips) |
|
|
81
|
+
| Make charts accessible to everyone | [Accessibility](/handbook/accessibility) |
|
|
82
|
+
|
|
83
|
+
## How this connects to Blueprint Chart
|
|
84
|
+
|
|
85
|
+
Blueprint Chart is the tool we built to make these principles the path of least resistance: grey defaults, baseline-zero where it matters, CVD-aware palettes, direct labeling, and a frame model that mirrors the hierarchy described here. The handbook is editorial; the [Guide](/guide/getting-started), [DSL Spec](/reference/dsl/), and [API Reference](/reference/api/) are how you put it into practice.
|
|
86
|
+
|
|
87
|
+
## See also
|
|
88
|
+
|
|
89
|
+
- [Choosing the Right Chart](/handbook/choosing)
|
|
90
|
+
- [Design Principles](/handbook/design-principles)
|
|
91
|
+
- [Getting Started](/guide/getting-started)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Labels & Legends
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Labels & Legends
|
|
6
|
+
|
|
7
|
+
> 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.
|
|
8
|
+
|
|
9
|
+
## Direct labeling is preferred
|
|
10
|
+
|
|
11
|
+
Place labels directly on or adjacent to data elements instead of using a separate legend. This eliminates the back-and-forth eye movement between legend and data.
|
|
12
|
+
|
|
13
|
+
**Direct labeling works well for:**
|
|
14
|
+
|
|
15
|
+
- **Line charts** — label at the end of each line
|
|
16
|
+
- **Bar charts** — label at the end of each bar
|
|
17
|
+
- **Pie / donut charts** — label each slice
|
|
18
|
+
- **Area charts** — label within or adjacent to each area
|
|
19
|
+
|
|
20
|
+
::: tip
|
|
21
|
+
**Match label color to data color** for instant association.
|
|
22
|
+
:::
|
|
23
|
+
|
|
24
|
+
## When to use legends
|
|
25
|
+
|
|
26
|
+
- Mobile or small screens where direct labels would overlap
|
|
27
|
+
- Too many series to label directly without clutter
|
|
28
|
+
- When the same visualization appears at multiple sizes
|
|
29
|
+
|
|
30
|
+
**Legend placement:**
|
|
31
|
+
|
|
32
|
+
- **Top of chart (horizontal legend)** — default for most charts
|
|
33
|
+
- Adjacent to the relevant data (right side of line chart)
|
|
34
|
+
- Never covering data
|
|
35
|
+
- Never at the bottom where it's missed
|
|
36
|
+
|
|
37
|
+
## Value labels
|
|
38
|
+
|
|
39
|
+
- Show value labels when precision matters to the reader
|
|
40
|
+
- On bar charts: inside the bar (if wide enough) or at the end
|
|
41
|
+
- On line charts: at key data points only, not every point
|
|
42
|
+
- On pie / donut charts: outside for small slices, inside for large ones
|
|
43
|
+
- Position labels to avoid overlap; use tooltips as a fallback for dense data
|
|
44
|
+
- Use "auto" positioning that chooses inside vs. outside based on available space
|
|
45
|
+
|
|
46
|
+
::: warning
|
|
47
|
+
Labeling every point on a dense line chart creates visual noise. Label extremes (peaks, troughs, end values) and let the reader rely on the axis or tooltip for the rest.
|
|
48
|
+
:::
|
|
49
|
+
|
|
50
|
+
## Label legibility checklist
|
|
51
|
+
|
|
52
|
+
- Does the label color contrast enough with its background?
|
|
53
|
+
- Is there a text outline (stroke) when the label overlays data or grid lines?
|
|
54
|
+
- Can the label be read without rotation? (Never rotate.)
|
|
55
|
+
- Does the label use the chart's number formatter so units match the axis?
|
|
56
|
+
|
|
57
|
+
## How Blueprint Chart applies labels
|
|
58
|
+
|
|
59
|
+
Blueprint Chart exposes a legend renderer with placement, orientation, and wrapping options. Direct labels are available for line, bar, and pie-family charts; the renderer falls back to legends on narrow layouts automatically. See the [API reference](/reference/api/) for `renderLegend` and the per-chart label options.
|
|
60
|
+
|
|
61
|
+
## Worked example: value labels replace the axis
|
|
62
|
+
|
|
63
|
+
```bpc
|
|
64
|
+
chart bar-vertical {
|
|
65
|
+
title = "E is the most frequent letter in English"
|
|
66
|
+
description = "How often each letter appears in typical English text"
|
|
67
|
+
sort = descending
|
|
68
|
+
valueLabels = true
|
|
69
|
+
verticalLabelPosition = off
|
|
70
|
+
verticalGridStyle = none
|
|
71
|
+
|
|
72
|
+
data {
|
|
73
|
+
"E" = 12.70
|
|
74
|
+
"T" = 9.06
|
|
75
|
+
"A" = 8.17
|
|
76
|
+
"O" = 7.51
|
|
77
|
+
"I" = 6.97
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
::: info From `packages/lib/src/samples/letter-frequency.bpc`
|
|
83
|
+
`valueLabels = true` puts the precise number at the end of every bar, so the y-axis label position can be set to `off` and the gridlines removed entirely. Direct labelling replaces both the legend and the axis labels — a clean application of the data-ink rule.
|
|
84
|
+
:::
|
|
85
|
+
|
|
86
|
+
## Worked example: legend at the top, direct value labels at the bar end
|
|
87
|
+
|
|
88
|
+
```bpc
|
|
89
|
+
chart bar-multi {
|
|
90
|
+
title = "USA tops Paris 2024 with 126 medals across all categories"
|
|
91
|
+
description = "2024 Paris Summer Games — top six nations"
|
|
92
|
+
colors = "#eeca3b, #c0c0c0, #cd7f32"
|
|
93
|
+
legendPosition = "top"
|
|
94
|
+
valueLabels = true
|
|
95
|
+
verticalGridStyle = none
|
|
96
|
+
verticalLabelPosition = off
|
|
97
|
+
sort = descending
|
|
98
|
+
|
|
99
|
+
data {
|
|
100
|
+
_series = "Gold","Silver","Bronze"
|
|
101
|
+
"USA" = 40,44,42
|
|
102
|
+
"China" = 38,32,18
|
|
103
|
+
"Japan" = 27,14,17
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
::: info From `packages/lib/src/samples/medal-count.bpc`
|
|
109
|
+
A multi-series bar chart needs a legend to map the three hues to Gold / Silver / Bronze — placed at the top so the eye reaches it before scanning the bars. Inside each bar, `valueLabels = true` prints the exact count, eliminating the need to read against a vertical scale.
|
|
110
|
+
:::
|
|
111
|
+
|
|
112
|
+
## See also
|
|
113
|
+
|
|
114
|
+
- [Typography](/handbook/typography)
|
|
115
|
+
- [Annotations](/handbook/annotations)
|
|
116
|
+
- [Tooltips & Interaction](/handbook/tooltips)
|
|
117
|
+
- [Accessibility](/handbook/accessibility)
|