@blueprint-chart/docs 2.9.0 → 2.11.0

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.
@@ -217,6 +217,13 @@
217
217
  "blurb": "> Circular part-to-whole chart with a central label slot.",
218
218
  "mdPath": "charts/donut.md"
219
219
  },
220
+ {
221
+ "slug": "dot-plot",
222
+ "group": "charts",
223
+ "title": "Dot plot chart",
224
+ "blurb": "> One dot per row on a shared value axis, with optional ranges and gaps between values.",
225
+ "mdPath": "charts/dot-plot.md"
226
+ },
220
227
  {
221
228
  "slug": "line-multi",
222
229
  "group": "charts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueprint-chart/docs",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "description": "Public documentation for Blueprint Chart — handbook, guide, BPC DSL spec, and lib API reference.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,8 +33,8 @@
33
33
  "provenance": true
34
34
  },
35
35
  "devDependencies": {
36
- "@blueprint-chart/lib": "2.9.0",
37
- "@blueprint-chart/ui": "2.9.0",
36
+ "@blueprint-chart/lib": "2.11.0",
37
+ "@blueprint-chart/ui": "2.11.0",
38
38
  "@fontsource-variable/geist": "^5.3.0",
39
39
  "@fontsource-variable/geist-mono": "^5.3.0",
40
40
  "@fontsource/dm-serif-display": "^5.3.0",
@@ -0,0 +1,242 @@
1
+ ---
2
+ title: Dot plot chart
3
+ ---
4
+
5
+ # Dot plot chart
6
+
7
+ > One dot per row on a shared value axis, with optional ranges and gaps between values.
8
+
9
+ `dot-plot` puts categories on the vertical axis and values on a horizontal axis. With one value column it draws one dot per row. With two or more it joins the dots with a line (a dumbbell). With `dotStyle = "range"` it draws one dot per row with a soft bar from a `low` to a `high` column. The style is always yours to pick: column names never change it. See [Properties](#properties) for every key it accepts.
10
+
11
+ ## When to use
12
+
13
+ - Showing the gap between two moments or two groups (2000 and 2022, before and after)
14
+ - Showing a value with its margin of error or its spread (poll results, min and max)
15
+ - Comparing many categories on one measure, when bars would be heavy
16
+
17
+ ## When NOT to use
18
+
19
+ - The categories form a time series (use [`line`](./line))
20
+ - The story is a total or a composition (use a bar chart)
21
+ - Two numeric measures against each other (use [`scatter`](./scatter))
22
+
23
+ ## Data shape
24
+
25
+ Each row is one category. Number columns become dots, or the range bounds in range style.
26
+
27
+ A single value column draws one dot per row.
28
+
29
+ ```bpc
30
+ chart dot-plot {
31
+ data {
32
+ series = "Life expectancy"
33
+ "France" = 82.8
34
+ "Kenya" = 62.9
35
+ "Japan" = 84.4
36
+ }
37
+ }
38
+ ```
39
+
40
+ Two or more value columns draw a dumbbell: one colored dot per column and a neutral line between the lowest and the highest dot.
41
+
42
+ ```bpc
43
+ chart dot-plot {
44
+ data {
45
+ series = "2000","2022"
46
+ "Zimbabwe" = 46.0, 62.4
47
+ "Japan" = 81.1, 84.0
48
+ "United States" = 76.6, 77.4
49
+ }
50
+ }
51
+ ```
52
+
53
+ `dotStyle = "range"` with a `low` column, a `high` column and one value column draws one dot with a translucent bar from low to high.
54
+
55
+ ```bpc
56
+ chart dot-plot {
57
+ dotStyle = "range"
58
+
59
+ data {
60
+ series = "Poll","High","Low"
61
+ "CDU/CSU" = 29,32,27
62
+ "Greens" = 22,25,20
63
+ "SPD" = 14,16,12
64
+ }
65
+ }
66
+ ```
67
+
68
+ ## Style and column mapping
69
+
70
+ `dotStyle` picks the style: `dumbbell` (the default) or `range`. In dumbbell style every numeric column is a dot, including columns named `High` or `Low`, and `low` and `high` are ignored. In range style, `low` and `high` pick the bounds and the first other numeric column is the dot.
71
+
72
+ | Property | Role | Preselected from |
73
+ | --- | --- | --- |
74
+ | `low` | Lower end of the range bar | Numeric column named `low`, `lower`, `min` or `minimum` |
75
+ | `high` | Upper end of the range bar | Numeric column named `high`, `upper`, `max` or `maximum` |
76
+
77
+ - Preselection only happens in range style. It ignores case and matches whole words. `Lower bound` and `Max` match, `Lowland` does not.
78
+ - `low = "Margin low"` names a column yourself. A name that matches no column is reported, with a suggestion when one is close.
79
+ - If range style cannot find both a `low` and a `high` column, it draws plain dots of the value and warns that the range columns are missing.
80
+ - Range style needs a third numeric column for the dot. If there are more, the first is the value and the rest are ignored, with a warning.
81
+ - Rows with a missing value, or a missing low or high in range style, are not drawn and are reported. A value outside its low to high range is drawn and reported.
82
+
83
+ ## Arrows
84
+
85
+ `arrows` turns the row line into an arrow. Directions follow the series order, not the values, so with `series = "2015","2024"` a forward arrow points from 2015 to 2024 whichever is larger.
86
+
87
+ - `none` (default): a plain line.
88
+ - `forward`: an arrowhead at the last column, pointing away from the first.
89
+ - `backward`: an arrowhead at the first column, pointing away from the last.
90
+ - `both`: arrowheads at both ends.
91
+
92
+ Arrows apply to dumbbells only and are ignored in range style.
93
+
94
+ ## Sorting
95
+
96
+ `sortMode` orders the rows. The default is `value`.
97
+
98
+ - `value` sorts by the first value column, largest first.
99
+ - `gap` sorts by the last value column minus the first, largest first. Outside a dumbbell it falls back to `value`.
100
+ - `none` keeps the order of your data.
101
+
102
+ ## Labels
103
+
104
+ Value labels are off by default. `valueLabels = true` adds them:
105
+
106
+ - Single: the value sits to the right of the dot.
107
+ - Dumbbell: the lowest dot is labeled on its left and the highest on its right. Dots in between get no label.
108
+ - Range: one label to the right of the bar. It shows the value of the dot, not the low or high number.
109
+
110
+ The legend appears for dumbbells only, with one entry per value column.
111
+
112
+ ## Highlight and colorize
113
+
114
+ `highlight` and `colorize` take a row name.
115
+
116
+ - `highlight "Zimbabwe"` emphasizes one row and dims the rest.
117
+ - `colorize "Zimbabwe" { color = "#e15759" }` recolors that row.
118
+
119
+ ## Scenes
120
+
121
+ Rows are matched by name across [scenes](/reference/dsl/scenes-and-transforms). Dots, lines and range bars glide to their new positions, including when a scene changes the style. Keep row names identical between scenes so rows move instead of being replaced.
122
+
123
+ ## Annotations
124
+
125
+ [Annotations](/reference/dsl/annotations) work on dot plots:
126
+
127
+ - A point annotation targets a row by its name.
128
+ - On a dumbbell, it lands on the row's rightmost dot.
129
+ - In range style, it lands on the value dot.
130
+ - A range with row names runs from the first row's dots to the last row's dots. Set `startAnchor` and `endAnchor` to cover the whole rows.
131
+ - A range with numbers spans those values.
132
+
133
+ ## Example
134
+
135
+ From `packages/lib/src/samples/life-expectancy-gains.bpc`. A dumbbell with arrows, sorted by gap.
136
+
137
+ ```bpc
138
+ chart dot-plot {
139
+ title = "Zimbabwe gained over 16 years of life expectancy since 2000, the United States under 1"
140
+ description = "Life expectancy at birth in years, 2000 and 2022, for 10 countries"
141
+ source = "World Bank, World Development Indicators"
142
+ sourceUrl = "https://data.worldbank.org/indicator/SP.DYN.LE00.IN"
143
+ arrows = "forward"
144
+ sortMode = "gap"
145
+
146
+ data {
147
+ series = "2000","2022"
148
+ "Zimbabwe" = 46.0, 62.4
149
+ "Ethiopia" = 50.9, 66.9
150
+ "Nigeria" = 47.1, 54.1
151
+ "India" = 62.7, 71.7
152
+ "Russia" = 65.5, 72.5
153
+ "South Africa" = 58.4, 65.5
154
+ "China" = 72.3, 78.2
155
+ "Japan" = 81.1, 84.0
156
+ "Germany" = 77.9, 80.6
157
+ "United States" = 76.6, 77.4
158
+ }
159
+ }
160
+ ```
161
+
162
+ The range style sample is `packages/lib/src/samples/election-polls.bpc`.
163
+
164
+ ```bpc
165
+ chart dot-plot {
166
+ title = "CDU/CSU led German polls at 29 % ahead of the 2021 election"
167
+ description = "How Germany would vote in the September 2021 federal election, according to polling in the previous June"
168
+ source = "FG Wahlen"
169
+ sourceUrl = "https://www.forschungsgruppe.de"
170
+ note = "Margin of error at 10%: +/- 2 percentage points; at 40%: +/- 3 percentage points"
171
+ dotStyle = "range"
172
+
173
+ data {
174
+ series = "Poll","High","Low"
175
+ "CDU/CSU" = 29,32,27
176
+ "Greens" = 22,25,20
177
+ "SPD" = 14,16,12
178
+ "AfD" = 10,12,8
179
+ "FDP" = 10,12,8
180
+ "Left" = 7,9,5
181
+ }
182
+ }
183
+ ```
184
+
185
+ <!-- options:start -->
186
+
187
+ ## Properties
188
+
189
+ Every property `dot-plot` accepts, beside the [frame and layout keys](/reference/dsl/properties) every chart shares. Anything absent from this table is rejected by `validateChart` and ignored by the renderer.
190
+
191
+ | Property | Type | Default |
192
+ | --- | --- | --- |
193
+ | `colors` | colors | (unset) |
194
+ | `colorPalette` | select, see [Palettes](/guide/palettes) | `Blueprint` |
195
+ | `autoContrast` | boolean | `false` |
196
+ | `allowDarkMode` | boolean | `true` |
197
+ | `dotStyle` | select: `dumbbell`, `range` | `dumbbell` |
198
+ | `low` | text | `""` |
199
+ | `high` | text | `""` |
200
+ | `arrows` | select: `none`, `forward`, `backward`, `both` | `none` |
201
+ | `sortMode` | select: `none`, `value`, `gap` | `value` |
202
+ | `legend` | boolean | `true` |
203
+ | `legendPosition` | select: `top`, `bottom`, `left`, `right` | `top` |
204
+ | `legendAnchor` | select: `start`, `middle`, `end` | `start` |
205
+ | `categoryLabelLine` | boolean | `false` |
206
+ | `showVerticalAxis` | boolean | `true` |
207
+ | `verticalAxisDirection` | select: `left`, `right` | `left` |
208
+ | `showVerticalTicks` | boolean | `false` |
209
+ | `verticalLabelPosition` | select: `auto`, `inside`, `outside`, `off` | `auto` |
210
+ | `verticalGridStyle` | select: `solid`, `dashed`, `dotted`, `none` | `none` |
211
+ | `verticalNumberFormat` | numberFormat | (unset) |
212
+ | `showHorizontalAxis` | boolean | `false` |
213
+ | `showHorizontalTicks` | boolean | `false` |
214
+ | `horizontalLabelPosition` | select: `auto`, `inside`, `outside`, `off` | `auto` |
215
+ | `horizontalLabelRotation` | select: `auto`, `horizontal`, `vertical` | `horizontal` |
216
+ | `horizontalGridStyle` | select: `solid`, `dashed`, `dotted`, `none` | `dashed` |
217
+ | `horizontalNumberFormat` | numberFormat | (unset) |
218
+ | `horizontalScaleType` | select: `linear`, `log` | `linear` |
219
+ | `horizontalRangeMin` | text | (unset) |
220
+ | `horizontalRangeMax` | text | (unset) |
221
+ | `valueLabels` | boolean | `false` |
222
+ | `tooltips` | boolean | `true` |
223
+
224
+ <!-- options:end -->
225
+
226
+ ## Common pitfalls
227
+
228
+ - Using `gap` sort on a single value or a range: it falls back to `value`
229
+ - Expecting range bars from columns named `High` and `Low` without setting `dotStyle = "range"`: they draw as dumbbell dots instead
230
+ - Reading the arrow as a trend: it only points from the first column to the last
231
+ - Using a log axis with values, lows or highs at or below 0: those rows are not drawn and are reported
232
+ - Too many value columns: past three or four, the legend and the dots stop reading clearly
233
+
234
+ ## Related types
235
+
236
+ - [`scatter`](./scatter): when both axes are numeric measures
237
+ - [`bar-split`](./bar-split): when the values diverge around a baseline
238
+
239
+ ## See also
240
+
241
+ - [Choosing the right chart](/handbook/choosing)
242
+ - [Annotations](/reference/dsl/annotations)
@@ -4,7 +4,7 @@ title: Chart types
4
4
 
5
5
  # Chart types
6
6
 
7
- Blueprint Chart ships 14 chart types organized into five families: bar, line, area, part-to-whole, and relationship.
7
+ Blueprint Chart ships 15 chart types organized into six families: bar, line, area, part-to-whole, relationship, and ranges and gaps.
8
8
 
9
9
  ## Bar family
10
10
 
@@ -35,6 +35,10 @@ Blueprint Chart ships 14 chart types organized into five families: bar, line, ar
35
35
 
36
36
  - [`scatter`](./scatter): points placed by two numeric values; optional bubble size and color groups
37
37
 
38
+ ## Ranges and gaps
39
+
40
+ - [`dot-plot`](./dot-plot): one dot per row; a line for gaps between values, or a bar for ranges
41
+
38
42
  ::: tip Choosing the right chart
39
43
  Not sure which type fits your data? Start with the decision framework in the [choosing the right chart](/handbook/choosing) handbook entry.
40
44
  :::
@@ -63,7 +63,7 @@ chart <chartType> {
63
63
  }
64
64
  ```
65
65
 
66
- Where `<chartType>` is one of the registered chart-type identifiers (`line`, `bar-vertical`, `bar-horizontal`, `bar-grouped`, `bar-stacked`, `bar-multi`, `bar-split`, `column-stacked`, `area`, `area-stacked`, `line-multi`, `pie`, `donut`, `scatter`). The authoritative list is exported as `ChartType` from [`@blueprint-chart/lib`](/reference/api/).
66
+ Where `<chartType>` is one of the registered chart-type identifiers (`line`, `bar-vertical`, `bar-horizontal`, `bar-grouped`, `bar-stacked`, `bar-multi`, `bar-split`, `column-stacked`, `area`, `area-stacked`, `line-multi`, `pie`, `donut`, `scatter`, `dot-plot`). The authoritative list is exported as `ChartType` from [`@blueprint-chart/lib`](/reference/api/).
67
67
 
68
68
  ## Lexical grammar
69
69