@bicharts/chart-host 0.6.69 → 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/index.mjs +6 -0
- 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
|
package/dist/index.mjs
CHANGED
|
@@ -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.
|
|
@@ -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",
|