@blueprint-chart/lib 2.12.0 → 2.14.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.
- package/dist/charts/line-symbols.d.ts +2 -1
- package/dist/charts/plugins/arc-labels.d.ts +1 -2
- package/dist/charts/sort-helpers.d.ts +15 -1
- package/dist/charts/stack-helpers.d.ts +5 -0
- package/dist/charts/themes/index.d.ts +1 -0
- package/dist/charts/types/dot-plot/rows.d.ts +5 -1
- package/dist/charts/types.d.ts +23 -0
- package/dist/embed.js +1 -1
- package/dist/enums.d.ts +3 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +420 -430
- package/dist/lib/lib.iife.js +28 -23
- package/dist/node-backend/index.js +2758 -2538
- package/dist/render/chart-a11y.d.ts +1 -1
- package/dist/{render-bpc-t7lTvln4.js → render-bpc-CGb7G_vh.js} +2863 -2641
- package/dist/runtime/chart-css.d.ts +1 -1
- package/dist/runtime-CT02Shsd.js +118 -0
- package/dist/runtime.js +2 -2
- package/package.json +1 -1
- package/src/charts/chart.scss +2 -1
- package/dist/runtime-D_vHKSyR.js +0 -84
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as ee, I as te, It as _, J as v, Jt as ne, K as re, Kt as ie, L as ae, Lt as oe, M as y, Mt as se, N as ce, Nt as le, O as ue, Ot as de, P as b, Pt as
|
|
2
|
-
import { t as
|
|
3
|
-
import
|
|
1
|
+
import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as ee, I as te, It as _, J as v, Jt as ne, K as re, Kt as ie, L as ae, Lt as oe, M as y, Mt as se, N as ce, Nt as le, O as ue, Ot as de, P as b, Pt as fe, Q as pe, Qt as me, R as x, Rt as he, S as ge, St as _e, T as ve, Tt as ye, U as S, Ut as be, V as xe, Vt as Se, W as Ce, Wt as we, X as Te, Xt as Ee, Y as De, Yt as Oe, Z as ke, Zt as Ae, _ as je, _t as Me, a as Ne, an as Pe, at as Fe, b as Ie, bt as Le, c as Re, cn as ze, ct as Be, d as Ve, dt as He, en as Ue, et as We, f as Ge, ft as Ke, g as qe, gt as Je, h as Ye, ht as Xe, i as C, in as Ze, it as Qe, j as $e, jt as et, k as w, kt as tt, l as nt, ln as rt, lt as it, m as at, mt as ot, n as st, nn as ct, nt as lt, o as ut, on as dt, ot as ft, p as pt, pt as mt, q as ht, qt as gt, r as _t, rn as vt, rt as yt, s as bt, sn as xt, st as St, t as Ct, tn as wt, tt as Tt, u as Et, ut as Dt, v as Ot, vt as kt, w as At, wt as jt, x as Mt, xt as Nt, y as Pt, yt as Ft, z as T, zt as It } from "./render-bpc-CGb7G_vh.js";
|
|
2
|
+
import { c as Lt, i as Rt, s as zt, t as Bt } from "./runtime-CT02Shsd.js";
|
|
3
|
+
import E from "chroma-js";
|
|
4
4
|
//#region src/recommendations/intent.ts
|
|
5
|
-
var
|
|
5
|
+
var Vt = [
|
|
6
6
|
{
|
|
7
7
|
intent: "range",
|
|
8
8
|
pattern: /\b(range|high and low|high\/low|margin of error|confidence interval|confidence|interval|plus or minus|spread between)\b/i
|
|
@@ -32,97 +32,97 @@ var It = [
|
|
|
32
32
|
pattern: /\b(compares?|compared|comparison|versus|vs\.?|more than|difference between|across|than)\b/i
|
|
33
33
|
}
|
|
34
34
|
];
|
|
35
|
-
function
|
|
35
|
+
function Ht(e) {
|
|
36
36
|
if (e === void 0 || e.trim() === "") return "none";
|
|
37
|
-
for (let t of
|
|
37
|
+
for (let t of Vt) if (t.pattern.test(e)) return t.intent;
|
|
38
38
|
return "none";
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/recommendations/decisionTable.ts
|
|
42
|
-
var
|
|
42
|
+
var D = (e, t, n) => ({
|
|
43
43
|
type: e,
|
|
44
44
|
fitness: t,
|
|
45
45
|
reason: n
|
|
46
|
-
}),
|
|
46
|
+
}), O = {
|
|
47
47
|
"1cat+1num": {
|
|
48
48
|
none: (e) => {
|
|
49
|
-
let t = [
|
|
50
|
-
return e <= 8 && (t.push(
|
|
49
|
+
let t = [D("bar-vertical", "best", "1 categorical + 1 numeric — classic bar chart"), D("bar-horizontal", "good", "Horizontal bars work well for long labels")];
|
|
50
|
+
return e <= 8 && (t.push(D("donut", "good", `${e} items — suitable for part-of-whole`)), t.push(D("pie", "alternative", "Pie chart for part-of-whole"))), t;
|
|
51
51
|
},
|
|
52
|
-
comparison: (e) =>
|
|
53
|
-
ranking: () => [
|
|
52
|
+
comparison: (e) => O["1cat+1num"].none(e),
|
|
53
|
+
ranking: () => [D("bar-horizontal", "best", "Ranked categories read best as horizontal bars"), D("bar-vertical", "good", "Vertical bars also work for ranking")],
|
|
54
54
|
"part-to-whole": (e) => e <= 5 ? [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
D("pie", "best", `${e} slices — pie reads cleanly for very small N`),
|
|
56
|
+
D("donut", "good", "Donut for part-of-whole with a center label"),
|
|
57
|
+
D("bar-vertical", "alternative", "Bars if precise comparison matters")
|
|
58
58
|
] : e <= 8 ? [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
] : [
|
|
63
|
-
range: () => [
|
|
59
|
+
D("donut", "best", `${e} slices — donut for part-of-whole`),
|
|
60
|
+
D("pie", "good", "Pie for part-of-whole"),
|
|
61
|
+
D("bar-vertical", "alternative", "Bars if precise comparison matters")
|
|
62
|
+
] : [D("bar-vertical", "best", `${e} categories — too many for a readable pie`), D("bar-horizontal", "good", "Horizontal bars for long labels")],
|
|
63
|
+
range: () => [D("bar-vertical", "best", "A single numeric column carries no range — plain bars read the value directly"), D("bar-horizontal", "good", "Horizontal bars work well for long labels")]
|
|
64
64
|
},
|
|
65
65
|
"1cat+Nnum": {
|
|
66
|
-
none: () => [
|
|
67
|
-
comparison: (e) =>
|
|
68
|
-
ranking: (e) =>
|
|
69
|
-
trend: () => [
|
|
66
|
+
none: () => [D("bar-multi", "best", "1 categorical + multiple numeric columns — compare groups"), D("line-multi", "good", "Can also show as a multi-line chart")],
|
|
67
|
+
comparison: (e) => O["1cat+Nnum"].none(e),
|
|
68
|
+
ranking: (e) => O["1cat+Nnum"].none(e),
|
|
69
|
+
trend: () => [D("line-multi", "best", "A trend or crossover story reads best as lines, even over categorical periods"), D("bar-multi", "alternative", "Grouped bars if per-period comparison matters more than the trend")],
|
|
70
70
|
"part-to-whole": () => [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
D("bar-stacked", "best", "Stacked bars show composition within each category"),
|
|
72
|
+
D("column-stacked", "good", "Stacked columns for the same composition"),
|
|
73
|
+
D("bar-multi", "alternative", "Grouped bars if comparison beats composition")
|
|
74
74
|
],
|
|
75
75
|
"composition-over-time": () => [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
D("column-stacked", "best", "Stacked columns show composition across discrete periods"),
|
|
77
|
+
D("bar-stacked", "good", "Stacked bars for the same composition"),
|
|
78
|
+
D("area-stacked", "alternative", "Stacked area if the periods are continuous time")
|
|
79
79
|
],
|
|
80
|
-
relationship: () => [
|
|
81
|
-
range: () => [
|
|
80
|
+
relationship: () => [D("scatter", "best", "Two numeric columns per item — a scatter plot shows how they move together"), D("line-multi", "alternative", "Lines if the categories have a natural order")],
|
|
81
|
+
range: () => [D("dot-plot", "best", "A dot with a bar from low to high shows each value with its margin. Set dotStyle = \"range\" and pick the low and high columns"), D("bar-split", "alternative", "Split bars if each bound should read as its own panel")]
|
|
82
82
|
},
|
|
83
83
|
"1cat+text+Nnum": {
|
|
84
|
-
none: () => [
|
|
85
|
-
relationship: (e) =>
|
|
84
|
+
none: () => [D("scatter", "best", "A label, a text column and several numbers — plot one number against another"), D("bar-multi", "alternative", "Grouped bars if comparing values per row matters more")],
|
|
85
|
+
relationship: (e) => O["1cat+text+Nnum"].none(e)
|
|
86
86
|
},
|
|
87
87
|
"1date+1num": {
|
|
88
|
-
none: () => [
|
|
88
|
+
none: () => [D("line", "best", "1 date + 1 numeric column — ideal for trend"), D("bar-vertical", "alternative", "Can also show as bars")],
|
|
89
89
|
trend: () => [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
D("line", "best", "1 date + 1 numeric column — ideal for trend"),
|
|
91
|
+
D("area", "good", "Filled area emphasizes magnitude over time"),
|
|
92
|
+
D("bar-vertical", "alternative", "Can also show as bars")
|
|
93
93
|
],
|
|
94
|
-
comparison: () => [
|
|
95
|
-
ranking: () => [
|
|
96
|
-
"part-to-whole": () => [
|
|
97
|
-
"composition-over-time": () => [
|
|
94
|
+
comparison: () => [D("bar-vertical", "best", "Bars for comparing discrete time points"), D("line", "good", "Line if the trend matters more than the comparison")],
|
|
95
|
+
ranking: () => [D("bar-vertical", "best", "Bars for ranking discrete time points"), D("line", "good", "Line for the underlying trend")],
|
|
96
|
+
"part-to-whole": () => [D("area", "best", "Filled area reads as magnitude/share over time"), D("line", "good", "Line for the underlying trend")],
|
|
97
|
+
"composition-over-time": () => [D("area", "best", "Filled area shows magnitude over time"), D("line", "good", "Line for the underlying trend")]
|
|
98
98
|
},
|
|
99
99
|
"1date+Nnum": {
|
|
100
|
-
none: () => [
|
|
101
|
-
trend: (e) =>
|
|
102
|
-
comparison: (e) =>
|
|
103
|
-
ranking: (e) =>
|
|
100
|
+
none: () => [D("line-multi", "best", "1 date + multiple numeric columns — compare trends"), D("bar-multi", "alternative", "Can also show as grouped bars")],
|
|
101
|
+
trend: (e) => O["1date+Nnum"].none(e),
|
|
102
|
+
comparison: (e) => O["1date+Nnum"].none(e),
|
|
103
|
+
ranking: (e) => O["1date+Nnum"].none(e),
|
|
104
104
|
"composition-over-time": () => [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
D("area-stacked", "best", "Stacked area shows composition over continuous time"),
|
|
106
|
+
D("column-stacked", "good", "Stacked columns for the same composition"),
|
|
107
|
+
D("line-multi", "alternative", "Multi-line if composition is not the point")
|
|
108
108
|
],
|
|
109
|
-
"part-to-whole": () => [
|
|
109
|
+
"part-to-whole": () => [D("area-stacked", "best", "Stacked area shows share over time"), D("line-multi", "good", "Multi-line if absolute trends matter more")]
|
|
110
110
|
},
|
|
111
|
-
other: { none: () => [
|
|
111
|
+
other: { none: () => [D("bar-vertical", "good", "Default bar chart recommendation")] }
|
|
112
112
|
};
|
|
113
|
-
function
|
|
114
|
-
let r =
|
|
115
|
-
return i ? i(n) : [
|
|
113
|
+
function Ut(e, t, n) {
|
|
114
|
+
let r = O[e], i = r[t] ?? r.none;
|
|
115
|
+
return i ? i(n) : [D("bar-vertical", "good", "Default bar chart recommendation")];
|
|
116
116
|
}
|
|
117
117
|
//#endregion
|
|
118
118
|
//#region src/recommendations/shape.ts
|
|
119
|
-
function
|
|
119
|
+
function Wt(e, t) {
|
|
120
120
|
let n = e[0] === "date", r = e.filter((e) => e === "string").length, i = n ? e.filter((e) => e === "date").length : 0, a = e.filter((e) => e === "number" || e === "date" && !n).length;
|
|
121
121
|
return i === 1 && r === 0 && a >= 1 ? a === 1 ? "1date+1num" : "1date+Nnum" : r === 1 && i === 0 && a >= 1 ? a === 1 ? "1cat+1num" : "1cat+Nnum" : e[0] === "string" && i === 0 && r >= 2 && a >= 2 ? "1cat+text+Nnum" : "other";
|
|
122
122
|
}
|
|
123
123
|
//#endregion
|
|
124
124
|
//#region src/recommendations/types.ts
|
|
125
|
-
var
|
|
125
|
+
var Gt = {
|
|
126
126
|
"bar-vertical": "Vertical Bar Chart",
|
|
127
127
|
"bar-horizontal": "Horizontal Bar Chart",
|
|
128
128
|
"bar-multi": "Grouped Bar Chart",
|
|
@@ -141,43 +141,21 @@ var Bt = {
|
|
|
141
141
|
};
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region src/recommendations/recommend.ts
|
|
144
|
-
function
|
|
145
|
-
return e.length === 0 ? [] :
|
|
144
|
+
function Kt(e, t, n) {
|
|
145
|
+
return e.length === 0 ? [] : Ut(Wt(e, t), Ht(n), t).map((e) => ({
|
|
146
146
|
chartType: e.type,
|
|
147
|
-
label:
|
|
147
|
+
label: Gt[e.type] ?? e.type,
|
|
148
148
|
fitness: e.fitness,
|
|
149
149
|
reason: e.reason
|
|
150
150
|
}));
|
|
151
151
|
}
|
|
152
152
|
//#endregion
|
|
153
|
-
//#region src/charts/themes/index.ts
|
|
154
|
-
var Ht = [
|
|
155
|
-
{
|
|
156
|
-
name: "blueprint",
|
|
157
|
-
label: "Blueprint",
|
|
158
|
-
description: "The default Blueprint Chart theme"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
name: "blueprint-framed",
|
|
162
|
-
label: "Blueprint Framed",
|
|
163
|
-
description: "Adds borders and a tinted footer"
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
name: "blueprint-bold",
|
|
167
|
-
label: "Blueprint Bold",
|
|
168
|
-
description: "Charts on the blueprint canvas with the full brand palette"
|
|
169
|
-
}
|
|
170
|
-
];
|
|
171
|
-
function Ut() {
|
|
172
|
-
return Ht;
|
|
173
|
-
}
|
|
174
|
-
//#endregion
|
|
175
153
|
//#region src/charts/colorblind.ts
|
|
176
|
-
var
|
|
154
|
+
var qt = {
|
|
177
155
|
protanopia: "Protanopia (no red)",
|
|
178
156
|
deuteranopia: "Deuteranopia (no green)",
|
|
179
157
|
tritanopia: "Tritanopia (no blue)"
|
|
180
|
-
},
|
|
158
|
+
}, Jt = {
|
|
181
159
|
protanopia: [
|
|
182
160
|
.152286,
|
|
183
161
|
1.052583,
|
|
@@ -245,27 +223,27 @@ var Wt = {
|
|
|
245
223
|
0
|
|
246
224
|
]
|
|
247
225
|
};
|
|
248
|
-
function
|
|
226
|
+
function Yt(e) {
|
|
249
227
|
return `bc-cvd-${e}`;
|
|
250
228
|
}
|
|
251
|
-
function
|
|
229
|
+
function Xt(e) {
|
|
252
230
|
let t = "http://www.w3.org/2000/svg", n = document.createElementNS(t, "filter");
|
|
253
|
-
n.setAttribute("id",
|
|
231
|
+
n.setAttribute("id", Yt(e)), n.setAttribute("color-interpolation-filters", "linearRGB");
|
|
254
232
|
let r = document.createElementNS(t, "feColorMatrix");
|
|
255
|
-
return r.setAttribute("type", "matrix"), r.setAttribute("values",
|
|
233
|
+
return r.setAttribute("type", "matrix"), r.setAttribute("values", Jt[e].join(" ")), n.appendChild(r), n;
|
|
256
234
|
}
|
|
257
|
-
function
|
|
235
|
+
function Zt(e) {
|
|
258
236
|
return e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
259
237
|
}
|
|
260
|
-
function
|
|
238
|
+
function k(e) {
|
|
261
239
|
return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
|
|
262
240
|
}
|
|
263
|
-
function
|
|
264
|
-
let [n, r, i] = (
|
|
265
|
-
return
|
|
241
|
+
function Qt(e, t) {
|
|
242
|
+
let [n, r, i] = (E.valid(e) ? E(e) : E("#000")).rgb().map((e) => Zt(e / 255)), a = Jt[t], o = k(a[0] * n + a[1] * r + a[2] * i), s = k(a[5] * n + a[6] * r + a[7] * i), c = k(a[10] * n + a[11] * r + a[12] * i), l = (e) => Math.min(255, Math.max(0, Math.round(e * 255)));
|
|
243
|
+
return E(l(o), l(s), l(c)).hex();
|
|
266
244
|
}
|
|
267
|
-
var
|
|
268
|
-
function
|
|
245
|
+
var $t = 10;
|
|
246
|
+
function en(e) {
|
|
269
247
|
if (e.length < 2) return [];
|
|
270
248
|
let t = [
|
|
271
249
|
"protanopia",
|
|
@@ -273,10 +251,10 @@ function Zt(e) {
|
|
|
273
251
|
"tritanopia"
|
|
274
252
|
], n = [];
|
|
275
253
|
for (let r of t) {
|
|
276
|
-
let t = e.map((e) =>
|
|
254
|
+
let t = e.map((e) => Qt(e, r)), i = [];
|
|
277
255
|
for (let n = 0; n < t.length; n++) for (let r = n + 1; r < t.length; r++) {
|
|
278
|
-
let a =
|
|
279
|
-
a <
|
|
256
|
+
let a = E.deltaE(t[n], t[r]);
|
|
257
|
+
a < $t && i.push({
|
|
280
258
|
a: e[n],
|
|
281
259
|
b: e[r],
|
|
282
260
|
deltaE: a
|
|
@@ -284,7 +262,7 @@ function Zt(e) {
|
|
|
284
262
|
}
|
|
285
263
|
i.length > 0 && n.push({
|
|
286
264
|
type: r,
|
|
287
|
-
label:
|
|
265
|
+
label: qt[r],
|
|
288
266
|
pairs: i
|
|
289
267
|
});
|
|
290
268
|
}
|
|
@@ -292,162 +270,162 @@ function Zt(e) {
|
|
|
292
270
|
}
|
|
293
271
|
//#endregion
|
|
294
272
|
//#region src/dsl/serializer.ts
|
|
295
|
-
function
|
|
273
|
+
function A(e, t) {
|
|
296
274
|
return (e ?? []).flatMap((e) => e.split("\n").map((e) => `${t}// ${e.trim()}`));
|
|
297
275
|
}
|
|
298
|
-
function
|
|
276
|
+
function j(e, t) {
|
|
299
277
|
return t == null ? e : t.includes("\n") ? `${e} /* ${t} */` : `${e} // ${t}`;
|
|
300
278
|
}
|
|
301
|
-
function
|
|
302
|
-
return [...
|
|
279
|
+
function M(e, t) {
|
|
280
|
+
return [...A(e.trailingComments, `${t} `), j(`${t}}`, e.trailingComment)];
|
|
303
281
|
}
|
|
304
|
-
function
|
|
305
|
-
return typeof e.value == "number" ? e.isPercentage ? `${e.value}%` : `${e.value}` : typeof e.value == "string" && e.value.startsWith("#") ?
|
|
282
|
+
function N(e) {
|
|
283
|
+
return typeof e.value == "number" ? e.isPercentage ? `${e.value}%` : `${e.value}` : typeof e.value == "string" && e.value.startsWith("#") ? T(e.value) : typeof e.value == "string" && /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.value) ? e.value : T(String(e.value));
|
|
306
284
|
}
|
|
307
|
-
function
|
|
308
|
-
return /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e) ? e :
|
|
285
|
+
function tn(e) {
|
|
286
|
+
return /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e) ? e : T(e);
|
|
309
287
|
}
|
|
310
|
-
function
|
|
311
|
-
let n =
|
|
312
|
-
return [...
|
|
288
|
+
function P(e, t) {
|
|
289
|
+
let n = j(`${t}${tn(e.key)} = ${N(e)}`, e.trailingComment);
|
|
290
|
+
return [...A(e.leadingComments, t), n].join("\n");
|
|
313
291
|
}
|
|
314
|
-
function
|
|
292
|
+
function nn(e, t) {
|
|
315
293
|
let n;
|
|
316
|
-
return n = e.key === "series" && e.quotedKey && !(e.values && e.values.length > 1) ? `${t}"series" = ${
|
|
294
|
+
return n = e.key === "series" && e.quotedKey && !(e.values && e.values.length > 1) ? `${t}"series" = ${N(e)}` : e.values && e.values.length > 1 ? `${t}${e.key === "series" && !e.quotedKey ? e.key : T(e.key)} = ${e.values.map((e) => typeof e == "number" ? `${e}` : T(String(e))).join(",")}` : `${t}${tn(e.key)} = ${N(e)}`, [...A(e.leadingComments, t), j(n, e.trailingComment)].join("\n");
|
|
295
|
+
}
|
|
296
|
+
function F(e, t) {
|
|
297
|
+
let n = [...A(e.leadingComments, t), `${t}data {`];
|
|
298
|
+
for (let r of e.entries) n.push(nn(r, `${t} `));
|
|
299
|
+
return n.push(...M(e, t)), n.join("\n");
|
|
317
300
|
}
|
|
318
301
|
function I(e, t) {
|
|
319
|
-
let n = [...
|
|
320
|
-
for (let
|
|
321
|
-
return
|
|
302
|
+
let n = e.fromHighlight ? "highlight" : "colorize", r = [...A(e.leadingComments, t), `${t}${n} ${T(e.target)} {`];
|
|
303
|
+
for (let n of e.properties) r.push(P(n, `${t} `));
|
|
304
|
+
return r.push(...M(e, t)), r.join("\n");
|
|
322
305
|
}
|
|
323
306
|
function L(e, t) {
|
|
324
|
-
|
|
325
|
-
for (let n of e.properties) r.push(F(n, `${t} `));
|
|
326
|
-
return r.push(...N(e, t)), r.join("\n");
|
|
307
|
+
return [...A(e.leadingComments, t), j(`${t}highlight ${T(e.target)}`, e.trailingComment)].join("\n");
|
|
327
308
|
}
|
|
328
309
|
function R(e, t) {
|
|
329
|
-
|
|
310
|
+
let n = [...A(e.leadingComments, t), `${t}area-fill ${T(e.from)} ${T(e.to)} {`];
|
|
311
|
+
for (let r of e.properties) n.push(P(r, `${t} `));
|
|
312
|
+
return n.push(...M(e, t)), n.join("\n");
|
|
330
313
|
}
|
|
331
314
|
function z(e, t) {
|
|
332
|
-
let n =
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
let n = e.kind ?? T.Point;
|
|
338
|
-
if (n === T.Range) {
|
|
339
|
-
let n = [...j(e.leadingComments, t), `${t}range {`];
|
|
340
|
-
for (let r of e.properties) n.push(F(r, `${t} `));
|
|
341
|
-
return n.push(...N(e, t)), n.join("\n");
|
|
315
|
+
let n = e.kind ?? r.Point;
|
|
316
|
+
if (n === r.Range) {
|
|
317
|
+
let n = [...A(e.leadingComments, t), `${t}range {`];
|
|
318
|
+
for (let r of e.properties) n.push(P(r, `${t} `));
|
|
319
|
+
return n.push(...M(e, t)), n.join("\n");
|
|
342
320
|
}
|
|
343
|
-
if (n ===
|
|
344
|
-
let n = [...
|
|
345
|
-
for (let r of e.properties) n.push(
|
|
346
|
-
return n.push(...
|
|
321
|
+
if (n === r.Free) {
|
|
322
|
+
let n = [...A(e.leadingComments, t), `${t}note {`];
|
|
323
|
+
for (let r of e.properties) n.push(P(r, `${t} `));
|
|
324
|
+
return n.push(...M(e, t)), n.join("\n");
|
|
347
325
|
}
|
|
348
|
-
let
|
|
349
|
-
for (let n of e.properties)
|
|
350
|
-
return
|
|
326
|
+
let i = "target" in e ? e.target : "", a = [...A(e.leadingComments, t), `${t}annotation ${T(i)} {`];
|
|
327
|
+
for (let n of e.properties) a.push(P(n, `${t} `));
|
|
328
|
+
return a.push(...M(e, t)), a.join("\n");
|
|
329
|
+
}
|
|
330
|
+
function B(e, t) {
|
|
331
|
+
let n = [...A(e.leadingComments, t), `${t}series ${T(e.name)} {`];
|
|
332
|
+
for (let r of e.properties) n.push(P(r, `${t} `));
|
|
333
|
+
return n.push(...M(e, t)), n.join("\n");
|
|
334
|
+
}
|
|
335
|
+
function rn(e, t) {
|
|
336
|
+
let n = e.name == null ? `${t}scene {` : `${t}scene ${T(e.name)} {`, r = [...A(e.leadingComments, t), n];
|
|
337
|
+
for (let n of e.properties) r.push(P(n, `${t} `));
|
|
338
|
+
e.data && r.push(F(e.data, `${t} `));
|
|
339
|
+
for (let n of e.colorizes) r.push(I(n, `${t} `));
|
|
340
|
+
for (let n of e.highlights) r.push(L(n, `${t} `));
|
|
341
|
+
for (let n of e.areaFills) r.push(R(n, `${t} `));
|
|
342
|
+
for (let n of e.annotations) r.push(z(n, `${t} `));
|
|
343
|
+
for (let n of e.series) r.push(B(n, `${t} `));
|
|
344
|
+
for (let n of e.transforms) r.push(V(n, `${t} `));
|
|
345
|
+
return r.push(...M(e, t)), r.join("\n");
|
|
351
346
|
}
|
|
352
347
|
function V(e, t) {
|
|
353
|
-
let n = [...
|
|
354
|
-
for (let r of e.properties) n.push(
|
|
355
|
-
return n.push(...
|
|
356
|
-
}
|
|
357
|
-
function
|
|
358
|
-
let n = e.name == null ? `${t}scene {` : `${t}scene ${E(e.name)} {`, r = [...j(e.leadingComments, t), n];
|
|
359
|
-
for (let n of e.properties) r.push(F(n, `${t} `));
|
|
360
|
-
e.data && r.push(I(e.data, `${t} `));
|
|
361
|
-
for (let n of e.colorizes) r.push(L(n, `${t} `));
|
|
362
|
-
for (let n of e.highlights) r.push(R(n, `${t} `));
|
|
363
|
-
for (let n of e.areaFills) r.push(z(n, `${t} `));
|
|
364
|
-
for (let n of e.annotations) r.push(B(n, `${t} `));
|
|
365
|
-
for (let n of e.series) r.push(V(n, `${t} `));
|
|
366
|
-
for (let n of e.transforms) r.push(H(n, `${t} `));
|
|
367
|
-
return r.push(...N(e, t)), r.join("\n");
|
|
368
|
-
}
|
|
369
|
-
function H(e, t) {
|
|
370
|
-
let n = [...j(e.leadingComments, t), `${t}transform ${e.transformType} {`];
|
|
371
|
-
for (let r of e.properties) n.push(F(r, `${t} `));
|
|
372
|
-
return n.push(...N(e, t)), n.join("\n");
|
|
373
|
-
}
|
|
374
|
-
function tn(e, t, n) {
|
|
348
|
+
let n = [...A(e.leadingComments, t), `${t}transform ${e.transformType} {`];
|
|
349
|
+
for (let r of e.properties) n.push(P(r, `${t} `));
|
|
350
|
+
return n.push(...M(e, t)), n.join("\n");
|
|
351
|
+
}
|
|
352
|
+
function an(e, t, n) {
|
|
375
353
|
let r = g(n).find((t) => t.key === e);
|
|
376
354
|
return !r || r.default === void 0 ? !1 : String(r.default) === String(t);
|
|
377
355
|
}
|
|
378
|
-
function
|
|
356
|
+
function on(e) {
|
|
379
357
|
let t = [`chart ${e.chartType} {`];
|
|
380
|
-
for (let n of e.properties) t.push(
|
|
381
|
-
e.data && t.push(
|
|
382
|
-
for (let n of e.colorizes) t.push(
|
|
383
|
-
for (let n of e.highlights) t.push(
|
|
384
|
-
for (let n of e.areaFills) t.push(
|
|
385
|
-
for (let n of e.annotations) t.push(
|
|
386
|
-
for (let n of e.series) t.push(
|
|
387
|
-
for (let n of e.scenes) t.push(
|
|
388
|
-
for (let n of e.transforms) t.push(
|
|
389
|
-
return t.push(...
|
|
390
|
-
}
|
|
391
|
-
function
|
|
358
|
+
for (let n of e.properties) t.push(P(n, " "));
|
|
359
|
+
e.data && t.push(F(e.data, " "));
|
|
360
|
+
for (let n of e.colorizes) t.push(I(n, " "));
|
|
361
|
+
for (let n of e.highlights) t.push(L(n, " "));
|
|
362
|
+
for (let n of e.areaFills) t.push(R(n, " "));
|
|
363
|
+
for (let n of e.annotations) t.push(z(n, " "));
|
|
364
|
+
for (let n of e.series) t.push(B(n, " "));
|
|
365
|
+
for (let n of e.scenes) t.push(rn(n, " "));
|
|
366
|
+
for (let n of e.transforms) t.push(V(n, " "));
|
|
367
|
+
return t.push(...A(e.trailingComments, " "), "}"), t.join("\n");
|
|
368
|
+
}
|
|
369
|
+
function sn(e) {
|
|
392
370
|
return new Map(e.map((e) => [e.key, e.value]));
|
|
393
371
|
}
|
|
394
|
-
function
|
|
372
|
+
function H(e, t, n, r) {
|
|
395
373
|
let i = g(n).find((t) => t.key === e);
|
|
396
374
|
return i ? r.has(e) ? String(r.get(e)) === String(t) : i.default !== void 0 && String(i.default) === String(t) : !1;
|
|
397
375
|
}
|
|
398
|
-
function
|
|
399
|
-
let i = [...
|
|
400
|
-
for (let a of e.properties) (a.isPercentage || !
|
|
401
|
-
return i.push(...
|
|
376
|
+
function cn(e, t, n, r) {
|
|
377
|
+
let i = [...A(e.leadingComments, t), `${t}series ${T(e.name)} {`];
|
|
378
|
+
for (let a of e.properties) (a.isPercentage || !H(a.key, a.value, n, r)) && i.push(P(a, `${t} `));
|
|
379
|
+
return i.push(...M(e, t)), i.join("\n");
|
|
402
380
|
}
|
|
403
|
-
function
|
|
404
|
-
let i = e.properties.find((e) => e.key === "type"), a = i ? String(i.value) : n, o = e.name == null ? `${t}scene {` : `${t}scene ${
|
|
381
|
+
function ln(e, t, n, r) {
|
|
382
|
+
let i = e.properties.find((e) => e.key === "type"), a = i ? String(i.value) : n, o = e.name == null ? `${t}scene {` : `${t}scene ${T(e.name)} {`, s = [...A(e.leadingComments, t), o], c = new Map(r);
|
|
405
383
|
for (let n of e.properties) {
|
|
406
384
|
if (n.key === "type") {
|
|
407
|
-
s.push(
|
|
385
|
+
s.push(P(n, `${t} `));
|
|
408
386
|
continue;
|
|
409
387
|
}
|
|
410
|
-
c.set(n.key, n.value), (n.isPercentage || !
|
|
388
|
+
c.set(n.key, n.value), (n.isPercentage || !H(n.key, n.value, a, r)) && s.push(P(n, `${t} `));
|
|
411
389
|
}
|
|
412
|
-
e.data && s.push(
|
|
413
|
-
for (let n of e.colorizes) s.push(
|
|
414
|
-
for (let n of e.highlights) s.push(
|
|
415
|
-
for (let n of e.areaFills) s.push(
|
|
416
|
-
for (let n of e.annotations) s.push(
|
|
417
|
-
for (let n of e.series) s.push(
|
|
418
|
-
for (let n of e.transforms) s.push(
|
|
419
|
-
return s.push(...
|
|
420
|
-
}
|
|
421
|
-
function
|
|
390
|
+
e.data && s.push(F(e.data, `${t} `));
|
|
391
|
+
for (let n of e.colorizes) s.push(I(n, `${t} `));
|
|
392
|
+
for (let n of e.highlights) s.push(L(n, `${t} `));
|
|
393
|
+
for (let n of e.areaFills) s.push(R(n, `${t} `));
|
|
394
|
+
for (let n of e.annotations) s.push(z(n, `${t} `));
|
|
395
|
+
for (let n of e.series) s.push(cn(n, `${t} `, a, c));
|
|
396
|
+
for (let n of e.transforms) s.push(V(n, `${t} `));
|
|
397
|
+
return s.push(...M(e, t)), s.join("\n");
|
|
398
|
+
}
|
|
399
|
+
function un(e) {
|
|
422
400
|
let t = [`chart ${e.chartType} {`], n = /* @__PURE__ */ new Map();
|
|
423
|
-
for (let r of e.properties) (r.isPercentage || !
|
|
424
|
-
e.data && t.push(
|
|
425
|
-
for (let n of e.colorizes) t.push(
|
|
426
|
-
for (let n of e.highlights) t.push(
|
|
427
|
-
for (let n of e.areaFills) t.push(
|
|
428
|
-
for (let n of e.annotations) t.push(
|
|
429
|
-
let r =
|
|
430
|
-
for (let n of e.series) t.push(
|
|
431
|
-
for (let n of e.scenes) t.push(
|
|
432
|
-
for (let n of e.transforms) t.push(
|
|
433
|
-
return t.push(...
|
|
434
|
-
}
|
|
435
|
-
function
|
|
401
|
+
for (let r of e.properties) (r.isPercentage || !H(r.key, r.value, e.chartType, n)) && t.push(P(r, " "));
|
|
402
|
+
e.data && t.push(F(e.data, " "));
|
|
403
|
+
for (let n of e.colorizes) t.push(I(n, " "));
|
|
404
|
+
for (let n of e.highlights) t.push(L(n, " "));
|
|
405
|
+
for (let n of e.areaFills) t.push(R(n, " "));
|
|
406
|
+
for (let n of e.annotations) t.push(z(n, " "));
|
|
407
|
+
let r = sn(e.properties);
|
|
408
|
+
for (let n of e.series) t.push(cn(n, " ", e.chartType, r));
|
|
409
|
+
for (let n of e.scenes) t.push(ln(n, " ", e.chartType, r));
|
|
410
|
+
for (let n of e.transforms) t.push(V(n, " "));
|
|
411
|
+
return t.push(...A(e.trailingComments, " "), "}"), t.join("\n");
|
|
412
|
+
}
|
|
413
|
+
function dn(e) {
|
|
436
414
|
let t = [`chart ${e.chartType} {`];
|
|
437
|
-
for (let n of e.properties)
|
|
438
|
-
e.data && t.push(
|
|
439
|
-
for (let n of e.colorizes) t.push(
|
|
440
|
-
for (let n of e.highlights) t.push(
|
|
441
|
-
for (let n of e.areaFills) t.push(
|
|
442
|
-
for (let n of e.annotations) t.push(
|
|
443
|
-
for (let n of e.series) t.push(
|
|
444
|
-
for (let n of e.scenes) t.push(
|
|
445
|
-
for (let n of e.transforms) t.push(
|
|
446
|
-
return t.push(...
|
|
415
|
+
for (let n of e.properties) an(n.key, n.value, e.chartType) || t.push(P(n, " "));
|
|
416
|
+
e.data && t.push(F(e.data, " "));
|
|
417
|
+
for (let n of e.colorizes) t.push(I(n, " "));
|
|
418
|
+
for (let n of e.highlights) t.push(L(n, " "));
|
|
419
|
+
for (let n of e.areaFills) t.push(R(n, " "));
|
|
420
|
+
for (let n of e.annotations) t.push(z(n, " "));
|
|
421
|
+
for (let n of e.series) t.push(B(n, " "));
|
|
422
|
+
for (let n of e.scenes) t.push(rn(n, " "));
|
|
423
|
+
for (let n of e.transforms) t.push(V(n, " "));
|
|
424
|
+
return t.push(...A(e.trailingComments, " "), "}"), t.join("\n");
|
|
447
425
|
}
|
|
448
426
|
//#endregion
|
|
449
427
|
//#region src/dsl/suggest.ts
|
|
450
|
-
function
|
|
428
|
+
function fn(e, t) {
|
|
451
429
|
let n = [Array.from({ length: t.length + 1 }, (e, t) => t)];
|
|
452
430
|
for (let r = 1; r <= e.length; r++) {
|
|
453
431
|
n.push([r]);
|
|
@@ -458,10 +436,10 @@ function ln(e, t) {
|
|
|
458
436
|
}
|
|
459
437
|
return n[e.length][t.length];
|
|
460
438
|
}
|
|
461
|
-
function
|
|
439
|
+
function U(e, t) {
|
|
462
440
|
let n, r = Infinity;
|
|
463
441
|
for (let i of t) {
|
|
464
|
-
let t =
|
|
442
|
+
let t = fn(e.toLowerCase(), i.toLowerCase());
|
|
465
443
|
t < r && (r = t, n = i);
|
|
466
444
|
}
|
|
467
445
|
if (n === void 0) return;
|
|
@@ -470,26 +448,26 @@ function W(e, t) {
|
|
|
470
448
|
}
|
|
471
449
|
//#endregion
|
|
472
450
|
//#region src/charts/types/scatter/issues.ts
|
|
473
|
-
var
|
|
451
|
+
var pn = [
|
|
474
452
|
"x",
|
|
475
453
|
"y",
|
|
476
454
|
"size",
|
|
477
455
|
"group"
|
|
478
|
-
],
|
|
456
|
+
], mn = {
|
|
479
457
|
"missing-x": "missing x",
|
|
480
458
|
"missing-y": "missing y",
|
|
481
459
|
"invalid-size": "size must be above 0",
|
|
482
460
|
"non-positive-log-x": "x must be above 0 on a log axis",
|
|
483
461
|
"non-positive-log-y": "y must be above 0 on a log axis"
|
|
484
|
-
},
|
|
462
|
+
}, hn = {
|
|
485
463
|
x: "horizontal",
|
|
486
464
|
y: "vertical"
|
|
487
465
|
};
|
|
488
|
-
function
|
|
489
|
-
return [...
|
|
466
|
+
function gn(e) {
|
|
467
|
+
return [...pe(e), ...(e.textColumns ?? []).map((e) => e.name)];
|
|
490
468
|
}
|
|
491
|
-
function
|
|
492
|
-
let i =
|
|
469
|
+
function _n(e, t, n, r) {
|
|
470
|
+
let i = gn(e);
|
|
493
471
|
return n.flatMap((e) => {
|
|
494
472
|
let n = t[e];
|
|
495
473
|
return !n || n === "none" || i.includes(n) ? [] : [{
|
|
@@ -497,11 +475,11 @@ function mn(e, t, n, r) {
|
|
|
497
475
|
severity: r,
|
|
498
476
|
key: e,
|
|
499
477
|
message: `${e} names "${n}", which is not a column.`,
|
|
500
|
-
suggestion:
|
|
478
|
+
suggestion: U(n, i)
|
|
501
479
|
}];
|
|
502
480
|
});
|
|
503
481
|
}
|
|
504
|
-
function
|
|
482
|
+
function vn(e, t) {
|
|
505
483
|
if (!e.length) return [];
|
|
506
484
|
let n = e.slice(0, 5).map((e) => `"${e.name}" (${t[e.reason]})`), r = e.length - n.length;
|
|
507
485
|
return [{
|
|
@@ -510,92 +488,94 @@ function hn(e, t) {
|
|
|
510
488
|
message: `${`${e.length} ${e.length === 1 ? "row" : "rows"}`} not drawn: ${n.join(", ")}${r > 0 ? `, and ${r} more` : ""}.`
|
|
511
489
|
}];
|
|
512
490
|
}
|
|
513
|
-
function
|
|
491
|
+
function yn(e) {
|
|
514
492
|
return e.map((e) => ({
|
|
515
493
|
code: "trend-skipped",
|
|
516
494
|
severity: "warning",
|
|
517
495
|
message: `Trend line skipped${e === "overall" ? "" : ` for ${e}`}: needs at least 3 points.`
|
|
518
496
|
}));
|
|
519
497
|
}
|
|
520
|
-
function
|
|
521
|
-
return ["x", "y"].flatMap((
|
|
522
|
-
let
|
|
523
|
-
return e[
|
|
498
|
+
function bn(e, n) {
|
|
499
|
+
return ["x", "y"].flatMap((r) => ["min", "max"].flatMap((i) => {
|
|
500
|
+
let a = n[r]?.[i];
|
|
501
|
+
return e[r] !== t.Log || a === void 0 || String(a).trim() === "" || !(Number(a) <= 0) ? [] : [{
|
|
524
502
|
code: "log-range-ignored",
|
|
525
503
|
severity: "warning",
|
|
526
|
-
message: `${`${
|
|
504
|
+
message: `${`${hn[r]}Range${i === "min" ? "Min" : "Max"}`} must be above 0 on a log axis; it is ignored.`
|
|
527
505
|
}];
|
|
528
506
|
}));
|
|
529
507
|
}
|
|
530
|
-
function
|
|
531
|
-
let o =
|
|
508
|
+
function xn(t, n, r, i, a) {
|
|
509
|
+
let o = _n(t, n, pn, "error"), s = e(t, n);
|
|
532
510
|
if (!s.y) return [...o, {
|
|
533
511
|
code: "scatter-missing-y",
|
|
534
512
|
severity: "error",
|
|
535
513
|
key: "y",
|
|
536
514
|
message: "Scatter needs at least two numeric columns."
|
|
537
515
|
}];
|
|
538
|
-
let c =
|
|
516
|
+
let c = bn(r, i);
|
|
539
517
|
if (o.length) return [...o, ...c];
|
|
540
|
-
let { points: l, dropped: u } =
|
|
518
|
+
let { points: l, dropped: u } = Te(t, s, r), d = v(a) ? De(l, a, r).skipped : [];
|
|
541
519
|
return [
|
|
542
|
-
...
|
|
543
|
-
...
|
|
520
|
+
...vn(u, mn),
|
|
521
|
+
...yn(d),
|
|
544
522
|
...c
|
|
545
523
|
];
|
|
546
524
|
}
|
|
547
525
|
//#endregion
|
|
548
526
|
//#region src/charts/types/dot-plot/issues.ts
|
|
549
|
-
var
|
|
527
|
+
var Sn = ["low", "high"], Cn = {
|
|
550
528
|
"missing-value": "missing value",
|
|
551
529
|
"missing-range": "missing low or high",
|
|
552
530
|
"non-positive-log": "values must be above 0 on a log axis"
|
|
553
|
-
},
|
|
554
|
-
function
|
|
531
|
+
}, W = (e) => e.map((e) => `"${e}"`).join(", ");
|
|
532
|
+
function wn(e) {
|
|
555
533
|
let t = e.filter(({ values: [e], low: t = -Infinity, high: n = Infinity }) => e < Math.min(t, n) || e > Math.max(t, n));
|
|
556
534
|
if (!t.length) return [];
|
|
557
535
|
let n = t.slice(0, 5).map((e) => e.name), r = t.length - n.length;
|
|
558
536
|
return [{
|
|
559
537
|
code: "value-outside-range",
|
|
560
538
|
severity: "warning",
|
|
561
|
-
message: `${`${t.length} ${t.length === 1 ? "row has" : "rows have"}`} a value outside low to high: ${
|
|
539
|
+
message: `${`${t.length} ${t.length === 1 ? "row has" : "rows have"}`} a value outside low to high: ${W(n)}${r > 0 ? `, and ${r} more` : ""}.`
|
|
562
540
|
}];
|
|
563
541
|
}
|
|
564
|
-
function
|
|
542
|
+
function Tn(e, t) {
|
|
565
543
|
return t.length ? [{
|
|
566
544
|
code: "ignored-columns",
|
|
567
545
|
severity: "warning",
|
|
568
|
-
message: `Range mode uses ${
|
|
546
|
+
message: `Range mode uses ${W(e)} as the value and ignores ${W(t)}.`
|
|
569
547
|
}] : [];
|
|
570
548
|
}
|
|
571
|
-
function
|
|
572
|
-
return e.dotStyle !==
|
|
549
|
+
function En(e, t) {
|
|
550
|
+
return e.dotStyle !== a.Range || t === "range" ? [] : [{
|
|
573
551
|
code: "missing-range-columns",
|
|
574
552
|
severity: "warning",
|
|
575
553
|
message: "Range style needs a low and a high column. Pick them in low and high."
|
|
576
554
|
}];
|
|
577
555
|
}
|
|
578
|
-
function
|
|
579
|
-
let r =
|
|
556
|
+
function Dn(e, t, n) {
|
|
557
|
+
let r = ht(e, t), { rows: i, dropped: a } = m(e, r, n);
|
|
580
558
|
return [
|
|
581
|
-
...
|
|
582
|
-
...
|
|
583
|
-
...
|
|
584
|
-
...r.mode === "range" ?
|
|
585
|
-
...
|
|
559
|
+
..._n(e, t, Sn, "warning"),
|
|
560
|
+
...En(t, r.mode),
|
|
561
|
+
...vn(a, Cn),
|
|
562
|
+
...r.mode === "range" ? wn(i) : [],
|
|
563
|
+
...Tn(r.values, r.ignored)
|
|
586
564
|
];
|
|
587
565
|
}
|
|
588
566
|
//#endregion
|
|
589
567
|
//#region src/dsl/validate.ts
|
|
590
|
-
var
|
|
568
|
+
var On = /* @__PURE__ */ new Set([
|
|
591
569
|
"title",
|
|
592
570
|
"description",
|
|
571
|
+
"altText",
|
|
593
572
|
"byline",
|
|
594
573
|
"note",
|
|
595
574
|
"source",
|
|
596
575
|
"sourceUrl",
|
|
597
576
|
"padding",
|
|
598
577
|
"transparentBackground",
|
|
578
|
+
"getTheData",
|
|
599
579
|
"type",
|
|
600
580
|
"sort",
|
|
601
581
|
"sortMode",
|
|
@@ -608,8 +588,8 @@ var Tn = /* @__PURE__ */ new Set([
|
|
|
608
588
|
"maxWidth",
|
|
609
589
|
"player",
|
|
610
590
|
"playerPosition"
|
|
611
|
-
]),
|
|
612
|
-
["theme",
|
|
591
|
+
]), kn = /* @__PURE__ */ new Map([
|
|
592
|
+
["theme", Lt().map((e) => e.name)],
|
|
613
593
|
["player", [
|
|
614
594
|
"buttons",
|
|
615
595
|
"progress-bar",
|
|
@@ -622,13 +602,13 @@ var Tn = /* @__PURE__ */ new Set([
|
|
|
622
602
|
"center",
|
|
623
603
|
"right"
|
|
624
604
|
]]
|
|
625
|
-
]),
|
|
605
|
+
]), An = /* @__PURE__ */ new Set([
|
|
626
606
|
"lineSymbolSize",
|
|
627
607
|
"circleSize",
|
|
628
608
|
"fixedHeight",
|
|
629
609
|
"fixedWidth",
|
|
630
610
|
"maxWidth"
|
|
631
|
-
]),
|
|
611
|
+
]), G = ut, jn = /* @__PURE__ */ new Set([
|
|
632
612
|
"text",
|
|
633
613
|
"repeat",
|
|
634
614
|
"textColor",
|
|
@@ -646,7 +626,7 @@ var Tn = /* @__PURE__ */ new Set([
|
|
|
646
626
|
"circleSize",
|
|
647
627
|
"circleStyle",
|
|
648
628
|
"circleColor"
|
|
649
|
-
]),
|
|
629
|
+
]), Mn = /* @__PURE__ */ new Set([
|
|
650
630
|
"color",
|
|
651
631
|
"lineWidth",
|
|
652
632
|
"dash",
|
|
@@ -661,11 +641,11 @@ var Tn = /* @__PURE__ */ new Set([
|
|
|
661
641
|
"symbolStyle",
|
|
662
642
|
"symbolSize",
|
|
663
643
|
"symbolOpacity"
|
|
664
|
-
]),
|
|
644
|
+
]), Nn = /* @__PURE__ */ new Map([
|
|
665
645
|
["symbolShape", "lineSymbolShape"],
|
|
666
646
|
["symbolShowOn", "lineSymbolShowOn"],
|
|
667
647
|
["symbolStyle", "lineSymbolStyle"]
|
|
668
|
-
]),
|
|
648
|
+
]), Pn = /* @__PURE__ */ new Set([
|
|
669
649
|
"start",
|
|
670
650
|
"end",
|
|
671
651
|
"repeat",
|
|
@@ -677,7 +657,7 @@ var Tn = /* @__PURE__ */ new Set([
|
|
|
677
657
|
"direction",
|
|
678
658
|
"text",
|
|
679
659
|
"textColor"
|
|
680
|
-
]),
|
|
660
|
+
]), Fn = /* @__PURE__ */ new Set([
|
|
681
661
|
"text",
|
|
682
662
|
"x",
|
|
683
663
|
"y",
|
|
@@ -686,19 +666,19 @@ var Tn = /* @__PURE__ */ new Set([
|
|
|
686
666
|
"maxWidth",
|
|
687
667
|
"textOutline"
|
|
688
668
|
]);
|
|
689
|
-
function
|
|
669
|
+
function In(e, t) {
|
|
690
670
|
return e.find((e) => e.key === t);
|
|
691
671
|
}
|
|
692
|
-
function
|
|
672
|
+
function K(e, t, n, r, i) {
|
|
693
673
|
i.push({
|
|
694
674
|
code: "invalid-choice",
|
|
695
675
|
path: r,
|
|
696
676
|
message: `${e} must be one of: ${n.map((e) => `"${e}"`).join(", ")}; got "${t}".`,
|
|
697
|
-
suggestion:
|
|
677
|
+
suggestion: U(String(t), n.filter((e) => e !== ""))
|
|
698
678
|
});
|
|
699
679
|
}
|
|
700
|
-
function
|
|
701
|
-
if (!
|
|
680
|
+
function Ln(e, t, n) {
|
|
681
|
+
if (!An.has(e.key)) return;
|
|
702
682
|
let r = parseFloat(String(e.value));
|
|
703
683
|
Number.isFinite(r) && r < 0 && n.push({
|
|
704
684
|
code: "invalid-number",
|
|
@@ -706,9 +686,9 @@ function Pn(e, t, n) {
|
|
|
706
686
|
message: `${e.key} must not be negative; got "${e.value}".`
|
|
707
687
|
});
|
|
708
688
|
}
|
|
709
|
-
function
|
|
689
|
+
function Rn(e, t, n, r) {
|
|
710
690
|
let i = t.value, a = String(i).toLowerCase();
|
|
711
|
-
if (e.type ===
|
|
691
|
+
if (e.type === fe.Boolean) {
|
|
712
692
|
if (e.key === "valueLabels" && a === "percent" || i === !0 || i === !1 || a === "true" || a === "false") return;
|
|
713
693
|
r.push({
|
|
714
694
|
code: "invalid-boolean",
|
|
@@ -721,88 +701,88 @@ function Fn(e, t, n, r) {
|
|
|
721
701
|
if (e.choices && e.choices.length > 0) {
|
|
722
702
|
let t = e.choices.map((e) => e.value);
|
|
723
703
|
if (t.includes(String(i)) || String(i) === "" && t.includes("")) return;
|
|
724
|
-
|
|
704
|
+
K(e.key, i, t, n, r);
|
|
725
705
|
}
|
|
726
706
|
}
|
|
727
|
-
function
|
|
728
|
-
let i = g(e), a = /* @__PURE__ */ new Set([...i.map((e) => e.key), ...
|
|
707
|
+
function zn(e, t, n, r) {
|
|
708
|
+
let i = g(e), a = /* @__PURE__ */ new Set([...i.map((e) => e.key), ...On]);
|
|
729
709
|
for (let o of t) {
|
|
730
710
|
let t = `${n}.${o.key}`;
|
|
731
|
-
|
|
732
|
-
let s =
|
|
733
|
-
if (s && String(o.value) !== "" && !s.includes(String(o.value)) &&
|
|
734
|
-
let c =
|
|
711
|
+
Ln(o, t, r);
|
|
712
|
+
let s = kn.get(o.key);
|
|
713
|
+
if (s && String(o.value) !== "" && !s.includes(String(o.value)) && K(o.key, o.value, s, t, r), On.has(o.key)) continue;
|
|
714
|
+
let c = In(i, o.key);
|
|
735
715
|
if (!c) {
|
|
736
716
|
r.push({
|
|
737
717
|
code: "unknown-property",
|
|
738
718
|
path: t,
|
|
739
719
|
message: `Unknown property "${o.key}" for chart type "${e}".`,
|
|
740
|
-
suggestion:
|
|
720
|
+
suggestion: U(o.key, a)
|
|
741
721
|
});
|
|
742
722
|
continue;
|
|
743
723
|
}
|
|
744
|
-
|
|
724
|
+
Rn(c, o, t, r);
|
|
745
725
|
}
|
|
746
726
|
}
|
|
747
|
-
function
|
|
748
|
-
return e ===
|
|
727
|
+
function Bn(e) {
|
|
728
|
+
return e === r.Range ? Pn : e === r.Free ? Fn : jn;
|
|
749
729
|
}
|
|
750
|
-
function
|
|
751
|
-
return
|
|
730
|
+
function Vn(e) {
|
|
731
|
+
return de[e];
|
|
752
732
|
}
|
|
753
|
-
function
|
|
754
|
-
e.forEach((e,
|
|
755
|
-
let
|
|
756
|
-
for (let
|
|
757
|
-
let e = `${t}.${
|
|
758
|
-
|
|
733
|
+
function Hn(e, t, n) {
|
|
734
|
+
e.forEach((e, i) => {
|
|
735
|
+
let a = e.kind ?? r.Point, o = Bn(a), s = Vn(a);
|
|
736
|
+
for (let r of e.properties) {
|
|
737
|
+
let e = `${t}.${s}[${i}].${r.key}`;
|
|
738
|
+
Ln(r, e, n), !o.has(r.key) && n.push({
|
|
759
739
|
code: "unknown-annotation-property",
|
|
760
740
|
path: e,
|
|
761
|
-
message: `Unknown ${
|
|
762
|
-
suggestion:
|
|
741
|
+
message: `Unknown ${s} property "${r.key}"; it will be silently ignored.`,
|
|
742
|
+
suggestion: U(r.key, o)
|
|
763
743
|
});
|
|
764
744
|
}
|
|
765
|
-
let
|
|
766
|
-
if (
|
|
767
|
-
let e = String(
|
|
768
|
-
e === "true" || e === "false" || typeof
|
|
745
|
+
let c = y(e.properties).get("repeat");
|
|
746
|
+
if (c !== void 0) {
|
|
747
|
+
let e = String(c).toLowerCase();
|
|
748
|
+
e === "true" || e === "false" || typeof c == "number" && Number.isInteger(c) && c >= 1 || n.push({
|
|
769
749
|
code: "invalid-annotation-repeat",
|
|
770
|
-
message: `repeat must be false, true, or a positive integer (got ${String(
|
|
771
|
-
path: `${t}.${
|
|
750
|
+
message: `repeat must be false, true, or a positive integer (got ${String(c)})`,
|
|
751
|
+
path: `${t}.${s}[${i}].repeat`
|
|
772
752
|
});
|
|
773
753
|
}
|
|
774
754
|
});
|
|
775
755
|
}
|
|
776
|
-
function
|
|
756
|
+
function Un(e, t, n, r) {
|
|
777
757
|
let i = g(e);
|
|
778
758
|
t.forEach((e, t) => {
|
|
779
759
|
for (let a of e.properties) {
|
|
780
760
|
let e = `${n}.series[${t}].${a.key}`;
|
|
781
|
-
if (!
|
|
761
|
+
if (!Mn.has(a.key)) {
|
|
782
762
|
r.push({
|
|
783
763
|
code: "unknown-series-property",
|
|
784
764
|
path: e,
|
|
785
765
|
message: `Unknown series property "${a.key}"; it will be silently ignored.`,
|
|
786
|
-
suggestion:
|
|
766
|
+
suggestion: U(a.key, Mn)
|
|
787
767
|
});
|
|
788
768
|
continue;
|
|
789
769
|
}
|
|
790
|
-
let o =
|
|
791
|
-
o?.length && !o.includes(String(a.value)) &&
|
|
770
|
+
let o = In(i, Nn.get(a.key) ?? a.key)?.choices?.map((e) => e.value);
|
|
771
|
+
o?.length && !o.includes(String(a.value)) && K(a.key, a.value, o, e, r);
|
|
792
772
|
}
|
|
793
773
|
});
|
|
794
774
|
}
|
|
795
|
-
function
|
|
775
|
+
function Wn(e, t, n) {
|
|
796
776
|
e.forEach((e, r) => {
|
|
797
|
-
|
|
777
|
+
G.has(e.transformType) || n.push({
|
|
798
778
|
code: "unknown-transform",
|
|
799
779
|
path: `${t}.transform[${r}]`,
|
|
800
|
-
message: `Unknown transform type "${e.transformType}". Known types: ${[...
|
|
801
|
-
suggestion:
|
|
780
|
+
message: `Unknown transform type "${e.transformType}". Known types: ${[...G].map((e) => `"${e}"`).join(", ")}.`,
|
|
781
|
+
suggestion: U(e.transformType, G)
|
|
802
782
|
});
|
|
803
783
|
});
|
|
804
784
|
}
|
|
805
|
-
function
|
|
785
|
+
function Gn(e) {
|
|
806
786
|
let t = /* @__PURE__ */ new Set();
|
|
807
787
|
for (let n of [e.data, ...e.scenes.map((e) => e.data)]) for (let e of n?.entries ?? []) {
|
|
808
788
|
if (e.key === "series" && !e.quotedKey) {
|
|
@@ -814,8 +794,8 @@ function Hn(e) {
|
|
|
814
794
|
}
|
|
815
795
|
return t;
|
|
816
796
|
}
|
|
817
|
-
function
|
|
818
|
-
let n =
|
|
797
|
+
function Kn(e, t) {
|
|
798
|
+
let n = Gn(e);
|
|
819
799
|
if (n.size === 0) return;
|
|
820
800
|
let r = [
|
|
821
801
|
{
|
|
@@ -843,34 +823,34 @@ function Un(e, t) {
|
|
|
843
823
|
code: "unresolved-target",
|
|
844
824
|
path: `${e}.${i}[${a}]`,
|
|
845
825
|
message: `${i} "${r.target}" matches no category or series; it has no effect.`,
|
|
846
|
-
suggestion:
|
|
826
|
+
suggestion: U(r.target, n)
|
|
847
827
|
});
|
|
848
828
|
});
|
|
849
829
|
}
|
|
850
|
-
function
|
|
851
|
-
let t = [], n = [], r =
|
|
830
|
+
function qn(e) {
|
|
831
|
+
let t = [], n = [], r = S(), i = r.includes(e.chartType);
|
|
852
832
|
i || t.push({
|
|
853
833
|
code: "unknown-chart-type",
|
|
854
834
|
path: "chartType",
|
|
855
835
|
message: `Unknown chart type "${e.chartType}".`,
|
|
856
|
-
suggestion:
|
|
857
|
-
}), i &&
|
|
836
|
+
suggestion: U(e.chartType, r)
|
|
837
|
+
}), i && zn(e.chartType, e.properties, "chart", t), Wn(e.transforms, "chart", t), Hn(e.annotations, "chart", t), i && Un(e.chartType, e.series, "chart", t);
|
|
858
838
|
let a = !!e.data && e.data.entries.length > 0, o = e.scenes.some((e) => !!e.data && e.data.entries.length > 0);
|
|
859
839
|
return !a && !o && t.push({
|
|
860
840
|
code: "missing-data",
|
|
861
841
|
path: "data",
|
|
862
842
|
message: e.data && e.data.entries.length === 0 ? "Data block is empty." : "Chart has no data."
|
|
863
|
-
}), e.data &&
|
|
864
|
-
|
|
843
|
+
}), e.data && Jn(e.data.entries, n), e.data && Yn(e.data.entries, n), Kn(e, n), e.chartType === p.Scatter && Zn(e.data, e.properties, "chart", "data", t, n), e.chartType === p.DotPlot && Qn(e.data, e.properties, "chart", "data", n), e.scenes.forEach((r, i) => {
|
|
844
|
+
Xn(r, e.chartType, i, t);
|
|
865
845
|
let a = r.properties.find((e) => e.key === "type")?.value ?? e.chartType;
|
|
866
|
-
a ===
|
|
846
|
+
a === p.Scatter && Zn(r.data, [...e.properties, ...r.properties], `scene[${i}]`, `scene[${i}].data`, t, n), a === p.DotPlot && Qn(r.data, [...e.properties, ...r.properties], `scene[${i}]`, `scene[${i}].data`, n);
|
|
867
847
|
}), {
|
|
868
848
|
valid: t.length === 0,
|
|
869
849
|
errors: t,
|
|
870
850
|
warnings: n
|
|
871
851
|
};
|
|
872
852
|
}
|
|
873
|
-
function
|
|
853
|
+
function Jn(e, t) {
|
|
874
854
|
let n = e.findIndex((e) => e.key === "series" && !e.quotedKey);
|
|
875
855
|
if (n === -1) return;
|
|
876
856
|
let r = e[n], i = r.values ?? [r.value];
|
|
@@ -886,7 +866,7 @@ function Gn(e, t) {
|
|
|
886
866
|
suggestion: "Move the series row to the top of the data block."
|
|
887
867
|
});
|
|
888
868
|
}
|
|
889
|
-
function
|
|
869
|
+
function Yn(e, t) {
|
|
890
870
|
let n = /* @__PURE__ */ new Map();
|
|
891
871
|
for (let t of e) t.key === "series" && !t.quotedKey || n.set(t.key, (n.get(t.key) ?? 0) + 1);
|
|
892
872
|
for (let [e, r] of n) r > 1 && t.push({
|
|
@@ -896,16 +876,16 @@ function Kn(e, t) {
|
|
|
896
876
|
suggestion: `"${e} (2)"`
|
|
897
877
|
});
|
|
898
878
|
}
|
|
899
|
-
function
|
|
879
|
+
function Xn(e, t, n, r) {
|
|
900
880
|
let i = `scene[${n}]`, a = e.properties.find((e) => e.key === "type")?.value, o = a == null ? t : String(a);
|
|
901
|
-
a != null && !
|
|
881
|
+
a != null && !S().includes(o) ? r.push({
|
|
902
882
|
code: "unknown-chart-type",
|
|
903
883
|
path: `${i}.type`,
|
|
904
884
|
message: `Unknown chart type "${o}".`,
|
|
905
|
-
suggestion:
|
|
906
|
-
}) : (
|
|
885
|
+
suggestion: U(o, S())
|
|
886
|
+
}) : (zn(o, e.properties, i, r), Un(o, e.series, i, r)), Wn(e.transforms, i, r), Hn(e.annotations, i, r);
|
|
907
887
|
}
|
|
908
|
-
function
|
|
888
|
+
function Zn(e, t, n, r, i, a) {
|
|
909
889
|
if (!e || e.entries.length === 0) return;
|
|
910
890
|
let o = y(t), s = (e) => o.has(e) ? String(o.get(e)) : void 0, c = (e) => s(e), l = (e) => ({
|
|
911
891
|
min: s(`${e}RangeMin`),
|
|
@@ -922,18 +902,18 @@ function Jn(e, t, n, r, i, a) {
|
|
|
922
902
|
x: l("horizontal"),
|
|
923
903
|
y: l("vertical")
|
|
924
904
|
};
|
|
925
|
-
for (let t of
|
|
905
|
+
for (let t of xn(x(w(e)), u, d, f, s("trend"))) (t.severity === "error" ? i : a).push($n(t, t.key ? `${n}.${t.key}` : r));
|
|
926
906
|
}
|
|
927
|
-
function
|
|
907
|
+
function Qn(e, t, n, r, i) {
|
|
928
908
|
if (!e || e.entries.length === 0) return;
|
|
929
909
|
let a = y(t), o = (e) => a.has(e) ? String(a.get(e)) : void 0, s = {
|
|
930
910
|
dotStyle: o("dotStyle"),
|
|
931
911
|
low: o("low"),
|
|
932
912
|
high: o("high")
|
|
933
913
|
};
|
|
934
|
-
for (let t of
|
|
914
|
+
for (let t of Dn(x(w(e)), s, o("horizontalScaleType"))) i.push($n(t, t.key ? `${n}.${t.key}` : r));
|
|
935
915
|
}
|
|
936
|
-
function
|
|
916
|
+
function $n({ code: e, message: t, suggestion: n }, r) {
|
|
937
917
|
return {
|
|
938
918
|
code: e,
|
|
939
919
|
path: r,
|
|
@@ -943,14 +923,14 @@ function Xn({ code: e, message: t, suggestion: n }, r) {
|
|
|
943
923
|
}
|
|
944
924
|
//#endregion
|
|
945
925
|
//#region src/samples/letter-frequency.bpc?raw
|
|
946
|
-
var Zn = "chart bar-vertical {\n title = \"E is the most frequent letter in English\"\n description = \"How often each letter appears in typical English text\"\n byline = \"Pierre Romera\"\n source = \"Lewand, Cryptological Mathematics\"\n sourceUrl = \"https://en.wikipedia.org/wiki/Letter_frequency\"\n note = \"Based on analysis of 40,000 words from English prose\"\n colorPalette = \"London\"\n sort = descending\n\n highlight \"E\"\n\n data {\n \"E\" = 12.70\n \"T\" = 9.06\n \"A\" = 8.17\n \"O\" = 7.51\n \"I\" = 6.97\n \"N\" = 6.75\n \"S\" = 6.33\n \"H\" = 6.09\n \"R\" = 5.99\n \"D\" = 4.25\n }\n}\n", Qn = "chart bar-vertical {\n // the headline above the chart\n title = \"China emits more CO₂ than the US and India combined\"\n description = \"Annual emissions in billion tonnes, 2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/co2-emissions\"\n\n // one row per country: \"label\" = value\n data {\n \"China\" = 12.17\n \"United States\" = 4.92\n \"India\" = 3.06\n \"Russia\" = 1.73\n \"Japan\" = 0.99\n \"Germany\" = 0.59\n }\n\n // highlight pops one bar in the accent color\n highlight \"China\"\n\n // an annotation points a callout at a single bar\n annotation \"India\" {\n text = \"Surpassed EU in 2023\"\n showLine = true\n anchorDirection = N\n textOffsetX = 66\n textOffsetY = -41\n lineStyle = curve-left\n showArrow = true\n lineTargetDistance = 26\n showCircle = false\n }\n}\n", $n = "chart bar-horizontal {\n title = \"Mandarin has nearly twice as many native speakers as Spanish\"\n description = \"Number of native speakers worldwide, in millions\"\n source = \"Ethnologue\"\n sourceUrl = \"https://ethnologue.com\"\n byline = \"Pierre Romera\"\n sort = descending\n\n highlight \"Mandarin\"\n\n data {\n \"Mandarin\" = 988\n \"Spanish\" = 487\n \"English\" = 372\n \"Hindi\" = 347\n \"Bengali\" = 232\n \"Portuguese\" = 252\n \"Russian\" = 133\n \"Japanese\" = 124\n }\n}\n", er = "chart line-multi {\n title = \"China now buys more electric cars than the rest of the world combined\"\n description = \"Electric car sales by region, millions per year\"\n source = \"IEA Global EV Outlook 2024\"\n sourceUrl = \"https://www.iea.org/reports/global-ev-outlook-2024\"\n colorPalette = \"Maya\"\n tooltips = true\n\n data {\n series = \"China\",\"Europe\",\"United States\",\"Rest of world\"\n \"2018\" = 1.1,0.4,0.36,0.1\n \"2020\" = 1.3,1.4,0.30,0.2\n \"2021\" = 3.3,2.3,0.63,0.4\n \"2022\" = 6.0,2.7,1.0,0.7\n \"2023\" = 8.1,3.2,1.4,1.0\n }\n}\n", tr = "chart bar-multi {\n title = \"USA tops Paris 2024 with 126 medals across all categories\"\n description = \"2024 Paris Summer Games — top six nations\"\n source = \"Olympics.com\"\n sourceUrl = \"https://olympics.com\"\n colors = \"#eeca3b, #c0c0c0, #cd7f32\"\n sort = descending\n\n data {\n series = \"Gold\",\"Silver\",\"Bronze\"\n \"USA\" = 40,44,42\n \"China\" = 40,27,24\n \"Japan\" = 20,12,13\n \"Great Britain\" = 14,22,29\n \"Australia\" = 18,19,16\n \"France\" = 16,26,22\n }\n}\n", nr = "chart line {\n title = \"2024 was the hottest year on record\"\n description = \"Deviation from the 1951–1980 average, in °C\"\n source = \"NASA GISS\"\n sourceUrl = \"https://data.giss.nasa.gov/gistemp/\"\n tooltips = true\n crosshair = false\n lineSymbols = true\n\n data {\n \"1980\" = 0.26\n \"1985\" = 0.12\n \"1990\" = 0.45\n \"1995\" = 0.45\n \"2000\" = 0.39\n \"2005\" = 0.68\n \"2010\" = 0.73\n \"2015\" = 0.9\n \"2020\" = 1.01\n \"2024\" = 1.28\n }\n\n annotation \"2015\" {\n text = \"2015 Paris Agreement to limit global warming to 1.5°C \"\n maxWidth = 224\n showLine = true\n lineStyle = curve-right\n showArrow = true\n showCircle = true\n }\n}\n", rr = "chart line {\n title = \"Bitcoin surged past $90,000 in 2024\"\n description = \"USD, year-end closing price\"\n source = \"CoinGecko\"\n sourceUrl = \"https://www.coingecko.com\"\n colors = \"#f7931a\"\n lineSymbols = true\n lineSymbolShowOn = \"all\"\n lineSymbolShape = \"diamond\"\n verticalNumberFormat = \",.0f\"\n tooltips = true\n\n annotation \"2021\" {\n text = \"All-time high cycle\"\n textOffsetY = -12\n showArrow = true\n }\n\n data {\n \"2016\" = 963\n \"2017\" = 14156\n \"2018\" = 3742\n \"2019\" = 7194\n \"2020\" = 29080\n \"2021\" = 46306\n \"2022\" = 16547\n \"2023\" = 42258\n \"2024\" = 93429\n }\n}\n", ir = "chart line-multi {\n title = \"The income share of the top 1% has surged since 1980\"\n description = \"Pre-tax national income captured by the top 1%, percent\"\n source = \"World Inequality Database\"\n sourceUrl = \"https://wid.world\"\n colorPalette = \"Egypt\"\n tooltips = true\n lineSymbols = true\n lineSymbolShowOn = \"all\"\n\n data {\n series = \"United States\",\"India\",\"China\",\"France\"\n \"1980\" = 10.4,7.5,6.6,7.5\n \"1990\" = 14.7,10.7,8.3,9.0\n \"2000\" = 17.3,10.5,10.5,11.3\n \"2010\" = 17.9,16.4,15.2,11.0\n \"2021\" = 19.9,22.1,15.7,12.7\n }\n\n scene \"US doubles\" {\n title = \"The US top 1% nearly doubled its income share since 1980\"\n highlight \"United States\"\n }\n\n scene \"India overtakes\" {\n title = \"India is now the most unequal of these major economies\"\n highlight \"India\"\n }\n\n scene \"France's modest rise\" {\n title = \"France's top 1% rose far less than the US or India\"\n highlight \"France\"\n }\n}\n", ar = "chart pie {\n title = \"Asia is home to nearly 60% of the world's population\"\n description = \"Estimated share, 2024\"\n source = \"United Nations\"\n sourceUrl = \"https://population.un.org\"\n colorPalette = \"Klimt\"\n legendPosition = \"right\"\n tooltips = true\n\n data {\n \"Asia\" = 58.9\n \"Africa\" = 18.6\n \"Europe\" = 9.1\n \"Latin America\" = 8.1\n \"North America\" = 4.7\n }\n}\n", or = "chart bar-vertical {\n title = \"Brazil produces more coffee than the next three countries combined\"\n description = \"Million 60-kg bags, 2023/24 crop year\"\n source = \"USDA Foreign Agricultural Service\"\n sourceUrl = \"https://www.fas.usda.gov/data/coffee-world-markets-and-trade\"\n colorPalette = \"Harvey\"\n\n data {\n \"Brazil\" = 66.4\n \"Vietnam\" = 27.5\n \"Colombia\" = 12.76\n \"Ethiopia\" = 9.13\n \"Indonesia\" = 7.65\n \"Honduras\" = 5.5\n }\n\n highlight \"Brazil\"\n\n transform sort {\n column = \"value\"\n direction = descending\n }\n}\n", sr = "chart donut {\n title = \"The richest 1% own more wealth than the entire bottom 90% combined\"\n description = \"Share of global wealth by group, 2021\"\n source = \"World Inequality Report 2022\"\n sourceUrl = \"https://wir2022.wid.world\"\n colorPalette = \"Imperator\"\n legendPosition = \"right\"\n displayAsPercentage = true\n tooltips = true\n\n data {\n \"Top 1%\" = 38\n \"Next 9%\" = 38\n \"Middle 40%\" = 22\n \"Bottom 50%\" = 2\n }\n\n scene \"Top 1% spotlight\" {\n title = \"The top 1% hold 38% of all global wealth\"\n description = \"Share of global wealth by group, 2021\"\n highlight \"Top 1%\"\n }\n\n scene \"Bottom half\" {\n title = \"The bottom half of humanity owns just 2%\"\n description = \"Share of global wealth by group, 2021\"\n highlight \"Bottom 50%\"\n }\n\n scene \"Income tells a softer story\" {\n title = \"Income is concentrated too — but less than wealth\"\n description = \"Share of global income by the same groups, 2021\"\n highlight \"Top 1%\"\n data {\n \"Top 1%\" = 19\n \"Next 9%\" = 33\n \"Middle 40%\" = 39\n \"Bottom 50%\" = 9\n }\n }\n}\n", cr = "chart area {\n title = \"The US national debt has more than tripled since 2008\"\n description = \"Total federal debt outstanding, trillions of dollars\"\n source = \"U.S. Treasury, Fiscal Data\"\n sourceUrl = \"https://fiscaldata.treasury.gov\"\n\n annotation \"2008\" {\n text = \"Financial crisis\"\n showArrow = true\n textOffsetY = -14\n }\n\n data {\n \"2000\" = 5.7\n \"2004\" = 7.4\n \"2008\" = 10.0\n \"2012\" = 16.1\n \"2016\" = 19.6\n \"2020\" = 26.9\n \"2024\" = 35.5\n }\n}\n", lr = "chart area-stacked {\n title = \"Renewables' share of global energy has more than doubled since 2000\"\n description = \"Share of global primary energy by source, 2000–2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/energy-mix\"\n stackPercent = true\n areaSortMode = descending\n\n data {\n series = \"Coal\",\"Oil\",\"Gas\",\"Renewables\"\n \"2000\" = 27456,43017,23994,2997\n \"2005\" = 36201,47017,27439,3510\n \"2010\" = 42016,48193,31593,4868\n \"2015\" = 43695,51294,34780,6400\n \"2020\" = 42316,49101,38704,8569\n \"2023\" = 45319,54839,40151,10325\n }\n}\n", ur = "chart column-stacked {\n title = \"Natural gas and renewables pushed coal off the US power grid\"\n description = \"Share of US electricity generation by source, percent\"\n source = \"U.S. Energy Information Administration\"\n sourceUrl = \"https://www.eia.gov/electricity\"\n stackMode = \"percent\"\n\n data {\n series = \"Coal\",\"Natural gas\",\"Nuclear\",\"Renewables\"\n \"2010\" = 45,24,20,10\n \"2015\" = 33,33,20,13\n \"2020\" = 19,39,20,20\n \"2023\" = 16,43,19,21\n }\n}\n", dr = "chart bar-stacked {\n title = \"India has far more children than China, and a workforce nearly as large\"\n description = \"Millions of people, 2023\"\n source = \"UN Population Division\"\n sourceUrl = \"https://population.un.org\"\n colorPalette = \"London\"\n\n data {\n series = \"0-14\",\"15-64\",\"65+\"\n \"China\" = 232,988,200\n \"India\" = 354,978,97\n \"USA\" = 58,216,59\n \"Indonesia\" = 67,189,21\n \"Brazil\" = 43,148,24\n }\n}\n", fr = "chart area-stacked {\n title = \"EU subsidies to new members surged after enlargement\"\n description = \"Agricultural subsidies to post-socialist EU members, million euros\"\n source = \"Eurostat\"\n sourceUrl = \"https://ec.europa.eu/eurostat\"\n colorPalette = \"Enara\"\n interpolation = \"linear\"\n heightMode = \"aspect-ratio\"\n aspectRatio = \"1:1\"\n\n data {\n series = \"Indirect subsidies\",\"Direct subsidies\"\n \"2000\" = 370,800\n \"2001\" = 445,896\n \"2002\" = 567,816\n \"2003\" = 641,950\n \"2004\" = 1908,2434\n \"2005\" = 2234,3509\n \"2006\" = 2576,4356\n \"2007\" = 2467,5429\n \"2008\" = 2672,6655\n \"2009\" = 2474,7195\n \"2010\" = 2117,8207\n \"2011\" = 1863,9230\n \"2012\" = 1528,9191\n \"2013\" = 1251,10252\n \"2014\" = 1132,10987\n \"2015\" = 1687,10145\n }\n\n scene \"Indirect subsidies shrank\" {\n title = \"Indirect subsidies were cut under WTO pressure\"\n description = \"Subsidies tied to specific crops fell foul of World Trade Organization rules\"\n\n highlight \"Indirect subsidies\"\n }\n\n scene \"Direct subsidies dominate\" {\n title = \"Direct per-hectare payments now dominate\"\n description = \"The larger the fields, the more money farmers receive\"\n\n highlight \"Direct subsidies\"\n }\n\n scene \"Bulgaria: subsidies explode\" {\n title = \"Bulgarian farmers received almost nothing before 2007 accession\"\n description = \"More than three-quarters of Bulgarian subsidies are direct payments — the highest share among new members\"\n\n data {\n series = \"Indirect subsidies\",\"Direct subsidies\"\n \"2000\" = 0,5\n \"2001\" = 0,33\n \"2002\" = 0,48\n \"2003\" = 0,69\n \"2004\" = 0,67\n \"2005\" = 0,87\n \"2006\" = 0,57\n \"2007\" = 59,250\n \"2008\" = 75,484\n \"2009\" = 97,415\n \"2010\" = 79,466\n \"2011\" = 94,458\n \"2012\" = 120,617\n \"2013\" = 132,852\n \"2014\" = 143,821\n \"2015\" = 213,677\n }\n\n highlight \"Direct subsidies\"\n }\n\n scene \"Bulgarian farms grew\" {\n title = \"Average farm size in Bulgaria quadrupled\"\n description = \"Average farm size in hectares\"\n type = line\n\n data {\n \"2005\" = 5\n \"2007\" = 6\n \"2010\" = 12\n \"2013\" = 18\n }\n }\n\n scene \"Production rose\" {\n title = \"Bulgarian farm production rose from 3 to 4 billion euros\"\n description = \"Total production of Bulgarian farms, million euros\"\n type = area\n\n data {\n \"2000\" = 2933\n \"2001\" = 3240\n \"2002\" = 3051\n \"2003\" = 2816\n \"2004\" = 3049\n \"2005\" = 3011\n \"2006\" = 3111\n \"2007\" = 3038\n \"2008\" = 4148\n \"2009\" = 3437\n \"2010\" = 3486\n \"2011\" = 4038\n \"2012\" = 4161\n \"2013\" = 4115\n \"2014\" = 4138\n \"2015\" = 3915\n }\n }\n\n scene \"Cash crops replaced vegetables\" {\n title = \"Cash crops replaced vegetables in Bulgaria\"\n description = \"Production of Bulgarian farms, million euros\"\n type = area-stacked\n\n data {\n series = \"Vegetables\",\"Cash crops\",\"Other production\"\n \"2000\" = 464,615,1854\n \"2001\" = 458,777,2005\n \"2002\" = 577,850,1624\n \"2003\" = 539,818,1459\n \"2004\" = 483,1103,1463\n \"2005\" = 492,994,1525\n \"2006\" = 510,1083,1518\n \"2007\" = 436,936,1666\n \"2008\" = 541,2045,1563\n \"2009\" = 243,1553,1641\n \"2010\" = 184,2173,1128\n \"2011\" = 120,2853,1065\n \"2012\" = 117,2900,1144\n \"2013\" = 139,2802,1174\n \"2014\" = 143,3082,914\n \"2015\" = 144,2986,785\n }\n\n highlight \"Cash crops\"\n }\n\n scene \"Vegetables collapsed\" {\n title = \"Vegetable production fell by a factor of three\"\n description = \"A traditional Bulgarian cultivation shrank as subsidies favoured large fields\"\n\n highlight \"Vegetables\"\n }\n\n scene \"Every vegetable declined\" {\n title = \"Bulgarian vegetable production collapsed across the board\"\n description = \"Production volume indexed to 2001 = 100\"\n type = line-multi\n lineSymbols = false\n\n data {\n series = \"Cabbages\",\"Tomatoes\",\"Watermelons\",\"Carrots\",\"Onions\",\"Garlic\",\"Strawberries\"\n \"2001\" = 100,100,100,100,100,100,100\n \"2002\" = 79,90,124,64,106,95,100\n \"2003\" = 100,157,177,142,118,98,72\n \"2004\" = 84,87,83,245,124,138,74\n \"2005\" = 50,46,62,30,40,93,42\n \"2006\" = 52,78,113,95,56,80,56\n \"2007\" = 36,49,64,74,29,30,38\n \"2008\" = 47,49,66,97,44,29,55\n \"2009\" = 28,38,74,105,23,39,55\n \"2010\" = 57,42,51,76,53,57,37\n \"2011\" = 32,38,56,86,47,43,45\n \"2012\" = 34,34,46,69,29,43,31\n \"2013\" = 33,43,53,39,36,40,24\n \"2014\" = 31,44,28,69,37,8,27\n \"2015\" = 31,45,50,57,25,18,32\n }\n }\n\n scene \"Jobs disappeared\" {\n title = \"Family farmers disappeared while salaried ag jobs held steady\"\n description = \"EU agricultural employment, thousands of full-time equivalents\"\n type = line-multi\n lineSymbols = false\n\n data {\n series = \"Salaried workers\",\"Non-salaried workers\"\n \"2000\" = 2678,12194\n \"2001\" = 2598,11586\n \"2002\" = 2658,10795\n \"2003\" = 2563,10609\n \"2004\" = 2560,9999\n \"2005\" = 2501,10047\n \"2006\" = 2499,9782\n \"2007\" = 2437,9231\n \"2008\" = 2416,8971\n \"2009\" = 2348,8672\n \"2010\" = 2335,7808\n \"2011\" = 2322,7551\n \"2012\" = 2325,7501\n \"2013\" = 2297,7425\n \"2014\" = 2366,7183\n \"2015\" = 2413,6928\n \"2016\" = 2457,6741\n }\n\n highlight \"Non-salaried workers\"\n }\n}\n", pr = "chart bar-horizontal {\n title = \"China emits more CO₂ than the US and India combined\"\n description = \"Annual emissions in billion tonnes, 2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/co2-emissions\"\n byline = \"Pierre Romera\"\n\n data {\n \"China\" = 12.17\n \"United States\" = 4.92\n \"India\" = 3.06\n \"Russia\" = 1.73\n \"Japan\" = 0.99\n \"Germany\" = 0.59\n }\n\n scene \"China spotlight\" {\n title = \"China alone emits more than the US and India together\"\n highlight \"China\"\n }\n\n scene \"India rising\" {\n title = \"India passed the EU to become the third-largest emitter\"\n highlight \"India\"\n }\n\n scene \"Japan declining\" {\n title = \"Japan's emissions have fallen since their 2013 peak\"\n highlight \"Japan\"\n }\n\n scene \"Per capita reframe\" {\n title = \"Per person, Gulf states dwarf the biggest emitters\"\n description = \"CO₂ emissions per capita, tonnes per person, 2023\"\n highlight \"Qatar\"\n data {\n \"Qatar\" = 40.13\n \"United Arab Emirates\" = 19.77\n \"United States\" = 14.32\n \"China\" = 8.56\n \"India\" = 2.13\n }\n }\n}\n", mr = "chart dot-plot {\n title = \"CDU/CSU led German polls at 29 % ahead of the 2021 election\"\n description = \"How Germany would vote in the September 2021 federal election, according to polling in the previous June\"\n source = \"FG Wahlen\"\n sourceUrl = \"https://www.forschungsgruppe.de\"\n note = \"Margin of error at 10%: +/- 2 percentage points; at 40%: +/- 3 percentage points\"\n dotStyle = \"range\"\n\n data {\n series = \"Poll\",\"High\",\"Low\"\n \"CDU/CSU\" = 29,32,27\n \"Greens\" = 22,25,20\n \"SPD\" = 14,16,12\n \"AfD\" = 10,12,8\n \"FDP\" = 10,12,8\n \"Left\" = 7,9,5\n }\n}\n", hr = "chart bar-grouped {\n title = \"Asia Pacific holds more renewable capacity than all other regions combined\"\n description = \"Installed capacity in gigawatts (GW), 2023\"\n source = \"IRENA\"\n sourceUrl = \"https://www.irena.org/Publications/2024/Mar/Renewable-capacity-statistics-2024\"\n colorPalette = \"Folklore\"\n\n data {\n series = \"Solar\",\"Wind\",\"Hydro\"\n \"Asia Pacific\" = 870,520,650\n \"Europe\" = 290,260,230\n \"North America\" = 150,170,200\n \"Latin America\" = 50,40,190\n \"Africa\" = 12,9,40\n }\n}\n", gr = "chart scatter {\n title = \"Richer countries live longer, but Nigeria lags far behind its wealth\"\n description = \"Life expectancy in years against GDP per capita (PPP, constant international dollars, log scale), 60 countries, bubble size is population in millions\"\n source = \"World Bank, World Development Indicators\"\n sourceUrl = \"https://databank.worldbank.org/source/world-development-indicators\"\n horizontalScaleType = \"log\"\n trend = \"overall\"\n\n data {\n series = \"GDP per capita\",\"Life expectancy\",\"Population\",\"Region\"\n \"Argentina\" = 26630, 76.8, 45.0, \"Americas\"\n \"Australia\" = 58049, 82.9, 25.3, \"East Asia & Pacific\"\n \"Bangladesh\" = 6838, 72.6, 164.9, \"South Asia\"\n \"Bolivia\" = 11931, 67.8, 11.7, \"Americas\"\n \"Brazil\" = 18019, 75.8, 207.5, \"Americas\"\n \"Botswana\" = 18106, 67.2, 2.3, \"Sub-Saharan Africa\"\n \"Canada\" = 57584, 82.2, 37.6, \"Americas\"\n \"Switzerland\" = 81695, 83.9, 8.6, \"Europe & Central Asia\"\n \"Chile\" = 28228, 80.3, 19.2, \"Americas\"\n \"China\" = 18821, 77.9, 1407.7, \"East Asia & Pacific\"\n \"Cote d'Ivoire\" = 5895, 60.3, 28.2, \"Sub-Saharan Africa\"\n \"Colombia\" = 17337, 76.8, 49.9, \"Americas\"\n \"Costa Rica\" = 23497, 80.3, 5.0, \"Americas\"\n \"Germany\" = 62950, 81.3, 83.1, \"Europe & Central Asia\"\n \"Ecuador\" = 13870, 77.3, 17.3, \"Americas\"\n \"Egypt\" = 15027, 71.2, 107.6, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Spain\" = 46896, 83.8, 47.1, \"Europe & Central Asia\"\n \"Ethiopia\" = 2438, 65.7, 115.7, \"Sub-Saharan Africa\"\n \"France\" = 53449, 82.8, 67.4, \"Europe & Central Asia\"\n \"United Kingdom\" = 53374, 81.4, 66.6, \"Europe & Central Asia\"\n \"Ghana\" = 6508, 64.5, 31.3, \"Sub-Saharan Africa\"\n \"Greece\" = 33503, 81.6, 10.7, \"Europe & Central Asia\"\n \"Guatemala\" = 11466, 71.6, 17.1, \"Americas\"\n \"Haiti\" = 3362, 64.3, 11.1, \"Americas\"\n \"Indonesia\" = 12758, 70.3, 272.5, \"East Asia & Pacific\"\n \"India\" = 7702, 70.7, 1389.0, \"South Asia\"\n \"Iran\" = 14841, 76.9, 87.1, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Israel\" = 44492, 82.8, 9.1, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Italy\" = 49691, 83.5, 59.7, \"Europe & Central Asia\"\n \"Jordan\" = 10168, 76.9, 10.7, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Japan\" = 46055, 84.4, 126.6, \"East Asia & Pacific\"\n \"Kenya\" = 5172, 62.9, 51.2, \"Sub-Saharan Africa\"\n \"Cambodia\" = 6449, 70.1, 16.5, \"East Asia & Pacific\"\n \"South Korea\" = 49791, 83.2, 51.8, \"East Asia & Pacific\"\n \"Sri Lanka\" = 14637, 76.7, 21.8, \"South Asia\"\n \"Morocco\" = 8768, 74.2, 36.2, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Mexico\" = 21704, 74.5, 125.8, \"Americas\"\n \"Malaysia\" = 31301, 75.9, 33.4, \"East Asia & Pacific\"\n \"Nigeria\" = 8362, 53.0, 209.5, \"Sub-Saharan Africa\"\n \"Norway\" = 90773, 83.0, 5.3, \"Europe & Central Asia\"\n \"New Zealand\" = 47392, 82.1, 5.0, \"East Asia & Pacific\"\n \"Pakistan\" = 5296, 66.7, 230.8, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Peru\" = 15461, 76.3, 32.4, \"Americas\"\n \"Philippines\" = 9452, 69.7, 110.8, \"East Asia & Pacific\"\n \"Poland\" = 38182, 77.9, 38.0, \"Europe & Central Asia\"\n \"Portugal\" = 40188, 81.7, 10.3, \"Europe & Central Asia\"\n \"Romania\" = 36399, 75.6, 19.4, \"Europe & Central Asia\"\n \"Russia\" = 37319, 73.1, 145.5, \"Europe & Central Asia\"\n \"Rwanda\" = 2754, 66.7, 12.8, \"Sub-Saharan Africa\"\n \"Saudi Arabia\" = 62648, 78.3, 30.1, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Senegal\" = 4071, 67.7, 16.4, \"Sub-Saharan Africa\"\n \"Sweden\" = 61071, 83.1, 10.3, \"Europe & Central Asia\"\n \"Thailand\" = 21280, 77.2, 71.5, \"East Asia & Pacific\"\n \"Turkey\" = 28741, 77.7, 82.6, \"Europe & Central Asia\"\n \"Tanzania\" = 3485, 66.0, 59.2, \"Sub-Saharan Africa\"\n \"Ukraine\" = 17637, 73.9, 45.0, \"Europe & Central Asia\"\n \"Uruguay\" = 30011, 77.5, 3.4, \"Americas\"\n \"United States\" = 69121, 78.8, 330.2, \"Americas\"\n \"Vietnam\" = 11629, 74.2, 97.2, \"East Asia & Pacific\"\n \"South Africa\" = 14353, 66.1, 59.6, \"Sub-Saharan Africa\" }\n\n highlight \"Nigeria\"\n\n annotation \"Nigeria\" {\n text = \"17 years below the trend\"\n showLine = true\n anchorDirection = SW\n textOffsetX = -60\n textOffsetY = 50\n lineStyle = elbow\n showArrow = false\n lineTargetDistance = 10\n }\n\n scene \"1990\" {\n title = \"In 1990 the same countries were poorer and lived shorter lives\"\n data {\n series = \"GDP per capita\",\"Life expectancy\",\"Population\",\"Region\"\n \"Argentina\" = 17007, 71.6, 32.8, \"Americas\"\n \"Australia\" = 36268, 77.0, 17.1, \"East Asia & Pacific\"\n \"Bangladesh\" = 2070, 55.8, 111.6, \"South Asia\"\n \"Bolivia\" = 6247, 56.8, 7.1, \"Americas\"\n \"Brazil\" = 12633, 65.9, 149.1, \"Americas\"\n \"Botswana\" = 10521, 60.1, 1.3, \"Sub-Saharan Africa\"\n \"Canada\" = 40475, 77.4, 27.7, \"Americas\"\n \"Switzerland\" = 63921, 77.2, 6.7, \"Europe & Central Asia\"\n \"Chile\" = 10955, 73.7, 13.4, \"Americas\"\n \"China\" = 1667, 68.2, 1135.2, \"East Asia & Pacific\"\n \"Cote d'Ivoire\" = 5256, 52.8, 12.2, \"Sub-Saharan Africa\"\n \"Colombia\" = 9999, 68.7, 32.4, \"Americas\"\n \"Costa Rica\" = 10980, 76.1, 3.1, \"Americas\"\n \"Germany\" = 42355, 75.1, 79.4, \"Europe & Central Asia\"\n \"Ecuador\" = 9105, 68.4, 10.5, \"Americas\"\n \"Egypt\" = 8007, 62.5, 58.4, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Spain\" = 31773, 76.8, 38.9, \"Europe & Central Asia\"\n \"Ethiopia\" = 874, 45.1, 47.6, \"Sub-Saharan Africa\"\n \"France\" = 38656, 76.6, 58.3, \"Europe & Central Asia\"\n \"United Kingdom\" = 33531, 75.9, 57.2, \"Europe & Central Asia\"\n \"Ghana\" = 2786, 55.4, 15.4, \"Sub-Saharan Africa\"\n \"Greece\" = 26916, 76.9, 10.2, \"Europe & Central Asia\"\n \"Guatemala\" = 7595, 61.8, 9.0, \"Americas\"\n \"Haiti\" = 3923, 53.2, 6.9, \"Americas\"\n \"Indonesia\" = 4873, 63.2, 183.5, \"East Asia & Pacific\"\n \"India\" = 2140, 58.6, 865.0, \"South Asia\"\n \"Iran\" = 9656, 64.1, 58.4, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Israel\" = 25341, 76.6, 4.7, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Italy\" = 42657, 77.0, 56.7, \"Europe & Central Asia\"\n \"Jordan\" = 8242, 70.1, 3.6, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Japan\" = 36138, 78.8, 123.5, \"East Asia & Pacific\"\n \"Kenya\" = 4177, 58.3, 22.9, \"Sub-Saharan Africa\"\n \"Cambodia\" = 2646, 55.2, 7.4, \"East Asia & Pacific\"\n \"South Korea\" = 14378, 71.6, 42.9, \"East Asia & Pacific\"\n \"Sri Lanka\" = 4562, 69.2, 16.4, \"South Asia\"\n \"Morocco\" = 4419, 62.4, 24.4, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Mexico\" = 17170, 69.0, 82.8, \"Americas\"\n \"Malaysia\" = 12014, 71.0, 17.8, \"East Asia & Pacific\"\n \"Nigeria\" = 5424, 45.7, 97.1, \"Sub-Saharan Africa\"\n \"Norway\" = 56608, 76.5, 4.2, \"Europe & Central Asia\"\n \"New Zealand\" = 30786, 75.4, 3.3, \"East Asia & Pacific\"\n \"Pakistan\" = 3200, 59.7, 116.2, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Peru\" = 6316, 64.0, 22.0, \"Americas\"\n \"Philippines\" = 4504, 64.4, 62.9, \"East Asia & Pacific\"\n \"Poland\" = 12821, 70.9, 38.1, \"Europe & Central Asia\"\n \"Portugal\" = 27191, 74.0, 10.0, \"Europe & Central Asia\"\n \"Romania\" = 16317, 69.7, 23.2, \"Europe & Central Asia\"\n \"Russia\" = 29644, 68.9, 148.0, \"Europe & Central Asia\"\n \"Rwanda\" = 1166, 47.8, 7.4, \"Sub-Saharan Africa\"\n \"Saudi Arabia\" = 65197, 68.9, 10.6, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Senegal\" = 2923, 56.7, 7.7, \"Sub-Saharan Africa\"\n \"Sweden\" = 40200, 77.5, 8.6, \"Europe & Central Asia\"\n \"Thailand\" = 8703, 68.9, 54.7, \"East Asia & Pacific\"\n \"Turkey\" = 12184, 67.8, 56.0, \"Europe & Central Asia\"\n \"Tanzania\" = 1794, 52.0, 26.1, \"Sub-Saharan Africa\"\n \"Ukraine\" = 22816, 70.4, 52.1, \"Europe & Central Asia\"\n \"Uruguay\" = 14061, 73.0, 3.1, \"Americas\"\n \"United States\" = 44384, 75.2, 249.6, \"Americas\"\n \"Vietnam\" = 2468, 69.0, 65.5, \"East Asia & Pacific\"\n \"South Africa\" = 10811, 62.9, 40.7, \"Sub-Saharan Africa\" }\n }\n}\n", _r = "chart dot-plot {\n title = \"Zimbabwe gained over 16 years of life expectancy since 2000, the United States under 1\"\n description = \"Life expectancy at birth in years, 2000 and 2022, for 10 countries\"\n source = \"World Bank, World Development Indicators\"\n sourceUrl = \"https://data.worldbank.org/indicator/SP.DYN.LE00.IN\"\n arrows = \"forward\"\n sortMode = \"gap\"\n\n data {\n series = \"2000\",\"2022\"\n \"Zimbabwe\" = 46.0, 62.4\n \"Ethiopia\" = 50.9, 66.9\n \"Nigeria\" = 47.1, 54.1\n \"India\" = 62.7, 71.7\n \"Russia\" = 65.5, 72.5\n \"South Africa\" = 58.4, 65.5\n \"China\" = 72.3, 78.2\n \"Japan\" = 81.1, 84.0\n \"Germany\" = 77.9, 80.6\n \"United States\" = 76.6, 77.4\n }\n}\n";
|
|
926
|
+
var er = "chart bar-vertical {\n title = \"E is the most frequent letter in English\"\n description = \"How often each letter appears in typical English text\"\n byline = \"Pierre Romera\"\n source = \"Lewand, Cryptological Mathematics\"\n sourceUrl = \"https://en.wikipedia.org/wiki/Letter_frequency\"\n note = \"Based on analysis of 40,000 words from English prose\"\n colorPalette = \"London\"\n sort = descending\n\n highlight \"E\"\n\n data {\n \"E\" = 12.70\n \"T\" = 9.06\n \"A\" = 8.17\n \"O\" = 7.51\n \"I\" = 6.97\n \"N\" = 6.75\n \"S\" = 6.33\n \"H\" = 6.09\n \"R\" = 5.99\n \"D\" = 4.25\n }\n}\n", tr = "chart bar-vertical {\n // the headline above the chart\n title = \"China emits more CO₂ than the US and India combined\"\n description = \"Annual emissions in billion tonnes, 2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/co2-emissions\"\n\n // one row per country: \"label\" = value\n data {\n \"China\" = 12.17\n \"United States\" = 4.92\n \"India\" = 3.06\n \"Russia\" = 1.73\n \"Japan\" = 0.99\n \"Germany\" = 0.59\n }\n\n // highlight pops one bar in the accent color\n highlight \"China\"\n\n // an annotation points a callout at a single bar\n annotation \"India\" {\n text = \"Surpassed EU in 2023\"\n showLine = true\n anchorDirection = N\n textOffsetX = 66\n textOffsetY = -41\n lineStyle = curve-left\n showArrow = true\n lineTargetDistance = 26\n showCircle = false\n }\n}\n", nr = "chart bar-horizontal {\n title = \"Mandarin has nearly twice as many native speakers as Spanish\"\n description = \"Number of native speakers worldwide, in millions\"\n source = \"Ethnologue\"\n sourceUrl = \"https://ethnologue.com\"\n byline = \"Pierre Romera\"\n sort = descending\n\n highlight \"Mandarin\"\n\n data {\n \"Mandarin\" = 988\n \"Spanish\" = 487\n \"English\" = 372\n \"Hindi\" = 347\n \"Bengali\" = 232\n \"Portuguese\" = 252\n \"Russian\" = 133\n \"Japanese\" = 124\n }\n}\n", rr = "chart line-multi {\n title = \"China now buys more electric cars than the rest of the world combined\"\n description = \"Electric car sales by region, millions per year\"\n source = \"IEA Global EV Outlook 2024\"\n sourceUrl = \"https://www.iea.org/reports/global-ev-outlook-2024\"\n colorPalette = \"Maya\"\n tooltips = true\n\n data {\n series = \"China\",\"Europe\",\"United States\",\"Rest of world\"\n \"2018\" = 1.1,0.4,0.36,0.1\n \"2020\" = 1.3,1.4,0.30,0.2\n \"2021\" = 3.3,2.3,0.63,0.4\n \"2022\" = 6.0,2.7,1.0,0.7\n \"2023\" = 8.1,3.2,1.4,1.0\n }\n}\n", ir = "chart bar-multi {\n title = \"USA tops Paris 2024 with 126 medals across all categories\"\n description = \"2024 Paris Summer Games — top six nations\"\n source = \"Olympics.com\"\n sourceUrl = \"https://olympics.com\"\n colors = \"#eeca3b, #c0c0c0, #cd7f32\"\n sort = descending\n\n data {\n series = \"Gold\",\"Silver\",\"Bronze\"\n \"USA\" = 40,44,42\n \"China\" = 40,27,24\n \"Japan\" = 20,12,13\n \"Great Britain\" = 14,22,29\n \"Australia\" = 18,19,16\n \"France\" = 16,26,22\n }\n}\n", ar = "chart line {\n title = \"2024 was the hottest year on record\"\n description = \"Deviation from the 1951–1980 average, in °C\"\n source = \"NASA GISS\"\n sourceUrl = \"https://data.giss.nasa.gov/gistemp/\"\n tooltips = true\n crosshair = false\n lineSymbols = true\n\n data {\n \"1980\" = 0.26\n \"1985\" = 0.12\n \"1990\" = 0.45\n \"1995\" = 0.45\n \"2000\" = 0.39\n \"2005\" = 0.68\n \"2010\" = 0.73\n \"2015\" = 0.9\n \"2020\" = 1.01\n \"2024\" = 1.28\n }\n\n annotation \"2015\" {\n text = \"2015 Paris Agreement to limit global warming to 1.5°C \"\n maxWidth = 224\n showLine = true\n lineStyle = curve-right\n showArrow = true\n showCircle = true\n }\n}\n", or = "chart line {\n title = \"Bitcoin surged past $90,000 in 2024\"\n description = \"USD, year-end closing price\"\n source = \"CoinGecko\"\n sourceUrl = \"https://www.coingecko.com\"\n colors = \"#f7931a\"\n lineSymbols = true\n lineSymbolShowOn = \"all\"\n lineSymbolShape = \"diamond\"\n verticalNumberFormat = \",.0f\"\n tooltips = true\n\n annotation \"2021\" {\n text = \"All-time high cycle\"\n textOffsetY = -12\n showArrow = true\n }\n\n data {\n \"2016\" = 963\n \"2017\" = 14156\n \"2018\" = 3742\n \"2019\" = 7194\n \"2020\" = 29080\n \"2021\" = 46306\n \"2022\" = 16547\n \"2023\" = 42258\n \"2024\" = 93429\n }\n}\n", sr = "chart line-multi {\n title = \"The income share of the top 1% has surged since 1980\"\n description = \"Pre-tax national income captured by the top 1%, percent\"\n source = \"World Inequality Database\"\n sourceUrl = \"https://wid.world\"\n colorPalette = \"Egypt\"\n tooltips = true\n lineSymbols = true\n lineSymbolShowOn = \"all\"\n\n data {\n series = \"United States\",\"India\",\"China\",\"France\"\n \"1980\" = 10.4,7.5,6.6,7.5\n \"1990\" = 14.7,10.7,8.3,9.0\n \"2000\" = 17.3,10.5,10.5,11.3\n \"2010\" = 17.9,16.4,15.2,11.0\n \"2021\" = 19.9,22.1,15.7,12.7\n }\n\n scene \"US doubles\" {\n title = \"The US top 1% nearly doubled its income share since 1980\"\n highlight \"United States\"\n }\n\n scene \"India overtakes\" {\n title = \"India is now the most unequal of these major economies\"\n highlight \"India\"\n }\n\n scene \"France's modest rise\" {\n title = \"France's top 1% rose far less than the US or India\"\n highlight \"France\"\n }\n}\n", cr = "chart pie {\n title = \"Asia is home to nearly 60% of the world's population\"\n description = \"Estimated share, 2024\"\n source = \"United Nations\"\n sourceUrl = \"https://population.un.org\"\n colorPalette = \"Klimt\"\n legendPosition = \"right\"\n tooltips = true\n\n data {\n \"Asia\" = 58.9\n \"Africa\" = 18.6\n \"Europe\" = 9.1\n \"Latin America\" = 8.1\n \"North America\" = 4.7\n }\n}\n", lr = "chart bar-vertical {\n title = \"Brazil produces more coffee than the next three countries combined\"\n description = \"Million 60-kg bags, 2023/24 crop year\"\n source = \"USDA Foreign Agricultural Service\"\n sourceUrl = \"https://www.fas.usda.gov/data/coffee-world-markets-and-trade\"\n colorPalette = \"Harvey\"\n\n data {\n \"Brazil\" = 66.4\n \"Vietnam\" = 27.5\n \"Colombia\" = 12.76\n \"Ethiopia\" = 9.13\n \"Indonesia\" = 7.65\n \"Honduras\" = 5.5\n }\n\n highlight \"Brazil\"\n\n transform sort {\n column = \"value\"\n direction = descending\n }\n}\n", ur = "chart donut {\n title = \"The richest 1% own more wealth than the entire bottom 90% combined\"\n description = \"Share of global wealth by group, 2021\"\n source = \"World Inequality Report 2022\"\n sourceUrl = \"https://wir2022.wid.world\"\n colorPalette = \"Imperator\"\n legendPosition = \"right\"\n displayAsPercentage = true\n tooltips = true\n\n data {\n \"Top 1%\" = 38\n \"Next 9%\" = 38\n \"Middle 40%\" = 22\n \"Bottom 50%\" = 2\n }\n\n scene \"Top 1% spotlight\" {\n title = \"The top 1% hold 38% of all global wealth\"\n description = \"Share of global wealth by group, 2021\"\n highlight \"Top 1%\"\n }\n\n scene \"Bottom half\" {\n title = \"The bottom half of humanity owns just 2%\"\n description = \"Share of global wealth by group, 2021\"\n highlight \"Bottom 50%\"\n }\n\n scene \"Income tells a softer story\" {\n title = \"Income is concentrated too — but less than wealth\"\n description = \"Share of global income by the same groups, 2021\"\n highlight \"Top 1%\"\n data {\n \"Top 1%\" = 19\n \"Next 9%\" = 33\n \"Middle 40%\" = 39\n \"Bottom 50%\" = 9\n }\n }\n}\n", dr = "chart area {\n title = \"The US national debt has more than tripled since 2008\"\n description = \"Total federal debt outstanding, trillions of dollars\"\n source = \"U.S. Treasury, Fiscal Data\"\n sourceUrl = \"https://fiscaldata.treasury.gov\"\n\n annotation \"2008\" {\n text = \"Financial crisis\"\n showArrow = true\n textOffsetY = -14\n }\n\n data {\n \"2000\" = 5.7\n \"2004\" = 7.4\n \"2008\" = 10.0\n \"2012\" = 16.1\n \"2016\" = 19.6\n \"2020\" = 26.9\n \"2024\" = 35.5\n }\n}\n", fr = "chart area-stacked {\n title = \"Renewables' share of global energy has more than doubled since 2000\"\n description = \"Share of global primary energy by source, 2000–2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/energy-mix\"\n stackPercent = true\n areaSortMode = descending\n\n data {\n series = \"Coal\",\"Oil\",\"Gas\",\"Renewables\"\n \"2000\" = 27456,43017,23994,2997\n \"2005\" = 36201,47017,27439,3510\n \"2010\" = 42016,48193,31593,4868\n \"2015\" = 43695,51294,34780,6400\n \"2020\" = 42316,49101,38704,8569\n \"2023\" = 45319,54839,40151,10325\n }\n}\n", pr = "chart column-stacked {\n title = \"Natural gas and renewables pushed coal off the US power grid\"\n description = \"Share of US electricity generation by source, percent\"\n source = \"U.S. Energy Information Administration\"\n sourceUrl = \"https://www.eia.gov/electricity\"\n stackMode = \"percent\"\n\n data {\n series = \"Coal\",\"Natural gas\",\"Nuclear\",\"Renewables\"\n \"2010\" = 45,24,20,10\n \"2015\" = 33,33,20,13\n \"2020\" = 19,39,20,20\n \"2023\" = 16,43,19,21\n }\n}\n", mr = "chart bar-stacked {\n title = \"India has far more children than China, and a workforce nearly as large\"\n description = \"Millions of people, 2023\"\n source = \"UN Population Division\"\n sourceUrl = \"https://population.un.org\"\n colorPalette = \"London\"\n\n data {\n series = \"0-14\",\"15-64\",\"65+\"\n \"China\" = 232,988,200\n \"India\" = 354,978,97\n \"USA\" = 58,216,59\n \"Indonesia\" = 67,189,21\n \"Brazil\" = 43,148,24\n }\n}\n", hr = "chart area-stacked {\n title = \"EU subsidies to new members surged after enlargement\"\n description = \"Agricultural subsidies to post-socialist EU members, million euros\"\n source = \"Eurostat\"\n sourceUrl = \"https://ec.europa.eu/eurostat\"\n colorPalette = \"Enara\"\n interpolation = \"linear\"\n heightMode = \"aspect-ratio\"\n aspectRatio = \"1:1\"\n\n data {\n series = \"Indirect subsidies\",\"Direct subsidies\"\n \"2000\" = 370,800\n \"2001\" = 445,896\n \"2002\" = 567,816\n \"2003\" = 641,950\n \"2004\" = 1908,2434\n \"2005\" = 2234,3509\n \"2006\" = 2576,4356\n \"2007\" = 2467,5429\n \"2008\" = 2672,6655\n \"2009\" = 2474,7195\n \"2010\" = 2117,8207\n \"2011\" = 1863,9230\n \"2012\" = 1528,9191\n \"2013\" = 1251,10252\n \"2014\" = 1132,10987\n \"2015\" = 1687,10145\n }\n\n scene \"Indirect subsidies shrank\" {\n title = \"Indirect subsidies were cut under WTO pressure\"\n description = \"Subsidies tied to specific crops fell foul of World Trade Organization rules\"\n\n highlight \"Indirect subsidies\"\n }\n\n scene \"Direct subsidies dominate\" {\n title = \"Direct per-hectare payments now dominate\"\n description = \"The larger the fields, the more money farmers receive\"\n\n highlight \"Direct subsidies\"\n }\n\n scene \"Bulgaria: subsidies explode\" {\n title = \"Bulgarian farmers received almost nothing before 2007 accession\"\n description = \"More than three-quarters of Bulgarian subsidies are direct payments — the highest share among new members\"\n\n data {\n series = \"Indirect subsidies\",\"Direct subsidies\"\n \"2000\" = 0,5\n \"2001\" = 0,33\n \"2002\" = 0,48\n \"2003\" = 0,69\n \"2004\" = 0,67\n \"2005\" = 0,87\n \"2006\" = 0,57\n \"2007\" = 59,250\n \"2008\" = 75,484\n \"2009\" = 97,415\n \"2010\" = 79,466\n \"2011\" = 94,458\n \"2012\" = 120,617\n \"2013\" = 132,852\n \"2014\" = 143,821\n \"2015\" = 213,677\n }\n\n highlight \"Direct subsidies\"\n }\n\n scene \"Bulgarian farms grew\" {\n title = \"Average farm size in Bulgaria quadrupled\"\n description = \"Average farm size in hectares\"\n type = line\n\n data {\n \"2005\" = 5\n \"2007\" = 6\n \"2010\" = 12\n \"2013\" = 18\n }\n }\n\n scene \"Production rose\" {\n title = \"Bulgarian farm production rose from 3 to 4 billion euros\"\n description = \"Total production of Bulgarian farms, million euros\"\n type = area\n\n data {\n \"2000\" = 2933\n \"2001\" = 3240\n \"2002\" = 3051\n \"2003\" = 2816\n \"2004\" = 3049\n \"2005\" = 3011\n \"2006\" = 3111\n \"2007\" = 3038\n \"2008\" = 4148\n \"2009\" = 3437\n \"2010\" = 3486\n \"2011\" = 4038\n \"2012\" = 4161\n \"2013\" = 4115\n \"2014\" = 4138\n \"2015\" = 3915\n }\n }\n\n scene \"Cash crops replaced vegetables\" {\n title = \"Cash crops replaced vegetables in Bulgaria\"\n description = \"Production of Bulgarian farms, million euros\"\n type = area-stacked\n\n data {\n series = \"Vegetables\",\"Cash crops\",\"Other production\"\n \"2000\" = 464,615,1854\n \"2001\" = 458,777,2005\n \"2002\" = 577,850,1624\n \"2003\" = 539,818,1459\n \"2004\" = 483,1103,1463\n \"2005\" = 492,994,1525\n \"2006\" = 510,1083,1518\n \"2007\" = 436,936,1666\n \"2008\" = 541,2045,1563\n \"2009\" = 243,1553,1641\n \"2010\" = 184,2173,1128\n \"2011\" = 120,2853,1065\n \"2012\" = 117,2900,1144\n \"2013\" = 139,2802,1174\n \"2014\" = 143,3082,914\n \"2015\" = 144,2986,785\n }\n\n highlight \"Cash crops\"\n }\n\n scene \"Vegetables collapsed\" {\n title = \"Vegetable production fell by a factor of three\"\n description = \"A traditional Bulgarian cultivation shrank as subsidies favoured large fields\"\n\n highlight \"Vegetables\"\n }\n\n scene \"Every vegetable declined\" {\n title = \"Bulgarian vegetable production collapsed across the board\"\n description = \"Production volume indexed to 2001 = 100\"\n type = line-multi\n lineSymbols = false\n\n data {\n series = \"Cabbages\",\"Tomatoes\",\"Watermelons\",\"Carrots\",\"Onions\",\"Garlic\",\"Strawberries\"\n \"2001\" = 100,100,100,100,100,100,100\n \"2002\" = 79,90,124,64,106,95,100\n \"2003\" = 100,157,177,142,118,98,72\n \"2004\" = 84,87,83,245,124,138,74\n \"2005\" = 50,46,62,30,40,93,42\n \"2006\" = 52,78,113,95,56,80,56\n \"2007\" = 36,49,64,74,29,30,38\n \"2008\" = 47,49,66,97,44,29,55\n \"2009\" = 28,38,74,105,23,39,55\n \"2010\" = 57,42,51,76,53,57,37\n \"2011\" = 32,38,56,86,47,43,45\n \"2012\" = 34,34,46,69,29,43,31\n \"2013\" = 33,43,53,39,36,40,24\n \"2014\" = 31,44,28,69,37,8,27\n \"2015\" = 31,45,50,57,25,18,32\n }\n }\n\n scene \"Jobs disappeared\" {\n title = \"Family farmers disappeared while salaried ag jobs held steady\"\n description = \"EU agricultural employment, thousands of full-time equivalents\"\n type = line-multi\n lineSymbols = false\n\n data {\n series = \"Salaried workers\",\"Non-salaried workers\"\n \"2000\" = 2678,12194\n \"2001\" = 2598,11586\n \"2002\" = 2658,10795\n \"2003\" = 2563,10609\n \"2004\" = 2560,9999\n \"2005\" = 2501,10047\n \"2006\" = 2499,9782\n \"2007\" = 2437,9231\n \"2008\" = 2416,8971\n \"2009\" = 2348,8672\n \"2010\" = 2335,7808\n \"2011\" = 2322,7551\n \"2012\" = 2325,7501\n \"2013\" = 2297,7425\n \"2014\" = 2366,7183\n \"2015\" = 2413,6928\n \"2016\" = 2457,6741\n }\n\n highlight \"Non-salaried workers\"\n }\n}\n", gr = "chart bar-horizontal {\n title = \"China emits more CO₂ than the US and India combined\"\n description = \"Annual emissions in billion tonnes, 2023\"\n source = \"Our World in Data\"\n sourceUrl = \"https://ourworldindata.org/co2-emissions\"\n byline = \"Pierre Romera\"\n\n data {\n \"China\" = 12.17\n \"United States\" = 4.92\n \"India\" = 3.06\n \"Russia\" = 1.73\n \"Japan\" = 0.99\n \"Germany\" = 0.59\n }\n\n scene \"China spotlight\" {\n title = \"China alone emits more than the US and India together\"\n highlight \"China\"\n }\n\n scene \"India rising\" {\n title = \"India passed the EU to become the third-largest emitter\"\n highlight \"India\"\n }\n\n scene \"Japan declining\" {\n title = \"Japan's emissions have fallen since their 2013 peak\"\n highlight \"Japan\"\n }\n\n scene \"Per capita reframe\" {\n title = \"Per person, Gulf states dwarf the biggest emitters\"\n description = \"CO₂ emissions per capita, tonnes per person, 2023\"\n highlight \"Qatar\"\n data {\n \"Qatar\" = 40.13\n \"United Arab Emirates\" = 19.77\n \"United States\" = 14.32\n \"China\" = 8.56\n \"India\" = 2.13\n }\n }\n}\n", _r = "chart dot-plot {\n title = \"CDU/CSU led German polls at 29 % ahead of the 2021 election\"\n description = \"How Germany would vote in the September 2021 federal election, according to polling in the previous June\"\n source = \"FG Wahlen\"\n sourceUrl = \"https://www.forschungsgruppe.de\"\n note = \"Margin of error at 10%: +/- 2 percentage points; at 40%: +/- 3 percentage points\"\n dotStyle = \"range\"\n\n data {\n series = \"Poll\",\"High\",\"Low\"\n \"CDU/CSU\" = 29,32,27\n \"Greens\" = 22,25,20\n \"SPD\" = 14,16,12\n \"AfD\" = 10,12,8\n \"FDP\" = 10,12,8\n \"Left\" = 7,9,5\n }\n}\n", vr = "chart bar-grouped {\n title = \"Asia Pacific holds more renewable capacity than all other regions combined\"\n description = \"Installed capacity in gigawatts (GW), 2023\"\n source = \"IRENA\"\n sourceUrl = \"https://www.irena.org/Publications/2024/Mar/Renewable-capacity-statistics-2024\"\n colorPalette = \"Folklore\"\n\n data {\n series = \"Solar\",\"Wind\",\"Hydro\"\n \"Asia Pacific\" = 870,520,650\n \"Europe\" = 290,260,230\n \"North America\" = 150,170,200\n \"Latin America\" = 50,40,190\n \"Africa\" = 12,9,40\n }\n}\n", yr = "chart scatter {\n title = \"Richer countries live longer, but Nigeria lags far behind its wealth\"\n description = \"Life expectancy in years against GDP per capita (PPP, constant international dollars, log scale), 60 countries, bubble size is population in millions\"\n source = \"World Bank, World Development Indicators\"\n sourceUrl = \"https://databank.worldbank.org/source/world-development-indicators\"\n horizontalScaleType = \"log\"\n trend = \"overall\"\n\n data {\n series = \"GDP per capita\",\"Life expectancy\",\"Population\",\"Region\"\n \"Argentina\" = 26630, 76.8, 45.0, \"Americas\"\n \"Australia\" = 58049, 82.9, 25.3, \"East Asia & Pacific\"\n \"Bangladesh\" = 6838, 72.6, 164.9, \"South Asia\"\n \"Bolivia\" = 11931, 67.8, 11.7, \"Americas\"\n \"Brazil\" = 18019, 75.8, 207.5, \"Americas\"\n \"Botswana\" = 18106, 67.2, 2.3, \"Sub-Saharan Africa\"\n \"Canada\" = 57584, 82.2, 37.6, \"Americas\"\n \"Switzerland\" = 81695, 83.9, 8.6, \"Europe & Central Asia\"\n \"Chile\" = 28228, 80.3, 19.2, \"Americas\"\n \"China\" = 18821, 77.9, 1407.7, \"East Asia & Pacific\"\n \"Cote d'Ivoire\" = 5895, 60.3, 28.2, \"Sub-Saharan Africa\"\n \"Colombia\" = 17337, 76.8, 49.9, \"Americas\"\n \"Costa Rica\" = 23497, 80.3, 5.0, \"Americas\"\n \"Germany\" = 62950, 81.3, 83.1, \"Europe & Central Asia\"\n \"Ecuador\" = 13870, 77.3, 17.3, \"Americas\"\n \"Egypt\" = 15027, 71.2, 107.6, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Spain\" = 46896, 83.8, 47.1, \"Europe & Central Asia\"\n \"Ethiopia\" = 2438, 65.7, 115.7, \"Sub-Saharan Africa\"\n \"France\" = 53449, 82.8, 67.4, \"Europe & Central Asia\"\n \"United Kingdom\" = 53374, 81.4, 66.6, \"Europe & Central Asia\"\n \"Ghana\" = 6508, 64.5, 31.3, \"Sub-Saharan Africa\"\n \"Greece\" = 33503, 81.6, 10.7, \"Europe & Central Asia\"\n \"Guatemala\" = 11466, 71.6, 17.1, \"Americas\"\n \"Haiti\" = 3362, 64.3, 11.1, \"Americas\"\n \"Indonesia\" = 12758, 70.3, 272.5, \"East Asia & Pacific\"\n \"India\" = 7702, 70.7, 1389.0, \"South Asia\"\n \"Iran\" = 14841, 76.9, 87.1, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Israel\" = 44492, 82.8, 9.1, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Italy\" = 49691, 83.5, 59.7, \"Europe & Central Asia\"\n \"Jordan\" = 10168, 76.9, 10.7, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Japan\" = 46055, 84.4, 126.6, \"East Asia & Pacific\"\n \"Kenya\" = 5172, 62.9, 51.2, \"Sub-Saharan Africa\"\n \"Cambodia\" = 6449, 70.1, 16.5, \"East Asia & Pacific\"\n \"South Korea\" = 49791, 83.2, 51.8, \"East Asia & Pacific\"\n \"Sri Lanka\" = 14637, 76.7, 21.8, \"South Asia\"\n \"Morocco\" = 8768, 74.2, 36.2, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Mexico\" = 21704, 74.5, 125.8, \"Americas\"\n \"Malaysia\" = 31301, 75.9, 33.4, \"East Asia & Pacific\"\n \"Nigeria\" = 8362, 53.0, 209.5, \"Sub-Saharan Africa\"\n \"Norway\" = 90773, 83.0, 5.3, \"Europe & Central Asia\"\n \"New Zealand\" = 47392, 82.1, 5.0, \"East Asia & Pacific\"\n \"Pakistan\" = 5296, 66.7, 230.8, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Peru\" = 15461, 76.3, 32.4, \"Americas\"\n \"Philippines\" = 9452, 69.7, 110.8, \"East Asia & Pacific\"\n \"Poland\" = 38182, 77.9, 38.0, \"Europe & Central Asia\"\n \"Portugal\" = 40188, 81.7, 10.3, \"Europe & Central Asia\"\n \"Romania\" = 36399, 75.6, 19.4, \"Europe & Central Asia\"\n \"Russia\" = 37319, 73.1, 145.5, \"Europe & Central Asia\"\n \"Rwanda\" = 2754, 66.7, 12.8, \"Sub-Saharan Africa\"\n \"Saudi Arabia\" = 62648, 78.3, 30.1, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Senegal\" = 4071, 67.7, 16.4, \"Sub-Saharan Africa\"\n \"Sweden\" = 61071, 83.1, 10.3, \"Europe & Central Asia\"\n \"Thailand\" = 21280, 77.2, 71.5, \"East Asia & Pacific\"\n \"Turkey\" = 28741, 77.7, 82.6, \"Europe & Central Asia\"\n \"Tanzania\" = 3485, 66.0, 59.2, \"Sub-Saharan Africa\"\n \"Ukraine\" = 17637, 73.9, 45.0, \"Europe & Central Asia\"\n \"Uruguay\" = 30011, 77.5, 3.4, \"Americas\"\n \"United States\" = 69121, 78.8, 330.2, \"Americas\"\n \"Vietnam\" = 11629, 74.2, 97.2, \"East Asia & Pacific\"\n \"South Africa\" = 14353, 66.1, 59.6, \"Sub-Saharan Africa\" }\n\n highlight \"Nigeria\"\n\n annotation \"Nigeria\" {\n text = \"17 years below the trend\"\n showLine = true\n anchorDirection = SW\n textOffsetX = -60\n textOffsetY = 50\n lineStyle = elbow\n showArrow = false\n lineTargetDistance = 10\n }\n\n scene \"1990\" {\n title = \"In 1990 the same countries were poorer and lived shorter lives\"\n data {\n series = \"GDP per capita\",\"Life expectancy\",\"Population\",\"Region\"\n \"Argentina\" = 17007, 71.6, 32.8, \"Americas\"\n \"Australia\" = 36268, 77.0, 17.1, \"East Asia & Pacific\"\n \"Bangladesh\" = 2070, 55.8, 111.6, \"South Asia\"\n \"Bolivia\" = 6247, 56.8, 7.1, \"Americas\"\n \"Brazil\" = 12633, 65.9, 149.1, \"Americas\"\n \"Botswana\" = 10521, 60.1, 1.3, \"Sub-Saharan Africa\"\n \"Canada\" = 40475, 77.4, 27.7, \"Americas\"\n \"Switzerland\" = 63921, 77.2, 6.7, \"Europe & Central Asia\"\n \"Chile\" = 10955, 73.7, 13.4, \"Americas\"\n \"China\" = 1667, 68.2, 1135.2, \"East Asia & Pacific\"\n \"Cote d'Ivoire\" = 5256, 52.8, 12.2, \"Sub-Saharan Africa\"\n \"Colombia\" = 9999, 68.7, 32.4, \"Americas\"\n \"Costa Rica\" = 10980, 76.1, 3.1, \"Americas\"\n \"Germany\" = 42355, 75.1, 79.4, \"Europe & Central Asia\"\n \"Ecuador\" = 9105, 68.4, 10.5, \"Americas\"\n \"Egypt\" = 8007, 62.5, 58.4, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Spain\" = 31773, 76.8, 38.9, \"Europe & Central Asia\"\n \"Ethiopia\" = 874, 45.1, 47.6, \"Sub-Saharan Africa\"\n \"France\" = 38656, 76.6, 58.3, \"Europe & Central Asia\"\n \"United Kingdom\" = 33531, 75.9, 57.2, \"Europe & Central Asia\"\n \"Ghana\" = 2786, 55.4, 15.4, \"Sub-Saharan Africa\"\n \"Greece\" = 26916, 76.9, 10.2, \"Europe & Central Asia\"\n \"Guatemala\" = 7595, 61.8, 9.0, \"Americas\"\n \"Haiti\" = 3923, 53.2, 6.9, \"Americas\"\n \"Indonesia\" = 4873, 63.2, 183.5, \"East Asia & Pacific\"\n \"India\" = 2140, 58.6, 865.0, \"South Asia\"\n \"Iran\" = 9656, 64.1, 58.4, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Israel\" = 25341, 76.6, 4.7, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Italy\" = 42657, 77.0, 56.7, \"Europe & Central Asia\"\n \"Jordan\" = 8242, 70.1, 3.6, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Japan\" = 36138, 78.8, 123.5, \"East Asia & Pacific\"\n \"Kenya\" = 4177, 58.3, 22.9, \"Sub-Saharan Africa\"\n \"Cambodia\" = 2646, 55.2, 7.4, \"East Asia & Pacific\"\n \"South Korea\" = 14378, 71.6, 42.9, \"East Asia & Pacific\"\n \"Sri Lanka\" = 4562, 69.2, 16.4, \"South Asia\"\n \"Morocco\" = 4419, 62.4, 24.4, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Mexico\" = 17170, 69.0, 82.8, \"Americas\"\n \"Malaysia\" = 12014, 71.0, 17.8, \"East Asia & Pacific\"\n \"Nigeria\" = 5424, 45.7, 97.1, \"Sub-Saharan Africa\"\n \"Norway\" = 56608, 76.5, 4.2, \"Europe & Central Asia\"\n \"New Zealand\" = 30786, 75.4, 3.3, \"East Asia & Pacific\"\n \"Pakistan\" = 3200, 59.7, 116.2, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Peru\" = 6316, 64.0, 22.0, \"Americas\"\n \"Philippines\" = 4504, 64.4, 62.9, \"East Asia & Pacific\"\n \"Poland\" = 12821, 70.9, 38.1, \"Europe & Central Asia\"\n \"Portugal\" = 27191, 74.0, 10.0, \"Europe & Central Asia\"\n \"Romania\" = 16317, 69.7, 23.2, \"Europe & Central Asia\"\n \"Russia\" = 29644, 68.9, 148.0, \"Europe & Central Asia\"\n \"Rwanda\" = 1166, 47.8, 7.4, \"Sub-Saharan Africa\"\n \"Saudi Arabia\" = 65197, 68.9, 10.6, \"Middle East, North Africa, Afghanistan & Pakistan\"\n \"Senegal\" = 2923, 56.7, 7.7, \"Sub-Saharan Africa\"\n \"Sweden\" = 40200, 77.5, 8.6, \"Europe & Central Asia\"\n \"Thailand\" = 8703, 68.9, 54.7, \"East Asia & Pacific\"\n \"Turkey\" = 12184, 67.8, 56.0, \"Europe & Central Asia\"\n \"Tanzania\" = 1794, 52.0, 26.1, \"Sub-Saharan Africa\"\n \"Ukraine\" = 22816, 70.4, 52.1, \"Europe & Central Asia\"\n \"Uruguay\" = 14061, 73.0, 3.1, \"Americas\"\n \"United States\" = 44384, 75.2, 249.6, \"Americas\"\n \"Vietnam\" = 2468, 69.0, 65.5, \"East Asia & Pacific\"\n \"South Africa\" = 10811, 62.9, 40.7, \"Sub-Saharan Africa\" }\n }\n}\n", br = "chart dot-plot {\n title = \"Zimbabwe gained over 16 years of life expectancy since 2000, the United States under 1\"\n description = \"Life expectancy at birth in years, 2000 and 2022, for 10 countries\"\n source = \"World Bank, World Development Indicators\"\n sourceUrl = \"https://data.worldbank.org/indicator/SP.DYN.LE00.IN\"\n arrows = \"forward\"\n sortMode = \"gap\"\n\n data {\n series = \"2000\",\"2022\"\n \"Zimbabwe\" = 46.0, 62.4\n \"Ethiopia\" = 50.9, 66.9\n \"Nigeria\" = 47.1, 54.1\n \"India\" = 62.7, 71.7\n \"Russia\" = 65.5, 72.5\n \"South Africa\" = 58.4, 65.5\n \"China\" = 72.3, 78.2\n \"Japan\" = 81.1, 84.0\n \"Germany\" = 77.9, 80.6\n \"United States\" = 76.6, 77.4\n }\n}\n";
|
|
947
927
|
//#endregion
|
|
948
928
|
//#region src/samples.ts
|
|
949
|
-
function
|
|
929
|
+
function xr(e, t) {
|
|
950
930
|
let n = e.properties.find((e) => e.key === t);
|
|
951
931
|
return n ? String(n.value) : "";
|
|
952
932
|
}
|
|
953
|
-
function
|
|
933
|
+
function Sr(e) {
|
|
954
934
|
if (!e.data) return "";
|
|
955
935
|
let t = e.data.entries, n = t.find((e) => e.key === "series" && !e.quotedKey);
|
|
956
936
|
return n ? [["category", ...String(n.value).split(",")].join(" "), ...t.filter((e) => !(e.key === "series" && !e.quotedKey)).map((e) => {
|
|
@@ -958,61 +938,61 @@ function yr(e) {
|
|
|
958
938
|
return [e.key, ...t].join(" ");
|
|
959
939
|
})].join("\n") : [["label", "value"].join(" "), ...t.map((e) => [e.key, String(e.value)].join(" "))].join("\n");
|
|
960
940
|
}
|
|
961
|
-
function
|
|
941
|
+
function Cr(e) {
|
|
962
942
|
if (!e.data) return "";
|
|
963
943
|
let t = e.data.entries, n = t.find((e) => e.key === "series" && !e.quotedKey);
|
|
964
944
|
return n ? [`series = "${String(n.value)}"`, ...t.filter((e) => !(e.key === "series" && !e.quotedKey)).map((e) => `"${e.key}" = "${String(e.value)}"`)].join("\n") : t.map((e) => `"${e.key}" = ${String(e.value)}`).join("\n");
|
|
965
945
|
}
|
|
966
|
-
function
|
|
946
|
+
function q(e, t) {
|
|
967
947
|
let n = b(t);
|
|
968
948
|
return {
|
|
969
949
|
id: e,
|
|
970
|
-
title:
|
|
971
|
-
description:
|
|
950
|
+
title: xr(n, "title"),
|
|
951
|
+
description: xr(n, "description"),
|
|
972
952
|
chartType: n.chartType,
|
|
973
|
-
tsvData:
|
|
974
|
-
serializedData:
|
|
953
|
+
tsvData: Sr(n),
|
|
954
|
+
serializedData: Cr(n),
|
|
975
955
|
dsl: t
|
|
976
956
|
};
|
|
977
957
|
}
|
|
978
|
-
var
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
],
|
|
958
|
+
var wr = [
|
|
959
|
+
q("letter-frequency", er),
|
|
960
|
+
q("co2-emissions", tr),
|
|
961
|
+
q("coffee-production", lr),
|
|
962
|
+
q("spoken-languages", nr),
|
|
963
|
+
q("quarterly-revenue", rr),
|
|
964
|
+
q("medal-count", ir),
|
|
965
|
+
q("temperature-anomaly", ar),
|
|
966
|
+
q("bitcoin-price", or),
|
|
967
|
+
q("unemployment-rates", sr),
|
|
968
|
+
q("browser-market", ur),
|
|
969
|
+
q("world-population", cr),
|
|
970
|
+
q("stock-price-area", dr),
|
|
971
|
+
q("energy-mix-stacked-area", fr),
|
|
972
|
+
q("quarterly-stacked-columns", pr),
|
|
973
|
+
q("population-stacked-bar", mr),
|
|
974
|
+
q("renewable-capacity", vr),
|
|
975
|
+
q("farm-compass", hr),
|
|
976
|
+
q("co2-emissions-story", gr),
|
|
977
|
+
q("life-expectancy-wealth", yr),
|
|
978
|
+
q("election-polls", _r),
|
|
979
|
+
q("life-expectancy-gains", br)
|
|
980
|
+
], Tr = class extends Error {
|
|
1001
981
|
constructor(e, t) {
|
|
1002
982
|
super(e, t), this.name = "ChartParseError";
|
|
1003
983
|
}
|
|
1004
|
-
},
|
|
984
|
+
}, Er = class extends Error {
|
|
1005
985
|
constructor(e = "PNG export is only available in Node. Use toSvg() in the browser.") {
|
|
1006
986
|
super(e), this.name = "PngBrowserUnsupportedError";
|
|
1007
987
|
}
|
|
1008
|
-
},
|
|
988
|
+
}, Dr = class extends Error {
|
|
1009
989
|
constructor(e) {
|
|
1010
990
|
super(e), this.name = "MissingNodeRenderDepsError";
|
|
1011
991
|
}
|
|
1012
992
|
};
|
|
1013
993
|
//#endregion
|
|
1014
994
|
//#region src/render/backends/dom-backend.ts
|
|
1015
|
-
function
|
|
995
|
+
function Or() {
|
|
1016
996
|
return {
|
|
1017
997
|
kind: "dom",
|
|
1018
998
|
createContainer(e, t) {
|
|
@@ -1023,7 +1003,7 @@ function Tr() {
|
|
|
1023
1003
|
};
|
|
1024
1004
|
},
|
|
1025
1005
|
renderToContainer(e, t, n) {
|
|
1026
|
-
|
|
1006
|
+
st(e, t, {
|
|
1027
1007
|
sceneIndex: n.sceneIndex,
|
|
1028
1008
|
thumbnail: n.thumbnail ?? !1,
|
|
1029
1009
|
transition: !1,
|
|
@@ -1042,23 +1022,23 @@ function Tr() {
|
|
|
1042
1022
|
throw Error("dom-backend: renderToContainer produced no frame");
|
|
1043
1023
|
},
|
|
1044
1024
|
rasterizePng() {
|
|
1045
|
-
return Promise.reject(new
|
|
1025
|
+
return Promise.reject(new Er());
|
|
1046
1026
|
}
|
|
1047
1027
|
};
|
|
1048
1028
|
}
|
|
1049
1029
|
//#endregion
|
|
1050
1030
|
//#region src/render/frame-svg.ts
|
|
1051
|
-
var
|
|
1031
|
+
var kr = {
|
|
1052
1032
|
background: "#ffffff",
|
|
1053
1033
|
color: "#333333"
|
|
1054
|
-
},
|
|
1034
|
+
}, Ar = {
|
|
1055
1035
|
background: "#1c1c1c",
|
|
1056
1036
|
color: "rgba(255, 255, 255, 0.9)"
|
|
1057
|
-
},
|
|
1058
|
-
function
|
|
1059
|
-
return e === "dark" ? { ...
|
|
1037
|
+
}, jr = "sans-serif", Mr = 20, Nr = 14, J = 12, Y = 1.25, Pr = 4, Fr = 8, Ir = 12, Lr = 40, Rr = "16px", zr = "Blueprint Chart", Br = "Source: ", Vr = " · ", Hr = .6;
|
|
1038
|
+
function Ur(e) {
|
|
1039
|
+
return e === "dark" ? { ...Ar } : { ...kr };
|
|
1060
1040
|
}
|
|
1061
|
-
function
|
|
1041
|
+
function Wr() {
|
|
1062
1042
|
if (typeof document > "u") return null;
|
|
1063
1043
|
try {
|
|
1064
1044
|
return document.createElement("canvas").getContext("2d");
|
|
@@ -1066,11 +1046,11 @@ function Hr() {
|
|
|
1066
1046
|
return null;
|
|
1067
1047
|
}
|
|
1068
1048
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let e =
|
|
1049
|
+
function Gr() {
|
|
1050
|
+
let e = Wr();
|
|
1071
1051
|
return (t, n, r) => {
|
|
1072
|
-
let i = t.length * n *
|
|
1073
|
-
return e ? (e.font = `${r ? "bold " : ""}${n}px ${
|
|
1052
|
+
let i = t.length * n * Hr;
|
|
1053
|
+
return e ? (e.font = `${r ? "bold " : ""}${n}px ${jr}`, Math.max(e.measureText(t).width, i)) : i;
|
|
1074
1054
|
};
|
|
1075
1055
|
}
|
|
1076
1056
|
function X(e, t, n, r, i) {
|
|
@@ -1098,43 +1078,43 @@ function Z(e, t, n) {
|
|
|
1098
1078
|
fontStyle: n.fontStyle,
|
|
1099
1079
|
fill: n.fill,
|
|
1100
1080
|
anchor: n.anchor
|
|
1101
|
-
}), r += n.fontSize *
|
|
1081
|
+
}), r += n.fontSize * Y;
|
|
1102
1082
|
return r;
|
|
1103
1083
|
}
|
|
1104
|
-
function
|
|
1084
|
+
function Kr(e) {
|
|
1105
1085
|
let t = parseFloat(e) || 0;
|
|
1106
1086
|
return /r?em$/.test(e) ? t * 16 : t;
|
|
1107
1087
|
}
|
|
1108
|
-
function
|
|
1109
|
-
let t = e.frame ?? {}, n =
|
|
1110
|
-
t.title && (
|
|
1088
|
+
function qr(e) {
|
|
1089
|
+
let t = e.frame ?? {}, n = Ur(e.theme), [r, i, a, o] = l(t.padding ?? Rr).map(Kr), s = Math.max(e.width - o - i, 1), c = Gr(), u = [], d = r;
|
|
1090
|
+
t.title && (d = Z(u, X(t.title, s, Mr, !0, c), {
|
|
1111
1091
|
x: o,
|
|
1112
|
-
top:
|
|
1113
|
-
fontSize:
|
|
1092
|
+
top: d,
|
|
1093
|
+
fontSize: Mr,
|
|
1114
1094
|
fontWeight: "bold",
|
|
1115
1095
|
fill: n.color
|
|
1116
|
-
})), t.description && (
|
|
1096
|
+
})), t.description && (d = Z(u, X(t.description, s, Nr, !1, c), {
|
|
1117
1097
|
x: o,
|
|
1118
|
-
top: t.title ?
|
|
1119
|
-
fontSize:
|
|
1098
|
+
top: t.title ? d + Pr : d,
|
|
1099
|
+
fontSize: Nr,
|
|
1120
1100
|
fill: n.color
|
|
1121
1101
|
}));
|
|
1122
|
-
let f =
|
|
1123
|
-
return v = Z(
|
|
1102
|
+
let f = d, p = t.note ? X(t.note, s, J, !1, c) : [], m = c(zr, J, !1), h = [t.byline, t.source ? Br + t.source : ""].filter(Boolean).join(Vr), g = h ? X(h, Math.max(s - m - Ir, 1), J, !1, c) : [], ee = Math.max(g.length, 1), te = p.length * J * Y + Fr + ee * J * Y + a, _ = Math.max(e.height - f - te, Lr), v = f + _;
|
|
1103
|
+
return v = Z(u, p, {
|
|
1124
1104
|
x: o,
|
|
1125
1105
|
top: v,
|
|
1126
|
-
fontSize:
|
|
1106
|
+
fontSize: J,
|
|
1127
1107
|
fontStyle: "italic",
|
|
1128
1108
|
fill: n.color
|
|
1129
|
-
}) +
|
|
1109
|
+
}) + Fr, Z(u, g, {
|
|
1130
1110
|
x: o,
|
|
1131
1111
|
top: v,
|
|
1132
|
-
fontSize:
|
|
1112
|
+
fontSize: J,
|
|
1133
1113
|
fill: n.color
|
|
1134
|
-
}), Z(
|
|
1114
|
+
}), Z(u, [zr], {
|
|
1135
1115
|
x: e.width - i,
|
|
1136
1116
|
top: v,
|
|
1137
|
-
fontSize:
|
|
1117
|
+
fontSize: J,
|
|
1138
1118
|
fontWeight: "600",
|
|
1139
1119
|
fill: n.color,
|
|
1140
1120
|
anchor: "end"
|
|
@@ -1147,10 +1127,10 @@ function Gr(e) {
|
|
|
1147
1127
|
width: s,
|
|
1148
1128
|
height: _
|
|
1149
1129
|
},
|
|
1150
|
-
blocks:
|
|
1130
|
+
blocks: u,
|
|
1151
1131
|
background: t.transparentBackground ? null : n.background,
|
|
1152
1132
|
color: n.color,
|
|
1153
|
-
fontFamily:
|
|
1133
|
+
fontFamily: jr
|
|
1154
1134
|
};
|
|
1155
1135
|
}
|
|
1156
1136
|
function Q(e) {
|
|
@@ -1159,7 +1139,7 @@ function Q(e) {
|
|
|
1159
1139
|
function $(e) {
|
|
1160
1140
|
return Q(e).replace(/"/g, """);
|
|
1161
1141
|
}
|
|
1162
|
-
function
|
|
1142
|
+
function Jr(e, t) {
|
|
1163
1143
|
return [
|
|
1164
1144
|
`<text x="${e.x}" y="${e.y}" font-size="${e.fontSize}px"`,
|
|
1165
1145
|
e.fontFamily ? ` font-family="${$(e.fontFamily)}"` : "",
|
|
@@ -1171,7 +1151,7 @@ function Kr(e, t) {
|
|
|
1171
1151
|
"</text>"
|
|
1172
1152
|
].join("");
|
|
1173
1153
|
}
|
|
1174
|
-
function
|
|
1154
|
+
function Yr(e, t, n) {
|
|
1175
1155
|
return [
|
|
1176
1156
|
`<svg xmlns="http://www.w3.org/2000/svg" width="${e.width}" height="${e.height}"`,
|
|
1177
1157
|
` viewBox="0 0 ${e.width} ${e.height}" role="img" aria-label="${$(n.label)}"`,
|
|
@@ -1179,97 +1159,107 @@ function qr(e, t, n) {
|
|
|
1179
1159
|
`<title>${Q(n.label)}</title>`,
|
|
1180
1160
|
`<desc>${Q(n.description)}</desc>`,
|
|
1181
1161
|
e.background ? `<rect width="100%" height="100%" fill="${$(e.background)}"></rect>` : "",
|
|
1182
|
-
...e.blocks.map((t) =>
|
|
1162
|
+
...e.blocks.map((t) => Jr(t, e)),
|
|
1183
1163
|
`<g transform="translate(${e.plot.x},${e.plot.y})">${t}</g>`,
|
|
1184
1164
|
"</svg>"
|
|
1185
1165
|
].join("");
|
|
1186
1166
|
}
|
|
1187
1167
|
//#endregion
|
|
1188
1168
|
//#region src/render/public-render.ts
|
|
1189
|
-
var
|
|
1190
|
-
function
|
|
1169
|
+
var Xr = 640, Zr = 400;
|
|
1170
|
+
function Qr() {
|
|
1191
1171
|
return typeof document < "u" && typeof document.createElement == "function";
|
|
1192
1172
|
}
|
|
1193
|
-
async function
|
|
1194
|
-
return
|
|
1173
|
+
async function $r() {
|
|
1174
|
+
return Qr() ? Or() : (await import("@blueprint-chart/lib/internal/node-backend")).createNodeBackend();
|
|
1195
1175
|
}
|
|
1196
|
-
async function
|
|
1176
|
+
async function ei(e, t = {}) {
|
|
1197
1177
|
let n;
|
|
1198
1178
|
try {
|
|
1199
|
-
n =
|
|
1179
|
+
n = Ne(b(e));
|
|
1200
1180
|
} catch (e) {
|
|
1201
|
-
throw new
|
|
1181
|
+
throw new Tr(e instanceof Error ? e.message : String(e), { cause: e });
|
|
1202
1182
|
}
|
|
1203
|
-
let r = await
|
|
1183
|
+
let r = await $r(), i = t.frame ?? !0, a = {
|
|
1204
1184
|
sceneIndex: t.scene,
|
|
1205
|
-
width: t.width ??
|
|
1206
|
-
height: t.height ??
|
|
1185
|
+
width: t.width ?? Xr,
|
|
1186
|
+
height: t.height ?? Zr
|
|
1207
1187
|
};
|
|
1208
1188
|
function o(e, t) {
|
|
1209
|
-
let { background: n, color: r } =
|
|
1189
|
+
let { background: n, color: r } = Ur(t);
|
|
1210
1190
|
e.style.backgroundColor = n, e.style.setProperty("--bc-text-color", r);
|
|
1211
1191
|
}
|
|
1212
|
-
|
|
1192
|
+
let s = t.theme === "auto" ? void 0 : t.theme, c = s ? null : zt();
|
|
1193
|
+
function l(e) {
|
|
1194
|
+
return s ?? e ?? (c?.matches ? "dark" : void 0);
|
|
1195
|
+
}
|
|
1196
|
+
function u(e, t, i) {
|
|
1213
1197
|
r.renderToContainer(e, n, {
|
|
1214
|
-
sceneIndex:
|
|
1215
|
-
thumbnail:
|
|
1216
|
-
theme:
|
|
1198
|
+
sceneIndex: i,
|
|
1199
|
+
thumbnail: t,
|
|
1200
|
+
theme: l(C(n, i).theme)
|
|
1217
1201
|
});
|
|
1218
1202
|
}
|
|
1219
|
-
|
|
1220
|
-
|
|
1203
|
+
let d = /* @__PURE__ */ new Map();
|
|
1204
|
+
function f() {
|
|
1205
|
+
d.forEach((e, t) => {
|
|
1206
|
+
t.isConnected ? u(t, !i, e) : d.delete(t);
|
|
1207
|
+
}), d.size || c?.removeEventListener("change", f);
|
|
1208
|
+
}
|
|
1209
|
+
function p(e) {
|
|
1210
|
+
let t = e.width ?? a.width, s = e.height ?? a.height, c = C(n, a.sceneIndex), d = l(c.theme);
|
|
1221
1211
|
if (!i) {
|
|
1222
|
-
let { container: e, cleanup:
|
|
1212
|
+
let { container: e, cleanup: n } = r.createContainer(t, s);
|
|
1223
1213
|
try {
|
|
1224
|
-
return o(e, d),
|
|
1214
|
+
return o(e, d), u(e, !0, a.sceneIndex), r.serializeSvg(e);
|
|
1225
1215
|
} finally {
|
|
1226
|
-
|
|
1216
|
+
n();
|
|
1227
1217
|
}
|
|
1228
1218
|
}
|
|
1229
|
-
let f =
|
|
1230
|
-
width:
|
|
1231
|
-
height:
|
|
1232
|
-
frame:
|
|
1219
|
+
let f = qr({
|
|
1220
|
+
width: t,
|
|
1221
|
+
height: s,
|
|
1222
|
+
frame: c.frame,
|
|
1233
1223
|
theme: d
|
|
1234
1224
|
}), { container: p, cleanup: m } = r.createContainer(f.plot.width, f.plot.height);
|
|
1235
1225
|
try {
|
|
1236
|
-
o(p, d),
|
|
1237
|
-
let e =
|
|
1238
|
-
return
|
|
1226
|
+
o(p, d), u(p, !0, a.sceneIndex);
|
|
1227
|
+
let e = _t(c.chartType, c.frame, c.data);
|
|
1228
|
+
return Yr(f, r.serializeSvg(p), e);
|
|
1239
1229
|
} finally {
|
|
1240
1230
|
m();
|
|
1241
1231
|
}
|
|
1242
1232
|
}
|
|
1243
|
-
let
|
|
1233
|
+
let m = {
|
|
1244
1234
|
async toSvg(e = {}) {
|
|
1245
|
-
return
|
|
1235
|
+
return p(e);
|
|
1246
1236
|
},
|
|
1247
1237
|
async toHtml(e = {}) {
|
|
1248
1238
|
let { container: t, cleanup: n } = r.createContainer(e.width ?? a.width, e.height ?? a.height);
|
|
1249
1239
|
try {
|
|
1250
|
-
return
|
|
1240
|
+
return u(t, !i, a.sceneIndex), r.serializeFrame(t);
|
|
1251
1241
|
} finally {
|
|
1252
1242
|
n();
|
|
1253
1243
|
}
|
|
1254
1244
|
},
|
|
1255
1245
|
async toPng(e = {}) {
|
|
1256
|
-
let t =
|
|
1246
|
+
let t = p(e);
|
|
1257
1247
|
return r.rasterizePng(t, {
|
|
1258
1248
|
width: e.width ?? a.width,
|
|
1259
1249
|
height: e.height ?? a.height
|
|
1260
1250
|
});
|
|
1261
1251
|
},
|
|
1262
1252
|
mount(e) {
|
|
1263
|
-
if (r.kind !== "dom") return console.warn("Blueprint Chart: mount() is a no-op outside a browser environment."),
|
|
1253
|
+
if (r.kind !== "dom") return console.warn("Blueprint Chart: mount() is a no-op outside a browser environment."), m;
|
|
1264
1254
|
let t = typeof e == "string" ? document.querySelector(e) : e;
|
|
1265
1255
|
if (!t) throw Error(`Blueprint Chart: mount target "${String(e)}" not found`);
|
|
1266
|
-
return
|
|
1256
|
+
return u(t, !i, a.sceneIndex), c && !d.size && c.addEventListener("change", f), d.set(t, a.sceneIndex), m;
|
|
1267
1257
|
},
|
|
1268
1258
|
scene(e) {
|
|
1269
|
-
return a.sceneIndex = e,
|
|
1259
|
+
return a.sceneIndex = e, m;
|
|
1270
1260
|
}
|
|
1271
1261
|
};
|
|
1272
|
-
return
|
|
1262
|
+
return m;
|
|
1273
1263
|
}
|
|
1274
1264
|
//#endregion
|
|
1275
|
-
export {
|
|
1265
|
+
export { de as ANNOTATION_KIND_KEYWORD, tt as Anchor, r as AnnotationKind, et as AnnotationLineStyle, se as ArrowDirection, le as AxisDirection, Be as BC_TRANSITION_NAME, fe as ChartOptionType, Tr as ChartParseError, p as ChartType, _ as CompassDirection, oe as CrosshairDirection, he as CrosshairStyle, jt as DEFAULT_BAR_GAP, Dt as DEFAULT_COLORS, It as DirectLabelMode, a as DotStyle, Se as DslNodeType, ee as FilterCondition, be as FrameSizing, we as GridStyle, h as Interpolation, ie as LabelPosition, gt as LabelRotation, ne as LegendPosition, Oe as LineStyle, ke as MAPPING_NONE, Dr as MissingNodeRenderDepsError, Ot as NULL_VALUE, Ee as Orientation, Ae as ParseOperationCategory, Er as PngBrowserUnsupportedError, Rt as RESIZE_MESSAGE, me as RangeAnchor, t as ScaleType, Fe as SceneTransition, Ue as SortDirection, wt as SortMode, ct as StackMode, vt as StrokeStyle, Ze as SymbolShape, Pe as SymbolShowOn, dt as SymbolStyle, ut as TRANSFORM_TYPES, xt as TickPosition, ze as TransformType, rt as ValueLabelPosition, Le as adjustColorsForBackground, bt as applyTransformNodes, Re as applyTransformNodesToChartData, nt as applyTransformSteps, Ne as astToDefinition, ae as buildChartOptions, Yr as buildFrameSvg, Bt as buildSrcdoc, Ve as chartDataToTable, en as checkCvdColors, Ht as classifyIntent, Ge as cleanNumericValue, Xe as commitFadeOut, dn as compactSerialize, un as compactSerializeDeep, At as convertAnnotations, ve as convertAreaFills, u as convertColorizes, c as convertHighlights, ue as convertSeriesOverrides, Ft as createCanvas, Xt as createCvdSvgFilter, d as createFrame, w as dataEntriesToString, pt as detectColumnTypes, re as detectRangeColumn, n as extractChartTypeOptions, $e as extractSceneOverrides, Je as fadeIn, yt as featureJoin, St as getCachedChart, xe as getChart, g as getChartOptions, f as getChartTypeDefaults, Yt as getCvdFilterId, Ie as getOutputType, ft as getSceneTransition, Me as getTransitionDuration, at as isDateValue, Ye as isNumberValue, We as isSeriesHidden, Mt as isTypeCompatible, S as listCharts, He as listPalettes, Lt as listThemes, pe as numericColumns, b as parse, qe as parseBpcData, x as parseData, ge as parseOperationMap, o as parseOperations, y as propertyMap, T as quoteDslString, Kt as recommendCharts, Ce as registerChart, ei as render, Ct as renderBpc, st as renderChart, mt as renderHorizontalAxis, it as renderLegend, ot as renderVerticalAxis, Nt as resolveBackgroundColor, ye as resolveBarGapPadding, te as resolveChartTypeOptions, ht as resolveDotPlotMapping, Ke as resolvePalette, e as resolveScatterMapping, C as resolveScene, Tt as resolveSeriesColor, lt as resolveSeriesInterpolation, wr as samples, on as serialize, je as serializeTableData, Wt as shapeOf, Qt as simulateCvdColor, kt as snapshotForFadeOut, Qe as snapshotLiveAttrs, i as stripDigitGroupSpaces, ce as toBool, Et as transformNodesToSteps, Pt as transformValue, qn as validateChart, _e as wcagContrastRatio, s as wcagLevel };
|