@bicharts/chart-host 0.5.110 → 0.5.111
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.
|
@@ -142,7 +142,7 @@ var require_papaparse_min = __commonJS({
|
|
|
142
142
|
return "greedy" === m4.skipEmptyLines ? "" === e2.join("").trim() : 1 === e2.length && 0 === e2[0].length;
|
|
143
143
|
}
|
|
144
144
|
function g4() {
|
|
145
|
-
if (p4 && a5 && (
|
|
145
|
+
if (p4 && a5 && (k2("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + v2.DefaultDelimiter + "'"), a5 = false), m4.skipEmptyLines && (p4.data = p4.data.filter(function(e4) {
|
|
146
146
|
return !y6(e4);
|
|
147
147
|
})), _3()) {
|
|
148
148
|
let t4 = function(e4, t5) {
|
|
@@ -164,7 +164,7 @@ var require_papaparse_min = __commonJS({
|
|
|
164
164
|
})(t5) ? parseFloat(t5) : d3.test(t5) ? new Date(t5) : "" === t5 ? null : t5) : t5)(n4 = m4.header ? r5 >= c4.length ? "__parsed_extra" : c4[r5] : n4, s4 = m4.transform ? m4.transform(s4, n4) : s4);
|
|
165
165
|
"__parsed_extra" === n4 ? (i5[n4] = i5[n4] || [], i5[n4].push(s4)) : i5[n4] = s4;
|
|
166
166
|
}
|
|
167
|
-
return m4.header && (r5 > c4.length ?
|
|
167
|
+
return m4.header && (r5 > c4.length ? k2("FieldMismatch", "TooManyFields", "Too many fields: expected " + c4.length + " fields but parsed " + r5, f5 + t4) : r5 < c4.length && k2("FieldMismatch", "TooFewFields", "Too few fields: expected " + c4.length + " fields but parsed " + r5, f5 + t4)), i5;
|
|
168
168
|
}
|
|
169
169
|
var r4;
|
|
170
170
|
p4 && (m4.header || m4.dynamicTyping || m4.transform) && (r4 = 1, !p4.data.length || Array.isArray(p4.data[0]) ? (p4.data = p4.data.map(i4), r4 = p4.data.length) : p4.data = i4(p4.data, 0), m4.header && p4.meta && (p4.meta.fields = c4), f5 += r4);
|
|
@@ -172,7 +172,7 @@ var require_papaparse_min = __commonJS({
|
|
|
172
172
|
function _3() {
|
|
173
173
|
return m4.header && 0 === c4.length;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function k2(e2, t2, i4, r4) {
|
|
176
176
|
e2 = { type: e2, code: t2, message: i4 };
|
|
177
177
|
void 0 !== r4 && (e2.row = r4), p4.errors.push(e2);
|
|
178
178
|
}
|
|
@@ -211,8 +211,8 @@ var require_papaparse_min = __commonJS({
|
|
|
211
211
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
212
212
|
}
|
|
213
213
|
function E2(C2) {
|
|
214
|
-
var S = (C2 = C2 || {}).delimiter, O2 = C2.newline, x3 = C2.comments, I2 = C2.step, A = C2.preview, T3 = C2.fastMode, D4 = null, L2 = false, F4 = null == C2.quoteChar ? '"' : C2.quoteChar,
|
|
215
|
-
if (void 0 !== C2.escapeChar && (
|
|
214
|
+
var S = (C2 = C2 || {}).delimiter, O2 = C2.newline, x3 = C2.comments, I2 = C2.step, A = C2.preview, T3 = C2.fastMode, D4 = null, L2 = false, F4 = null == C2.quoteChar ? '"' : C2.quoteChar, j3 = F4;
|
|
215
|
+
if (void 0 !== C2.escapeChar && (j3 = C2.escapeChar), ("string" != typeof S || -1 < v2.BAD_DELIMITERS.indexOf(S)) && (S = ","), x3 === S) throw new Error("Comment character same as delimiter");
|
|
216
216
|
true === x3 ? x3 = "#" : ("string" != typeof x3 || -1 < v2.BAD_DELIMITERS.indexOf(x3)) && (x3 = false), "\n" !== O2 && "\r" !== O2 && "\r\n" !== O2 && (O2 = "\n");
|
|
217
217
|
var z3 = 0, M2 = false;
|
|
218
218
|
this.parse = function(i2, t, r2) {
|
|
@@ -225,18 +225,18 @@ var require_papaparse_min = __commonJS({
|
|
|
225
225
|
else if (r2) return w3();
|
|
226
226
|
if (!x3 || d3.substring(0, a5) !== x3) {
|
|
227
227
|
if (o2) {
|
|
228
|
-
if (h4 = [],
|
|
229
|
-
} else
|
|
228
|
+
if (h4 = [], k2(d3.split(S)), R3(), M2) return w3();
|
|
229
|
+
} else k2(d3.split(S));
|
|
230
230
|
if (A && A <= c4) return h4 = h4.slice(0, A), w3(true);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
return w3();
|
|
234
234
|
}
|
|
235
|
-
for (var p4 = i2.indexOf(S, z3), g4 = i2.indexOf(O2, z3), _3 = new RegExp(U2(
|
|
235
|
+
for (var p4 = i2.indexOf(S, z3), g4 = i2.indexOf(O2, z3), _3 = new RegExp(U2(j3) + U2(F4), "g"), m4 = i2.indexOf(F4, z3); ; ) if (i2[z3] === F4) for (m4 = z3, z3++; ; ) {
|
|
236
236
|
if (-1 === (m4 = i2.indexOf(F4, m4 + 1))) return r2 || u4.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h4.length, index: z3 }), E4();
|
|
237
237
|
if (m4 === n2 - 1) return E4(i2.substring(z3, m4).replace(_3, F4));
|
|
238
|
-
if (F4 ===
|
|
239
|
-
else if (F4 ===
|
|
238
|
+
if (F4 === j3 && i2[m4 + 1] === j3) m4++;
|
|
239
|
+
else if (F4 === j3 || 0 === m4 || i2[m4 - 1] !== j3) {
|
|
240
240
|
-1 !== p4 && p4 < m4 + 1 && (p4 = i2.indexOf(S, m4 + 1));
|
|
241
241
|
var y6 = v3(-1 === (g4 = -1 !== g4 && g4 < m4 + 1 ? i2.indexOf(O2, m4 + 1) : g4) ? p4 : Math.min(p4, g4));
|
|
242
242
|
if (i2.substr(m4 + 1 + y6, e) === S) {
|
|
@@ -262,7 +262,7 @@ var require_papaparse_min = __commonJS({
|
|
|
262
262
|
if (A && h4.length >= A) return w3(true);
|
|
263
263
|
}
|
|
264
264
|
return E4();
|
|
265
|
-
function
|
|
265
|
+
function k2(e2) {
|
|
266
266
|
h4.push(e2), f5 = z3;
|
|
267
267
|
}
|
|
268
268
|
function v3(e2) {
|
|
@@ -270,10 +270,10 @@ var require_papaparse_min = __commonJS({
|
|
|
270
270
|
return t2 = -1 !== e2 && (e2 = i2.substring(m4 + 1, e2)) && "" === e2.trim() ? e2.length : t2;
|
|
271
271
|
}
|
|
272
272
|
function E4(e2) {
|
|
273
|
-
return r2 || (void 0 === e2 && (e2 = i2.substring(z3)), d3.push(e2), z3 = n2,
|
|
273
|
+
return r2 || (void 0 === e2 && (e2 = i2.substring(z3)), d3.push(e2), z3 = n2, k2(d3), o2 && R3()), w3();
|
|
274
274
|
}
|
|
275
275
|
function b5(e2) {
|
|
276
|
-
z3 = e2,
|
|
276
|
+
z3 = e2, k2(d3), d3 = [], g4 = i2.indexOf(O2, z3);
|
|
277
277
|
}
|
|
278
278
|
function w3(e2) {
|
|
279
279
|
if (C2.header && !t && h4.length && !L2) {
|
|
@@ -368,7 +368,7 @@ var require_papaparse_min = __commonJS({
|
|
|
368
368
|
function n2(e2, t2, i4) {
|
|
369
369
|
var r4 = "", n4 = ("string" == typeof e2 && (e2 = JSON.parse(e2)), "string" == typeof t2 && (t2 = JSON.parse(t2)), Array.isArray(e2) && 0 < e2.length), s4 = !Array.isArray(t2[0]);
|
|
370
370
|
if (n4 && _3) {
|
|
371
|
-
for (var a6 = 0; a6 < e2.length; a6++) 0 < a6 && (r4 += m4), r4 +=
|
|
371
|
+
for (var a6 = 0; a6 < e2.length; a6++) 0 < a6 && (r4 += m4), r4 += k2(e2[a6], a6);
|
|
372
372
|
0 < t2.length && (r4 += y6);
|
|
373
373
|
}
|
|
374
374
|
for (var o4 = 0; o4 < t2.length; o4++) {
|
|
@@ -384,14 +384,14 @@ var require_papaparse_min = __commonJS({
|
|
|
384
384
|
for (var p4 = 0; p4 < h5; p4++) {
|
|
385
385
|
0 < p4 && !d3 && (r4 += m4);
|
|
386
386
|
var g4 = n4 && s4 ? e2[p4] : p4;
|
|
387
|
-
r4 +=
|
|
387
|
+
r4 += k2(t2[o4][g4], p4);
|
|
388
388
|
}
|
|
389
389
|
o4 < t2.length - 1 && (!i4 || 0 < h5 && !d3) && (r4 += y6);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
return r4;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function k2(e2, t2) {
|
|
395
395
|
var i4, r4, n4;
|
|
396
396
|
return null == e2 ? "" : e2.constructor === Date ? JSON.stringify(e2).slice(1, 25) : (n4 = false, h4 && "string" == typeof e2 && h4.test(e2) && (e2 = "'" + e2, n4 = true), r4 = (i4 = e2.toString()).replace(u4, o2), (n4 = n4 || true === s2 || "function" == typeof s2 && s2(e2, t2) || Array.isArray(s2) && s2[t2] || ((e4, t4) => {
|
|
397
397
|
for (var i5 = 0; i5 < t4.length; i5++) if (-1 < e4.indexOf(t4[i5])) return true;
|
|
@@ -502,8 +502,8 @@ function rgbToLab(r, g3, b4) {
|
|
|
502
502
|
const R3 = linearise(r), G3 = linearise(g3), B2 = linearise(b4);
|
|
503
503
|
const X2 = 0.4124564 * R3 + 0.3575761 * G3 + 0.1804375 * B2;
|
|
504
504
|
const Y2 = 0.2126729 * R3 + 0.7151522 * G3 + 0.072175 * B2;
|
|
505
|
-
const
|
|
506
|
-
const fx = f(X2 / Xn), fy = f(Y2 / Yn), fz = f(
|
|
505
|
+
const Z2 = 0.0193339 * R3 + 0.119192 * G3 + 0.9503041 * B2;
|
|
506
|
+
const fx = f(X2 / Xn), fy = f(Y2 / Yn), fz = f(Z2 / Zn);
|
|
507
507
|
return { L: 116 * fy - 16, a: 500 * (fx - fy), b: 200 * (fy - fz) };
|
|
508
508
|
}
|
|
509
509
|
function hexToLab(hex2) {
|
|
@@ -560,11 +560,11 @@ function labToHex(lab) {
|
|
|
560
560
|
const fy = (lab.L + 16) / 116, fx = fy + lab.a / 500, fz = fy - lab.b / 200;
|
|
561
561
|
const X2 = Xn * finv(fx);
|
|
562
562
|
const Y2 = Yn * (lab.L > KAPPA * EPS ? fy * fy * fy : lab.L / KAPPA);
|
|
563
|
-
const
|
|
563
|
+
const Z2 = Zn * finv(fz);
|
|
564
564
|
const lin = [
|
|
565
|
-
3.2404542 * X2 - 1.5371385 * Y2 - 0.4985314 *
|
|
566
|
-
-0.969266 * X2 + 1.8760108 * Y2 + 0.041556 *
|
|
567
|
-
0.0556434 * X2 - 0.2040259 * Y2 + 1.0572252 *
|
|
565
|
+
3.2404542 * X2 - 1.5371385 * Y2 - 0.4985314 * Z2,
|
|
566
|
+
-0.969266 * X2 + 1.8760108 * Y2 + 0.041556 * Z2,
|
|
567
|
+
0.0556434 * X2 - 0.2040259 * Y2 + 1.0572252 * Z2
|
|
568
568
|
];
|
|
569
569
|
return "#" + lin.map((v2) => {
|
|
570
570
|
const c2 = Math.max(0, Math.min(1, v2));
|
|
@@ -657,10 +657,10 @@ function censusColourSpread(container, doc) {
|
|
|
657
657
|
for (const { rgb } of counted) {
|
|
658
658
|
marks++;
|
|
659
659
|
distinct.add(rgb.join(","));
|
|
660
|
-
const
|
|
661
|
-
const cur = cells.get(
|
|
660
|
+
const k2 = cellKey(rgb);
|
|
661
|
+
const cur = cells.get(k2);
|
|
662
662
|
if (cur) cur.n++;
|
|
663
|
-
else cells.set(
|
|
663
|
+
else cells.set(k2, { rgb, n: 1 });
|
|
664
664
|
}
|
|
665
665
|
if (marks < MIN_MARKS || distinct.size < MIN_RAMP_FILLS) return EMPTY;
|
|
666
666
|
const top = [...cells.values()].sort((a4, b4) => b4.n - a4.n).slice(0, MAX_CELLS);
|
|
@@ -669,14 +669,14 @@ function censusColourSpread(container, doc) {
|
|
|
669
669
|
const d2 = cs.map(() => new Array(cs.length).fill(0));
|
|
670
670
|
let span = 0, lo = 0, hi = 1;
|
|
671
671
|
for (let i = 0; i < cs.length; i++) {
|
|
672
|
-
for (let
|
|
673
|
-
const v2 = deltaE2000(cs[i], cs[
|
|
674
|
-
d2[i][
|
|
675
|
-
d2[
|
|
672
|
+
for (let j3 = i + 1; j3 < cs.length; j3++) {
|
|
673
|
+
const v2 = deltaE2000(cs[i], cs[j3]);
|
|
674
|
+
d2[i][j3] = v2;
|
|
675
|
+
d2[j3][i] = v2;
|
|
676
676
|
if (v2 > span) {
|
|
677
677
|
span = v2;
|
|
678
678
|
lo = i;
|
|
679
|
-
hi =
|
|
679
|
+
hi = j3;
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
}
|
|
@@ -691,8 +691,8 @@ function censusColourSpread(container, doc) {
|
|
|
691
691
|
let crowd = 0;
|
|
692
692
|
for (let i = 0; i < cs.length; i++) {
|
|
693
693
|
let n = 0;
|
|
694
|
-
for (let
|
|
695
|
-
if (i ===
|
|
694
|
+
for (let j3 = 0; j3 < cs.length; j3++) {
|
|
695
|
+
if (i === j3 || d2[i][j3] <= SAME_SHADE_DELTA_E) n += top[j3].n;
|
|
696
696
|
}
|
|
697
697
|
if (n > crowd) crowd = n;
|
|
698
698
|
}
|
|
@@ -739,8 +739,8 @@ function autoRampMinStep(low, high, canvas, classes = AUTO_RAMP_CLASSES, opacity
|
|
|
739
739
|
const bg = normHex(canvas);
|
|
740
740
|
if (!lo || !hi || !bg || classes < 2) return NaN;
|
|
741
741
|
let prev = null, min = Infinity;
|
|
742
|
-
for (let
|
|
743
|
-
const painted = paintedOver(labToHex(mixLab(lo, hi,
|
|
742
|
+
for (let k2 = 0; k2 < classes; k2++) {
|
|
743
|
+
const painted = paintedOver(labToHex(mixLab(lo, hi, k2 / (classes - 1))), bg, opacity);
|
|
744
744
|
if (prev) min = Math.min(min, deltaE2000(prev, painted));
|
|
745
745
|
prev = painted;
|
|
746
746
|
}
|
|
@@ -941,12 +941,12 @@ var byAsset = /* @__PURE__ */ new Map();
|
|
|
941
941
|
var _na;
|
|
942
942
|
function geoAssetFor(geoKind) {
|
|
943
943
|
if (!geoKind) return null;
|
|
944
|
-
const
|
|
945
|
-
if (/^country/.test(
|
|
946
|
-
if (
|
|
947
|
-
if (
|
|
948
|
-
if (
|
|
949
|
-
if (
|
|
944
|
+
const k2 = geoKind.toLowerCase();
|
|
945
|
+
if (/^country/.test(k2)) return "world";
|
|
946
|
+
if (k2 === "north-america") return "world";
|
|
947
|
+
if (k2 === "world") return "world";
|
|
948
|
+
if (k2 === "us-state-code" || k2 === "us-state-name") return "us-states";
|
|
949
|
+
if (k2 === "us-zip5") return "us-zip3";
|
|
950
950
|
return null;
|
|
951
951
|
}
|
|
952
952
|
var _worldBase;
|
|
@@ -1423,11 +1423,11 @@ function It(n, s) {
|
|
|
1423
1423
|
}
|
|
1424
1424
|
function Wt(n, s) {
|
|
1425
1425
|
let i = new Array(n.length), r = /* @__PURE__ */ new Set(), M2 = [], h3 = 0;
|
|
1426
|
-
for (let
|
|
1427
|
-
let I2 = Mt(n[
|
|
1428
|
-
if (i[
|
|
1426
|
+
for (let N3 = 0; N3 < n.length; ++N3) {
|
|
1427
|
+
let I2 = Mt(n[N3], s), O2 = I2 !== null && It(I2, s) ? I2 : null;
|
|
1428
|
+
if (i[N3] = O2, O2 !== null) h3++;
|
|
1429
1429
|
else {
|
|
1430
|
-
let d2 = n[
|
|
1430
|
+
let d2 = n[N3];
|
|
1431
1431
|
if (d2 != null) {
|
|
1432
1432
|
let p2 = String(d2).trim();
|
|
1433
1433
|
if (p2.length > 0) {
|
|
@@ -1544,8 +1544,8 @@ function Yt(n, e) {
|
|
|
1544
1544
|
|
|
1545
1545
|
// ../shape-core/dist/index.mjs
|
|
1546
1546
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
1547
|
-
var
|
|
1548
|
-
var
|
|
1547
|
+
var N2 = 2;
|
|
1548
|
+
var j2 = 400;
|
|
1549
1549
|
function D3(o) {
|
|
1550
1550
|
return !!E(o);
|
|
1551
1551
|
}
|
|
@@ -1554,7 +1554,7 @@ function C(o) {
|
|
|
1554
1554
|
for (let n of o) {
|
|
1555
1555
|
if (n == null) continue;
|
|
1556
1556
|
let s = u(String(n));
|
|
1557
|
-
if (!V(s) && !e.has(s) && (e.add(s), e.size >=
|
|
1557
|
+
if (!V(s) && !e.has(s) && (e.add(s), e.size >= j2)) break;
|
|
1558
1558
|
}
|
|
1559
1559
|
return Array.from(e);
|
|
1560
1560
|
}
|
|
@@ -1564,7 +1564,7 @@ function R2(o) {
|
|
|
1564
1564
|
let n = e.filter((u2) => D3(u2) && !Y(u2)).length, s = e.filter((u2) => !D3(u2) && !!Y(u2)).length;
|
|
1565
1565
|
return n >= 1 && n >= s;
|
|
1566
1566
|
}
|
|
1567
|
-
function
|
|
1567
|
+
function W2(o, e) {
|
|
1568
1568
|
if (!Y(o)) return false;
|
|
1569
1569
|
let n = E(o);
|
|
1570
1570
|
return n ? e === "world" ? true : s3.has(n) : false;
|
|
@@ -1588,7 +1588,7 @@ function F3(o) {
|
|
|
1588
1588
|
for (let n of o) {
|
|
1589
1589
|
if (n == null) continue;
|
|
1590
1590
|
let s = String(n).trim();
|
|
1591
|
-
if (!V(u(s)) && !e.has(s) && (e.add(s), e.size >=
|
|
1591
|
+
if (!V(u(s)) && !e.has(s) && (e.add(s), e.size >= j2)) break;
|
|
1592
1592
|
}
|
|
1593
1593
|
return Array.from(e);
|
|
1594
1594
|
}
|
|
@@ -1599,7 +1599,7 @@ function G2(o) {
|
|
|
1599
1599
|
for (let s of e) Z(s).length > 0 && n++;
|
|
1600
1600
|
return Math.round(n / e.length * 1e3) / 10;
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1602
|
+
function q3(o, e) {
|
|
1603
1603
|
return y2(e, rt) ? true : F3(o).some((n) => /^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/, "")));
|
|
1604
1604
|
}
|
|
1605
1605
|
function de(o, e) {
|
|
@@ -1614,12 +1614,12 @@ function z2(o, e) {
|
|
|
1614
1614
|
for (let s of C(o)) e(s) && n++;
|
|
1615
1615
|
return n;
|
|
1616
1616
|
}
|
|
1617
|
-
function
|
|
1617
|
+
function pe(o, e) {
|
|
1618
1618
|
let n = 0;
|
|
1619
1619
|
for (let s of F3(o)) e(s) && n++;
|
|
1620
1620
|
return n;
|
|
1621
1621
|
}
|
|
1622
|
-
function
|
|
1622
|
+
function ge(o, e, n, s, u2) {
|
|
1623
1623
|
let b4 = [], c2 = [], r = {}, I2 = {}, M2 = new Set(o), l = (t) => e.map((i) => i[t]);
|
|
1624
1624
|
for (let t of ["city", "country"]) {
|
|
1625
1625
|
let i = n?.[t];
|
|
@@ -1630,15 +1630,15 @@ function pe(o, e, n, s, u2) {
|
|
|
1630
1630
|
let i = n?.[t];
|
|
1631
1631
|
i && Y2.has(i) && (r[t] = i);
|
|
1632
1632
|
}
|
|
1633
|
-
let
|
|
1634
|
-
if (
|
|
1635
|
-
let t = l(
|
|
1636
|
-
i < 95 ? c2.push(`zip=${
|
|
1633
|
+
let g3 = n?.zip;
|
|
1634
|
+
if (g3 && M2.has(g3)) {
|
|
1635
|
+
let t = l(g3), i = G2(t);
|
|
1636
|
+
i < 95 ? c2.push(`zip=${g3} (only ${i}% of values read as ZIPs)`) : q3(t, g3) ? r.zip = g3 : c2.push(`zip=${g3} (all values are 3-4 digits with nothing to say they are postal)`);
|
|
1637
1637
|
}
|
|
1638
1638
|
let d2 = n?.state;
|
|
1639
1639
|
if (d2 && M2.has(d2)) {
|
|
1640
1640
|
let t = l(d2), i = C(t);
|
|
1641
|
-
i.length > 0 && i.every((a4) =>
|
|
1641
|
+
i.length > 0 && i.every((a4) => W2(a4, s)) ? c2.push(`state=${d2} (every value is "CA", which is both Canada and California)`) : R2(t) ? (c2.push(`state=${d2} (every value is a country, not a state)`), r.country || (r.country = d2)) : w2(t) < 95 ? c2.push(`state=${d2} (only ${w2(t)}% of values are states/provinces)`) : r.state = d2;
|
|
1642
1642
|
}
|
|
1643
1643
|
let m2 = new Set(Object.values(r).filter(Boolean)), S = o.filter((t) => !m2.has(t) && !t.startsWith("__"));
|
|
1644
1644
|
if (!r.state) {
|
|
@@ -1648,15 +1648,15 @@ function pe(o, e, n, s, u2) {
|
|
|
1648
1648
|
if (R2(a4)) continue;
|
|
1649
1649
|
let f4 = w2(a4);
|
|
1650
1650
|
if (f4 < 95) continue;
|
|
1651
|
-
let O2 = z2(a4, (A) => !!Y(A)), Q2 = z2(a4, (A) => !!Y(A) && !
|
|
1652
|
-
O2 <
|
|
1651
|
+
let O2 = z2(a4, (A) => !!Y(A)), Q2 = z2(a4, (A) => !!Y(A) && !W2(A, s));
|
|
1652
|
+
O2 < N2 && Q2 < 1 || (!t || f4 > t.pct) && (t = { name: i, pct: f4 });
|
|
1653
1653
|
}
|
|
1654
1654
|
t && (r.state = t.name, m2.add(t.name), b4.push(`state=${t.name} (${t.pct}% states/provinces)`));
|
|
1655
1655
|
}
|
|
1656
1656
|
if (!r.zip) for (let t of S) {
|
|
1657
1657
|
if (m2.has(t)) continue;
|
|
1658
1658
|
let i = l(t), a4 = G2(i);
|
|
1659
|
-
if (!(a4 < 95) &&
|
|
1659
|
+
if (!(a4 < 95) && q3(i, t) && !(pe(i, (f4) => Z(f4).length > 0) < N2)) {
|
|
1660
1660
|
r.zip = t, m2.add(t), b4.push(`zip=${t} (${a4}% ZIP codes)`);
|
|
1661
1661
|
break;
|
|
1662
1662
|
}
|
|
@@ -1676,15 +1676,15 @@ function pe(o, e, n, s, u2) {
|
|
|
1676
1676
|
for (let i of S) {
|
|
1677
1677
|
if (m2.has(i)) continue;
|
|
1678
1678
|
let a4 = l(i), f4 = de(a4, s);
|
|
1679
|
-
f4 < m3 || z2(a4, (O2) => p3(O2, s)) <
|
|
1679
|
+
f4 < m3 || z2(a4, (O2) => p3(O2, s)) < N2 || (!t || f4 > t.pct) && (t = { name: i, pct: f4 });
|
|
1680
1680
|
}
|
|
1681
1681
|
t && (r.city = t.name, b4.push(`city=${t.name} (${t.pct}% known cities)`));
|
|
1682
1682
|
}
|
|
1683
|
-
let
|
|
1683
|
+
let K2 = r.country ? l(r.country) : [], E2 = !!r.country && R2(K2), J2 = E2 ? new Set(K2.map((t) => E(t == null ? null : String(t))).filter(Boolean)).size : 0, H2 = E2 && J2 >= 2, v2 = !!(r.lat && r.lon) && e.some((t) => {
|
|
1684
1684
|
let i = +String(t[r.lat] ?? "").trim(), a4 = +String(t[r.lon] ?? "").trim();
|
|
1685
1685
|
return isFinite(i) && isFinite(a4) && i >= -90 && i <= 90 && a4 >= -180 && a4 <= 180 && String(t[r.lat] ?? "").trim() !== "" && String(t[r.lon] ?? "").trim() !== "";
|
|
1686
1686
|
});
|
|
1687
|
-
return r.lat && r.lon && !v2 && c2.push(`lat/lon=${r.lat}/${r.lon} (no row holds a usable coordinate pair)`), r.country && !
|
|
1687
|
+
return r.lat && r.lon && !v2 && c2.push(`lat/lon=${r.lat}/${r.lon} (no row holds a usable coordinate pair)`), r.country && !H2 && !(r.city || r.state || r.zip || v2) && c2.push(E2 ? `country=${r.country} (every row resolves to the same country - nothing to place apart)` : `country=${r.country} (values are not country identifiers)`), { bind: !!(r.city || r.state || r.zip || H2 || v2) ? r : null, backfilled: b4, refused: c2, ...Object.keys(I2).length ? { labelFallback: I2 } : {} };
|
|
1688
1688
|
}
|
|
1689
1689
|
var he = new RegExp([String.raw`\bisMeasure\b`, String.raw`\bdataType\b`, String.raw`\bcolumns\s*\[\s*-?\d`, String.raw`\.iloc\s*\[[^\]]*,`, String.raw`\.iat\s*\[`, String.raw`\bselect_dtypes\b`, String.raw`\b_get_numeric_data\b`, String.raw`\bis_numeric_dtype\b`, String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`, String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`, String.raw`\bdf\.dtypes\b`, String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`, String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));
|
|
1690
1690
|
|
|
@@ -1700,7 +1700,7 @@ function resolvePointChannel(cols, rowObjs, point) {
|
|
|
1700
1700
|
let labelCol;
|
|
1701
1701
|
if (bind) {
|
|
1702
1702
|
const dims = cols.filter((c2) => !c2.isMeasure).map((c2) => c2.name);
|
|
1703
|
-
const res =
|
|
1703
|
+
const res = ge(dims, rowObjs, bind, point?.mapKind, cols.map((c2) => c2.name));
|
|
1704
1704
|
bind = res.bind;
|
|
1705
1705
|
rolesBackfilled = res.backfilled;
|
|
1706
1706
|
rolesRefused = res.refused;
|
|
@@ -1781,18 +1781,18 @@ function buildRenderPayload(cols, rowObjs, geo, point, destination, opts) {
|
|
|
1781
1781
|
a4[c2] = v2 ?? null;
|
|
1782
1782
|
}
|
|
1783
1783
|
}
|
|
1784
|
-
let
|
|
1785
|
-
a4[
|
|
1786
|
-
if (geoIso) a4[
|
|
1784
|
+
let k2 = cols.length;
|
|
1785
|
+
a4[k2++] = r;
|
|
1786
|
+
if (geoIso) a4[k2++] = geoIso[r];
|
|
1787
1787
|
if (pLat && pLon) {
|
|
1788
|
-
a4[
|
|
1789
|
-
a4[
|
|
1790
|
-
a4[
|
|
1788
|
+
a4[k2++] = pLat[r];
|
|
1789
|
+
a4[k2++] = pLon[r];
|
|
1790
|
+
a4[k2++] = pPrec ? pPrec[r] : null;
|
|
1791
1791
|
}
|
|
1792
1792
|
if (dLat && dLon) {
|
|
1793
|
-
a4[
|
|
1794
|
-
a4[
|
|
1795
|
-
a4[
|
|
1793
|
+
a4[k2++] = dLat[r];
|
|
1794
|
+
a4[k2++] = dLon[r];
|
|
1795
|
+
a4[k2++] = dPrec ? dPrec[r] : null;
|
|
1796
1796
|
}
|
|
1797
1797
|
out[r] = a4;
|
|
1798
1798
|
}
|
|
@@ -1857,9 +1857,9 @@ function createMarkResolver(env) {
|
|
|
1857
1857
|
const m2 = el.getScreenCTM();
|
|
1858
1858
|
if (!m2) return Number.MAX_VALUE;
|
|
1859
1859
|
let best = Number.MAX_VALUE;
|
|
1860
|
-
const
|
|
1861
|
-
for (let i = 0; i <=
|
|
1862
|
-
const pt = el.getPointAtLength(L2 * i /
|
|
1860
|
+
const N3 = 64;
|
|
1861
|
+
for (let i = 0; i <= N3; i++) {
|
|
1862
|
+
const pt = el.getPointAtLength(L2 * i / N3);
|
|
1863
1863
|
const dx = m2.a * pt.x + m2.c * pt.y + m2.e - x3;
|
|
1864
1864
|
const dy = m2.b * pt.x + m2.d * pt.y + m2.f - y5;
|
|
1865
1865
|
const d2 = dx * dx + dy * dy;
|
|
@@ -2244,10 +2244,10 @@ function censusValuePlacement(container, data) {
|
|
|
2244
2244
|
for (const axis of ["x", "y"]) {
|
|
2245
2245
|
const keep = [];
|
|
2246
2246
|
const v2 = [], pos = [];
|
|
2247
|
-
dots.forEach((d2,
|
|
2248
|
-
if (!Number.isFinite(vals[
|
|
2249
|
-
keep.push(
|
|
2250
|
-
v2.push(log ? Math.log10(vals[
|
|
2247
|
+
dots.forEach((d2, k2) => {
|
|
2248
|
+
if (!Number.isFinite(vals[k2])) return;
|
|
2249
|
+
keep.push(k2);
|
|
2250
|
+
v2.push(log ? Math.log10(vals[k2]) : vals[k2]);
|
|
2251
2251
|
pos.push(axis === "x" ? d2.x : d2.y);
|
|
2252
2252
|
});
|
|
2253
2253
|
const line = robustLine(v2, pos);
|
|
@@ -2256,8 +2256,8 @@ function censusValuePlacement(container, data) {
|
|
|
2256
2256
|
if (hi - lo < MIN_AXIS_SPAN_PX) continue;
|
|
2257
2257
|
const mean = pos.reduce((s, p2) => s + p2, 0) / pos.length;
|
|
2258
2258
|
let ssRes = 0, ssTot = 0;
|
|
2259
|
-
const res = pos.map((p2,
|
|
2260
|
-
const e = p2 - (line.a + line.b * v2[
|
|
2259
|
+
const res = pos.map((p2, k2) => {
|
|
2260
|
+
const e = p2 - (line.a + line.b * v2[k2]);
|
|
2261
2261
|
ssRes += e * e;
|
|
2262
2262
|
ssTot += (p2 - mean) ** 2;
|
|
2263
2263
|
return e;
|
|
@@ -2266,8 +2266,8 @@ function censusValuePlacement(container, data) {
|
|
|
2266
2266
|
const fit = 1 - ssRes / ssTot;
|
|
2267
2267
|
if (fit >= VALUE_AXIS_MIN_FIT && (!best || fit > best.fit)) {
|
|
2268
2268
|
const full = new Array(dots.length).fill(NaN);
|
|
2269
|
-
keep.forEach((
|
|
2270
|
-
full[
|
|
2269
|
+
keep.forEach((k2, j3) => {
|
|
2270
|
+
full[k2] = res[j3];
|
|
2271
2271
|
});
|
|
2272
2272
|
best = { col: c2, axis, fit, res: full, log };
|
|
2273
2273
|
}
|
|
@@ -2277,8 +2277,8 @@ function censusValuePlacement(container, data) {
|
|
|
2277
2277
|
if (!best) return EMPTY4;
|
|
2278
2278
|
let off = 0, measured = 0;
|
|
2279
2279
|
const radii = [];
|
|
2280
|
-
dots.forEach((d2,
|
|
2281
|
-
const e = best.res[
|
|
2280
|
+
dots.forEach((d2, k2) => {
|
|
2281
|
+
const e = best.res[k2];
|
|
2282
2282
|
if (!Number.isFinite(e)) return;
|
|
2283
2283
|
measured++;
|
|
2284
2284
|
const inRadii = Math.abs(e) / Math.max(d2.r, 1);
|
|
@@ -2853,8 +2853,8 @@ var NAMED = {
|
|
|
2853
2853
|
};
|
|
2854
2854
|
function toRGBA(c2) {
|
|
2855
2855
|
if (typeof c2 !== "string") return null;
|
|
2856
|
-
const
|
|
2857
|
-
if (
|
|
2856
|
+
const k2 = c2.trim().toLowerCase();
|
|
2857
|
+
if (k2 in NAMED) return NAMED[k2];
|
|
2858
2858
|
return parseRGBA(c2);
|
|
2859
2859
|
}
|
|
2860
2860
|
function compositeOver(fg, bg) {
|
|
@@ -2904,12 +2904,12 @@ var GLYPH_SAMPLE_N = 3;
|
|
|
2904
2904
|
function glyphSampleGrid(box, n = GLYPH_SAMPLE_N) {
|
|
2905
2905
|
const out = [];
|
|
2906
2906
|
if (!box || !(box.width > 0) || !(box.height > 0) || !(n >= 1)) return out;
|
|
2907
|
-
const
|
|
2908
|
-
for (let i = 0; i <
|
|
2909
|
-
for (let
|
|
2907
|
+
const k2 = Math.floor(n);
|
|
2908
|
+
for (let i = 0; i < k2; i++) {
|
|
2909
|
+
for (let j3 = 0; j3 < k2; j3++) {
|
|
2910
2910
|
out.push({
|
|
2911
|
-
x: box.left + box.width * (i + 0.5) /
|
|
2912
|
-
y: box.top + box.height * (
|
|
2911
|
+
x: box.left + box.width * (i + 0.5) / k2,
|
|
2912
|
+
y: box.top + box.height * (j3 + 0.5) / k2
|
|
2913
2913
|
});
|
|
2914
2914
|
}
|
|
2915
2915
|
}
|
|
@@ -3124,7 +3124,7 @@ function sessionViewStateProvider(container) {
|
|
|
3124
3124
|
load: () => store,
|
|
3125
3125
|
save: (next) => {
|
|
3126
3126
|
if (!next || typeof next !== "object") return;
|
|
3127
|
-
for (const
|
|
3127
|
+
for (const k2 of Object.keys(store)) delete store[k2];
|
|
3128
3128
|
Object.assign(store, next);
|
|
3129
3129
|
}
|
|
3130
3130
|
};
|
package/dist/index.mjs
CHANGED
package/dist/react.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.111",
|
|
4
4
|
"description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|