@blueprint-chart/lib 2.13.0 → 2.15.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/scale-helpers.d.ts +3 -0
- package/dist/charts/sort-helpers.d.ts +15 -1
- package/dist/charts/stack-helpers.d.ts +5 -0
- package/dist/charts/types/dot-plot/rows.d.ts +5 -1
- package/dist/charts/types.d.ts +24 -0
- package/dist/enums.d.ts +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +385 -384
- package/dist/lib/lib.iife.js +16 -16
- package/dist/node-backend/index.js +2751 -2549
- package/dist/{render-bpc-Df2pX315.js → render-bpc-CPj5h-p4.js} +2554 -2352
- package/dist/runtime.js +1 -1
- package/package.json +1 -1
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 { c 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-CPj5h-p4.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 zt = [
|
|
|
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,21 +141,21 @@ var Ut = {
|
|
|
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
153
|
//#region src/charts/colorblind.ts
|
|
154
|
-
var
|
|
154
|
+
var qt = {
|
|
155
155
|
protanopia: "Protanopia (no red)",
|
|
156
156
|
deuteranopia: "Deuteranopia (no green)",
|
|
157
157
|
tritanopia: "Tritanopia (no blue)"
|
|
158
|
-
},
|
|
158
|
+
}, Jt = {
|
|
159
159
|
protanopia: [
|
|
160
160
|
.152286,
|
|
161
161
|
1.052583,
|
|
@@ -223,27 +223,27 @@ var Gt = {
|
|
|
223
223
|
0
|
|
224
224
|
]
|
|
225
225
|
};
|
|
226
|
-
function
|
|
226
|
+
function Yt(e) {
|
|
227
227
|
return `bc-cvd-${e}`;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function Xt(e) {
|
|
230
230
|
let t = "http://www.w3.org/2000/svg", n = document.createElementNS(t, "filter");
|
|
231
|
-
n.setAttribute("id",
|
|
231
|
+
n.setAttribute("id", Yt(e)), n.setAttribute("color-interpolation-filters", "linearRGB");
|
|
232
232
|
let r = document.createElementNS(t, "feColorMatrix");
|
|
233
|
-
return r.setAttribute("type", "matrix"), r.setAttribute("values",
|
|
233
|
+
return r.setAttribute("type", "matrix"), r.setAttribute("values", Jt[e].join(" ")), n.appendChild(r), n;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function Zt(e) {
|
|
236
236
|
return e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function k(e) {
|
|
239
239
|
return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
|
|
240
240
|
}
|
|
241
|
-
function
|
|
242
|
-
let [n, r, i] = (
|
|
243
|
-
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();
|
|
244
244
|
}
|
|
245
|
-
var
|
|
246
|
-
function
|
|
245
|
+
var $t = 10;
|
|
246
|
+
function en(e) {
|
|
247
247
|
if (e.length < 2) return [];
|
|
248
248
|
let t = [
|
|
249
249
|
"protanopia",
|
|
@@ -251,10 +251,10 @@ function Qt(e) {
|
|
|
251
251
|
"tritanopia"
|
|
252
252
|
], n = [];
|
|
253
253
|
for (let r of t) {
|
|
254
|
-
let t = e.map((e) =>
|
|
254
|
+
let t = e.map((e) => Qt(e, r)), i = [];
|
|
255
255
|
for (let n = 0; n < t.length; n++) for (let r = n + 1; r < t.length; r++) {
|
|
256
|
-
let a =
|
|
257
|
-
a <
|
|
256
|
+
let a = E.deltaE(t[n], t[r]);
|
|
257
|
+
a < $t && i.push({
|
|
258
258
|
a: e[n],
|
|
259
259
|
b: e[r],
|
|
260
260
|
deltaE: a
|
|
@@ -262,7 +262,7 @@ function Qt(e) {
|
|
|
262
262
|
}
|
|
263
263
|
i.length > 0 && n.push({
|
|
264
264
|
type: r,
|
|
265
|
-
label:
|
|
265
|
+
label: qt[r],
|
|
266
266
|
pairs: i
|
|
267
267
|
});
|
|
268
268
|
}
|
|
@@ -270,162 +270,162 @@ function Qt(e) {
|
|
|
270
270
|
}
|
|
271
271
|
//#endregion
|
|
272
272
|
//#region src/dsl/serializer.ts
|
|
273
|
-
function
|
|
273
|
+
function A(e, t) {
|
|
274
274
|
return (e ?? []).flatMap((e) => e.split("\n").map((e) => `${t}// ${e.trim()}`));
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function j(e, t) {
|
|
277
277
|
return t == null ? e : t.includes("\n") ? `${e} /* ${t} */` : `${e} // ${t}`;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
return [...
|
|
279
|
+
function M(e, t) {
|
|
280
|
+
return [...A(e.trailingComments, `${t} `), j(`${t}}`, e.trailingComment)];
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
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));
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
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);
|
|
287
287
|
}
|
|
288
|
-
function
|
|
289
|
-
let n =
|
|
290
|
-
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");
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function nn(e, t) {
|
|
293
293
|
let n;
|
|
294
|
-
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");
|
|
295
300
|
}
|
|
296
301
|
function I(e, t) {
|
|
297
|
-
let n = [...
|
|
298
|
-
for (let
|
|
299
|
-
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");
|
|
300
305
|
}
|
|
301
306
|
function L(e, t) {
|
|
302
|
-
|
|
303
|
-
for (let n of e.properties) r.push(F(n, `${t} `));
|
|
304
|
-
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");
|
|
305
308
|
}
|
|
306
309
|
function R(e, t) {
|
|
307
|
-
|
|
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");
|
|
308
313
|
}
|
|
309
314
|
function z(e, t) {
|
|
310
|
-
let n =
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
let n = e.kind ?? T.Point;
|
|
316
|
-
if (n === T.Range) {
|
|
317
|
-
let n = [...j(e.leadingComments, t), `${t}range {`];
|
|
318
|
-
for (let r of e.properties) n.push(F(r, `${t} `));
|
|
319
|
-
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");
|
|
320
320
|
}
|
|
321
|
-
if (n ===
|
|
322
|
-
let n = [...
|
|
323
|
-
for (let r of e.properties) n.push(
|
|
324
|
-
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");
|
|
325
325
|
}
|
|
326
|
-
let
|
|
327
|
-
for (let n of e.properties)
|
|
328
|
-
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");
|
|
329
346
|
}
|
|
330
347
|
function V(e, t) {
|
|
331
|
-
let n = [...
|
|
332
|
-
for (let r of e.properties) n.push(
|
|
333
|
-
return n.push(...
|
|
334
|
-
}
|
|
335
|
-
function
|
|
336
|
-
let n = e.name == null ? `${t}scene {` : `${t}scene ${E(e.name)} {`, r = [...j(e.leadingComments, t), n];
|
|
337
|
-
for (let n of e.properties) r.push(F(n, `${t} `));
|
|
338
|
-
e.data && r.push(I(e.data, `${t} `));
|
|
339
|
-
for (let n of e.colorizes) r.push(L(n, `${t} `));
|
|
340
|
-
for (let n of e.highlights) r.push(R(n, `${t} `));
|
|
341
|
-
for (let n of e.areaFills) r.push(z(n, `${t} `));
|
|
342
|
-
for (let n of e.annotations) r.push(B(n, `${t} `));
|
|
343
|
-
for (let n of e.series) r.push(V(n, `${t} `));
|
|
344
|
-
for (let n of e.transforms) r.push(H(n, `${t} `));
|
|
345
|
-
return r.push(...N(e, t)), r.join("\n");
|
|
346
|
-
}
|
|
347
|
-
function H(e, t) {
|
|
348
|
-
let n = [...j(e.leadingComments, t), `${t}transform ${e.transformType} {`];
|
|
349
|
-
for (let r of e.properties) n.push(F(r, `${t} `));
|
|
350
|
-
return n.push(...N(e, t)), n.join("\n");
|
|
351
|
-
}
|
|
352
|
-
function nn(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) {
|
|
353
353
|
let r = g(n).find((t) => t.key === e);
|
|
354
354
|
return !r || r.default === void 0 ? !1 : String(r.default) === String(t);
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function on(e) {
|
|
357
357
|
let t = [`chart ${e.chartType} {`];
|
|
358
|
-
for (let n of e.properties) t.push(
|
|
359
|
-
e.data && t.push(
|
|
360
|
-
for (let n of e.colorizes) t.push(
|
|
361
|
-
for (let n of e.highlights) t.push(
|
|
362
|
-
for (let n of e.areaFills) t.push(
|
|
363
|
-
for (let n of e.annotations) t.push(
|
|
364
|
-
for (let n of e.series) t.push(
|
|
365
|
-
for (let n of e.scenes) t.push(
|
|
366
|
-
for (let n of e.transforms) t.push(
|
|
367
|
-
return t.push(...
|
|
368
|
-
}
|
|
369
|
-
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) {
|
|
370
370
|
return new Map(e.map((e) => [e.key, e.value]));
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function H(e, t, n, r) {
|
|
373
373
|
let i = g(n).find((t) => t.key === e);
|
|
374
374
|
return i ? r.has(e) ? String(r.get(e)) === String(t) : i.default !== void 0 && String(i.default) === String(t) : !1;
|
|
375
375
|
}
|
|
376
|
-
function
|
|
377
|
-
let i = [...
|
|
378
|
-
for (let a of e.properties) (a.isPercentage || !
|
|
379
|
-
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");
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
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);
|
|
383
383
|
for (let n of e.properties) {
|
|
384
384
|
if (n.key === "type") {
|
|
385
|
-
s.push(
|
|
385
|
+
s.push(P(n, `${t} `));
|
|
386
386
|
continue;
|
|
387
387
|
}
|
|
388
|
-
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} `));
|
|
389
389
|
}
|
|
390
|
-
e.data && s.push(
|
|
391
|
-
for (let n of e.colorizes) s.push(
|
|
392
|
-
for (let n of e.highlights) s.push(
|
|
393
|
-
for (let n of e.areaFills) s.push(
|
|
394
|
-
for (let n of e.annotations) s.push(
|
|
395
|
-
for (let n of e.series) s.push(
|
|
396
|
-
for (let n of e.transforms) s.push(
|
|
397
|
-
return s.push(...
|
|
398
|
-
}
|
|
399
|
-
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) {
|
|
400
400
|
let t = [`chart ${e.chartType} {`], n = /* @__PURE__ */ new Map();
|
|
401
|
-
for (let r of e.properties) (r.isPercentage || !
|
|
402
|
-
e.data && t.push(
|
|
403
|
-
for (let n of e.colorizes) t.push(
|
|
404
|
-
for (let n of e.highlights) t.push(
|
|
405
|
-
for (let n of e.areaFills) t.push(
|
|
406
|
-
for (let n of e.annotations) t.push(
|
|
407
|
-
let r =
|
|
408
|
-
for (let n of e.series) t.push(
|
|
409
|
-
for (let n of e.scenes) t.push(
|
|
410
|
-
for (let n of e.transforms) t.push(
|
|
411
|
-
return t.push(...
|
|
412
|
-
}
|
|
413
|
-
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) {
|
|
414
414
|
let t = [`chart ${e.chartType} {`];
|
|
415
|
-
for (let n of e.properties)
|
|
416
|
-
e.data && t.push(
|
|
417
|
-
for (let n of e.colorizes) t.push(
|
|
418
|
-
for (let n of e.highlights) t.push(
|
|
419
|
-
for (let n of e.areaFills) t.push(
|
|
420
|
-
for (let n of e.annotations) t.push(
|
|
421
|
-
for (let n of e.series) t.push(
|
|
422
|
-
for (let n of e.scenes) t.push(
|
|
423
|
-
for (let n of e.transforms) t.push(
|
|
424
|
-
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");
|
|
425
425
|
}
|
|
426
426
|
//#endregion
|
|
427
427
|
//#region src/dsl/suggest.ts
|
|
428
|
-
function
|
|
428
|
+
function fn(e, t) {
|
|
429
429
|
let n = [Array.from({ length: t.length + 1 }, (e, t) => t)];
|
|
430
430
|
for (let r = 1; r <= e.length; r++) {
|
|
431
431
|
n.push([r]);
|
|
@@ -436,10 +436,10 @@ function un(e, t) {
|
|
|
436
436
|
}
|
|
437
437
|
return n[e.length][t.length];
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function U(e, t) {
|
|
440
440
|
let n, r = Infinity;
|
|
441
441
|
for (let i of t) {
|
|
442
|
-
let t =
|
|
442
|
+
let t = fn(e.toLowerCase(), i.toLowerCase());
|
|
443
443
|
t < r && (r = t, n = i);
|
|
444
444
|
}
|
|
445
445
|
if (n === void 0) return;
|
|
@@ -448,26 +448,26 @@ function W(e, t) {
|
|
|
448
448
|
}
|
|
449
449
|
//#endregion
|
|
450
450
|
//#region src/charts/types/scatter/issues.ts
|
|
451
|
-
var
|
|
451
|
+
var pn = [
|
|
452
452
|
"x",
|
|
453
453
|
"y",
|
|
454
454
|
"size",
|
|
455
455
|
"group"
|
|
456
|
-
],
|
|
456
|
+
], mn = {
|
|
457
457
|
"missing-x": "missing x",
|
|
458
458
|
"missing-y": "missing y",
|
|
459
459
|
"invalid-size": "size must be above 0",
|
|
460
460
|
"non-positive-log-x": "x must be above 0 on a log axis",
|
|
461
461
|
"non-positive-log-y": "y must be above 0 on a log axis"
|
|
462
|
-
},
|
|
462
|
+
}, hn = {
|
|
463
463
|
x: "horizontal",
|
|
464
464
|
y: "vertical"
|
|
465
465
|
};
|
|
466
|
-
function
|
|
467
|
-
return [...
|
|
466
|
+
function gn(e) {
|
|
467
|
+
return [...pe(e), ...(e.textColumns ?? []).map((e) => e.name)];
|
|
468
468
|
}
|
|
469
|
-
function
|
|
470
|
-
let i =
|
|
469
|
+
function _n(e, t, n, r) {
|
|
470
|
+
let i = gn(e);
|
|
471
471
|
return n.flatMap((e) => {
|
|
472
472
|
let n = t[e];
|
|
473
473
|
return !n || n === "none" || i.includes(n) ? [] : [{
|
|
@@ -475,11 +475,11 @@ function hn(e, t, n, r) {
|
|
|
475
475
|
severity: r,
|
|
476
476
|
key: e,
|
|
477
477
|
message: `${e} names "${n}", which is not a column.`,
|
|
478
|
-
suggestion:
|
|
478
|
+
suggestion: U(n, i)
|
|
479
479
|
}];
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function vn(e, t) {
|
|
483
483
|
if (!e.length) return [];
|
|
484
484
|
let n = e.slice(0, 5).map((e) => `"${e.name}" (${t[e.reason]})`), r = e.length - n.length;
|
|
485
485
|
return [{
|
|
@@ -488,84 +488,84 @@ function gn(e, t) {
|
|
|
488
488
|
message: `${`${e.length} ${e.length === 1 ? "row" : "rows"}`} not drawn: ${n.join(", ")}${r > 0 ? `, and ${r} more` : ""}.`
|
|
489
489
|
}];
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function yn(e) {
|
|
492
492
|
return e.map((e) => ({
|
|
493
493
|
code: "trend-skipped",
|
|
494
494
|
severity: "warning",
|
|
495
495
|
message: `Trend line skipped${e === "overall" ? "" : ` for ${e}`}: needs at least 3 points.`
|
|
496
496
|
}));
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
return ["x", "y"].flatMap((
|
|
500
|
-
let
|
|
501
|
-
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) ? [] : [{
|
|
502
502
|
code: "log-range-ignored",
|
|
503
503
|
severity: "warning",
|
|
504
|
-
message: `${`${
|
|
504
|
+
message: `${`${hn[r]}Range${i === "min" ? "Min" : "Max"}`} must be above 0 on a log axis; it is ignored.`
|
|
505
505
|
}];
|
|
506
506
|
}));
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
let o =
|
|
508
|
+
function xn(t, n, r, i, a) {
|
|
509
|
+
let o = _n(t, n, pn, "error"), s = e(t, n);
|
|
510
510
|
if (!s.y) return [...o, {
|
|
511
511
|
code: "scatter-missing-y",
|
|
512
512
|
severity: "error",
|
|
513
513
|
key: "y",
|
|
514
514
|
message: "Scatter needs at least two numeric columns."
|
|
515
515
|
}];
|
|
516
|
-
let c =
|
|
516
|
+
let c = bn(r, i);
|
|
517
517
|
if (o.length) return [...o, ...c];
|
|
518
518
|
let { points: l, dropped: u } = Te(t, s, r), d = v(a) ? De(l, a, r).skipped : [];
|
|
519
519
|
return [
|
|
520
|
-
...
|
|
521
|
-
...
|
|
520
|
+
...vn(u, mn),
|
|
521
|
+
...yn(d),
|
|
522
522
|
...c
|
|
523
523
|
];
|
|
524
524
|
}
|
|
525
525
|
//#endregion
|
|
526
526
|
//#region src/charts/types/dot-plot/issues.ts
|
|
527
|
-
var
|
|
527
|
+
var Sn = ["low", "high"], Cn = {
|
|
528
528
|
"missing-value": "missing value",
|
|
529
529
|
"missing-range": "missing low or high",
|
|
530
530
|
"non-positive-log": "values must be above 0 on a log axis"
|
|
531
|
-
},
|
|
532
|
-
function
|
|
531
|
+
}, W = (e) => e.map((e) => `"${e}"`).join(", ");
|
|
532
|
+
function wn(e) {
|
|
533
533
|
let t = e.filter(({ values: [e], low: t = -Infinity, high: n = Infinity }) => e < Math.min(t, n) || e > Math.max(t, n));
|
|
534
534
|
if (!t.length) return [];
|
|
535
535
|
let n = t.slice(0, 5).map((e) => e.name), r = t.length - n.length;
|
|
536
536
|
return [{
|
|
537
537
|
code: "value-outside-range",
|
|
538
538
|
severity: "warning",
|
|
539
|
-
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` : ""}.`
|
|
540
540
|
}];
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function Tn(e, t) {
|
|
543
543
|
return t.length ? [{
|
|
544
544
|
code: "ignored-columns",
|
|
545
545
|
severity: "warning",
|
|
546
|
-
message: `Range mode uses ${
|
|
546
|
+
message: `Range mode uses ${W(e)} as the value and ignores ${W(t)}.`
|
|
547
547
|
}] : [];
|
|
548
548
|
}
|
|
549
|
-
function
|
|
550
|
-
return e.dotStyle !==
|
|
549
|
+
function En(e, t) {
|
|
550
|
+
return e.dotStyle !== a.Range || t === "range" ? [] : [{
|
|
551
551
|
code: "missing-range-columns",
|
|
552
552
|
severity: "warning",
|
|
553
553
|
message: "Range style needs a low and a high column. Pick them in low and high."
|
|
554
554
|
}];
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
let r =
|
|
556
|
+
function Dn(e, t, n) {
|
|
557
|
+
let r = ht(e, t), { rows: i, dropped: a } = m(e, r, n);
|
|
558
558
|
return [
|
|
559
|
-
...
|
|
560
|
-
...
|
|
561
|
-
...
|
|
562
|
-
...r.mode === "range" ?
|
|
563
|
-
...
|
|
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)
|
|
564
564
|
];
|
|
565
565
|
}
|
|
566
566
|
//#endregion
|
|
567
567
|
//#region src/dsl/validate.ts
|
|
568
|
-
var
|
|
568
|
+
var On = /* @__PURE__ */ new Set([
|
|
569
569
|
"title",
|
|
570
570
|
"description",
|
|
571
571
|
"altText",
|
|
@@ -588,8 +588,8 @@ var En = /* @__PURE__ */ new Set([
|
|
|
588
588
|
"maxWidth",
|
|
589
589
|
"player",
|
|
590
590
|
"playerPosition"
|
|
591
|
-
]),
|
|
592
|
-
["theme",
|
|
591
|
+
]), kn = /* @__PURE__ */ new Map([
|
|
592
|
+
["theme", Lt().map((e) => e.name)],
|
|
593
593
|
["player", [
|
|
594
594
|
"buttons",
|
|
595
595
|
"progress-bar",
|
|
@@ -602,13 +602,13 @@ var En = /* @__PURE__ */ new Set([
|
|
|
602
602
|
"center",
|
|
603
603
|
"right"
|
|
604
604
|
]]
|
|
605
|
-
]),
|
|
605
|
+
]), An = /* @__PURE__ */ new Set([
|
|
606
606
|
"lineSymbolSize",
|
|
607
607
|
"circleSize",
|
|
608
608
|
"fixedHeight",
|
|
609
609
|
"fixedWidth",
|
|
610
610
|
"maxWidth"
|
|
611
|
-
]),
|
|
611
|
+
]), G = ut, jn = /* @__PURE__ */ new Set([
|
|
612
612
|
"text",
|
|
613
613
|
"repeat",
|
|
614
614
|
"textColor",
|
|
@@ -626,7 +626,7 @@ var En = /* @__PURE__ */ new Set([
|
|
|
626
626
|
"circleSize",
|
|
627
627
|
"circleStyle",
|
|
628
628
|
"circleColor"
|
|
629
|
-
]),
|
|
629
|
+
]), Mn = /* @__PURE__ */ new Set([
|
|
630
630
|
"color",
|
|
631
631
|
"lineWidth",
|
|
632
632
|
"dash",
|
|
@@ -636,16 +636,17 @@ var En = /* @__PURE__ */ new Set([
|
|
|
636
636
|
"valueLabels",
|
|
637
637
|
"lineSymbols",
|
|
638
638
|
"hidden",
|
|
639
|
+
"connectGaps",
|
|
639
640
|
"symbolShape",
|
|
640
641
|
"symbolShowOn",
|
|
641
642
|
"symbolStyle",
|
|
642
643
|
"symbolSize",
|
|
643
644
|
"symbolOpacity"
|
|
644
|
-
]),
|
|
645
|
+
]), Nn = /* @__PURE__ */ new Map([
|
|
645
646
|
["symbolShape", "lineSymbolShape"],
|
|
646
647
|
["symbolShowOn", "lineSymbolShowOn"],
|
|
647
648
|
["symbolStyle", "lineSymbolStyle"]
|
|
648
|
-
]),
|
|
649
|
+
]), Pn = /* @__PURE__ */ new Set([
|
|
649
650
|
"start",
|
|
650
651
|
"end",
|
|
651
652
|
"repeat",
|
|
@@ -657,7 +658,7 @@ var En = /* @__PURE__ */ new Set([
|
|
|
657
658
|
"direction",
|
|
658
659
|
"text",
|
|
659
660
|
"textColor"
|
|
660
|
-
]),
|
|
661
|
+
]), Fn = /* @__PURE__ */ new Set([
|
|
661
662
|
"text",
|
|
662
663
|
"x",
|
|
663
664
|
"y",
|
|
@@ -666,19 +667,19 @@ var En = /* @__PURE__ */ new Set([
|
|
|
666
667
|
"maxWidth",
|
|
667
668
|
"textOutline"
|
|
668
669
|
]);
|
|
669
|
-
function
|
|
670
|
+
function In(e, t) {
|
|
670
671
|
return e.find((e) => e.key === t);
|
|
671
672
|
}
|
|
672
|
-
function
|
|
673
|
+
function K(e, t, n, r, i) {
|
|
673
674
|
i.push({
|
|
674
675
|
code: "invalid-choice",
|
|
675
676
|
path: r,
|
|
676
677
|
message: `${e} must be one of: ${n.map((e) => `"${e}"`).join(", ")}; got "${t}".`,
|
|
677
|
-
suggestion:
|
|
678
|
+
suggestion: U(String(t), n.filter((e) => e !== ""))
|
|
678
679
|
});
|
|
679
680
|
}
|
|
680
|
-
function
|
|
681
|
-
if (!
|
|
681
|
+
function Ln(e, t, n) {
|
|
682
|
+
if (!An.has(e.key)) return;
|
|
682
683
|
let r = parseFloat(String(e.value));
|
|
683
684
|
Number.isFinite(r) && r < 0 && n.push({
|
|
684
685
|
code: "invalid-number",
|
|
@@ -686,9 +687,9 @@ function Fn(e, t, n) {
|
|
|
686
687
|
message: `${e.key} must not be negative; got "${e.value}".`
|
|
687
688
|
});
|
|
688
689
|
}
|
|
689
|
-
function
|
|
690
|
+
function Rn(e, t, n, r) {
|
|
690
691
|
let i = t.value, a = String(i).toLowerCase();
|
|
691
|
-
if (e.type ===
|
|
692
|
+
if (e.type === fe.Boolean) {
|
|
692
693
|
if (e.key === "valueLabels" && a === "percent" || i === !0 || i === !1 || a === "true" || a === "false") return;
|
|
693
694
|
r.push({
|
|
694
695
|
code: "invalid-boolean",
|
|
@@ -701,88 +702,88 @@ function In(e, t, n, r) {
|
|
|
701
702
|
if (e.choices && e.choices.length > 0) {
|
|
702
703
|
let t = e.choices.map((e) => e.value);
|
|
703
704
|
if (t.includes(String(i)) || String(i) === "" && t.includes("")) return;
|
|
704
|
-
|
|
705
|
+
K(e.key, i, t, n, r);
|
|
705
706
|
}
|
|
706
707
|
}
|
|
707
|
-
function
|
|
708
|
-
let i = g(e), a = /* @__PURE__ */ new Set([...i.map((e) => e.key), ...
|
|
708
|
+
function zn(e, t, n, r) {
|
|
709
|
+
let i = g(e), a = /* @__PURE__ */ new Set([...i.map((e) => e.key), ...On]);
|
|
709
710
|
for (let o of t) {
|
|
710
711
|
let t = `${n}.${o.key}`;
|
|
711
|
-
|
|
712
|
-
let s =
|
|
713
|
-
if (s && String(o.value) !== "" && !s.includes(String(o.value)) &&
|
|
714
|
-
let c =
|
|
712
|
+
Ln(o, t, r);
|
|
713
|
+
let s = kn.get(o.key);
|
|
714
|
+
if (s && String(o.value) !== "" && !s.includes(String(o.value)) && K(o.key, o.value, s, t, r), On.has(o.key)) continue;
|
|
715
|
+
let c = In(i, o.key);
|
|
715
716
|
if (!c) {
|
|
716
717
|
r.push({
|
|
717
718
|
code: "unknown-property",
|
|
718
719
|
path: t,
|
|
719
720
|
message: `Unknown property "${o.key}" for chart type "${e}".`,
|
|
720
|
-
suggestion:
|
|
721
|
+
suggestion: U(o.key, a)
|
|
721
722
|
});
|
|
722
723
|
continue;
|
|
723
724
|
}
|
|
724
|
-
|
|
725
|
+
Rn(c, o, t, r);
|
|
725
726
|
}
|
|
726
727
|
}
|
|
727
|
-
function
|
|
728
|
-
return e ===
|
|
728
|
+
function Bn(e) {
|
|
729
|
+
return e === r.Range ? Pn : e === r.Free ? Fn : jn;
|
|
729
730
|
}
|
|
730
|
-
function
|
|
731
|
-
return
|
|
731
|
+
function Vn(e) {
|
|
732
|
+
return de[e];
|
|
732
733
|
}
|
|
733
|
-
function
|
|
734
|
-
e.forEach((e,
|
|
735
|
-
let
|
|
736
|
-
for (let
|
|
737
|
-
let e = `${t}.${
|
|
738
|
-
|
|
734
|
+
function Hn(e, t, n) {
|
|
735
|
+
e.forEach((e, i) => {
|
|
736
|
+
let a = e.kind ?? r.Point, o = Bn(a), s = Vn(a);
|
|
737
|
+
for (let r of e.properties) {
|
|
738
|
+
let e = `${t}.${s}[${i}].${r.key}`;
|
|
739
|
+
Ln(r, e, n), !o.has(r.key) && n.push({
|
|
739
740
|
code: "unknown-annotation-property",
|
|
740
741
|
path: e,
|
|
741
|
-
message: `Unknown ${
|
|
742
|
-
suggestion:
|
|
742
|
+
message: `Unknown ${s} property "${r.key}"; it will be silently ignored.`,
|
|
743
|
+
suggestion: U(r.key, o)
|
|
743
744
|
});
|
|
744
745
|
}
|
|
745
|
-
let
|
|
746
|
-
if (
|
|
747
|
-
let e = String(
|
|
748
|
-
e === "true" || e === "false" || typeof
|
|
746
|
+
let c = y(e.properties).get("repeat");
|
|
747
|
+
if (c !== void 0) {
|
|
748
|
+
let e = String(c).toLowerCase();
|
|
749
|
+
e === "true" || e === "false" || typeof c == "number" && Number.isInteger(c) && c >= 1 || n.push({
|
|
749
750
|
code: "invalid-annotation-repeat",
|
|
750
|
-
message: `repeat must be false, true, or a positive integer (got ${String(
|
|
751
|
-
path: `${t}.${
|
|
751
|
+
message: `repeat must be false, true, or a positive integer (got ${String(c)})`,
|
|
752
|
+
path: `${t}.${s}[${i}].repeat`
|
|
752
753
|
});
|
|
753
754
|
}
|
|
754
755
|
});
|
|
755
756
|
}
|
|
756
|
-
function
|
|
757
|
+
function Un(e, t, n, r) {
|
|
757
758
|
let i = g(e);
|
|
758
759
|
t.forEach((e, t) => {
|
|
759
760
|
for (let a of e.properties) {
|
|
760
761
|
let e = `${n}.series[${t}].${a.key}`;
|
|
761
|
-
if (!
|
|
762
|
+
if (!Mn.has(a.key)) {
|
|
762
763
|
r.push({
|
|
763
764
|
code: "unknown-series-property",
|
|
764
765
|
path: e,
|
|
765
766
|
message: `Unknown series property "${a.key}"; it will be silently ignored.`,
|
|
766
|
-
suggestion:
|
|
767
|
+
suggestion: U(a.key, Mn)
|
|
767
768
|
});
|
|
768
769
|
continue;
|
|
769
770
|
}
|
|
770
|
-
let o =
|
|
771
|
-
o?.length && !o.includes(String(a.value)) &&
|
|
771
|
+
let o = In(i, Nn.get(a.key) ?? a.key)?.choices?.map((e) => e.value);
|
|
772
|
+
o?.length && !o.includes(String(a.value)) && K(a.key, a.value, o, e, r);
|
|
772
773
|
}
|
|
773
774
|
});
|
|
774
775
|
}
|
|
775
|
-
function
|
|
776
|
+
function Wn(e, t, n) {
|
|
776
777
|
e.forEach((e, r) => {
|
|
777
|
-
|
|
778
|
+
G.has(e.transformType) || n.push({
|
|
778
779
|
code: "unknown-transform",
|
|
779
780
|
path: `${t}.transform[${r}]`,
|
|
780
|
-
message: `Unknown transform type "${e.transformType}". Known types: ${[...
|
|
781
|
-
suggestion:
|
|
781
|
+
message: `Unknown transform type "${e.transformType}". Known types: ${[...G].map((e) => `"${e}"`).join(", ")}.`,
|
|
782
|
+
suggestion: U(e.transformType, G)
|
|
782
783
|
});
|
|
783
784
|
});
|
|
784
785
|
}
|
|
785
|
-
function
|
|
786
|
+
function Gn(e) {
|
|
786
787
|
let t = /* @__PURE__ */ new Set();
|
|
787
788
|
for (let n of [e.data, ...e.scenes.map((e) => e.data)]) for (let e of n?.entries ?? []) {
|
|
788
789
|
if (e.key === "series" && !e.quotedKey) {
|
|
@@ -794,8 +795,8 @@ function Un(e) {
|
|
|
794
795
|
}
|
|
795
796
|
return t;
|
|
796
797
|
}
|
|
797
|
-
function
|
|
798
|
-
let n =
|
|
798
|
+
function Kn(e, t) {
|
|
799
|
+
let n = Gn(e);
|
|
799
800
|
if (n.size === 0) return;
|
|
800
801
|
let r = [
|
|
801
802
|
{
|
|
@@ -823,34 +824,34 @@ function Wn(e, t) {
|
|
|
823
824
|
code: "unresolved-target",
|
|
824
825
|
path: `${e}.${i}[${a}]`,
|
|
825
826
|
message: `${i} "${r.target}" matches no category or series; it has no effect.`,
|
|
826
|
-
suggestion:
|
|
827
|
+
suggestion: U(r.target, n)
|
|
827
828
|
});
|
|
828
829
|
});
|
|
829
830
|
}
|
|
830
|
-
function
|
|
831
|
+
function qn(e) {
|
|
831
832
|
let t = [], n = [], r = S(), i = r.includes(e.chartType);
|
|
832
833
|
i || t.push({
|
|
833
834
|
code: "unknown-chart-type",
|
|
834
835
|
path: "chartType",
|
|
835
836
|
message: `Unknown chart type "${e.chartType}".`,
|
|
836
|
-
suggestion:
|
|
837
|
-
}), i &&
|
|
837
|
+
suggestion: U(e.chartType, r)
|
|
838
|
+
}), 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);
|
|
838
839
|
let a = !!e.data && e.data.entries.length > 0, o = e.scenes.some((e) => !!e.data && e.data.entries.length > 0);
|
|
839
840
|
return !a && !o && t.push({
|
|
840
841
|
code: "missing-data",
|
|
841
842
|
path: "data",
|
|
842
843
|
message: e.data && e.data.entries.length === 0 ? "Data block is empty." : "Chart has no data."
|
|
843
|
-
}), e.data &&
|
|
844
|
-
|
|
844
|
+
}), 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) => {
|
|
845
|
+
Xn(r, e.chartType, i, t);
|
|
845
846
|
let a = r.properties.find((e) => e.key === "type")?.value ?? e.chartType;
|
|
846
|
-
a ===
|
|
847
|
+
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);
|
|
847
848
|
}), {
|
|
848
849
|
valid: t.length === 0,
|
|
849
850
|
errors: t,
|
|
850
851
|
warnings: n
|
|
851
852
|
};
|
|
852
853
|
}
|
|
853
|
-
function
|
|
854
|
+
function Jn(e, t) {
|
|
854
855
|
let n = e.findIndex((e) => e.key === "series" && !e.quotedKey);
|
|
855
856
|
if (n === -1) return;
|
|
856
857
|
let r = e[n], i = r.values ?? [r.value];
|
|
@@ -866,7 +867,7 @@ function Kn(e, t) {
|
|
|
866
867
|
suggestion: "Move the series row to the top of the data block."
|
|
867
868
|
});
|
|
868
869
|
}
|
|
869
|
-
function
|
|
870
|
+
function Yn(e, t) {
|
|
870
871
|
let n = /* @__PURE__ */ new Map();
|
|
871
872
|
for (let t of e) t.key === "series" && !t.quotedKey || n.set(t.key, (n.get(t.key) ?? 0) + 1);
|
|
872
873
|
for (let [e, r] of n) r > 1 && t.push({
|
|
@@ -876,16 +877,16 @@ function qn(e, t) {
|
|
|
876
877
|
suggestion: `"${e} (2)"`
|
|
877
878
|
});
|
|
878
879
|
}
|
|
879
|
-
function
|
|
880
|
+
function Xn(e, t, n, r) {
|
|
880
881
|
let i = `scene[${n}]`, a = e.properties.find((e) => e.key === "type")?.value, o = a == null ? t : String(a);
|
|
881
882
|
a != null && !S().includes(o) ? r.push({
|
|
882
883
|
code: "unknown-chart-type",
|
|
883
884
|
path: `${i}.type`,
|
|
884
885
|
message: `Unknown chart type "${o}".`,
|
|
885
|
-
suggestion:
|
|
886
|
-
}) : (
|
|
886
|
+
suggestion: U(o, S())
|
|
887
|
+
}) : (zn(o, e.properties, i, r), Un(o, e.series, i, r)), Wn(e.transforms, i, r), Hn(e.annotations, i, r);
|
|
887
888
|
}
|
|
888
|
-
function
|
|
889
|
+
function Zn(e, t, n, r, i, a) {
|
|
889
890
|
if (!e || e.entries.length === 0) return;
|
|
890
891
|
let o = y(t), s = (e) => o.has(e) ? String(o.get(e)) : void 0, c = (e) => s(e), l = (e) => ({
|
|
891
892
|
min: s(`${e}RangeMin`),
|
|
@@ -902,18 +903,18 @@ function Yn(e, t, n, r, i, a) {
|
|
|
902
903
|
x: l("horizontal"),
|
|
903
904
|
y: l("vertical")
|
|
904
905
|
};
|
|
905
|
-
for (let t of
|
|
906
|
+
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));
|
|
906
907
|
}
|
|
907
|
-
function
|
|
908
|
+
function Qn(e, t, n, r, i) {
|
|
908
909
|
if (!e || e.entries.length === 0) return;
|
|
909
910
|
let a = y(t), o = (e) => a.has(e) ? String(a.get(e)) : void 0, s = {
|
|
910
911
|
dotStyle: o("dotStyle"),
|
|
911
912
|
low: o("low"),
|
|
912
913
|
high: o("high")
|
|
913
914
|
};
|
|
914
|
-
for (let t of
|
|
915
|
+
for (let t of Dn(x(w(e)), s, o("horizontalScaleType"))) i.push($n(t, t.key ? `${n}.${t.key}` : r));
|
|
915
916
|
}
|
|
916
|
-
function
|
|
917
|
+
function $n({ code: e, message: t, suggestion: n }, r) {
|
|
917
918
|
return {
|
|
918
919
|
code: e,
|
|
919
920
|
path: r,
|
|
@@ -923,14 +924,14 @@ function Zn({ code: e, message: t, suggestion: n }, r) {
|
|
|
923
924
|
}
|
|
924
925
|
//#endregion
|
|
925
926
|
//#region src/samples/letter-frequency.bpc?raw
|
|
926
|
-
var Qn = "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", $n = "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", er = "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", tr = "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", nr = "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", rr = "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", ir = "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", ar = "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", or = "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", sr = "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", cr = "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", lr = "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", ur = "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", dr = "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", fr = "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", pr = "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", mr = "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", hr = "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", gr = "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", _r = "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", vr = "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";
|
|
927
|
+
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";
|
|
927
928
|
//#endregion
|
|
928
929
|
//#region src/samples.ts
|
|
929
|
-
function
|
|
930
|
+
function xr(e, t) {
|
|
930
931
|
let n = e.properties.find((e) => e.key === t);
|
|
931
932
|
return n ? String(n.value) : "";
|
|
932
933
|
}
|
|
933
|
-
function
|
|
934
|
+
function Sr(e) {
|
|
934
935
|
if (!e.data) return "";
|
|
935
936
|
let t = e.data.entries, n = t.find((e) => e.key === "series" && !e.quotedKey);
|
|
936
937
|
return n ? [["category", ...String(n.value).split(",")].join(" "), ...t.filter((e) => !(e.key === "series" && !e.quotedKey)).map((e) => {
|
|
@@ -938,61 +939,61 @@ function br(e) {
|
|
|
938
939
|
return [e.key, ...t].join(" ");
|
|
939
940
|
})].join("\n") : [["label", "value"].join(" "), ...t.map((e) => [e.key, String(e.value)].join(" "))].join("\n");
|
|
940
941
|
}
|
|
941
|
-
function
|
|
942
|
+
function Cr(e) {
|
|
942
943
|
if (!e.data) return "";
|
|
943
944
|
let t = e.data.entries, n = t.find((e) => e.key === "series" && !e.quotedKey);
|
|
944
945
|
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");
|
|
945
946
|
}
|
|
946
|
-
function
|
|
947
|
+
function q(e, t) {
|
|
947
948
|
let n = b(t);
|
|
948
949
|
return {
|
|
949
950
|
id: e,
|
|
950
|
-
title:
|
|
951
|
-
description:
|
|
951
|
+
title: xr(n, "title"),
|
|
952
|
+
description: xr(n, "description"),
|
|
952
953
|
chartType: n.chartType,
|
|
953
|
-
tsvData:
|
|
954
|
-
serializedData:
|
|
954
|
+
tsvData: Sr(n),
|
|
955
|
+
serializedData: Cr(n),
|
|
955
956
|
dsl: t
|
|
956
957
|
};
|
|
957
958
|
}
|
|
958
|
-
var
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
],
|
|
959
|
+
var wr = [
|
|
960
|
+
q("letter-frequency", er),
|
|
961
|
+
q("co2-emissions", tr),
|
|
962
|
+
q("coffee-production", lr),
|
|
963
|
+
q("spoken-languages", nr),
|
|
964
|
+
q("quarterly-revenue", rr),
|
|
965
|
+
q("medal-count", ir),
|
|
966
|
+
q("temperature-anomaly", ar),
|
|
967
|
+
q("bitcoin-price", or),
|
|
968
|
+
q("unemployment-rates", sr),
|
|
969
|
+
q("browser-market", ur),
|
|
970
|
+
q("world-population", cr),
|
|
971
|
+
q("stock-price-area", dr),
|
|
972
|
+
q("energy-mix-stacked-area", fr),
|
|
973
|
+
q("quarterly-stacked-columns", pr),
|
|
974
|
+
q("population-stacked-bar", mr),
|
|
975
|
+
q("renewable-capacity", vr),
|
|
976
|
+
q("farm-compass", hr),
|
|
977
|
+
q("co2-emissions-story", gr),
|
|
978
|
+
q("life-expectancy-wealth", yr),
|
|
979
|
+
q("election-polls", _r),
|
|
980
|
+
q("life-expectancy-gains", br)
|
|
981
|
+
], Tr = class extends Error {
|
|
981
982
|
constructor(e, t) {
|
|
982
983
|
super(e, t), this.name = "ChartParseError";
|
|
983
984
|
}
|
|
984
|
-
},
|
|
985
|
+
}, Er = class extends Error {
|
|
985
986
|
constructor(e = "PNG export is only available in Node. Use toSvg() in the browser.") {
|
|
986
987
|
super(e), this.name = "PngBrowserUnsupportedError";
|
|
987
988
|
}
|
|
988
|
-
},
|
|
989
|
+
}, Dr = class extends Error {
|
|
989
990
|
constructor(e) {
|
|
990
991
|
super(e), this.name = "MissingNodeRenderDepsError";
|
|
991
992
|
}
|
|
992
993
|
};
|
|
993
994
|
//#endregion
|
|
994
995
|
//#region src/render/backends/dom-backend.ts
|
|
995
|
-
function
|
|
996
|
+
function Or() {
|
|
996
997
|
return {
|
|
997
998
|
kind: "dom",
|
|
998
999
|
createContainer(e, t) {
|
|
@@ -1003,7 +1004,7 @@ function Er() {
|
|
|
1003
1004
|
};
|
|
1004
1005
|
},
|
|
1005
1006
|
renderToContainer(e, t, n) {
|
|
1006
|
-
|
|
1007
|
+
st(e, t, {
|
|
1007
1008
|
sceneIndex: n.sceneIndex,
|
|
1008
1009
|
thumbnail: n.thumbnail ?? !1,
|
|
1009
1010
|
transition: !1,
|
|
@@ -1022,23 +1023,23 @@ function Er() {
|
|
|
1022
1023
|
throw Error("dom-backend: renderToContainer produced no frame");
|
|
1023
1024
|
},
|
|
1024
1025
|
rasterizePng() {
|
|
1025
|
-
return Promise.reject(new
|
|
1026
|
+
return Promise.reject(new Er());
|
|
1026
1027
|
}
|
|
1027
1028
|
};
|
|
1028
1029
|
}
|
|
1029
1030
|
//#endregion
|
|
1030
1031
|
//#region src/render/frame-svg.ts
|
|
1031
|
-
var
|
|
1032
|
+
var kr = {
|
|
1032
1033
|
background: "#ffffff",
|
|
1033
1034
|
color: "#333333"
|
|
1034
|
-
},
|
|
1035
|
+
}, Ar = {
|
|
1035
1036
|
background: "#1c1c1c",
|
|
1036
1037
|
color: "rgba(255, 255, 255, 0.9)"
|
|
1037
|
-
},
|
|
1038
|
-
function
|
|
1039
|
-
return e === "dark" ? { ...
|
|
1038
|
+
}, 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;
|
|
1039
|
+
function Ur(e) {
|
|
1040
|
+
return e === "dark" ? { ...Ar } : { ...kr };
|
|
1040
1041
|
}
|
|
1041
|
-
function
|
|
1042
|
+
function Wr() {
|
|
1042
1043
|
if (typeof document > "u") return null;
|
|
1043
1044
|
try {
|
|
1044
1045
|
return document.createElement("canvas").getContext("2d");
|
|
@@ -1046,11 +1047,11 @@ function Ur() {
|
|
|
1046
1047
|
return null;
|
|
1047
1048
|
}
|
|
1048
1049
|
}
|
|
1049
|
-
function
|
|
1050
|
-
let e =
|
|
1050
|
+
function Gr() {
|
|
1051
|
+
let e = Wr();
|
|
1051
1052
|
return (t, n, r) => {
|
|
1052
|
-
let i = t.length * n *
|
|
1053
|
-
return e ? (e.font = `${r ? "bold " : ""}${n}px ${
|
|
1053
|
+
let i = t.length * n * Hr;
|
|
1054
|
+
return e ? (e.font = `${r ? "bold " : ""}${n}px ${jr}`, Math.max(e.measureText(t).width, i)) : i;
|
|
1054
1055
|
};
|
|
1055
1056
|
}
|
|
1056
1057
|
function X(e, t, n, r, i) {
|
|
@@ -1078,43 +1079,43 @@ function Z(e, t, n) {
|
|
|
1078
1079
|
fontStyle: n.fontStyle,
|
|
1079
1080
|
fill: n.fill,
|
|
1080
1081
|
anchor: n.anchor
|
|
1081
|
-
}), r += n.fontSize *
|
|
1082
|
+
}), r += n.fontSize * Y;
|
|
1082
1083
|
return r;
|
|
1083
1084
|
}
|
|
1084
|
-
function
|
|
1085
|
+
function Kr(e) {
|
|
1085
1086
|
let t = parseFloat(e) || 0;
|
|
1086
1087
|
return /r?em$/.test(e) ? t * 16 : t;
|
|
1087
1088
|
}
|
|
1088
|
-
function
|
|
1089
|
-
let t = e.frame ?? {}, n =
|
|
1090
|
-
t.title && (
|
|
1089
|
+
function qr(e) {
|
|
1090
|
+
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;
|
|
1091
|
+
t.title && (d = Z(u, X(t.title, s, Mr, !0, c), {
|
|
1091
1092
|
x: o,
|
|
1092
|
-
top:
|
|
1093
|
-
fontSize:
|
|
1093
|
+
top: d,
|
|
1094
|
+
fontSize: Mr,
|
|
1094
1095
|
fontWeight: "bold",
|
|
1095
1096
|
fill: n.color
|
|
1096
|
-
})), t.description && (
|
|
1097
|
+
})), t.description && (d = Z(u, X(t.description, s, Nr, !1, c), {
|
|
1097
1098
|
x: o,
|
|
1098
|
-
top: t.title ?
|
|
1099
|
-
fontSize:
|
|
1099
|
+
top: t.title ? d + Pr : d,
|
|
1100
|
+
fontSize: Nr,
|
|
1100
1101
|
fill: n.color
|
|
1101
1102
|
}));
|
|
1102
|
-
let f =
|
|
1103
|
-
return v = Z(
|
|
1103
|
+
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 + _;
|
|
1104
|
+
return v = Z(u, p, {
|
|
1104
1105
|
x: o,
|
|
1105
1106
|
top: v,
|
|
1106
|
-
fontSize:
|
|
1107
|
+
fontSize: J,
|
|
1107
1108
|
fontStyle: "italic",
|
|
1108
1109
|
fill: n.color
|
|
1109
|
-
}) +
|
|
1110
|
+
}) + Fr, Z(u, g, {
|
|
1110
1111
|
x: o,
|
|
1111
1112
|
top: v,
|
|
1112
|
-
fontSize:
|
|
1113
|
+
fontSize: J,
|
|
1113
1114
|
fill: n.color
|
|
1114
|
-
}), Z(
|
|
1115
|
+
}), Z(u, [zr], {
|
|
1115
1116
|
x: e.width - i,
|
|
1116
1117
|
top: v,
|
|
1117
|
-
fontSize:
|
|
1118
|
+
fontSize: J,
|
|
1118
1119
|
fontWeight: "600",
|
|
1119
1120
|
fill: n.color,
|
|
1120
1121
|
anchor: "end"
|
|
@@ -1127,10 +1128,10 @@ function Kr(e) {
|
|
|
1127
1128
|
width: s,
|
|
1128
1129
|
height: _
|
|
1129
1130
|
},
|
|
1130
|
-
blocks:
|
|
1131
|
+
blocks: u,
|
|
1131
1132
|
background: t.transparentBackground ? null : n.background,
|
|
1132
1133
|
color: n.color,
|
|
1133
|
-
fontFamily:
|
|
1134
|
+
fontFamily: jr
|
|
1134
1135
|
};
|
|
1135
1136
|
}
|
|
1136
1137
|
function Q(e) {
|
|
@@ -1139,7 +1140,7 @@ function Q(e) {
|
|
|
1139
1140
|
function $(e) {
|
|
1140
1141
|
return Q(e).replace(/"/g, """);
|
|
1141
1142
|
}
|
|
1142
|
-
function
|
|
1143
|
+
function Jr(e, t) {
|
|
1143
1144
|
return [
|
|
1144
1145
|
`<text x="${e.x}" y="${e.y}" font-size="${e.fontSize}px"`,
|
|
1145
1146
|
e.fontFamily ? ` font-family="${$(e.fontFamily)}"` : "",
|
|
@@ -1151,7 +1152,7 @@ function qr(e, t) {
|
|
|
1151
1152
|
"</text>"
|
|
1152
1153
|
].join("");
|
|
1153
1154
|
}
|
|
1154
|
-
function
|
|
1155
|
+
function Yr(e, t, n) {
|
|
1155
1156
|
return [
|
|
1156
1157
|
`<svg xmlns="http://www.w3.org/2000/svg" width="${e.width}" height="${e.height}"`,
|
|
1157
1158
|
` viewBox="0 0 ${e.width} ${e.height}" role="img" aria-label="${$(n.label)}"`,
|
|
@@ -1159,37 +1160,37 @@ function Jr(e, t, n) {
|
|
|
1159
1160
|
`<title>${Q(n.label)}</title>`,
|
|
1160
1161
|
`<desc>${Q(n.description)}</desc>`,
|
|
1161
1162
|
e.background ? `<rect width="100%" height="100%" fill="${$(e.background)}"></rect>` : "",
|
|
1162
|
-
...e.blocks.map((t) =>
|
|
1163
|
+
...e.blocks.map((t) => Jr(t, e)),
|
|
1163
1164
|
`<g transform="translate(${e.plot.x},${e.plot.y})">${t}</g>`,
|
|
1164
1165
|
"</svg>"
|
|
1165
1166
|
].join("");
|
|
1166
1167
|
}
|
|
1167
1168
|
//#endregion
|
|
1168
1169
|
//#region src/render/public-render.ts
|
|
1169
|
-
var
|
|
1170
|
-
function
|
|
1170
|
+
var Xr = 640, Zr = 400;
|
|
1171
|
+
function Qr() {
|
|
1171
1172
|
return typeof document < "u" && typeof document.createElement == "function";
|
|
1172
1173
|
}
|
|
1173
|
-
async function
|
|
1174
|
-
return
|
|
1174
|
+
async function $r() {
|
|
1175
|
+
return Qr() ? Or() : (await import("@blueprint-chart/lib/internal/node-backend")).createNodeBackend();
|
|
1175
1176
|
}
|
|
1176
|
-
async function
|
|
1177
|
+
async function ei(e, t = {}) {
|
|
1177
1178
|
let n;
|
|
1178
1179
|
try {
|
|
1179
1180
|
n = Ne(b(e));
|
|
1180
1181
|
} catch (e) {
|
|
1181
|
-
throw new
|
|
1182
|
+
throw new Tr(e instanceof Error ? e.message : String(e), { cause: e });
|
|
1182
1183
|
}
|
|
1183
|
-
let r = await
|
|
1184
|
+
let r = await $r(), i = t.frame ?? !0, a = {
|
|
1184
1185
|
sceneIndex: t.scene,
|
|
1185
|
-
width: t.width ??
|
|
1186
|
-
height: t.height ??
|
|
1186
|
+
width: t.width ?? Xr,
|
|
1187
|
+
height: t.height ?? Zr
|
|
1187
1188
|
};
|
|
1188
1189
|
function o(e, t) {
|
|
1189
|
-
let { background: n, color: r } =
|
|
1190
|
+
let { background: n, color: r } = Ur(t);
|
|
1190
1191
|
e.style.backgroundColor = n, e.style.setProperty("--bc-text-color", r);
|
|
1191
1192
|
}
|
|
1192
|
-
let s = t.theme === "auto" ? void 0 : t.theme, c = s ? null :
|
|
1193
|
+
let s = t.theme === "auto" ? void 0 : t.theme, c = s ? null : zt();
|
|
1193
1194
|
function l(e) {
|
|
1194
1195
|
return s ?? e ?? (c?.matches ? "dark" : void 0);
|
|
1195
1196
|
}
|
|
@@ -1216,7 +1217,7 @@ async function $r(e, t = {}) {
|
|
|
1216
1217
|
n();
|
|
1217
1218
|
}
|
|
1218
1219
|
}
|
|
1219
|
-
let f =
|
|
1220
|
+
let f = qr({
|
|
1220
1221
|
width: t,
|
|
1221
1222
|
height: s,
|
|
1222
1223
|
frame: c.frame,
|
|
@@ -1224,8 +1225,8 @@ async function $r(e, t = {}) {
|
|
|
1224
1225
|
}), { container: p, cleanup: m } = r.createContainer(f.plot.width, f.plot.height);
|
|
1225
1226
|
try {
|
|
1226
1227
|
o(p, d), u(p, !0, a.sceneIndex);
|
|
1227
|
-
let e =
|
|
1228
|
-
return
|
|
1228
|
+
let e = _t(c.chartType, c.frame, c.data);
|
|
1229
|
+
return Yr(f, r.serializeSvg(p), e);
|
|
1229
1230
|
} finally {
|
|
1230
1231
|
m();
|
|
1231
1232
|
}
|
|
@@ -1262,4 +1263,4 @@ async function $r(e, t = {}) {
|
|
|
1262
1263
|
return m;
|
|
1263
1264
|
}
|
|
1264
1265
|
//#endregion
|
|
1265
|
-
export {
|
|
1266
|
+
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 };
|