@tidal-ts/chart 0.12.1 → 0.13.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.
@@ -402,7 +402,8 @@ function TimeSeriesChartInner({ rows, sources, ohlcSources = EMPTY_SOURCES, cale
402
402
  // "colour = series" — and whatever the user has set per output on top.
403
403
  // A band's one line (its centre) draws under `c.id`, so its look lands
404
404
  // there; a stack's lines each get their own key.
405
- if ((c.style === 'lines' && c.derive) || c.style === 'band') {
405
+ if ((c.style === 'lines' && (c.derive || (c.fan && c.fan.length > 0))) ||
406
+ c.style === 'band') {
406
407
  configOutputs(c).forEach((out, i) => {
407
408
  const look = outputLook(c, i, settings);
408
409
  const ink = withAlpha(resolveColor(look.color), opacityOf(look.opacity) * (isDim ? 0.22 : 1));
@@ -935,8 +936,9 @@ function TimeSeriesChartInner({ rows, sources, ohlcSources = EMPTY_SOURCES, cale
935
936
  // N layers for ONE config — one per declared output, each on its own
936
937
  // theme key so the textures above apply. `col` is the SPEC ID, so every
937
938
  // column is named off it by suffix; reading `col` itself finds nothing,
938
- // exactly as for a band.
939
- if (!c.derive)
939
+ // exactly as for a band. A multi-column DATA node (`fan`, no `derive`)
940
+ // draws one line per column, named by the column.
941
+ if (!c.derive && !(c.fan && c.fan.length > 0))
940
942
  return [];
941
943
  const histSplit = effectiveSplit(c, settings);
942
944
  const histSeries = (c.source ? histSeriesFor(c.source) : undefined) ?? panelSeries;
package/dist/prepare.d.ts CHANGED
@@ -125,7 +125,7 @@ export declare function sourceFacts(sources: Record<string, ChartSeries>): Sourc
125
125
  * every band and every multi-output study — a MACD's chip sat blank while the
126
126
  * hover readout, which reads the series itself, showed a value. `every`,
127
127
  * because one op's fold either produces all its outputs or none. */
128
- export declare function carries(facts: SourceFacts, c: Pick<SeriesConfig, 'source' | 'column' | 'style' | 'derive'>): boolean;
128
+ export declare function carries(facts: SourceFacts, c: Pick<SeriesConfig, 'source' | 'column' | 'style' | 'derive' | 'fan' | 'bandMiddle'>): boolean;
129
129
  /**
130
130
  * Per row, the configs to show, each stamped with its latest value (or `null`).
131
131
  *
package/dist/series.d.ts CHANGED
@@ -57,8 +57,10 @@ export interface ConfigOutput {
57
57
  * The outputs a config draws, in order — the one answer to "what lines does
58
58
  * this config put on the canvas, and what is each called?".
59
59
  *
60
- * Three shapes:
60
+ * Four shapes:
61
61
  *
62
+ * - **A multi-column data node** ({@link SeriesConfig.fan} on a raw config):
63
+ * one output per column of its source it draws, named by the column.
62
64
  * - **A fanned study** ({@link SeriesConfig.fan}): one output per source output
63
65
  * it runs on, each its own spec (`withFanOutput`) and so its own column.
64
66
  * - **A multi-output op**: one per declared suffix, named off the spec id.
@@ -71,9 +73,13 @@ export declare function configOutputs(c: Pick<SeriesConfig, 'column' | 'derive'
71
73
  /**
72
74
  * The columns a `band` config draws between (and its centre line, when it has
73
75
  * one). A fanned band — an SMA of a band's `Upper` and `Lower` — may have no
74
- * centre at all; an op's own band always does (`bandColumns`).
76
+ * centre at all; an op's own band always does (`bandColumns`) unless it is told
77
+ * not to draw it (`bandMiddle: false`). A multi-column data node's band runs
78
+ * between its first two columns, with no centre.
75
79
  */
76
- export declare function configBand(c: Pick<SeriesConfig, 'column' | 'derive' | 'fan'>): {
80
+ export declare function configBand(c: Pick<SeriesConfig, 'column' | 'derive' | 'fan'> & {
81
+ bandMiddle?: boolean;
82
+ }): {
77
83
  middle?: string;
78
84
  upper: string;
79
85
  lower: string;
@@ -107,6 +113,7 @@ export declare function configColumns(c: {
107
113
  style: SeriesStyle;
108
114
  derive?: DeriveSpec;
109
115
  fan?: readonly string[];
116
+ bandMiddle?: boolean;
110
117
  }): string[];
111
118
  import type { DeriveSpec, SeriesWindow } from '@tidal-ts/core';
112
119
  export type { DeriveSpec, SeriesWindow };
@@ -262,8 +269,18 @@ export interface SeriesConfig {
262
269
  * spec is the same chain with the bottom pick swapped (`withFanOutput`), so a
263
270
  * retune moves every line together. Absent ⇒ the one output `derive` picks.
264
271
  * A fan over a band's two edges draws as a `band`; anything else as `lines`.
272
+ *
273
+ * On a DATA node (no `derive`) it is the columns of its source it draws —
274
+ * a price's `open` and `close` — `column` being the first: two may draw as a
275
+ * `band` between them, any number as `lines`.
265
276
  */
266
277
  fan?: readonly string[];
278
+ /**
279
+ * Whether a `band` draws its centre line. `false` draws the wash alone (a
280
+ * Bollinger as just its band); omitted ⇒ the centre is drawn when the band
281
+ * has one.
282
+ */
283
+ bandMiddle?: boolean;
267
284
  }
268
285
  /** The textures in display order. */
269
286
  export declare const LINE_DASHES: readonly LineDash[];
package/dist/series.js CHANGED
@@ -36,8 +36,10 @@ export const outputKey = (id, i) => `${id}__o${i}`;
36
36
  * The outputs a config draws, in order — the one answer to "what lines does
37
37
  * this config put on the canvas, and what is each called?".
38
38
  *
39
- * Three shapes:
39
+ * Four shapes:
40
40
  *
41
+ * - **A multi-column data node** ({@link SeriesConfig.fan} on a raw config):
42
+ * one output per column of its source it draws, named by the column.
41
43
  * - **A fanned study** ({@link SeriesConfig.fan}): one output per source output
42
44
  * it runs on, each its own spec (`withFanOutput`) and so its own column.
43
45
  * - **A multi-output op**: one per declared suffix, named off the spec id.
@@ -47,6 +49,8 @@ export const outputKey = (id, i) => `${id}__o${i}`;
47
49
  * throwing (a persisted config can outlive the op that named it).
48
50
  */
49
51
  export function configOutputs(c) {
52
+ if (!c.derive && c.fan && c.fan.length > 0)
53
+ return c.fan.map((column) => ({ name: column, column, mark: 'line' }));
50
54
  if (c.derive && c.fan && c.fan.length > 0) {
51
55
  const mark = outputMark(c.derive.op, '');
52
56
  const derive = c.derive;
@@ -67,9 +71,19 @@ export function configOutputs(c) {
67
71
  /**
68
72
  * The columns a `band` config draws between (and its centre line, when it has
69
73
  * one). A fanned band — an SMA of a band's `Upper` and `Lower` — may have no
70
- * centre at all; an op's own band always does (`bandColumns`).
74
+ * centre at all; an op's own band always does (`bandColumns`) unless it is told
75
+ * not to draw it (`bandMiddle: false`). A multi-column data node's band runs
76
+ * between its first two columns, with no centre.
71
77
  */
72
78
  export function configBand(c) {
79
+ const b = bandOf(c);
80
+ if (c.bandMiddle === false && b.middle)
81
+ return { upper: b.upper, lower: b.lower };
82
+ return b;
83
+ }
84
+ function bandOf(c) {
85
+ if (!c.derive && c.fan && c.fan.length > 0)
86
+ return { lower: c.fan[0], upper: c.fan[1] ?? c.fan[0] };
73
87
  if (c.derive && c.fan && c.fan.length > 0) {
74
88
  const by = new Map(configOutputs(c).map((o) => [o.name, o.column]));
75
89
  const middle = by.get('Middle');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidal-ts/chart",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "private": false,
5
5
  "description": "TimeSeriesChart — a multi-row time-series chart on @pond-ts/charts, plus the series and settings vocabulary and the prepare step. Theme, colours and settings arrive as props.",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "react": "^18.2.0 || ^19.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@tidal-ts/core": "0.12.1"
41
+ "@tidal-ts/core": "0.13.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@pond-ts/charts": "^0.73.0",