@bicharts/chart-host 0.6.18 → 0.6.19
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.
|
@@ -1658,10 +1658,10 @@ function tt2(n, e) {
|
|
|
1658
1658
|
return t;
|
|
1659
1659
|
}
|
|
1660
1660
|
function rt3(n, e, t, o, u2) {
|
|
1661
|
-
let a4 = [], s = [], i = {}, C2 = {},
|
|
1661
|
+
let a4 = [], s = [], i = {}, C2 = {}, b4 = new Set(n), m = (r) => e.map((l) => l[r]);
|
|
1662
1662
|
for (let r of ["city", "country"]) {
|
|
1663
1663
|
let l = t?.[r];
|
|
1664
|
-
l &&
|
|
1664
|
+
l && b4.has(l) && (i[r] = l);
|
|
1665
1665
|
}
|
|
1666
1666
|
let ie = new Set(u2 ?? n);
|
|
1667
1667
|
for (let r of ["lat", "lon"]) {
|
|
@@ -1669,58 +1669,58 @@ function rt3(n, e, t, o, u2) {
|
|
|
1669
1669
|
l && ie.has(l) && (i[r] = l);
|
|
1670
1670
|
}
|
|
1671
1671
|
let h3 = t?.zip;
|
|
1672
|
-
if (h3 &&
|
|
1673
|
-
let r =
|
|
1672
|
+
if (h3 && b4.has(h3)) {
|
|
1673
|
+
let r = m(h3), l = W2(r);
|
|
1674
1674
|
l < 95 ? s.push(`zip=${h3} (only ${l}% of values read as ZIPs)`) : Z3(r, h3) ? i.zip = h3 : s.push(`zip=${h3} (all values are 3-4 digits with nothing to say they are postal)`);
|
|
1675
1675
|
}
|
|
1676
1676
|
let g3 = t?.state;
|
|
1677
|
-
if (g3 &&
|
|
1678
|
-
let r =
|
|
1679
|
-
l.length > 0 && l.every((
|
|
1677
|
+
if (g3 && b4.has(g3)) {
|
|
1678
|
+
let r = m(g3), l = N3(r);
|
|
1679
|
+
l.length > 0 && l.every((d2) => X3(d2, o)) ? s.push(`state=${g3} (every value is "CA", which is both Canada and California)`) : v3(r) ? (s.push(`state=${g3} (every value is a country, not a state)`), i.country || (i.country = g3)) : L2(r) < 95 ? s.push(`state=${g3} (only ${L2(r)}% of values are states/provinces)`) : i.state = g3;
|
|
1680
1680
|
}
|
|
1681
|
-
let S = new Set(Object.values(i).filter(Boolean)),
|
|
1681
|
+
let S = new Set(Object.values(i).filter(Boolean)), F3 = n.filter((r) => !S.has(r) && !r.startsWith("__"));
|
|
1682
1682
|
if (!i.state) {
|
|
1683
1683
|
let r = null;
|
|
1684
|
-
for (let l of
|
|
1685
|
-
let
|
|
1686
|
-
if (v3(
|
|
1687
|
-
let p2 = L2(
|
|
1684
|
+
for (let l of F3) {
|
|
1685
|
+
let d2 = m(l);
|
|
1686
|
+
if (v3(d2)) continue;
|
|
1687
|
+
let p2 = L2(d2);
|
|
1688
1688
|
if (p2 < 95) continue;
|
|
1689
|
-
let _2 = K3(
|
|
1689
|
+
let _2 = K3(d2, (T3) => !!Y(T3)), ae2 = K3(d2, (T3) => !!Y(T3) && !X3(T3, o));
|
|
1690
1690
|
_2 < V3 && ae2 < 1 || (!r || p2 > r.pct) && (r = { name: l, pct: p2 });
|
|
1691
1691
|
}
|
|
1692
1692
|
r && (i.state = r.name, S.add(r.name), a4.push(`state=${r.name} (${r.pct}% states/provinces)`));
|
|
1693
1693
|
}
|
|
1694
|
-
if (!i.zip) for (let r of
|
|
1694
|
+
if (!i.zip) for (let r of F3) {
|
|
1695
1695
|
if (S.has(r)) continue;
|
|
1696
|
-
let l =
|
|
1697
|
-
if (!(
|
|
1698
|
-
i.zip = r, S.add(r), a4.push(`zip=${r} (${
|
|
1696
|
+
let l = m(r), d2 = W2(l);
|
|
1697
|
+
if (!(d2 < 95) && Z3(l, r) && !(tt2(l, (p2) => Z(p2).length > 0) < V3)) {
|
|
1698
|
+
i.zip = r, S.add(r), a4.push(`zip=${r} (${d2}% ZIP codes)`);
|
|
1699
1699
|
break;
|
|
1700
1700
|
}
|
|
1701
1701
|
}
|
|
1702
|
-
let
|
|
1703
|
-
if (!
|
|
1702
|
+
let x2 = i.country;
|
|
1703
|
+
if (!x2 || !v3(m(x2))) {
|
|
1704
1704
|
let r = null;
|
|
1705
|
-
for (let l of
|
|
1706
|
-
if (S.has(l) || !v3(
|
|
1707
|
-
let
|
|
1708
|
-
(!r ||
|
|
1705
|
+
for (let l of F3) {
|
|
1706
|
+
if (S.has(l) || !v3(m(l))) continue;
|
|
1707
|
+
let d2 = B3(m(l));
|
|
1708
|
+
(!r || d2 > r.pct) && (r = { name: l, pct: d2 });
|
|
1709
1709
|
}
|
|
1710
|
-
r && (
|
|
1710
|
+
r && (x2 && (s.push(`country=${x2} (only ${B3(m(x2))}% of values are country identifiers; using ${r.name} instead)`), C2.country = x2), i.country = r.name, S.add(r.name), a4.push(`country=${r.name}`));
|
|
1711
1711
|
}
|
|
1712
1712
|
if (!i.city) {
|
|
1713
1713
|
let r = null;
|
|
1714
|
-
for (let l of
|
|
1714
|
+
for (let l of F3) {
|
|
1715
1715
|
if (S.has(l)) continue;
|
|
1716
|
-
let
|
|
1717
|
-
p2 < m3 || K3(
|
|
1716
|
+
let d2 = m(l), p2 = nt2(d2, o);
|
|
1717
|
+
p2 < m3 || K3(d2, (_2) => p3(_2, o)) < V3 || (!r || p2 > r.pct) && (r = { name: l, pct: p2 });
|
|
1718
1718
|
}
|
|
1719
1719
|
r && (i.city = r.name, a4.push(`city=${r.name} (${r.pct}% known cities)`));
|
|
1720
1720
|
}
|
|
1721
|
-
let H3 = i.country ?
|
|
1722
|
-
let l = +String(r[i.lat] ?? "").trim(),
|
|
1723
|
-
return isFinite(l) && isFinite(
|
|
1721
|
+
let H3 = i.country ? m(i.country) : [], E4 = !!i.country && v3(H3), se = E4 ? new Set(H3.map((r) => E(r == null ? null : String(r))).filter(Boolean)).size : 0, U3 = E4 && se >= 2, O3 = !!(i.lat && i.lon) && e.some((r) => {
|
|
1722
|
+
let l = +String(r[i.lat] ?? "").trim(), d2 = +String(r[i.lon] ?? "").trim();
|
|
1723
|
+
return isFinite(l) && isFinite(d2) && l >= -90 && l <= 90 && d2 >= -180 && d2 <= 180 && String(r[i.lat] ?? "").trim() !== "" && String(r[i.lon] ?? "").trim() !== "";
|
|
1724
1724
|
});
|
|
1725
1725
|
return i.lat && i.lon && !O3 && s.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`), i.country && !U3 && !(i.city || i.state || i.zip || O3) && s.push(E4 ? `country=${i.country} (every row resolves to the same country - nothing to place apart)` : `country=${i.country} (values are not country identifiers)`), { bind: !!(i.city || i.state || i.zip || U3 || O3) ? i : null, backfilled: a4, refused: s, ...Object.keys(C2).length ? { labelFallback: C2 } : {} };
|
|
1726
1726
|
}
|
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.6.
|
|
3
|
+
"version": "0.6.19",
|
|
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",
|