@bicharts/chart-host 0.6.66 → 0.6.70
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/README.md +33 -0
- package/dist/{chunk-CXDTSQBJ.mjs → chunk-KBFJTRYA.mjs} +10 -10
- package/dist/index.mjs +7 -1
- package/dist/react.mjs +1 -1
- package/dist/types/optionsVocabulary.d.ts +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -145,6 +145,39 @@ group.onChange(sel => console.log(sel.sourceId, sel.rows)); // SOURCE row indic
|
|
|
145
145
|
group.clear();
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
+
## Reader options
|
|
149
|
+
|
|
150
|
+
Everything a reader can tune lives in `options` - the `options` prop on `<BicChart>`, the
|
|
151
|
+
`options` you hand `createChartHost`, or a later `setOptions`. The full set, with each option's
|
|
152
|
+
default, bounds and whether it repaints the chart on screen, is exported as `OPTIONS_VOCABULARY`;
|
|
153
|
+
`LIVE_OPTION_KEYS` lists the ones that apply without a new chart.
|
|
154
|
+
|
|
155
|
+
**Card decks and carousels.** A chart that pages through several faces (a flippable multi-card
|
|
156
|
+
deck, a rotating carousel) reads these on every draw, so they all restyle live:
|
|
157
|
+
|
|
158
|
+
| Option | Values | Unset means |
|
|
159
|
+
| --- | --- | --- |
|
|
160
|
+
| `cardBackgroundColor` | any CSS color | the chart's own fill: a deck uses the page, a carousel a light tint |
|
|
161
|
+
| `flipIntervalMs` | `0` (manual only), or 500-120000 ms | the chart's own: manual for a deck, 5 s for a carousel |
|
|
162
|
+
| `flipDirection` | `"horizontal"`, `"vertical"` | `"horizontal"` (side to side) |
|
|
163
|
+
| `flipMode` | `"both"`, `"all"`, `"single"` (the deck only; a carousel has its own arrows) | `"both"` |
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
<BicChart id="kpis" code={code} d3={d3}
|
|
167
|
+
options={{ width, height, cardBackgroundColor: "#f4c7b8", flipIntervalMs: 4000 }} />
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The fill is the only thing you set: the chart still chooses its text colors, and they are its
|
|
171
|
+
job to keep readable on a dark card.
|
|
172
|
+
|
|
173
|
+
**Clearing an option.** `setOptions` merges into what the chart already has, and so does a
|
|
174
|
+
changed `options` prop - a key you simply drop keeps its last value. To hand an option back to
|
|
175
|
+
the chart's own default, pass it explicitly as `undefined`:
|
|
176
|
+
|
|
177
|
+
```js
|
|
178
|
+
host.setOptions({ cardBackgroundColor: undefined, flipIntervalMs: undefined });
|
|
179
|
+
```
|
|
180
|
+
|
|
148
181
|
## Sizing is yours
|
|
149
182
|
|
|
150
183
|
`width`/`height` have **no defaults**. A chart draws once at whatever it is handed and does not
|
|
@@ -1978,17 +1978,17 @@ function Yn3(t, e, n, o4, u4) {
|
|
|
1978
1978
|
for (let d2 of b4) {
|
|
1979
1979
|
let S2 = y2(d2);
|
|
1980
1980
|
if (A2(S2)) continue;
|
|
1981
|
-
let
|
|
1982
|
-
if (
|
|
1981
|
+
let P4 = z2(S2);
|
|
1982
|
+
if (P4 < 95) continue;
|
|
1983
1983
|
let H2 = ee3(S2, (D2) => !!t3(D2)), Ne = ee3(S2, (D2) => !!t3(D2) && !ce3(D2, o4));
|
|
1984
|
-
H2 < Z3 && Ne < 1 || (!s2 ||
|
|
1984
|
+
H2 < Z3 && Ne < 1 || (!s2 || P4 > s2.pct) && (s2 = { name: d2, pct: P4 });
|
|
1985
1985
|
}
|
|
1986
1986
|
s2 && (i.state = s2.name, p4.add(s2.name), l2.push(`state=${s2.name} (${s2.pct}% states/provinces)`));
|
|
1987
1987
|
}
|
|
1988
1988
|
if (!i.zip) for (let s2 of b4) {
|
|
1989
1989
|
if (p4.has(s2)) continue;
|
|
1990
1990
|
let d2 = y2(s2), S2 = re2(d2);
|
|
1991
|
-
if (!(S2 < 95) && de(d2, s2) && !(jn(d2, (
|
|
1991
|
+
if (!(S2 < 95) && de(d2, s2) && !(jn(d2, (P4) => r3(P4).length > 0) < Z3)) {
|
|
1992
1992
|
i.zip = s2, p4.add(s2), l2.push(`zip=${s2} (${S2}% ZIP codes)`);
|
|
1993
1993
|
break;
|
|
1994
1994
|
}
|
|
@@ -2007,12 +2007,12 @@ function Yn3(t, e, n, o4, u4) {
|
|
|
2007
2007
|
let s2 = null;
|
|
2008
2008
|
for (let d2 of b4) {
|
|
2009
2009
|
if (p4.has(d2)) continue;
|
|
2010
|
-
let S2 = y2(d2),
|
|
2011
|
-
|
|
2010
|
+
let S2 = y2(d2), P4 = Bn2(S2, o4);
|
|
2011
|
+
P4 < D3 || ee3(S2, (H2) => j3(H2, o4)) < Z3 || (!s2 || P4 > s2.pct) && (s2 = { name: d2, pct: P4 });
|
|
2012
2012
|
}
|
|
2013
2013
|
s2 && (i.city = s2.name, l2.push(`city=${s2.name} (${s2.pct}% known cities)`));
|
|
2014
2014
|
}
|
|
2015
|
-
let
|
|
2015
|
+
let v = i.country ? y2(i.country) : [], R4 = !!i.country && A2(v), L4 = R4 ? new Set(v.map((s2) => k(s2 == null ? null : String(s2))).filter(Boolean)).size : 0, x3 = R4 && L4 >= 2, w3 = !!(i.lat && i.lon) && e.some((s2) => {
|
|
2016
2016
|
let d2 = +String(s2[i.lat] ?? "").trim(), S2 = +String(s2[i.lon] ?? "").trim();
|
|
2017
2017
|
return isFinite(d2) && isFinite(S2) && d2 >= -90 && d2 <= 90 && S2 >= -180 && S2 <= 180 && String(s2[i.lat] ?? "").trim() !== "" && String(s2[i.lon] ?? "").trim() !== "";
|
|
2018
2018
|
});
|
|
@@ -2022,9 +2022,9 @@ var r = (t, ...e) => ({ part: t, langs: Object.freeze(e) });
|
|
|
2022
2022
|
var ie2 = Object.freeze({ jaar: r("year", "nl"), kwartaal: r("quarter", "nl"), maand: r("month", "nl"), dag: r("day", "nl", "sv", "da", "nb"), jahr: r("year", "de"), quartal: r("quarter", "de"), monat: r("month", "de"), tag: r("day", "de"), ann\u00E9e: r("year", "fr"), mois: r("month", "fr"), jour: r("day", "fr"), trimestre: r("quarter", "fr", "es", "pt", "it"), a\u00F1o: r("year", "es"), mes: r("month", "es"), d\u00EDa: r("day", "es"), ano: r("year", "pt"), m\u00EAs: r("month", "pt"), dia: r("day", "pt"), anno: r("year", "it"), mese: r("month", "it"), giorno: r("day", "it"), \u0433\u043E\u0434: r("year", "ru"), \u043C\u0435\u0441\u044F\u0446: r("month", "ru"), \u0440\u0456\u043A: r("year", "uk"), \u043C\u0456\u0441\u044F\u0446\u044C: r("month", "uk"), \u043A\u0432\u0430\u0440\u0442\u0430\u043B: r("quarter", "ru", "uk"), \u0434\u0435\u043D\u044C: r("day", "ru", "uk"), rok: r("year", "pl", "cs", "sk"), kwarta\u0142: r("quarter", "pl"), miesi\u0105c: r("month", "pl"), dzie\u0144: r("day", "pl"), \u010Dtvrtlet\u00ED: r("quarter", "cs"), m\u011Bs\u00EDc: r("month", "cs"), den: r("day", "cs"), \u0161tvr\u0165rok: r("quarter", "sk"), mesiac: r("month", "sk"), de\u0148: r("day", "sk"), \u00E5r: r("year", "sv", "da", "nb"), kvartal: r("quarter", "sv", "da", "nb"), m\u00E5nad: r("month", "sv"), m\u00E5ned: r("month", "da", "nb"), vuosi: r("year", "fi"), vuosinelj\u00E4nnes: r("quarter", "fi"), kuukausi: r("month", "fi"), p\u00E4iv\u00E4: r("day", "fi"), \u00E9v: r("year", "hu"), negyed\u00E9v: r("quarter", "hu"), h\u00F3nap: r("month", "hu"), nap: r("day", "hu"), y\u0131l: r("year", "tr"), \u00E7eyrek: r("quarter", "tr"), ay: r("month", "tr"), g\u00FCn: r("day", "tr"), \u03AD\u03C4\u03BF\u03C2: r("year", "el"), \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF: r("quarter", "el"), \u03BC\u03AE\u03BD\u03B1\u03C2: r("month", "el"), \u03B7\u03BC\u03AD\u03C1\u03B1: r("day", "el"), an: r("year", "ro"), trimestru: r("quarter", "ro"), lun\u0103: r("month", "ro"), zi: r("day", "ro"), godina: r("year", "hr"), tromjese\u010Dje: r("quarter", "hr"), mjesec: r("month", "hr"), dan: r("day", "hr"), \u5E74: r("year", "ja", "zh"), \u56DB\u534A\u671F: r("quarter", "ja"), \u5B63\u5EA6: r("quarter", "zh"), \u6708: r("month", "ja", "zh"), \u65E5: r("day", "ja", "zh"), \uC5F0\uB3C4: r("year", "ko"), \uBD84\uAE30: r("quarter", "ko"), \uC6D4: r("month", "ko"), \uC77C: r("day", "ko"), tahun: r("year", "id"), kuartal: r("quarter", "id"), triwulan: r("quarter", "id"), bulan: r("month", "id"), hari: r("day", "id"), n\u0103m: r("year", "vi"), qu\u00FD: r("quarter", "vi"), th\u00E1ng: r("month", "vi"), ng\u00E0y: r("day", "vi"), \u0E1B\u0E35: r("year", "th"), \u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A: r("quarter", "th"), \u0E40\u0E14\u0E37\u0E2D\u0E19: r("month", "th"), \u0E27\u0E31\u0E19: r("day", "th"), \u0627\u0644\u0633\u0646\u0629: r("year", "ar"), \u0633\u0646\u0629: r("year", "ar"), \u0627\u0644\u0639\u0627\u0645: r("year", "ar"), \u0639\u0627\u0645: r("year", "ar"), \u0627\u0644\u0631\u0628\u0639: r("quarter", "ar"), \u0631\u0628\u0639: r("quarter", "ar"), "\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629": r("quarter", "ar"), \u0627\u0644\u0634\u0647\u0631: r("month", "ar"), \u0634\u0647\u0631: r("month", "ar"), \u0627\u0644\u064A\u0648\u0645: r("day", "ar"), \u064A\u0648\u0645: r("day", "ar"), \u05E9\u05E0\u05D4: r("year", "he"), \u05E8\u05D1\u05E2\u05D5\u05DF: r("quarter", "he"), \u05D7\u05D5\u05D3\u05E9: r("month", "he"), \u05D9\u05D5\u05DD: r("day", "he"), \u0935\u0930\u094D\u0937: r("year", "hi"), \u0938\u093E\u0932: r("year", "hi"), \u0924\u093F\u092E\u093E\u0939\u0940: r("quarter", "hi"), \u092E\u0939\u0940\u0928\u093E: r("month", "hi"), \u092E\u093E\u0939: r("month", "hi"), \u0926\u093F\u0928: r("day", "hi"), \u0633\u0627\u0644: r("year", "fa"), \u0645\u0627\u0647: r("month", "fa"), \u0631\u0648\u0632: r("day", "fa") });
|
|
2023
2023
|
var Qn2 = Object.freeze(Array.from(new Set(Object.values(ie2).flatMap((t) => t.langs))));
|
|
2024
2024
|
var fe = Object.freeze(["fa", "ar", "he", "th"]);
|
|
2025
|
-
var
|
|
2026
|
-
var
|
|
2027
|
-
var
|
|
2025
|
+
var wr = Object.freeze({ integer: "number", decimal: "number", double: "number", datetime: "date", date: "date", boolean: "boolean", string: "text" });
|
|
2026
|
+
var Nr = Object.freeze({ RENDER_START: "render-start", RENDER_OK: "render-ok", RENDER_ERROR: "render-error", VIEW: "view", VIEW_VERDICT: "view-verdict" });
|
|
2027
|
+
var Le = 2 ** 31 - 1;
|
|
2028
2028
|
|
|
2029
2029
|
// src/payload.ts
|
|
2030
2030
|
var ROW_IDX_COLUMN = "__rowIdx__";
|
package/dist/index.mjs
CHANGED
|
@@ -122,7 +122,7 @@ import {
|
|
|
122
122
|
toSourceRows,
|
|
123
123
|
unpinScrolledAxis,
|
|
124
124
|
valuePlacementFlag
|
|
125
|
-
} from "./chunk-
|
|
125
|
+
} from "./chunk-KBFJTRYA.mjs";
|
|
126
126
|
import "./chunk-A2GMXZP7.mjs";
|
|
127
127
|
import {
|
|
128
128
|
ACTIVE_TICK_CLASS,
|
|
@@ -212,6 +212,12 @@ var OPTIONS_VOCABULARY = Object.freeze({
|
|
|
212
212
|
flipIntervalMs: entry({ timing: "live", default: "", min: 0, max: FLIP_INTERVAL_MAX_MS }),
|
|
213
213
|
/** Which way a face turns, for any chart that turns between faces: side to side, or top to bottom. */
|
|
214
214
|
flipDirection: entry({ timing: "live", default: FLIP_DIRECTION_DEFAULT, values: ["horizontal", "vertical"] }),
|
|
215
|
+
/**
|
|
216
|
+
* The fill behind each card of a card deck and each face of a carousel. BLANK - "the chart's own" -
|
|
217
|
+
* is the default, and it differs by chart: a deck uses the page so its cards read as part of it, a
|
|
218
|
+
* carousel tints its faces so each reads as a surface. A color is a reader's choice.
|
|
219
|
+
*/
|
|
220
|
+
cardBackgroundColor: entry({ timing: "live", default: "" }),
|
|
215
221
|
/**
|
|
216
222
|
* Hover drop lines on a 3D chart. BLANK - "the chart's own" - is the default: off, unless the request
|
|
217
223
|
* that made the chart asked for them. "on" / "off" is a reader's choice and wins either way.
|
package/dist/react.mjs
CHANGED
|
@@ -60,6 +60,12 @@ export declare const OPTIONS_VOCABULARY: Readonly<{
|
|
|
60
60
|
flipIntervalMs: OptionVocabularyEntry;
|
|
61
61
|
/** Which way a face turns, for any chart that turns between faces: side to side, or top to bottom. */
|
|
62
62
|
flipDirection: OptionVocabularyEntry;
|
|
63
|
+
/**
|
|
64
|
+
* The fill behind each card of a card deck and each face of a carousel. BLANK - "the chart's own" -
|
|
65
|
+
* is the default, and it differs by chart: a deck uses the page so its cards read as part of it, a
|
|
66
|
+
* carousel tints its faces so each reads as a surface. A color is a reader's choice.
|
|
67
|
+
*/
|
|
68
|
+
cardBackgroundColor: OptionVocabularyEntry;
|
|
63
69
|
/**
|
|
64
70
|
* Hover drop lines on a 3D chart. BLANK - "the chart's own" - is the default: off, unless the request
|
|
65
71
|
* that made the chart asked for them. "on" / "off" is a reader's choice and wins either way.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/chart-host",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.70",
|
|
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",
|