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