apexsankey 1.14.0 → 1.15.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/LICENSE.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  ApexSankey is a commercial product, included in the **Pro** plan and above.
4
4
 
5
- **There is no free tier for ApexSankey.** The $2M threshold that makes some Apex products free does not apply to this one: a Pro license is required whatever your financial resources, by companies, individuals, non-profits and educators alike. Without a valid license key ApexSankey renders with a trial watermark, which is for evaluation only.
5
+ **There is no free tier for ApexSankey.** The $2M threshold that makes some Apex products free does not apply to this one: a Pro license is required whatever your financial resources, by companies, individuals, non-profits and educators alike. Without a valid license key ApexSankey renders with a trial watermark. Using it that way without ever having bought a license is for evaluation only.
6
6
 
7
- One license key works across every Apex product, so a customer of one does not buy a second for another.
7
+ One license key covers every Apex product your plan includes, so you do not buy a separate key for each product.
8
8
 
9
9
  ---
10
10
 
@@ -16,13 +16,15 @@ Pro and Premium are priced per developer, and priced on the features you use rat
16
16
 
17
17
  ✅ What's included:
18
18
 
19
- - Use in internal tools and commercial applications
20
- - Modifications and app-level distribution
21
- - 12-month subscription with updates & support
19
+ - Use in internal tools, client work, and commercial applications
20
+ - Client work includes a system you build for a single client and hand over to run on the client's own servers
21
+ - Modifications, and deploying your application to its users
22
+ - 12-month subscription with updates, and technical support on Pro and above
22
23
 
23
24
  🚫 Not allowed:
24
25
 
25
26
  - Redistribution in toolkits, SDKs, or platforms
27
+ - Selling or licensing the same product to multiple customers, which is redistribution and needs the OEM License below
26
28
  - Use by unlicensed developers
27
29
  - Competing charting or diagramming products
28
30
 
@@ -36,7 +38,7 @@ Non-Profits are treated like commercial entities and need a **Pro** license or h
36
38
 
37
39
  ### 🔄 OEM / Redistribution License (Paid)
38
40
 
39
- Required if you are **embedding ApexSankey into a product or platform used by other people**, such as:
41
+ Required if you ship ApexSankey inside a **product you distribute** to customers or other developers, or inside a **hosted product where users build, customize, or configure diagrams**, such as:
40
42
 
41
43
  - No-code dashboards
42
44
  - Developer platforms
@@ -49,11 +51,13 @@ Required if you are **embedding ApexSankey into a product or platform used by ot
49
51
  - **Every licensed feature**, at the highest tier
50
52
  - 12-month subscription with updates & support
51
53
 
52
- ⚠️ **Developer licenses are purchased separately.** The OEM License grants redistribution rights and carries no developer seats. Each developer who works with ApexSankey in that application also needs a **Community + Commercial** license of their own. That is the tier whatever features your product uses, because the license key comes from the OEM License and already renders every licensed feature.
54
+ ⚠️ **Developer licenses are purchased separately.** The OEM License grants redistribution rights and carries no developer seats. Each developer who works with ApexSankey in that application also needs a **Community + Commercial** license of their own, which is free for organizations under $2M in annual revenue, budget or funding. That is the tier whatever features your product uses, because the license key comes from the OEM License and already renders every licensed feature.
55
+
56
+ This holds for ApexSankey too, even though the Community plan does not include it on its own: the OEM license key is what covers ApexSankey in that application.
53
57
 
54
58
  Your end users need no license of their own. A second application needs a second OEM license. White-label, resale, and affiliate arrangements are quoted separately.
55
59
 
56
- ✅ OEM **not required** if your app simply renders static diagrams and users **cannot** configure or interact with them.
60
+ ✅ OEM **not required** for a hosted app that only shows predefined diagrams, which users **cannot** build, customize, or configure. Using features your developers enabled, including Premium features, does not by itself require an OEM license. OEM is for products whose purpose is letting users build charts or dashboards: dashboard and report builders, embedded BI, no-code tools, SDKs.
57
61
 
58
62
  ---
59
63
 
@@ -61,7 +65,7 @@ Your end users need no license of their own. A second application needs a second
61
65
 
62
66
  Your license key expires and **ApexSankey renders with a trial watermark**, because the whole product is licensed rather than a set of features inside a free one. You no longer receive updates, new features, or technical support. Your existing deployment keeps running.
63
67
 
64
- For OEM licenses, continued redistribution requires an active subscription.
68
+ For OEM licenses, redistribution must stop until the license is reinstated. Cancelling or not renewing a subscription is not termination of the [Terms of Use](https://apexcharts.com/legal/terms/).
65
69
 
66
70
  ---
67
71
 
@@ -70,7 +74,7 @@ For OEM licenses, continued redistribution requires an active subscription.
70
74
  By installing ApexSankey (e.g., via `npm install apexsankey`), you are agreeing to the applicable license based on your usage:
71
75
 
72
76
  - Commercial License (Pro or higher, whatever your financial resources)
73
- - OEM License (if redistributing to third-party users)
77
+ - OEM License (if you distribute a product containing it, or host one where users build diagrams)
74
78
 
75
79
  ---
76
80
 
package/README.md CHANGED
@@ -67,9 +67,11 @@ Methods available on an `ApexSankey` instance:
67
67
 
68
68
  | Method | Description |
69
69
  | --- | --- |
70
- | `render(data)` | Build the diagram from `data` (`{ nodes, edges }`) and write the SVG into the container. Returns the internal graph renderer, which exposes `exportToSvg()`. |
70
+ | `render(data)` | Build the diagram from `data` (`{ nodes, edges }`) and write the SVG into the container. Returns the internal graph renderer, which exposes `exportToSvg()` and `getResolvedOptions()` (the styling options this render resolved from the options, the variables, the tokens and the theme, for page code that matches its own DOM to the diagram). |
71
71
  | `update(data)` | Transition an already-rendered instance to new `data`. When the new layout shares the current topology (same nodes and flows, only different values or positions), the nodes and ribbons spring smoothly to their new places. When the topology differs, it morphs through the change: entering flows grow out of their source node, survivors slide to their new places, and removed flows retract and dissolve. When animation is disabled or the user prefers reduced motion, it redraws instantly. |
72
72
  | `refreshTokens()` | Re-read the theme (the `--apex-sankey-*` variables, the `--apx-*` tokens, the named or registered theme and the page's design system) and repaint the diagram: node colours follow the palette as it resolves now (a node's own `color` stays), and so do the labels, the tooltip, the focus ring and the particles. The diagram reads its theme on every render and `update()` takes only data, so call this after a stylesheet swap (an Ignite UI light/dark switch, say), a class that sets the variables, or the `apexsankey/ignite-ui` add-on loaded after the first render. Nodes stay where they are, dragged ones included, and the view does not move. A no-op before `render()`. |
73
+ | `pauseParticles()` | Stop the `particleFlow` particles where they are. They stay paused through `update()` and `refreshTokens()`, still riding along with their ribbons as an update moves them, until `resumeParticles()`. Called before the particles exist, it takes effect when they appear. |
74
+ | `resumeParticles()` | Set paused particles moving again from where they are. |
73
75
  | `ApexSankey.setLicense(key)` | Static. Set the commercial license key before creating any chart instances. |
74
76
  | `ApexSankey.registerTheme(name, theme)` | Static. Register (or override) a named theme (a `SankeyTheme`), then reference it by name via the `theme` option. Use for brand presets. |
75
77
  | `ApexSankey.collapseGroups(data, groups, collapsed)` | Static. Project a detailed `{ nodes, edges }` to an aggregated one by collapsing the listed groups into super-nodes (re-routing and merging their flows). The pure transform behind the `drillDown` plugin; use it to seed the initial collapsed render. |
@@ -102,11 +104,13 @@ The layout can be configured by passing a second argument to `ApexSankey` with t
102
104
  | `onNodeClick` | `(node: SankeyNode) => void` | `undefined` | Callback fired when the user clicks a node. |
103
105
  | `edgeOpacity` | `number` | `0.4` | Opacity of edges (0–1). |
104
106
  | `edgeGradientFill` | `boolean` | `true` | Fill edges with a gradient between source and target node colors. |
105
- | `particleFlow` | `boolean` | `false` | Animate particles drifting along each flow ribbon, with density proportional to the ribbon's value. Purely decorative; skipped under `prefers-reduced-motion`. |
107
+ | `particleFlow` | `boolean \| ParticleFlowOptions` | `false` | Animate particles drifting along each flow ribbon. Purely decorative; skipped under `prefers-reduced-motion`. The particles keep moving through `update()`, each holding its place along its ribbon. `true` uses the built-in density (one particle per 9 px of thickness, 1 to 16 per flow); an object turns them on with its rules: `unitsPerParticle` (one particle per that many units of value, rounded, no per-flow limit, so counts compare across flows and updates) and `minValue` (a flow below it carries none). Counts are worked out when an update starts. At most 600 particles are drawn: with `unitsPerParticle`, a frame that needs more scales every count down by one factor (a flow that had a particle keeps one), warns once in the console with a setting that fits, and keeps that factor for the later frames. Chord diagrams draw no particles. |
106
108
  | `edgeGap` | `number` | `0` | Gap in pixels between adjacent edges at node connection points. |
107
109
  | `whitespace` | `number` | `0.18` | Fraction of vertical space used as margins between nodes (0–1). Lower = taller nodes. |
108
110
  | `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Flow direction. `'horizontal'` lays ranks out in columns (flows left→right); `'vertical'` lays them in rows (flows top→bottom). |
109
111
  | `axisTitles` | `string[]` | `undefined` | Titles drawn above each column (or beside each row when vertical), one per rank — the axis/dimension labels of an alluvial diagram. Index `i` labels rank `i`. See [Alluvial](#alluvial). |
112
+ | `maxValue` | `number` | `undefined` | Draw every render and `update()` at one fixed scale instead of fitting each to the chart, so the same value draws the same thickness in every frame. Set it to the largest column total across all your data. A lighter column packs to the top (the left when vertical) with the gaps it has at `maxValue`, rather than spreading out, as long as it keeps the same nodes (keep a node's flows at 0 rather than leaving them out). Ignored, with a console warning, by chord diagrams and when not a positive number. See [Comparing frames](#comparing-frames-fixed-scale-and-input-order). |
113
+ | `nodeOrder` | `'auto' \| 'input'` | `'auto'` | Order of the nodes within each column. `'auto'` reorders them to cut crossings, so the order can change when flows appear or disappear; `'input'` keeps the order of `nodes`. See [Comparing frames](#comparing-frames-fixed-scale-and-input-order). |
110
114
  | `viewPortWidth` | `number` | `800` | Internal SVG viewport width in pixels. |
111
115
  | `viewPortHeight` | `number` | `500` | Internal SVG viewport height in pixels. |
112
116
  | `highlightConnectedPath` | `boolean` | `true` | Highlight connected flows on interaction. Hovering a node or flow gives a one-hop preview; clicking a node or flow pins an isolate of its full upstream/downstream path (click again, or click another, to change/release). |
@@ -125,7 +129,8 @@ The layout can be configured by passing a second argument to `ApexSankey` with t
125
129
  | `fontFamily` | `string` | `''` | CSS font-family for node labels. Falls back to the page default when empty. |
126
130
  | `fontSize` | `string` | `'14px'` | CSS font-size for node labels. |
127
131
  | `fontWeight` | `string` | `'400'` | CSS font-weight for node labels. |
128
- | `a11y` | `{ enabled?: boolean, diagramLabel?: string, description?: string }` | `{ enabled: true }` | WCAG 2.1 AA accessibility options. |
132
+ | `nodeLabel` | `{ formatter?: (content: NodeLabelContent) => string, position?: 'inside' \| 'outside' \| 'start' \| 'end', minHeight?: number }` | `undefined` | Node label text, side and visibility. Unset, a label is the node's title cut to 15 characters (18 when vertical), on the side facing the middle of the diagram, on nodes taller than `fontSize`. See [Node labels](#node-labels). |
133
+ | `a11y` | `{ enabled?: boolean, diagramLabel?: string, description?: string }` | `{ enabled: true }` | WCAG 2.1 AA accessibility options. The SVG is a labelled `group` holding a list of nodes and the flows as images, so all of them stay exposed to screen readers. Nodes are Tab stops in reading order (column by column, top to bottom); the arrow keys move to a node's flows. Zero-value nodes and flows draw nothing and are skipped. `description` fills a `<desc>` with an id unique to the diagram. |
129
134
  | `locale` | `{ direction?: 'ltr' \| 'rtl' \| 'auto', messages?: Partial<SankeyMessages> }` | `{ direction: 'ltr' }` | Localization and text-direction. `direction: 'rtl'` mirrors the diagram horizontally (flows read right-to-left) and sets `dir="rtl"` on the container (`'auto'` defers to the document). `messages` overrides the screen-reader strings the diagram generates. |
130
135
 
131
136
  ### Chord
@@ -178,6 +183,30 @@ sankey.render({...ApexSankey.buildAlluvialData(input), options: sankey.options})
178
183
 
179
184
  Each `AlluvialRecord` is `{ values: Record<string, string>, value?: number }` — the category at each dimension (keyed by dimension id), and the weight it contributes (default `1`). A record missing a category at some dimension simply skips that adjacency.
180
185
 
186
+ ### Comparing frames: fixed scale and input order
187
+
188
+ By default every `render()` and `update()` fits the diagram to the chart: the largest column fills the height. That is right for one diagram, but across a series of updates (one frame per year, say) a small year is scaled up as far as a large one, so ribbon widths cannot be compared between frames. Two options make the frames comparable:
189
+
190
+ - `maxValue` fixes the scale. Set it to the largest column total across all the frames you will show. A column that totals `maxValue` fills the height as the largest column does by default; a lighter one is drawn in proportion, packed to the top (the left when vertical) with the same gaps, and the unused space collects below it. A column that totals more draws past the edge of the chart, with a one-time console warning. The gaps are shared among the nodes the column has in that frame. A node whose flows are left out of a frame leaves the layout, and the others move to share its gap, so keep such a node's flows in the data with a value of 0: it then keeps its slot at zero height.
191
+ - `nodeOrder: 'input'` keeps every column in the order the nodes are listed in `nodes`, so a flow that appears or disappears never reshuffles them. The column a node sits in still follows its flows.
192
+
193
+ ```js
194
+ const sankey = new ApexSankey(el, {maxValue: 100, nodeOrder: 'input'});
195
+ sankey.render({nodes, edges: edges1950, options: sankey.options});
196
+ // later: the same value draws the same thickness, and the nodes keep their order
197
+ sankey.update({nodes, edges: edges2007, options: sankey.options});
198
+ ```
199
+
200
+ Both work horizontally and vertically, in circular and alluvial diagrams, and in a [comparison](#comparison-split-view) (pass them in `options` and both panels share one scale and one order). A chord diagram always fills its ring and keeps the order of `nodes`, so it ignores `maxValue` (with a warning) and needs no `nodeOrder`.
201
+
202
+ Flows whose value is zero can stay in the data from frame to frame:
203
+
204
+ - A node whose flows are all zero is drawn at zero height. It is not a tab stop and screen readers do not announce it; a zero flow is skipped the same way, and is left out of its nodes' descriptions and of the diagram's node and flow counts.
205
+ - When an update takes the focused node or flow to zero, focus moves to the nearest one still drawn: a flow hands it to its source node (then its target), a node to the next node in reading order (then the previous one). A node removed from the data hands focus to the node now in its place in reading order.
206
+ - While an animated update runs, keyboard focus stays on the node or flow it was on, and the frame being drawn shows it: the node's focus ring and the connected-path highlight.
207
+ - When a flow rises from zero, it unfurls out of its source node, as a new flow does. When it falls to zero, it thins away in place.
208
+ - A frame in which every flow is zero draws nothing, without errors.
209
+
181
210
  ### Plugins & Events
182
211
 
183
212
  Subscribe to instance events with `on` (it returns an unsubscribe function), or package reusable behaviour as a `SankeyPlugin` and install it with `use`.
@@ -209,8 +238,9 @@ Emitted events and their payloads:
209
238
  | `edge:mouseleave` | `{ source, target, value, originalEvent }` | The pointer leaves a flow. |
210
239
  | `rendered` | none | After the initial render and after each `update()` settles. |
211
240
  | `destroyed` | none | On `destroy()`. |
241
+ | `playback:frame` | `{ index, frame }` | The `timePlayback` plugin showed a frame (a playback step, a scrub or `goTo()`). |
212
242
 
213
- A `SankeyPlugin` is `{ name, install(ctx) }`. `install` receives `{ chart, on }` and may return a teardown function that runs on `destroy()`. Every subscription made through `ctx.on` is also released automatically on `destroy()`.
243
+ A `SankeyPlugin` is `{ name, install(ctx) }`. `install` receives `{ chart, on, emit }` and may return a teardown function that runs on `destroy()`. Every subscription made through `ctx.on` is also released automatically on `destroy()`. `ctx.emit(event, payload)` sends an event to the chart's subscribers, as `timePlayback` does with `playback:frame`.
214
244
 
215
245
  #### Built-in plugins
216
246
 
@@ -237,12 +267,47 @@ sankey.use(timePlayback({frames, interval: 1500, loop: true}));
237
267
 
238
268
  | `TimePlaybackOptions` | Type | Default | Description |
239
269
  | --- | --- | --- | --- |
240
- | `frames` | `TimePlaybackFrame[]` | required | Ordered frames (`{ nodes, edges, label? }`). Share topology across frames for a smooth morph. |
241
- | `interval` | `number` | `1600` | Milliseconds each frame is shown before advancing. |
242
- | `autoplay` | `boolean` | `false` | Start playing on install. |
270
+ | `frames` | `TimePlaybackFrame[]` | required | Ordered frames (`{ nodes, edges, label?, hold? }`). Share topology across frames for a smooth morph. |
271
+ | `interval` | `number` | `1600` | Milliseconds each frame is shown before advancing, unless the frame sets its own `hold`. |
272
+ | `autoplay` | `boolean` | `false` | Start playing on install. Ignored when the user prefers reduced motion. |
243
273
  | `loop` | `boolean` | `false` | Loop back to the first frame after the last. |
244
274
  | `controls` | `boolean` | `true` | Render the built-in control bar. |
245
275
  | `mount` | `HTMLElement` | after the chart | Where to render the control bar. |
276
+ | `onFrame` | `(index, frame) => void` | none | Called each time the plugin shows a frame: a playback step, a scrub or `goTo()`. Not called on install. |
277
+ | `announce` | `boolean` | `true` | Announce frame changes to screen readers through a polite live region, with the frame's label. A scrub or `goTo()` is announced at once. While playing, announcements are at least 1.5 s apart so speech keeps up: the frame on screen when the gap ends is spoken, and so is the frame playback pauses or stops on. Skipped while the scrubber has focus, since it reads its own value out. |
278
+
279
+ A frame's `label` is what the bar shows, what the scrubber reads out as its value (`aria-valuetext`) and what the announcement speaks; a frame without one uses the `playbackFrameLabel` message (`Frame 2 / 75`). A frame's `hold` (milliseconds) replaces `interval` for that frame, so a story can stop on the frames it is about:
280
+
281
+ ```js
282
+ const frames = years.map((y) => ({...y, label: String(y.year), hold: y.year === 2007 ? 4000 : 800}));
283
+ ```
284
+
285
+ Under `locale.direction: 'rtl'` the bar is mirrored too: the button sits on the right and the scrubber runs right to left, the way the flows do.
286
+
287
+ `timePlayback()` returns the plugin, which is also its controller. Keep the reference to drive it from the page; `use()` still returns the chart, so chaining is unchanged:
288
+
289
+ ```js
290
+ const playback = timePlayback({frames, controls: false, onFrame: (i, frame) => console.log(i, frame.label)});
291
+ sankey.use(playback);
292
+ playback.goTo(57); // show frame 57; playback, if running, continues from it
293
+ playback.play();
294
+ playback.pause();
295
+ playback.index; // the frame on screen
296
+ playback.playing; // whether playback is running
297
+ sankey.on('playback:frame', ({index, frame}) => {}); // the same as onFrame, as an event
298
+ ```
299
+
300
+ | `TimePlaybackController` | Type | Description |
301
+ | --- | --- | --- |
302
+ | `play()` | `() => void` | Play from the frame on screen (from the first when the last is on screen and `loop` is off). |
303
+ | `pause()` | `() => void` | Stop on the frame on screen. |
304
+ | `goTo(index)` | `(index: number) => void` | Show a frame; the index is rounded and clamped, and a non-number is ignored. Called from `onFrame` or a `playback:frame` handler, it runs once every handler has seen the frame it was called for, and a call for that same frame is ignored. |
305
+ | `index` | `number` | 0-based index of the frame on screen. |
306
+ | `playing` | `boolean` | Whether playback is running. |
307
+
308
+ Before `use()` and after `destroy()` the controller does nothing, `index` reads `0` and `playing` reads `false`. Install each `timePlayback()` on one chart.
309
+
310
+ The control bar's play and pause glyphs are hidden from screen readers, and the button is named by the `playbackPlayLabel` and `playbackPauseLabel` messages, the scrubber by `playbackSliderLabel` (see [Localization & RTL](#localization--rtl)). The bar follows the diagram's theme: its text takes the label colour (`fontColor`, `--apex-sankey-label-color`, `--apx-fore`, the theme or the design system) once something sets it, and with light labels it renders its native parts dark and sits on the canvas colour the theme paints. The button and its border take `--apx-surface` and `--apx-grid`, and the scrubber `--apx-accent`. With nothing themed it keeps its light look.
246
311
 
247
312
  `drillDown` turns a large diagram into a set of super-nodes you expand on demand: click a super-node to reveal its constituent flows, click any of its children to collapse it back. The drillable nodes get a `pointer` cursor so they read as clickable. Expanding animates the children **growing out of the super-node** (and shrinking back into it on collapse) with their ribbons — driven through the chart's own `update()` (which accepts an optional `SankeyTransition` hint for this). It is built on the pure `ApexSankey.collapseGroups` transform (also exported as `collapseGroups`), which re-routes and merges the flows of a collapsed group. Importable as `drillDown` or `ApexSankey.plugins.drillDown`; applies to the Sankey projection (not chord). Seed the initial collapsed render with `ApexSankey.collapseGroups` so there is no load-time morph.
248
313
 
@@ -313,16 +378,46 @@ You can also pass an inline `SankeyTheme` object directly as `theme`. A `SankeyT
313
378
  | `canvasStyle` | `string` | CSS on the SVG root container, typically the background and border. |
314
379
  | `tooltipTheme` | `'light' \| 'dark'` | Tooltip color preset. |
315
380
 
381
+ ### Node labels
382
+
383
+ `nodeLabel` sets what each node's label says, which side of the node it sits on, and how small a node can be and still get one. Every field is optional.
384
+
385
+ | `NodeLabelOptions` field | Type | Default | Description |
386
+ | --- | --- | --- | --- |
387
+ | `formatter` | `(content: NodeLabelContent) => string` | `undefined` | Returns the label text. `content.node` is the node's data and `content.value` its value (the larger of its incoming and outgoing totals, unrounded). The text is never truncated; an empty string leaves that node unlabelled. |
388
+ | `position` | `NodeLabelPosition` | `'inside'` | `'inside'` faces the middle of the diagram (downstream for the first half of the columns, upstream for the rest), `'outside'` the other way, `'start'` always upstream and `'end'` always downstream. These follow the flow, so they hold under RTL and `orientation: 'vertical'` (`'start'` is above a vertical bar). Labels past the outer columns sit in the `spacing` margin: raise `spacing` until they fit. |
389
+ | `minHeight` | `number` | `undefined` | Labels nodes at least this many pixels along the value axis (height, or width when vertical); `0` labels every node with a value. A zero-value node draws nothing and is never labelled. Unset, a node must be taller than `fontSize`. |
390
+
391
+ ```ts
392
+ const sankey = new ApexSankey(el, {
393
+ nodeLabel: {
394
+ formatter: ({node, value}) => `${node.title} ${value.toFixed(1)}`, // "Coal 7.8"
395
+ position: 'end',
396
+ minHeight: 4,
397
+ },
398
+ });
399
+ ```
400
+
401
+ During an animated `update()`, a label shows the new value from the first frame, and whether a node is labelled follows the height it is moving to. A label therefore appears or goes once, as the update starts, instead of popping in or out when the node crosses `minHeight` part way through.
402
+
316
403
  ### Localization & RTL
317
404
 
318
405
  The diagram's screen-reader strings live in `SankeyMessages`; pass a `Partial<SankeyMessages>` via `locale.messages` to translate any subset (unset keys keep their English defaults, exported as `DEFAULT_SANKEY_MESSAGES`). Visible tooltips are localized separately via `tooltipTemplate` / `nodeTooltipTemplate`.
319
406
 
407
+ A message whose default is a function also takes a string template, whose `{name}` placeholders take the fields of the message's context: `playbackFrameLabel: '{position} of {total}'`, `diagramLabel: '{nodeCount} nodes, {flowCount} flows'`. This is the form the Blazor wrapper sends.
408
+
409
+ The English defaults speak numbers in English formatting, rounded to at most three decimals (three significant digits below 1, so a small flow is never read as 0). A message you supply receives the raw numbers. Zero-value flows, and nodes whose flows are all zero, are left out of the counts and summaries.
410
+
320
411
  | `SankeyMessages` key | Type | Description |
321
412
  | --- | --- | --- |
322
413
  | `diagramLabel` | `(ctx: SankeyDiagramLabelContext) => string` | SVG root aria-label summary (node/flow counts + largest flow). |
323
414
  | `nodeAriaLabel` | `(ctx: SankeyNodeLabelContext) => string` | Per-node aria-label (incoming/outgoing flow summary). |
324
- | `edgeAriaLabel` | `(ctx: SankeyEdgeLabelContext) => string` | Per-edge aria-label. Default: `Flow from {source} to {target}: {value} units`. |
415
+ | `edgeAriaLabel` | `(ctx: SankeyEdgeLabelContext) => string` | Per-edge aria-label. Default: `Flow from {source} to {target}: {value} units`, with `{value}` rounded (`1 unit` for exactly one). |
325
416
  | `nodesGroupLabel` | `string` | aria-label for the `<g>` wrapping all nodes. Default: `'Sankey nodes'`. |
417
+ | `playbackFrameLabel` | `(ctx: SankeyPlaybackFrameContext) => string` | `timePlayback` text for a frame without a `label` (`ctx` is `{ position, total }`, 1-based). Default: `Frame {position} / {total}`. |
418
+ | `playbackPlayLabel` | `string` | aria-label of the `timePlayback` button while paused. Default: `'Play'`. |
419
+ | `playbackPauseLabel` | `string` | aria-label of the `timePlayback` button while playing. Default: `'Pause'`. |
420
+ | `playbackSliderLabel` | `string` | aria-label of the `timePlayback` scrubber. Default: `'Time frame'`. |
326
421
 
327
422
  ```ts
328
423
  const sankey = new ApexSankey(el, {
@@ -333,7 +428,7 @@ const sankey = new ApexSankey(el, {
333
428
  });
334
429
  ```
335
430
 
336
- Default tooltip template
431
+ Default tooltip template (the built-in one rounds `value` to at most three decimals, three significant digits below 1; a template you supply gets the raw number)
337
432
 
338
433
  ```js
339
434
  const tooltipTemplate = ({source, target, value}) => {