@astrato-io/visualizations 0.10.1 → 0.12.0
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/CHANGELOG.md +30 -1
- package/README.md +148 -5
- package/THIRD_PARTY_NOTICES.md +494 -0
- package/VISUALIZATION_DEFINITIONS.md +9 -146
- package/chunks/{Button-Dn3rJrYf.js → Button-CQdoKSXX.js} +3 -3
- package/chunks/{CircularProgress-BFeu06Yb.js → CircularProgress-DpT1lwWw.js} +20 -20
- package/chunks/FieldTypeIcon-Cg4F9Q5D.js +22 -0
- package/chunks/{LinearProgress-ClO6GUjN.js → LinearProgress-B7S0Q26A.js} +14 -14
- package/chunks/{MenuOption-Czc34u4q.js → MenuOption-DpKFJxmo.js} +167 -167
- package/chunks/{Title-BgYnaVTR.js → Title-m5damhc0.js} +37 -37
- package/chunks/{_createAggregator-BMu9uRax.js → _createAggregator-BA8_iU9q.js} +17 -17
- package/chunks/{app-filter-bar.compiler-CVir0wkl.js → app-filter-bar.compiler--T4Qz3Wu.js} +8 -8
- package/chunks/{bar-layout-C_UgRlVl.js → bar-layout-OFhxn2Go.js} +2 -2
- package/chunks/{bar.compiler-DYuFdi9J.js → bar.compiler-hWZBYYvV.js} +71 -69
- package/chunks/{builder-C-TKA-My.js → builder-7w_bgV_h.js} +106 -55
- package/chunks/{coloring-BtnPiQ_o.js → coloring-Cd6p0GQJ.js} +93 -88
- package/chunks/{createSimplePaletteValueFilter--zrZxRV9.js → createSimplePaletteValueFilter-CiJT8s1s.js} +169 -169
- package/chunks/defaults-CMFqXvaJ.js +3 -0
- package/chunks/{definitions-CT304NDn.js → definitions-DTauTjIX.js} +399 -398
- package/chunks/{escobar-CvEV2ES1.js → escobar-CMvphKSK.js} +4949 -4879
- package/chunks/{extend-preset-D9-JP92b.js → extend-preset-BpXttHFk.js} +449 -450
- package/chunks/{filter.compiler-CXeZznks.js → filter.compiler-DOGFweJz.js} +10 -10
- package/chunks/{filtering-8_bFv-jb.js → filtering-NOnDcGbo.js} +241 -241
- package/chunks/handlers-CyYFSfhM.js +15393 -0
- package/chunks/{icon-picker-styles-BXiJ1SZS.js → icon-picker-styles-DuSERhBU.js} +8 -8
- package/chunks/{isEqual-D8Ay63xR.js → isEqual-4f8yUUtC.js} +1 -1
- package/chunks/{isFocusVisible-Bu8gGZu5.js → isFocusVisible-Czm70MGc.js} +9 -9
- package/chunks/line.compiler-B-4H55_T.js +203 -0
- package/chunks/linear-Bq_r9l5S.js +264 -0
- package/chunks/{logger-DdZpR7xZ.js → logger-Cioob-QV.js} +74 -73
- package/chunks/{lookup-BWllin0q.js → lookup-B3tWH2hX.js} +1 -0
- package/chunks/{map.compiler-Q_Y1Pvat.js → map.compiler-Cv5V6EhF.js} +40 -40
- package/chunks/measure-axis-label-format-COy8U_dd.js +27 -0
- package/chunks/measure-format-default-B_kuGSzi.js +26 -0
- package/chunks/{metadata-BQm_TXI1.js → metadata-dGSe5UWy.js} +5 -5
- package/chunks/number.compiler-D7nMcEMv.js +57 -0
- package/chunks/{operations-DKQWuLL7.js → operations-CgfehCad.js} +11397 -11114
- package/chunks/{range-BdhzvYQ_.js → range-Dmwp9kVB.js} +2 -2
- package/chunks/{react-dom-BGP4tbXV.js → react-dom-CfuL-m78.js} +82 -82
- package/chunks/{render-wrappers-BZpyDnJy.js → render-wrappers--g-zPFBW.js} +1 -1
- package/chunks/{requirements-e8Fe96ag.js → requirements-DHayNJ2C.js} +245 -221
- package/chunks/{shared-C_2F90xq.js → shared-DoEN9nNM.js} +505 -494
- package/chunks/standalone-B3hRGgYi.js +773 -0
- package/chunks/{standalone-BkbiH-o8.js → standalone-BPNXgFft.js} +498 -759
- package/chunks/standalone-BPTT8XEu.js +424 -0
- package/chunks/standalone-BgAeHROc.js +2 -0
- package/chunks/{standalone-BE_ONgiG.js → standalone-BkQxag7M.js} +102 -102
- package/chunks/{standalone-Cc98Pdr6.js → standalone-Bxa3x6dg.js} +872 -872
- package/chunks/standalone-C0If-V6O.js +773 -0
- package/chunks/standalone-C1TOyflX.js +287 -0
- package/chunks/{standalone-CY_kjarf.js → standalone-CE5PwJN0.js} +18 -18
- package/chunks/{standalone-B8ZSqauS.js → standalone-CG7IFN6n.js} +120 -120
- package/chunks/{standalone-wOWRCpdn.js → standalone-CKlgGu80.js} +49 -49
- package/chunks/standalone-CNf-oA2U.js +355 -0
- package/chunks/{standalone-BDrXVxlP.js → standalone-CXPdWFlw.js} +14 -14
- package/chunks/{standalone-z0o52o5t.js → standalone-Cf0_5tbu.js} +5567 -5568
- package/chunks/{standalone-Cl0TSfqC.js → standalone-DMi4-Vp3.js} +122 -122
- package/chunks/{standalone-DNh9NcMa.js → standalone-DTEX67C8.js} +154 -154
- package/chunks/{standalone-DHRalbVO.js → standalone-DU46-kYv.js} +279 -279
- package/chunks/standalone-Dbn3jSH6.js +690 -0
- package/chunks/{standalone-CsoMmE9T.js → standalone-DdcAL_k_.js} +839 -843
- package/chunks/standalone-DwCIA0UG.js +1057 -0
- package/chunks/standalone-Dz13tl3P.js +357 -0
- package/chunks/standalone-H9GFzFk_.js +8377 -0
- package/chunks/{standalone-CaTxAydz.js → standalone-MduR0qre.js} +2227 -1000
- package/chunks/standalone-ejTz66P3.js +2 -0
- package/chunks/{standalone-DflyWtuR.js → standalone-keB-0wK3.js} +216 -216
- package/chunks/{standalone-BTY3w_JA.js → standalone-nnkuQd0K.js} +28 -28
- package/chunks/standalone-vGGR6Vcn.js +6 -0
- package/chunks/{table.compiler-COaHE9VD.js → table.compiler-mS4UvhLT.js} +31 -31
- package/chunks/theme-MYp6Rj1J.js +232 -0
- package/chunks/{useFieldName-CdnCWzhd.js → useFieldName-AdSak4Ch.js} +1 -1
- package/chunks/{utils-DganVptf.js → utils-CUKgR7it.js} +4216 -4070
- package/chunks/{view-Bzlros43.js → view-BeYwpcVD.js} +1561 -1561
- package/chunks/{visualization-filters-D7i6oh1Z.js → visualization-filters-B9qik5_K.js} +2683 -2342
- package/chunks/{with-html-element-CiIhFEa5.js → with-html-element-1GSeLT59.js} +3712 -3682
- package/definitions.js +2 -2
- package/docs/operations/astrato-app-filter-bar.md +1 -1
- package/docs/operations/bar.md +144 -32
- package/docs/operations/combo.md +79 -17
- package/docs/operations/date-picker.md +4 -4
- package/docs/operations/distribution-gauge.md +18 -16
- package/docs/operations/dot.md +107 -24
- package/docs/operations/filter.md +10 -8
- package/docs/operations/gauge.md +20 -18
- package/docs/operations/heatMap.md +73 -21
- package/docs/operations/histogram.md +45 -12
- package/docs/operations/iframe.md +1 -1
- package/docs/operations/image.md +1 -1
- package/docs/operations/index.md +12 -11
- package/docs/operations/line.md +86 -24
- package/docs/operations/map.md +5274 -0
- package/docs/operations/number.md +10 -9
- package/docs/operations/pie.md +23 -21
- package/docs/operations/radar.md +13 -11
- package/docs/operations/sankey.md +19 -17
- package/docs/operations/scatter.md +111 -28
- package/docs/operations/shape.md +5 -5
- package/docs/operations/simpleTextObject.md +4 -4
- package/docs/operations/slider.md +1 -1
- package/docs/operations/table.md +27 -25
- package/docs/operations/tree.md +5 -3
- package/docs/operations/treemap.md +70 -18
- package/docs/operations/waterfall.md +40 -7
- package/docs/operations/word-cloud.md +69 -17
- package/getters.js +3 -3
- package/index.js +585 -612
- package/metadata.js +2 -2
- package/operations.js +25 -18
- package/package.json +74 -70
- package/src/definitions/index.d.ts +1 -7
- package/src/definitions/model/definitions/descriptors/descriptor-metadata.d.ts +3 -48
- package/src/definitions/model/definitions/schema-registry.d.ts +15 -14
- package/src/definitions/model/definitions/schemas/bar.schema.d.ts +3 -3
- package/src/definitions/model/definitions/schemas/broad-chart.schema.d.ts +2 -2
- package/src/definitions/model/definitions/schemas/common.schema.d.ts +19 -6
- package/src/definitions/model/definitions/schemas/index.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/line.schema.d.ts +4 -3
- package/src/definitions/model/definitions/schemas/number.schema.d.ts +1 -1
- package/src/definitions/model/definitions/schemas/table.schema.d.ts +14 -14
- package/src/index.d.ts +1 -1
- package/src/operations/index.d.ts +11 -1
- package/src/types.d.ts +166 -1
- package/src/visualization-catalog.d.ts +3 -0
- package/styles.css +1 -1
- package/chunks/FieldTypeIcon-DrMoGpHJ.js +0 -22
- package/chunks/color-rules-DYJL4fIW.js +0 -15
- package/chunks/color-settings-DJFoFTip.js +0 -5
- package/chunks/defaults-Dtk7fg3C.js +0 -3
- package/chunks/handlers-C6CZ0XJA.js +0 -15399
- package/chunks/line.compiler-DmHpmQCC.js +0 -198
- package/chunks/number.compiler-DQdg6zTy.js +0 -53
- package/chunks/standalone-4MsKiqs0.js +0 -355
- package/chunks/standalone-B794g9pE.js +0 -1012
- package/chunks/standalone-BA2YXyJS.js +0 -422
- package/chunks/standalone-BgumbdaJ2.js +0 -357
- package/chunks/standalone-Blh4qejk.js +0 -689
- package/chunks/standalone-CXY4FpF7.js +0 -773
- package/chunks/standalone-DH0xTEes.js +0 -2
- package/chunks/standalone-DcnHjNnC.js +0 -2
- package/chunks/standalone-DrHdGkY7.js +0 -762
- package/chunks/standalone-c_rROMtx.js +0 -287
- package/chunks/standalone-drcFLeN6.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Changes to `@astrato-io/visualizations`, newest first. Operation names, payload shapes and allowed values for the
|
|
4
4
|
installed version are in the bundled [Operations Reference](./docs/operations/index.md) and in
|
|
5
5
|
`getVisualizationMetadata(type).operations`.
|
|
6
6
|
|
|
7
|
+
## 0.12.0
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Chart theming on the runtime. `createVisualizationRuntime({ theme, mode })` takes a full chart theme and a `light` or
|
|
12
|
+
`dark` mode, and `runtime.setTheme()` and `runtime.setMode()` redraw mounted charts without remounting them. Theme
|
|
13
|
+
values may be `{ light, dark }` pairs, resolved for the active mode.
|
|
14
|
+
- Color fields accept theme references such as `theme:primary`, `theme:palette.3` or `theme:status.negative` as well
|
|
15
|
+
as literal colors. The stored vSpec keeps the reference. An unknown reference draws `#9e9e9e` and is reported as
|
|
16
|
+
`UNRESOLVED_THEME_REFERENCES`.
|
|
17
|
+
- Diverging gradients: a gradient is `sequential` or `diverging`, with a `midpoint` (zero, a number or automatic) and
|
|
18
|
+
optional `steps`.
|
|
19
|
+
- Theme slots for styling that was hardcoded: font sizes, tooltip, label contrast inside marks, hover outline, muted
|
|
20
|
+
fill, status colors, and optional null and "Others" colors. Labels, legend and axis text follow the theme's text color
|
|
21
|
+
and table cells its surface.
|
|
22
|
+
- `colors.table.rowHighlight` sets the background of the row or column a table highlights under the pointer when the
|
|
23
|
+
vSpec sets none, and `theme:table.rowHighlight` refers to it. It defaults to `#f2f2f2`, and to a dark gray in dark
|
|
24
|
+
mode.
|
|
25
|
+
|
|
26
|
+
## 0.11.0
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Standalone map rendering with support for layer queries, selections and map operations.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- `VisualizationDefinition` now includes `MapVisualizationDefinition`.
|
|
35
|
+
|
|
7
36
|
## 0.10.1
|
|
8
37
|
|
|
9
38
|
### Changed
|
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ Use these exact visualization IDs:
|
|
|
32
32
|
| `heatMap` | Chart |
|
|
33
33
|
| `histogram` | Chart |
|
|
34
34
|
| `line` | Chart |
|
|
35
|
+
| `map` | Chart |
|
|
35
36
|
| `pie` | Chart |
|
|
36
37
|
| `radar` | Chart |
|
|
37
38
|
| `sankey` | Chart |
|
|
@@ -151,7 +152,7 @@ Settings live in `vSpec.appFilterBarSettings` and are also available through [op
|
|
|
151
152
|
| `showChartBreakdown` | `false` | Opt in to **Chart breakdown** for apps using dimension groups. Only shown when a group has at least two available fields. |
|
|
152
153
|
| `selectableFieldKeys` | unrestricted | Limit fields available for creating filters. Omitted or empty means all fields; existing selections are always visible. |
|
|
153
154
|
|
|
154
|
-
The bar supports value lists with search and paging, available and excluded values, text matching, numeric and date ranges, relative date periods, associative conditions, and dimension group switching. It uses the engine's configured time zone for timestamp editing. The value editor keeps search, sort, and the selection count above its scrollable list. **Select all** affects loaded values; **Actions** exposes deselect, invert, select available, and clear. Pending selections can be applied or cancelled from the bar or the editor footer.
|
|
155
|
+
The bar supports value lists with search and paging, available and excluded values, text matching, numeric and date ranges, relative date periods, set filters (associative conditions), and dimension group switching. It uses the engine's configured time zone for timestamp editing. The value editor keeps search, sort, and the selection count above its scrollable list. **Select all** affects loaded values; **Actions** exposes deselect, invert, select available, and clear. Pending selections can be applied or cancelled from the bar or the editor footer.
|
|
155
156
|
|
|
156
157
|
Host integration requires the existing synchronous field metadata getters (or `dataBinding.fieldMetadata`), `engine.getData` or `data.query`, and selection services including `getSelection`, `setNewSelectionState`, pending apply/cancel, and clear-all. Provide the selection change observable so changes made elsewhere appear immediately. `getSelectionMode(groupId)` or the host's `selectionMode` supplies inherited behavior; the standalone adapter defaults to manual when neither is provided. Field locking is offered when `toggleFieldLocked` or `setFieldLocked` is available.
|
|
157
158
|
|
|
@@ -159,6 +160,8 @@ Associative filter creation requires an explicit `hostServices.engine.capabiliti
|
|
|
159
160
|
|
|
160
161
|
When an enabled field picker opens, the bar discovers eligible targets using `hostServices.engine.getAssociatedViews(fieldKey, dataBinding)`. Otherwise, when the host provides `engine.areViewsConnected`, the eligible views are those joined to the field's view among the views of `engine.getFields()`. Otherwise the adapter reads `viewStates` from a one-row engine query, using `alfStatus` or compatibility flags. Hosts that offer none of these must supply the explicit discovery method before opting in. Discovery checks at most four fields concurrently, stops scheduling when the picker closes, and retries on the next opening. The option appears only if a target has an associated view containing an allowed condition field; empty or failed lookups never make a target eligible. No discovery runs on mount or when the feature is disabled or unsupported.
|
|
161
162
|
|
|
163
|
+
A set filter selects values of one field by matching related rows. Each set combines row filters on fields from joined tables with measure filters, which keep the values whose measures pass over those rows; the two are always ANDed. Sets join the result as an intersection (AND) or a union (OR), and **Not** keeps values with no matching related rows. Measure filters offer the semantic layer measures whose tables are joined to the set's field.
|
|
164
|
+
|
|
162
165
|
Existing associative chips remain visible and removable (subject to locking and single-select policies). Disabling creation does not prevent editing existing filters on a capable host. Without runtime support, opening a chip explains that editing is unavailable instead of launching a broken editor.
|
|
163
166
|
|
|
164
167
|
Dimension group changes are shared with mounted visualizations in the same runtime group and retained for later mounts. Apps that use those groups can expose **Chart breakdown** with `settings.showChartBreakdown: true` in their visualization definition, or the `setAppFilterBarChartBreakdownEnabled` operation. The control is hidden by default and when no group offers multiple available fields.
|
|
@@ -509,12 +512,150 @@ Browsers do not draw hidden pages, so a chart cannot finish in a background tab.
|
|
|
509
512
|
is visible and starts over when a hidden page returns, so readiness stays pending in the background and resolves once
|
|
510
513
|
the chart renders on return.
|
|
511
514
|
|
|
515
|
+
## Theming
|
|
516
|
+
|
|
517
|
+
Pass a theme and a color mode when creating the runtime. Every chart the runtime mounts draws with them, and
|
|
518
|
+
`runtime.setTheme()` and `runtime.setMode()` redraw mounted charts without remounting them. Anything you leave out
|
|
519
|
+
keeps the default, so a runtime created without a theme renders exactly as before.
|
|
520
|
+
|
|
521
|
+
```ts
|
|
522
|
+
const runtime = createVisualizationRuntime({
|
|
523
|
+
client,
|
|
524
|
+
registry,
|
|
525
|
+
mode: 'dark', // optional; defaults to 'light'
|
|
526
|
+
theme: {
|
|
527
|
+
fontFamily: 'Inter',
|
|
528
|
+
titleFontFamily: 'Inter Display', // optional; defaults to fontFamily
|
|
529
|
+
colors: {
|
|
530
|
+
primary: { light: '#2f5bea', dark: '#7d9bff' },
|
|
531
|
+
text: { light: '#1b1d29', dark: '#e8e9f0' },
|
|
532
|
+
surface: { light: '#ffffff', dark: '#16171d' },
|
|
533
|
+
gridline: { light: '#e3e4ea', dark: '#34363f' },
|
|
534
|
+
axis: { line: { light: '#d0d2da', dark: '#3d3f49' }, label: { light: '#6b6e7b', dark: '#a3a6b3' } },
|
|
535
|
+
},
|
|
536
|
+
palettes: {
|
|
537
|
+
categorical: [{ id: 'brand', colors: ['#2f5bea', '#f2994a', '#27ae60', '#eb5757', '#9b51e0'] }],
|
|
538
|
+
sequential: [{ id: 'blues', colors: { light: ['#e8eefd', '#2f5bea'], dark: ['#1d2440', '#7d9bff'] } }],
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
// follow the host's color scheme
|
|
544
|
+
runtime.setMode(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
545
|
+
|
|
546
|
+
// replace the whole theme; pass undefined to return to the default theme
|
|
547
|
+
runtime.setTheme(nextTheme);
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
Any color, color list or palette's `colors` may be a `{ light, dark }` pair. The runtime uses the value for the
|
|
551
|
+
active mode, so you pass one theme and switch the mode. A plain value is used in both modes. In dark mode, text,
|
|
552
|
+
surface, gridline and axis colors, the hover outline and the table row highlight you leave out use built-in dark
|
|
553
|
+
defaults; palettes, `primary` and the other colors stay the same.
|
|
554
|
+
|
|
555
|
+
| Setting | What it styles |
|
|
556
|
+
| ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
557
|
+
| `fontFamily`, `titleFontFamily` | Chart text and chart titles. See [Fonts And Icons](#fonts-and-icons). |
|
|
558
|
+
| `colors.primary` | Series that have no palette, such as a single-measure bar chart. |
|
|
559
|
+
| `colors.brand` | Further colors offered as theme colors in color pickers. |
|
|
560
|
+
| `colors.text`, `colors.title` | Labels, legends and values; titles default to `text`. |
|
|
561
|
+
| `colors.surface` | The background charts draw on. Charts that paint cells, such as tables, use it. |
|
|
562
|
+
| `colors.border`, `colors.gridline` | Object borders and gridlines. |
|
|
563
|
+
| `colors.axis.line`, `.tick`, `.label`, `.title` | Axes. The tick defaults to the line color and the title to the label color. |
|
|
564
|
+
| `palettes.categorical`, `palettes.defaultCategorical` | Palettes for coloring by category, and the one used when a vSpec names none. |
|
|
565
|
+
| `palettes.sequential`, `palettes.defaultSequential` | Ramps for coloring by value, from low to high, and the default ramp. |
|
|
566
|
+
| `palettes.diverging`, `palettes.defaultDiverging` | Ramps for diverging gradients, from low through a neutral middle to high, and the default. |
|
|
567
|
+
| `colors.tooltip.background`, `.text` | Tooltips. |
|
|
568
|
+
| `colors.dataLabel.onDark`, `.onLight` | Labels inside marks, which take whichever of `text`, `onDark` and `onLight` contrasts best with the mark. Labels outside marks use `text`. |
|
|
569
|
+
| `colors.selection.hoverStroke`, `.mutedFill`, `mutedOpacity` | The hovered mark's outline, and marks a selection leaves out: mixed towards gray at `mutedOpacity` (default 0.25), or `mutedFill` when they have no fill. |
|
|
570
|
+
| `colors.status.positive`, `.negative`, `.total` | Increases, decreases and totals, such as waterfall bars whose vSpec sets no colors. |
|
|
571
|
+
| `colors.null`, `colors.others` | Categorical colors for null values and the Top N "Others" group. Unset, they take palette colors. |
|
|
572
|
+
| `colors.table.rowHighlight` | The row or column a table highlights under the pointer, when its vSpec sets no highlight color. Defaults to `#f2f2f2`. |
|
|
573
|
+
| `fontSizes.axisLabel`, `.legend`, `.dataLabel`, `.fieldTitle` | Default font sizes in pixels. A size set in a vSpec takes precedence. |
|
|
574
|
+
|
|
575
|
+
Sankey, treemap and map labels and line end labels keep the built-in pair rather than `colors.dataLabel`; they
|
|
576
|
+
still prefer `text` when it contrasts best with the mark.
|
|
577
|
+
|
|
578
|
+
Theme palettes are listed before the built-in ones. A vSpec selects a palette by its `id`; a vSpec that names no
|
|
579
|
+
palette uses the default, which is the first palette in the list unless you name another, including a built-in one.
|
|
580
|
+
The runtime throws a `TypeError` for a theme it cannot read and logs a warning for a default palette id that matches
|
|
581
|
+
no palette.
|
|
582
|
+
|
|
583
|
+
The runtime does not paint the mount container, so give it the same background as `colors.surface`.
|
|
584
|
+
|
|
585
|
+
### Diverging And Banded Gradients
|
|
586
|
+
|
|
587
|
+
Gradient coloring is sequential by default. `setColoringGradientRamp` makes it diverging, so the middle color of a
|
|
588
|
+
diverging ramp sits on a midpoint and colors grow more intense in both directions, and can draw any gradient as solid
|
|
589
|
+
bands:
|
|
590
|
+
|
|
591
|
+
```ts
|
|
592
|
+
await applyRuntimeOperations({
|
|
593
|
+
instanceId: 'margin-by-region',
|
|
594
|
+
runtime,
|
|
595
|
+
operationRequests: [
|
|
596
|
+
{ id: 'type', name: 'setColoringType', payload: 'gradient' },
|
|
597
|
+
{ id: 'ramp', name: 'setColoringGradientRamp', payload: { kind: 'diverging', midpoint: 0, steps: 6 } },
|
|
598
|
+
],
|
|
599
|
+
});
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
`midpoint` is a number, or `'auto'` for the middle of the gradient limits, and defaults to 0. The ramp reaches equally
|
|
603
|
+
far on both sides of the midpoint, so equal distances from it get equal intensity. `steps`, from 2 to 12, draws that
|
|
604
|
+
many bands; `null` returns to a continuous gradient. A diverging gradient uses `palettes.defaultDiverging` unless
|
|
605
|
+
`setChartPalette` names a diverging ramp: one from `palettes.diverging` or a built-in one (`redblue`, `purplegreen`,
|
|
606
|
+
`browngreen`).
|
|
607
|
+
|
|
608
|
+
### Theme Color References
|
|
609
|
+
|
|
610
|
+
Any vSpec color field that an operation can set, such as the coloring color, color overwrites and rules, custom
|
|
611
|
+
palettes, table styles and axis colors, accepts a theme color reference as well as a hex color. A reference is the
|
|
612
|
+
string `theme:` followed by a slot. It resolves when the chart draws, against the runtime's theme and mode, so the chart
|
|
613
|
+
follows later `setTheme()` and `setMode()` calls without being edited. The vSpec keeps the reference. Only color fields
|
|
614
|
+
resolve: text, titles and condition values that read like a reference are drawn as written.
|
|
615
|
+
|
|
616
|
+
```ts
|
|
617
|
+
await applyRuntimeOperations({
|
|
618
|
+
instanceId: 'revenue',
|
|
619
|
+
runtime,
|
|
620
|
+
operationRequests: [{ id: 'color', name: 'setColoringColor', payload: 'theme:palette.3' }],
|
|
621
|
+
});
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
| Reference | Resolves to |
|
|
625
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
626
|
+
| `theme:primary` | `colors.primary` |
|
|
627
|
+
| `theme:text`, `theme:title`, `theme:surface` | `colors.text`, `colors.title`, `colors.surface` |
|
|
628
|
+
| `theme:border`, `theme:gridline` | `colors.border` (defaults to the axis line color), `colors.gridline` |
|
|
629
|
+
| `theme:axis.line`, `theme:axis.tick`, `theme:axis.label`, `theme:axis.title` | The matching `colors.axis` color |
|
|
630
|
+
| `theme:palette.<n>` | The nth color, from 1, of the default categorical palette |
|
|
631
|
+
| `theme:brand.<n>` | The nth color, from 1, of `[colors.primary, ...colors.brand]` |
|
|
632
|
+
| `theme:tooltip.background`, `theme:tooltip.text`, `theme:dataLabel.onDark`, `theme:dataLabel.onLight`, `theme:selection.hoverStroke`, `theme:selection.mutedFill`, `theme:status.positive`, `theme:status.negative`, `theme:status.total`, `theme:table.rowHighlight`, `theme:null`, `theme:others` | The matching theme color |
|
|
633
|
+
|
|
634
|
+
A reference the theme cannot resolve, such as an unknown slot or a palette index past the end, draws in a neutral grey
|
|
635
|
+
(`#9e9e9e`). The runtime logs it once through the logger's `warn`, with the instance id and the references, and again
|
|
636
|
+
when the set of unresolved references changes.
|
|
637
|
+
|
|
638
|
+
## Maps
|
|
639
|
+
|
|
640
|
+
See the [map definition reference](./VISUALIZATION_DEFINITIONS.md#map-map) and
|
|
641
|
+
[map operations reference](./docs/operations/map.md) bundled with this package for creation and configuration.
|
|
642
|
+
|
|
643
|
+
Maps use the same runtime and stylesheet as other visualizations. Leaflet, its plugins and stylesheet images are
|
|
644
|
+
bundled; applications do not need to load Leaflet separately. Include `@astrato-io/visualizations/styles.css`.
|
|
645
|
+
|
|
646
|
+
Each visible data layer runs its own query using the instance's data binding and selection group. Layer static filters
|
|
647
|
+
and geographic bounds are handled by the existing map query builder. Map click selections use the host selection
|
|
648
|
+
service. Reset to default view restores the last authored configuration after panning or zooming.
|
|
649
|
+
|
|
650
|
+
Map readiness uses the existing map render-completion event. External tile and image downloads may continue after
|
|
651
|
+
the map reports ready; their URLs must be accessible from the application.
|
|
652
|
+
|
|
512
653
|
## Fonts And Icons
|
|
513
654
|
|
|
514
655
|
Charts draw axis labels and legends on `<canvas>`, which only uses fonts that have finished loading. The runtime picks
|
|
515
656
|
the chart font for you, so no host CSS is needed:
|
|
516
657
|
|
|
517
|
-
1. `
|
|
658
|
+
1. `theme.fontFamily` from `createVisualizationRuntime()` or `runtime.setTheme()`, when set.
|
|
518
659
|
2. Otherwise the host page's font: `--astrato-font-family`, then `--font-family` (both read from `:root`), then the
|
|
519
660
|
`font-family` of `body`.
|
|
520
661
|
|
|
@@ -628,8 +769,9 @@ Calls for different instances are independent and may run concurrently.
|
|
|
628
769
|
|
|
629
770
|
Supply `availableFields` for operations that add or replace dimensions, measures, calculations, or raw fields. The
|
|
630
771
|
catalog must belong to the same semantic-layer context as the instance. Operations that only modify existing visual
|
|
631
|
-
properties may not require it.
|
|
632
|
-
|
|
772
|
+
properties may not require it. Palette names such as "theme default" or
|
|
773
|
+
"theme palette 2" resolve against the runtime's theme and mode. Most integrations do not need the advanced `variables`,
|
|
774
|
+
`theme`, `mode`, `changesQueue`, or custom `registry` inputs.
|
|
633
775
|
|
|
634
776
|
### Batches, Results, And Errors
|
|
635
777
|
|
|
@@ -685,7 +827,8 @@ each definition `ref`. A map also returns `compilation.resolvedLayerRefs`, whose
|
|
|
685
827
|
operation's `layer` selector. It runs in memory and makes no engine requests. It is also useful when validating a vSpec,
|
|
686
828
|
running operations in tests, or building an adapter with intentional custom state ownership. It does not serialize separate calls or protect against a
|
|
687
829
|
newer runtime/chart vSpec. Avoid applying its result to a live runtime from an older instance snapshot; use
|
|
688
|
-
`applyRuntimeOperations` for that case.
|
|
830
|
+
`applyRuntimeOperations` for that case. Pass `theme` and `mode` when operations name theme palettes, since there is no
|
|
831
|
+
runtime theme to resolve them against.
|
|
689
832
|
|
|
690
833
|
### Table Column Operations
|
|
691
834
|
|