@tidal-ts/chart 0.1.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.
@@ -0,0 +1,474 @@
1
+ /** The config for one plotted series — shared by the legend chips, the controls
2
+ * popover, and the chart. The chart reads `color`/`axis`/`style`/`visible`; the
3
+ * chips + controls read `label`/`value`/`unit`. **`id` is identity, `column` is
4
+ * data** — see {@link SeriesConfig}; they are deliberately two fields. */
5
+ export type SeriesAxis = 'L' | 'R';
6
+ /** Draw style for the PRIMARY ticker's series. `line`/`area`/`bar` apply to any
7
+ * series; `candle` (a first-class OHLC candlestick — `@pond-ts/charts`
8
+ * `<Candlestick>`) needs OHLC columns, so it's offered only on the price series.
9
+ * `bar`/`candle` bin the series into {@link SeriesConfig.window} windows (pond
10
+ * aggregates). Note: `dashed` is NOT a style — dashing is
11
+ * reserved to encode the comparison ticker (texture = primary/compare, color =
12
+ * series), applied automatically by the chart, never chosen per series. */
13
+ export type SeriesStyle = 'line' | 'area' | 'bar' | 'candle' | 'band' | 'lines';
14
+ /**
15
+ * The three columns a `band` config reads. Its `column` is the SPEC ID, which
16
+ * for a multi-output op is a PREFIX rather than a column of its own — the
17
+ * engine names `${id}Middle` / `Upper` / `Lower` off it. So a band is the one
18
+ * style whose `column` is not directly readable, and everything that scans a
19
+ * config's data (extent, hover, render) goes through here instead.
20
+ */
21
+ export declare function bandColumns(column: string): {
22
+ middle: string;
23
+ upper: string;
24
+ lower: string;
25
+ };
26
+ /**
27
+ * Whether a config draws a bar-marked output — i.e. whether the rise/fall
28
+ * toggle means anything for it.
29
+ *
30
+ * A `lines` config is a multi-output study, and only some of those carry a
31
+ * histogram among their outputs (a MACD does; a stochastic does not). Offering
32
+ * the toggle on a study with nothing to colour would be a control that does
33
+ * nothing.
34
+ */
35
+ export declare function hasBarOutput(c: Pick<SeriesConfig, 'style' | 'derive'>): boolean;
36
+ /**
37
+ * The per-output theme key for a `lines` config.
38
+ *
39
+ * One colour, N textures — a study's outputs are ONE series (a MACD is one
40
+ * study), so varying colour across them would fight the "colour = series"
41
+ * encoding. Mirrors the `__cmp` key, which does the same thing for a
42
+ * comparison counterpart.
43
+ */
44
+ export declare const outputKey: (id: string, i: number) => string;
45
+ /**
46
+ * The columns a config actually reads — one for most styles, three for a
47
+ * `band`, and one per declared output for `lines`.
48
+ *
49
+ * The single place that answers "what data does this config touch?", so a new
50
+ * multi-output study doesn't have to be found in five scanners. A `lines`
51
+ * config needs its `derive` to answer, because the suffixes come from the op's
52
+ * declaration; without one it degrades to its bare column rather than throwing
53
+ * (a persisted config can outlive the op that named it).
54
+ */
55
+ export declare function configColumns(c: {
56
+ column: string;
57
+ style: SeriesStyle;
58
+ derive?: DeriveSpec;
59
+ }): string[];
60
+ import type { DeriveSpec, SeriesWindow } from '@tidal-ts/core';
61
+ export type { DeriveSpec, SeriesWindow };
62
+ import type { CandleVariant, ColorBy } from '@pond-ts/charts';
63
+ export type { CandleVariant, ColorBy };
64
+ import { type CategoryLineStyle, type ChartSettings } from './chartSettings.js';
65
+ /**
66
+ * One seated series.
67
+ *
68
+ * **`id` and `column` are two different things, and keeping them apart is the
69
+ * point.** `id` is the config's *identity*: an opaque key its host mints once
70
+ * (`s-3`) and never rewrites — it keys selection, expansion, the chart theme
71
+ * (`as={c.id}`), the tracker, axis membership (`configAxisId`) and every user
72
+ * override. `column` is the *data*: the column this config reads out of its
73
+ * `source`, which for a derived config is `deriveId(derive)` and is therefore
74
+ * **recomputed on every spec edit**.
75
+ *
76
+ * They used to be one string, which meant editing a study's period (or a pair
77
+ * leg, or a tenor) minted a new identity and silently threw away the user's
78
+ * colour, axis and pins. An id is never a column name and must never be used as
79
+ * one — the two are unrelated strings by construction, so a mix-up reads no data
80
+ * at all rather than quietly reading the wrong thing.
81
+ */
82
+ export interface SeriesConfig {
83
+ /** Stable identity — opaque, minted by the host, **never** parsed or used as a
84
+ * data column. Survives every edit to the config's spec. */
85
+ id: string;
86
+ /** The data column to read from the config's `source`. A raw metric names a
87
+ * feed column (`iv21`, `close`); a derived one names its folded output
88
+ * (`deriveId(derive)`), which changes whenever the spec does. */
89
+ column: string;
90
+ label: string;
91
+ /** A curated palette **key** (`'blue'`, resolved by the host's palette) or a raw custom
92
+ * CSS color from the controls' escape hatch. DOM resolves it via
93
+ * `seriesStrokeVar`, the canvas via `chartTheme.resolveSeriesColor`. */
94
+ color: string;
95
+ axis: SeriesAxis;
96
+ /**
97
+ * Which y-axis on its side this series scales on — the axis panel's
98
+ * membership.
99
+ *
100
+ * Absent ⇒ the side's SHARED axis. A string names a separate axis on that
101
+ * side, and series naming the same one **share a scale** — which a boolean
102
+ * `ownAxis` could not express: two unlinked series each got a private axis
103
+ * with no way to put them together (Peter, 2026-08-18, wanting to drag one
104
+ * member onto another's axis).
105
+ *
106
+ * Unlinking mints the config's own id as the key, so an own axis keeps the
107
+ * id it always had (`rowId:side:configId`) and its range pin with it. A
108
+ * non-shared axis never binds the side's unit (the unit gate applies to
109
+ * shared members only), which is what lets a unitless spread arrive on a
110
+ * bound side.
111
+ */
112
+ axisGroup?: string;
113
+ style: SeriesStyle;
114
+ /** Aggregation window for `bar`/`candle`. Defaults to `'1d'` (the native bar) —
115
+ * ignored by `line`/`area`, which draw the raw series. */
116
+ window?: SeriesWindow;
117
+ /** Candle-only: the mark shape (`<Candlestick variant>`). Default `'candle'`. */
118
+ candleVariant?: CandleVariant;
119
+ /** Candle-only: `'series'` (one colour — the series' `color`) or `'direction'`
120
+ * (market green/red off open-vs-close). Default `'series'`. */
121
+ candleColorBy?: ColorBy;
122
+ visible: boolean;
123
+ /** Which keyed data source this series reads (`'vol'` / `'price'`) in the
124
+ * rows model — rows are viewports, sources are a separate axis. Defaults to
125
+ * the row's source at the render boundary. */
126
+ source?: string;
127
+ /** Latest value for the chip/controls readout (null until data). */
128
+ value: number | null;
129
+ /** Value suffix, e.g. `%`. */
130
+ unit?: string;
131
+ /** For a tenor-bearing metric: the family name (`ATM Vol`) + its tenor. The
132
+ * controls show the family on the main row and the tenor on a params sub-line
133
+ * (`21D`), so the identity reads as name + params rather than one long label. */
134
+ family?: string;
135
+ tenor?: number;
136
+ /** Which censor variant this series reads, when its metric takes that
137
+ * parameter (`'i'` / `'h'` / `'on'` / `'off'` — the host's censor vocabulary).
138
+ * Shown on the params sub-line beside the tenor, and editable there.
139
+ *
140
+ * The `column` is the truth and this follows it; it is carried on the config
141
+ * so the controls can render the current choice without a catalog lookup, the
142
+ * same way `family`/`tenor` are. */
143
+ censor?: string;
144
+ /** A **leg group** member — one leg of an unjoined pair. Absent for every
145
+ * ordinary series and for a JOINED pair (which is a single config).
146
+ * See {@link SeriesGroup}. */
147
+ group?: SeriesGroup;
148
+ /** A **study**: this series induces its column (`sma(20)` of another) rather
149
+ * than reading raw data — so `column === deriveId(derive)` and moves with the
150
+ * spec, while `id` stands still. The render folds the op onto the source
151
+ * series via `applyDerived`. Absent ⇒ raw. */
152
+ derive?: DeriveSpec;
153
+ /** Stroke width (px) for `line`/`area`. Omitted ⇒ the category default from
154
+ * the chart settings (see {@link seriesLineWidth}). */
155
+ lineWidth?: number;
156
+ /** Direction coloring for a `bar`/`candle` series: `'split'` (rise/fall pair)
157
+ * vs `'single'` (the series' own `color`). Omitted ⇒ the chart settings'
158
+ * default for that mark (legacy `candleColorBy` respected as a fallback). */
159
+ colorMode?: 'single' | 'split';
160
+ /** Split-mode rise/fall color keys (palette / `positive`·`negative` market
161
+ * keys / raw CSS). Omitted ⇒ the chart settings' defaults. */
162
+ riseColor?: string;
163
+ fallColor?: string;
164
+ }
165
+ /** A row-side's shared axis id (once the chart's private `rowAxis`). */
166
+ export declare const sharedAxisId: (rowId: string, side: SeriesAxis) => string;
167
+ /** A non-shared axis's id on a row side, keyed by its group. */
168
+ export declare const seriesAxisId: (rowId: string, side: SeriesAxis, group: string) => string;
169
+ /** The axis a config actually scales on: its own when unlinked, else the shared. */
170
+ export declare const configAxisId: (rowId: string, c: Pick<SeriesConfig, "axis" | "axisGroup">) => string;
171
+ /** Per-axis range state (the terminal machine's `axisRanges` values): `manual`
172
+ * pins the axis to `[min, max]`; `auto` with values present is the **preserved
173
+ * manual memory** (the legacy triple — "Auto fit was …" / re-manual restores).
174
+ * An axis with no entry at all has simply never been touched. `unit` is the
175
+ * unit the pin was set FOR: a shared axis id (`rowId:side`) can be re-bound
176
+ * to a different unit later (remove the old series, move a new one over), and
177
+ * a pin only applies while the axis still reads in its unit — a mismatched
178
+ * entry is treated as absent everywhere (PR #132 review, MEDIUM). */
179
+ export interface AxisRange {
180
+ mode: 'auto' | 'manual';
181
+ /** The manual pin, and its preserved memory once `mode` is back to `auto`.
182
+ * **Optional**, because an axis can carry a {@link AxisRange.lockMin} without
183
+ * ever having been pinned — a bar's zero floor is not a manual range, and
184
+ * fabricating one would put a bogus "Auto fit was …" memory behind it. */
185
+ min?: number;
186
+ max?: number;
187
+ unit: string;
188
+ /**
189
+ * HARD LIMITS on each bound, independent of {@link mode}. A number fixes that
190
+ * bound against **both** auto-fit and gestures; absent leaves it free.
191
+ *
192
+ * Deliberately separate fields from `min`/`max`: those are the manual pin (and
193
+ * its preserved memory when `mode` is back to `auto`), which is a different
194
+ * thing — an axis can be auto-fitting its top while its floor is nailed to
195
+ * zero, and one pair of numbers cannot say that.
196
+ *
197
+ * The reason they exist: a bar rests on a baseline, and a baseline that slides
198
+ * under a pan reads as the data moving. Locking `min` to `0` states that as a
199
+ * constraint on the axis rather than as a special mode for the gesture — so
200
+ * there is no "is this axis in bar mode?" question to get wrong at gesture
201
+ * time, and the user can see the lock and switch it off (`TDL-AXISLOCK`).
202
+ */
203
+ lockMin?: number;
204
+ lockMax?: number;
205
+ /**
206
+ * What an AUTO axis fits to: `'viewport'` (the default, and what the library
207
+ * has always done — the extent of what is on screen) or `'metric'` (the whole
208
+ * series, so the scale holds still while you pan across it).
209
+ *
210
+ * Only consulted while `mode` is `auto`; a manual pin has already answered the
211
+ * question. Ignored per-bound wherever a lock has.
212
+ */
213
+ autoBasis?: 'metric' | 'viewport';
214
+ /**
215
+ * Fit symmetrically about zero — `[-m, +m]` for `m` the larger absolute
216
+ * bound. The honest scale for a signed series (a spread, a change), where an
217
+ * asymmetric fit makes a small move look like a large one on whichever side
218
+ * happens to be tighter.
219
+ */
220
+ centerZero?: boolean;
221
+ /**
222
+ * Decimal places for this axis's tick labels, 0–4. Absent keeps each unit's
223
+ * own default (`%` one place, `$` whole dollars, a count compacted to
224
+ * `1.2M`). It overrides the DECIMALS only — the unit keeps its symbol and
225
+ * placement, so `$` at 0 reads `$162` and at 3 reads `$161.760`.
226
+ */
227
+ precision?: number;
228
+ /**
229
+ * The scale this axis draws on. `log` is base-10, for data spanning orders of
230
+ * magnitude.
231
+ *
232
+ * **`log` and a `0` bound lock are mutually exclusive** — log(0) is undefined,
233
+ * so an axis cannot both be logarithmic and contain zero. The panel refuses
234
+ * `log` while either bound is locked at 0 rather than silently dropping the
235
+ * lock (which would move a bar's baseline, the exact failure the lock exists
236
+ * to prevent). Unlock the bound first.
237
+ *
238
+ * `symlog` — linear through zero, logarithmic beyond — is the scale that CAN
239
+ * hold both, and charts supports it; it is deliberately not offered yet
240
+ * (Peter asked for linear|log).
241
+ */
242
+ scaleType?: 'linear' | 'log';
243
+ }
244
+ /**
245
+ * Whether an axis's entry says nothing — no lock, no pin, no memory, no format
246
+ * or fit choice — and can therefore be dropped rather than accumulate an empty
247
+ * per axis ever touched.
248
+ *
249
+ * **One definition on purpose.** Each writer used to carry its own copy of this
250
+ * test, and two of the three had fallen behind the fields the type had grown:
251
+ * clearing a lock deleted the axis's `precision` and `scaleType` with it, and
252
+ * toggling centre-zero off did the same. A predicate that lives beside the type
253
+ * cannot drift from it that way.
254
+ */
255
+ export declare function axisRangeIsEmpty(r: AxisRange): boolean;
256
+ /** The 0–4 precision choices an axis offers. */
257
+ export declare const AXIS_PRECISIONS: readonly [0, 1, 2, 3, 4];
258
+ /**
259
+ * Whether `log` may be chosen for an axis. A log scale cannot contain zero or
260
+ * anything below it, so any bound the STATE nails at or under `0` — a hard lock
261
+ * or a manual pin — refuses it. The reason is the second element, for the
262
+ * disabled control's tooltip.
263
+ *
264
+ * Only what the range can state is checked. An AUTO fit that happens to span
265
+ * zero is a property of the data, not of this record, so it is the chart's to
266
+ * handle (PR #173 review, LOW: the old test was `=== 0` on the two locks, which
267
+ * let a hand-locked `-5` floor through while the doc claimed the stronger
268
+ * property).
269
+ */
270
+ export declare function logAllowed(range: AxisRange | undefined): [boolean, string?];
271
+ export declare function axisFormat(unit: string | undefined, precision?: number): (v: number) => string;
272
+ /** Make a fitted extent symmetric about zero — `[-m, +m]`. `null` when there is
273
+ * nothing to centre (no data), so the caller falls back to the library's fit. */
274
+ export declare function centerOnZero(fit: {
275
+ min: number;
276
+ max: number;
277
+ } | null | undefined): {
278
+ min: number;
279
+ max: number;
280
+ } | null;
281
+ /**
282
+ * What to hand `<YAxis min|max>` for an axis — a lock first, then the manual
283
+ * pin, else `undefined` for the library's auto fit.
284
+ *
285
+ * The two bounds resolve independently, which is the point: a bar axis normally
286
+ * runs with a hard `0` floor and a free, auto-fitting top.
287
+ */
288
+ export declare function effectiveAxisBounds(range: AxisRange | undefined,
289
+ /** The host's computed AUTO fit for this axis, when its `autoBasis` /
290
+ * `centerZero` ask for one the library would not produce by itself. Consulted
291
+ * only under `mode: 'auto'`, and only where no lock has already spoken. */
292
+ fitted?: {
293
+ min: number;
294
+ max: number;
295
+ } | null): {
296
+ min?: number;
297
+ max?: number;
298
+ };
299
+ /**
300
+ * Apply an axis's locks to bounds a GESTURE reported — the enforcement half of
301
+ * "a lock is a hard limit".
302
+ *
303
+ * The axes are controlled: charts reports where a drag or wheel would take the
304
+ * axis and the host decides what to write back. So a locked bound is simply not
305
+ * taken from the gesture, which is what makes the zero floor unpannable rather
306
+ * than merely re-drawn.
307
+ */
308
+ export declare function clampBoundsToLocks(range: AxisRange | undefined, bounds: readonly [number, number]): [number, number];
309
+ /**
310
+ * The DEFAULT locks for an axis, from what it carries — the rule that gives a
311
+ * bar its baseline for free.
312
+ *
313
+ * All-positive bars lock `min` to `0`; all-negative lock `max` to `0`. Any
314
+ * non-bar member removes the lock: a line has no baseline to protect, and it
315
+ * should not inherit a floor it never asked for.
316
+ *
317
+ * **Bars that straddle zero get no lock** (Peter, 2026-08-29). Their baseline
318
+ * sits inside the plot, where neither bound can hold it — locking `min` would
319
+ * pin the wrong thing. Better to leave it free than invent a rule.
320
+ *
321
+ * A derived default, re-seeded when an axis's membership changes, so an axis
322
+ * that returns to all-bars gets its floor back.
323
+ *
324
+ * @param autoMin the axis's auto fit — the sign test. `null` (no data) yields no
325
+ * lock, so an empty axis is never nailed to a floor it cannot justify.
326
+ */
327
+ export declare function barZeroLock(cfgs: readonly SeriesConfig[], autoMin: number | null, autoMax: number | null): {
328
+ lockMin?: number;
329
+ lockMax?: number;
330
+ };
331
+ /**
332
+ * Which symbol a seated series reads — the control panel's binding chip.
333
+ *
334
+ * - `primary` — the ticker bar's main symbol; the chip is **outlined**.
335
+ * - `compare` — the comparison ROLE, so it re-resolves when the compare ticker
336
+ * changes; the chip is **dashed-outlined**, matching the dashed ink that
337
+ * encodes compare on the canvas.
338
+ * - `pinned` — fixed to one named symbol whatever the bar says; the chip is
339
+ * **grey-filled**, the heaviest of the three because it is the one binding
340
+ * that does NOT follow the workspace (the binding-legibility rule in
341
+ * Tidal's pairs plan: a ticker that doesn't track the bar must be visible).
342
+ */
343
+ export interface SeriesBinding {
344
+ kind: 'primary' | 'compare' | 'pinned';
345
+ /** The resolved symbol to print (`AAPL`). */
346
+ symbol: string;
347
+ }
348
+ /** The pair transforms (TDL-PAIR). Local literal union — this presentational
349
+ * package doesn't depend on the core seam's types. */
350
+ export type PairJoinOp = 'diff' | 'ratio' | 'logRatio';
351
+ /** What fn() can be set to — a join, or **`'none'`**: no transform, so the pair
352
+ * draws its two legs as separate inks instead of one spread (the LEG GROUP).
353
+ * George's taxonomy maps onto exactly this: `none` pairs are the "2–4 overlaid
354
+ * spaghetti", joined pairs are the spread reads. */
355
+ export type PairLensOp = PairJoinOp | 'none';
356
+ /** The JOINS — what the pair PICKER offers at add time (a pair is built by
357
+ * choosing a transform), and the subset of fn() that yields one line. One
358
+ * list, so the picker and the fn() node can't drift on naming or order. */
359
+ export declare const PAIR_JOINS: readonly {
360
+ op: PairJoinOp;
361
+ glyph: string;
362
+ hint: string;
363
+ }[];
364
+ /** Every fn() option, in display order — the joins plus `None`, which leads
365
+ * because it is the least of them: no transform at all. */
366
+ export declare const PAIR_LENSES: readonly {
367
+ op: PairLensOp;
368
+ glyph: string;
369
+ hint: string;
370
+ }[];
371
+ /**
372
+ * A **leg group** member: one leg of an UNJOINED pair.
373
+ *
374
+ * With no transform there is no single line and therefore no single ink, so an
375
+ * unjoined pair is not one config but two — each an ordinary series with its
376
+ * own colour, axis, eye and study pipeline — tied together by this group.
377
+ *
378
+ * A pair's fn() is fixed when it is created (Peter, 2026-08-18), so there is no
379
+ * join to remember and no way back to a spread: a group is simply what an
380
+ * unjoined pair IS. That is what keeps every downstream reader honest — one
381
+ * config still means one column, so the render, the axis policy, the extents
382
+ * and the dependency walks work on a leg with no special case.
383
+ */
384
+ export interface SeriesGroup {
385
+ /** Shared by both legs — the pair's identity. */
386
+ id: string;
387
+ /** Which leg this is: the pair row names them in A-then-B order. */
388
+ side: 'A' | 'B';
389
+ /** The pair's own eye: set on BOTH members together. A leg keeps its own
390
+ * `visible` while an ancestor hides it, so unhiding the pair restores what
391
+ * each leg was, rather than turning everything on. */
392
+ hidden?: boolean;
393
+ }
394
+ /**
395
+ * One leg of a seated pair, as the control panel shows it — the **Metric/Part**
396
+ * node of the control tree.
397
+ *
398
+ * A part is not a seated config: it exists only as structure inside the pair's
399
+ * spec, so the host projects it (it owns the catalog that turns a column into a
400
+ * name). Same node type as a top-level metric, which is the unification the
401
+ * tree design rests on: "a part is just a metric which is part of a pair".
402
+ */
403
+ export interface PairPartView {
404
+ /** The leg's side, as the fn() glyphs name it. */
405
+ side: 'A' | 'B';
406
+ /** The metric's display name — no studies, no role suffix (both are their
407
+ * own affordances on the row). */
408
+ label: string;
409
+ /** Which symbol this leg reads. A ticker prints only for a PINNED leg. */
410
+ binding?: SeriesBinding;
411
+ /** The studies wrapping the metric, in application order (`SMA(20)`). */
412
+ studies: readonly string[];
413
+ }
414
+ /** A seated pair, projected for the panel: its current lens and its two parts. */
415
+ export interface PairView {
416
+ op: PairLensOp;
417
+ parts: readonly PairPartView[];
418
+ }
419
+ /**
420
+ * Whether a series actually DRAWS — its own eye, and every ancestor's.
421
+ *
422
+ * A leg keeps its own `visible` while the pair above it is hidden, so unhiding
423
+ * the pair restores what each leg was rather than switching everything on. The
424
+ * panel therefore shows the leg's OWN eye (dimmed, because something above it
425
+ * is doing the hiding); the chart asks this.
426
+ */
427
+ export declare const seriesDrawn: (c: Pick<SeriesConfig, "visible" | "group">) => boolean;
428
+ /** The stroke widths offered in the controls + settings (px). */
429
+ export declare const LINE_WIDTHS: readonly [0.5, 1, 1.5, 2];
430
+ /** The dash pattern a `'dashed'` category draws with (also the compare texture). */
431
+ export declare const DASH_PATTERN: readonly [number, number];
432
+ /** Whether a series is a windowed **study** (an SMA/EMA overlay — the "Derived"
433
+ * style category). A pointwise derived metric (the realized-vol line) and every
434
+ * raw column read as **metrics**. */
435
+ export declare function isStudySeries(s: SeriesConfig): boolean;
436
+ /** True if a series reads the COMPARISON symbol — a spec whose leaves are
437
+ * `cmp_`-prefixed, or (an unjoined pair's leg) a raw `cmp_` column. */
438
+ export declare function readsCompare(s: Pick<SeriesConfig, 'derive' | 'column'>): boolean;
439
+ /** The style category a series' line defaults come from. A comparison-reading
440
+ * series takes the `comparisons` category (dashed) whatever else it is — the
441
+ * texture encodes the SYMBOL, so a study of a compare leg is dashed too. */
442
+ export declare function seriesCategoryStyle(s: SeriesConfig, settings: ChartSettings): CategoryLineStyle;
443
+ /** A series' stroke width: its explicit `lineWidth` override, else its category
444
+ * default from the settings (metrics vs studies). */
445
+ export declare function seriesLineWidth(s: SeriesConfig, settings?: ChartSettings): number;
446
+ /** A series' dash pattern (`undefined` = solid) from its category's style. */
447
+ export declare function seriesLineDashArray(s: SeriesConfig, settings?: ChartSettings): readonly [number, number] | undefined;
448
+ /** The effective direction-coloring of a `bar`/`candle` series: the per-series
449
+ * override, else the legacy candle `candleColorBy` (old presets), else the
450
+ * settings default for that mark kind. Rise/fall fall back to the settings'
451
+ * colors. Meaningless (single) for a `line`/`area` series. */
452
+ export declare function effectiveSplit(s: SeriesConfig, settings?: ChartSettings): {
453
+ mode: 'single' | 'split';
454
+ rise: string;
455
+ fall: string;
456
+ };
457
+ /**
458
+ * A negative currency amount in the accounting convention: `($2.75)`, not
459
+ * `$-2.75`.
460
+ *
461
+ * The sign belongs to the AMOUNT, so it wraps the whole thing rather than
462
+ * wedging a minus between the symbol and the digits — which is how every
463
+ * finance surface writes it, and which stopped being a hypothetical the moment
464
+ * a `delta`-unit study (a MACD of a price) put negative dollars on screen.
465
+ * Applies to the axis ticks too, so a chip and the axis beside it agree.
466
+ */
467
+ export declare const formatCurrency: (v: number, digits: number) => string;
468
+ /** Format a series value for a chip/row. Currency (`$`) leads the value
469
+ * (`$161.76`), and a negative reads `($2.75)` — see {@link formatCurrency};
470
+ * `count` (volume/shares) compacts to `1.18M` with no suffix;
471
+ * `log` is a SCALE rather than a suffix, so a log-ratio reads `-0.23`, not
472
+ * `-0.23log` (the unit still keeps it off a unitless axis); a percent /
473
+ * unitless suffix trails the value (`22.65%`). */
474
+ export declare function formatSeriesValue(value: number | null, unit?: string): string;