@tidal-ts/chart 0.23.0 → 0.25.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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/series.d.ts +50 -1
- package/dist/series.js +26 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
export { TimeSeriesChart, annotationInView, type ChartAnnotation, type ChartStats, type TimeSeriesChartProps, type TimeSeriesChartRow, } from './TimeSeriesChart.js';
|
|
15
15
|
export type { ChartSeries } from './types.js';
|
|
16
16
|
export { levelRole, levelRoles, rowLevelMarks, type ChartLevel, type ChartLevelLine, type ChartLevelRange, type ChartLevelStyle, type LevelLineMark, type LevelRoleStyle, type LevelWashMark, } from './levels.js';
|
|
17
|
-
export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, drawsAsCompare, isCompareSide, seriesDrawn, seriesCategoryStyle, seriesLineDashArray, seriesLineWidth, sharedAxisId, type AxisRange, effectiveAxisBounds, clampBoundsToLocks, barZeroLock, centerOnZero, axisRangeIsEmpty, axisFormat, fractionTicks, bandColumns, configBand, configColumns, configOutputs, configSpecs, dashPattern, fanIsBand, LINE_DASHES, OUTPUT_DASHES, outputKey, outputLook, publishedColumns, type ConfigOutput, type OutputLook, type OutputStyle, hasBarOutput, offersOutputBars, logAllowed, AXIS_PRECISIONS, type PairJoinOp, type PairLensOp, type SeriesGroup, type PairPartView, type PairView, type SeriesBinding, type SeriesConfig, type SeriesAxis, type SeriesStyle, type SeriesWindow, type CandleVariant, type ColorBy, readsFrom, sourcesOf, } from './series.js';
|
|
17
|
+
export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, drawsAsCompare, isCompareSide, seriesDrawn, seriesCategoryStyle, seriesLineDashArray, seriesLineWidth, sharedAxisId, type AxisRange, effectiveAxisBounds, clampBoundsToLocks, barZeroLock, centerOnZero, axisRangeIsEmpty, axisFormat, fractionTicks, bandColumns, configBand, configColumns, configOutputs, configSpecs, dashPattern, fanIsBand, LINE_DASHES, OUTPUT_DASHES, outputKey, outputLook, publishedColumns, type ConfigOutput, type OutputLook, type OutputStyle, hasBarOutput, offersOutputBars, logAllowed, AXIS_PRECISIONS, type PairJoinOp, type PairLensOp, type SeriesGroup, type PairPartView, type PairView, type SeriesBinding, type SeriesConfig, type CompareWith, compareWithInput, type SeriesAxis, type SeriesStyle, type SeriesWindow, type CandleVariant, type ColorBy, readsFrom, sourcesOf, } from './series.js';
|
|
18
18
|
export { DEFAULT_CHART_SETTINGS, mergeChartSettings, type AnnotationOverride, type ChartSettings, type CategoryLineStyle, type SessionDividers, type SplitColorDefault, type LineDash, } from './chartSettings.js';
|
|
19
19
|
export { useMeasuredWidth, useMeasuredSize } from './useMeasuredWidth.js';
|
|
20
20
|
export { assembleRows, carries, foldKey, foldSources, foldSourcesReport, type SourceFoldReport, prepareChart, sourceFacts, type ConfigRow, type PreparedRow, type SourceFacts, type SourceHold, type SourceInput, type SourceInputs, } from './prepare.js';
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export { TimeSeriesChart, annotationInView, } from './TimeSeriesChart.js';
|
|
15
15
|
export { levelRole, levelRoles, rowLevelMarks, } from './levels.js';
|
|
16
|
-
export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, drawsAsCompare, isCompareSide, seriesDrawn, seriesCategoryStyle, seriesLineDashArray, seriesLineWidth, sharedAxisId, effectiveAxisBounds, clampBoundsToLocks, barZeroLock, centerOnZero, axisRangeIsEmpty, axisFormat, fractionTicks, bandColumns, configBand, configColumns, configOutputs, configSpecs, dashPattern, fanIsBand, LINE_DASHES, OUTPUT_DASHES, outputKey, outputLook, publishedColumns, hasBarOutput, offersOutputBars, logAllowed, AXIS_PRECISIONS, readsFrom, sourcesOf, } from './series.js';
|
|
16
|
+
export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, drawsAsCompare, isCompareSide, seriesDrawn, seriesCategoryStyle, seriesLineDashArray, seriesLineWidth, sharedAxisId, effectiveAxisBounds, clampBoundsToLocks, barZeroLock, centerOnZero, axisRangeIsEmpty, axisFormat, fractionTicks, bandColumns, configBand, configColumns, configOutputs, configSpecs, dashPattern, fanIsBand, LINE_DASHES, OUTPUT_DASHES, outputKey, outputLook, publishedColumns, hasBarOutput, offersOutputBars, logAllowed, AXIS_PRECISIONS, compareWithInput, readsFrom, sourcesOf, } from './series.js';
|
|
17
17
|
export { DEFAULT_CHART_SETTINGS, mergeChartSettings, } from './chartSettings.js';
|
|
18
18
|
export { useMeasuredWidth, useMeasuredSize } from './useMeasuredWidth.js';
|
|
19
19
|
export { assembleRows, carries, foldKey, foldSources, foldSourcesReport, prepareChart, sourceFacts, } from './prepare.js';
|
package/dist/series.d.ts
CHANGED
|
@@ -125,7 +125,7 @@ export declare function configColumns(c: {
|
|
|
125
125
|
fan?: readonly string[];
|
|
126
126
|
bandMiddle?: boolean;
|
|
127
127
|
}): string[];
|
|
128
|
-
import type { DeriveSpec, PairOp, SeriesWindow } from '@tidal-ts/core';
|
|
128
|
+
import type { DeriveInput, DeriveSpec, PairOp, SeriesWindow } from '@tidal-ts/core';
|
|
129
129
|
export type { DeriveSpec, SeriesWindow };
|
|
130
130
|
import type { CandleVariant, ColorBy } from '@pond-ts/charts';
|
|
131
131
|
export type { CandleVariant, ColorBy };
|
|
@@ -314,7 +314,56 @@ export interface SeriesConfig {
|
|
|
314
314
|
* the comparison, has nothing to restore.
|
|
315
315
|
*/
|
|
316
316
|
compareFn?: PairOp;
|
|
317
|
+
/**
|
|
318
|
+
* What a compare reads as its other side (inB), when it is **wired by hand**
|
|
319
|
+
* rather than automatic. Absent ⇒ automatic: the same chain on the
|
|
320
|
+
* comparison symbol. Set ⇒ the output of the config `id`, read on the
|
|
321
|
+
* primary symbol or on the comparison (`side`) — `iv21` against `hv21`, or
|
|
322
|
+
* against `close` with a `ratio`. Set on the ROOT of a chain, like
|
|
323
|
+
* {@link compareFn}; the studies on the metric mirror onto this input, and a
|
|
324
|
+
* function joins the metric with it.
|
|
325
|
+
*
|
|
326
|
+
* Saved with the config, and kept when the comparison goes away: like the
|
|
327
|
+
* function, it sleeps until there is a comparison again. The host does the
|
|
328
|
+
* wiring at render time and treats an `id` that no longer exists as
|
|
329
|
+
* automatic. The terminal machine drops a wiring as soon as the other side
|
|
330
|
+
* is removed or the line it reads stops being drawn: it joins a pair, or a
|
|
331
|
+
* wiring with no {@link CompareWith.output} finds it drawing several lines,
|
|
332
|
+
* or the named line is no longer one of its lines.
|
|
333
|
+
*
|
|
334
|
+
* The other side is read as its own PLAIN output, never its compare — so
|
|
335
|
+
* two metrics wired to each other, or a metric wired to its own study, form
|
|
336
|
+
* no cycle.
|
|
337
|
+
*/
|
|
338
|
+
compareWith?: CompareWith;
|
|
317
339
|
}
|
|
340
|
+
/** A compare's hand-wired other side — see {@link SeriesConfig.compareWith}. */
|
|
341
|
+
export interface CompareWith {
|
|
342
|
+
/** The config whose output is the other side. */
|
|
343
|
+
id: string;
|
|
344
|
+
/** Read on the primary symbol, or on the comparison. */
|
|
345
|
+
side: 'primary' | 'comparison';
|
|
346
|
+
/**
|
|
347
|
+
* Which of its lines, when the other config draws several — a Bollinger's
|
|
348
|
+
* `Upper`, one column of a data node drawing open and close, one output of
|
|
349
|
+
* a fanned study — by the name {@link configOutputs} gives it. Absent for a
|
|
350
|
+
* config with one line.
|
|
351
|
+
*/
|
|
352
|
+
output?: string;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* What a compare reads as its other side from `other` — the input a spec
|
|
356
|
+
* names it by ({@link CompareWith}): its spec or its raw column for one line;
|
|
357
|
+
* for one line of several, the column, the fanned spec or the PICKED output
|
|
358
|
+
* that is that line. Only a line the config DRAWS ({@link configColumns}):
|
|
359
|
+
* not a Bollinger's hidden middle, nor a third column of a two-line band.
|
|
360
|
+
*
|
|
361
|
+
* `null` when `output` names none of its drawn lines, or is missing for a
|
|
362
|
+
* config that draws several. A data node back to ONE column still answers to
|
|
363
|
+
* that column's name, so a wiring on `close` survives the node dropping
|
|
364
|
+
* `open`.
|
|
365
|
+
*/
|
|
366
|
+
export declare function compareWithInput(other: Pick<SeriesConfig, 'column' | 'derive' | 'fan' | 'style' | 'bandMiddle'>, output?: string): DeriveInput | null;
|
|
318
367
|
/** The textures in display order. */
|
|
319
368
|
export declare const LINE_DASHES: readonly LineDash[];
|
|
320
369
|
/** Ink for ONE output of a multi-output config — see
|
package/dist/series.js
CHANGED
|
@@ -154,6 +154,32 @@ export function configColumns(c) {
|
|
|
154
154
|
import { BAND_OUTPUTS, BAR_PRICE_COLUMNS, COMPARE_PREFIX, deriveId, hasPairOp, inputNames, isPairOp, isPickedInput, isStudyOp, opOutputs, opParams, outputMark, studyLevels, usesCompare, withFanOutput, } from '@tidal-ts/core';
|
|
155
155
|
// The app-wide presentation defaults the category resolvers below read.
|
|
156
156
|
import { DEFAULT_CHART_SETTINGS, } from './chartSettings.js';
|
|
157
|
+
/**
|
|
158
|
+
* What a compare reads as its other side from `other` — the input a spec
|
|
159
|
+
* names it by ({@link CompareWith}): its spec or its raw column for one line;
|
|
160
|
+
* for one line of several, the column, the fanned spec or the PICKED output
|
|
161
|
+
* that is that line. Only a line the config DRAWS ({@link configColumns}):
|
|
162
|
+
* not a Bollinger's hidden middle, nor a third column of a two-line band.
|
|
163
|
+
*
|
|
164
|
+
* `null` when `output` names none of its drawn lines, or is missing for a
|
|
165
|
+
* config that draws several. A data node back to ONE column still answers to
|
|
166
|
+
* that column's name, so a wiring on `close` survives the node dropping
|
|
167
|
+
* `open`.
|
|
168
|
+
*/
|
|
169
|
+
export function compareWithInput(other, output) {
|
|
170
|
+
const drawn = new Set(configColumns(other));
|
|
171
|
+
const lines = configOutputs(other).filter((o) => drawn.has(o.column));
|
|
172
|
+
const several = lines.length > 1 || other.style === 'band' || other.style === 'lines';
|
|
173
|
+
if (output === undefined)
|
|
174
|
+
return several ? null : (other.derive ?? other.column);
|
|
175
|
+
if (!several)
|
|
176
|
+
return !other.derive && output === other.column ? other.column : null;
|
|
177
|
+
if (!lines.some((o) => o.name === output))
|
|
178
|
+
return null;
|
|
179
|
+
if (other.fan && other.fan.length > 0)
|
|
180
|
+
return other.derive ? withFanOutput(other.derive, output) : output;
|
|
181
|
+
return other.derive ? { from: other.derive, output } : null;
|
|
182
|
+
}
|
|
157
183
|
/** The textures in display order. */
|
|
158
184
|
export const LINE_DASHES = ['solid', 'dashed', 'dotted'];
|
|
159
185
|
// --- Axis identity ------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tidal-ts/chart",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.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.
|
|
41
|
+
"@tidal-ts/core": "0.25.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@pond-ts/charts": "^0.78.0",
|