@bicharts/chart-host 0.6.11 → 0.6.12
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 +8 -3
- package/dist/{chunk-N5M4X7ON.mjs → chunk-5IE7AWZY.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/react.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -178,12 +178,17 @@ basemap — load or provide geometry first.
|
|
|
178
178
|
## D3 plugins
|
|
179
179
|
|
|
180
180
|
Some charts call `d3.sankey()`, `d3.hexbin()` or the voronoi family. Those are separate packages
|
|
181
|
-
that **attach onto the d3 object** — install them and
|
|
181
|
+
that **attach onto the d3 object** — install them and pass the host *one* d3 that carries them.
|
|
182
|
+
`import * as d3` is a module namespace, which is frozen, so assigning a plugin onto it throws;
|
|
183
|
+
`assembleD3` builds a plain copy instead:
|
|
182
184
|
|
|
183
185
|
```js
|
|
184
|
-
import * as
|
|
186
|
+
import * as d3base from "d3";
|
|
185
187
|
import { sankey, sankeyLinkHorizontal } from "d3-sankey";
|
|
186
|
-
|
|
188
|
+
import { assembleD3 } from "@bicharts/chart-host";
|
|
189
|
+
|
|
190
|
+
const d3 = assembleD3(d3base, { sankey, sankeyLinkHorizontal });
|
|
191
|
+
createChartHost(el, { code, data, d3 });
|
|
187
192
|
```
|
|
188
193
|
|
|
189
194
|
The integration contract returned by `generate_chart` names exactly which ones *your* chart
|
|
@@ -3384,7 +3384,7 @@ function explainRenderFailure(err, d3) {
|
|
|
3384
3384
|
}
|
|
3385
3385
|
if (typeof d3?.mermaid?.render !== "function" && /\bmermaid\b/i.test(msg)) {
|
|
3386
3386
|
return new Error(
|
|
3387
|
-
"[@bicharts/chart-host] this chart draws its diagram with Mermaid, which it reaches as d3.mermaid.render(...), and the d3 you passed has no mermaid on it \u2014 this host did not load the library. A host supplies it exactly the way the other plugins are supplied:
|
|
3387
|
+
"[@bicharts/chart-host] this chart draws its diagram with Mermaid, which it reaches as d3.mermaid.render(...), and the d3 you passed has no mermaid on it \u2014 this host did not load the library. A host supplies it exactly the way the other plugins are supplied: hand createChartHost ONE d3 that carries it, the SAME d3 every chart gets \u2014 npm install mermaid then import * as d3base from 'd3'; import mermaid from 'mermaid'; import { assembleD3 } from '@bicharts/chart-host'; const d3 = assembleD3(d3base, { mermaid }); (an ES-module d3 namespace is frozen, so assigning onto it throws) Original error: " + msg
|
|
3388
3388
|
);
|
|
3389
3389
|
}
|
|
3390
3390
|
const m = /d3\.(\w+) is not a function|(\w+) is not a function/.exec(msg);
|
|
@@ -3392,7 +3392,7 @@ function explainRenderFailure(err, d3) {
|
|
|
3392
3392
|
const pkg = D3_PLUGIN_PACKAGES[name];
|
|
3393
3393
|
if (pkg) {
|
|
3394
3394
|
return new Error(
|
|
3395
|
-
`[@bicharts/chart-host] this chart calls d3.${name}(), which comes from the separate "${pkg}" package and is not attached to the d3 you passed. Install it and
|
|
3395
|
+
`[@bicharts/chart-host] this chart calls d3.${name}(), which comes from the separate "${pkg}" package and is not attached to the d3 you passed. Install it and hand the host ONE d3 that carries it, the SAME d3 every chart gets: npm install ${pkg} then import * as d3base from "d3"; import { ${name} } from "${pkg}"; import { assembleD3 } from "@bicharts/chart-host"; const d3 = assembleD3(d3base, { ${name} }); (an ES-module d3 namespace is frozen, so assigning onto it throws) Original error: ` + msg
|
|
3396
3396
|
);
|
|
3397
3397
|
}
|
|
3398
3398
|
return err;
|
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.12",
|
|
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",
|