@tidal-ts/chart 0.13.0 → 0.14.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/TimeSeriesChart.js +7 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/series.d.ts +20 -2
- package/dist/series.js +14 -2
- package/package.json +2 -2
package/dist/TimeSeriesChart.js
CHANGED
|
@@ -336,8 +336,13 @@ function TimeSeriesChartInner({ rows, sources, ohlcSources = EMPTY_SOURCES, cale
|
|
|
336
336
|
.map((c) => {
|
|
337
337
|
const sp = effectiveSplit(c, settings);
|
|
338
338
|
// The per-output ink, texture and opacity too — and the FAN, whose
|
|
339
|
-
// outputs are what the per-output keys are named after
|
|
340
|
-
|
|
339
|
+
// outputs are what the per-output keys are named after, and each
|
|
340
|
+
// output's MARK, which says whether its ink is a line's or a bar's
|
|
341
|
+
// (`outputBars` moves a MACD's Hist from one to the other).
|
|
342
|
+
const marks = configOutputs(c)
|
|
343
|
+
.map((o) => o.mark[0])
|
|
344
|
+
.join('');
|
|
345
|
+
return `${c.id}:${c.color}:${sp.mode}:${sp.rise}:${sp.fall}:${c.style}:${seriesLineWidth(c, settings)}:${c.lineDash ?? ''}:${c.opacity ?? ''}:${c.fan?.join(',') ?? ''}:${marks}:${c.outputStyles ? JSON.stringify(c.outputStyles) : ''}`;
|
|
341
346
|
})
|
|
342
347
|
.join('|') +
|
|
343
348
|
'#' +
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
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
|
-
export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, 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, 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';
|
|
16
|
+
export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, 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
17
|
export { DEFAULT_CHART_SETTINGS, mergeChartSettings, type AnnotationOverride, type ChartSettings, type CategoryLineStyle, type SessionDividers, type SplitColorDefault, type LineDash, } from './chartSettings.js';
|
|
18
18
|
export { useMeasuredWidth, useMeasuredSize } from './useMeasuredWidth.js';
|
|
19
19
|
export { assembleRows, carries, foldKey, foldSources, prepareChart, sourceFacts, type ConfigRow, type PreparedRow, type SourceFacts, type SourceHold, type SourceInput, type SourceInputs, } from './prepare.js';
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* style builders) stay internal until a consumer asks.
|
|
13
13
|
*/
|
|
14
14
|
export { TimeSeriesChart, annotationInView, } from './TimeSeriesChart.js';
|
|
15
|
-
export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, 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, logAllowed, AXIS_PRECISIONS, readsFrom, sourcesOf, } from './series.js';
|
|
15
|
+
export { configAxisId, effectiveSplit, formatSeriesValue, isStudySeries, LINE_WIDTHS, PAIR_JOINS, PAIR_LENSES, seriesAxisId, readsCompare, 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
16
|
export { DEFAULT_CHART_SETTINGS, mergeChartSettings, } from './chartSettings.js';
|
|
17
17
|
export { useMeasuredWidth, useMeasuredSize } from './useMeasuredWidth.js';
|
|
18
18
|
export { assembleRows, carries, foldKey, foldSources, prepareChart, sourceFacts, } from './prepare.js';
|
package/dist/series.d.ts
CHANGED
|
@@ -32,7 +32,15 @@ export declare function bandColumns(column: string): {
|
|
|
32
32
|
* the toggle on a study with nothing to colour would be a control that does
|
|
33
33
|
* nothing.
|
|
34
34
|
*/
|
|
35
|
-
export declare function hasBarOutput(c: Pick<SeriesConfig, 'style' | 'derive' | 'column' | 'fan'>): boolean;
|
|
35
|
+
export declare function hasBarOutput(c: Pick<SeriesConfig, 'style' | 'derive' | 'column' | 'fan' | 'outputBars'>): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether {@link SeriesConfig.outputBars} means anything for a config: a
|
|
38
|
+
* `lines` study whose op draws an output as bars (a MACD), however it is drawn
|
|
39
|
+
* now. {@link hasBarOutput} answers "does it draw bars?", which turns false
|
|
40
|
+
* the moment the bars become lines — a host gating its bars/lines control on
|
|
41
|
+
* that would hide the control with no way back.
|
|
42
|
+
*/
|
|
43
|
+
export declare function offersOutputBars(c: Pick<SeriesConfig, 'style' | 'derive' | 'column' | 'fan'>): boolean;
|
|
36
44
|
/**
|
|
37
45
|
* The per-output theme key for a `lines` config.
|
|
38
46
|
*
|
|
@@ -69,7 +77,9 @@ export interface ConfigOutput {
|
|
|
69
77
|
* A config whose `derive` is gone degrades to its bare column rather than
|
|
70
78
|
* throwing (a persisted config can outlive the op that named it).
|
|
71
79
|
*/
|
|
72
|
-
export declare function configOutputs(c: Pick<SeriesConfig, 'column' | 'derive' | 'fan'>
|
|
80
|
+
export declare function configOutputs(c: Pick<SeriesConfig, 'column' | 'derive' | 'fan'> & {
|
|
81
|
+
outputBars?: boolean;
|
|
82
|
+
}): ConfigOutput[];
|
|
73
83
|
/**
|
|
74
84
|
* The columns a `band` config draws between (and its centre line, when it has
|
|
75
85
|
* one). A fanned band — an SMA of a band's `Upper` and `Lower` — may have no
|
|
@@ -281,6 +291,14 @@ export interface SeriesConfig {
|
|
|
281
291
|
* has one.
|
|
282
292
|
*/
|
|
283
293
|
bandMiddle?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Whether a `lines` study draws the outputs its op draws as BARS (a MACD's
|
|
296
|
+
* `Hist`) as bars. `false` draws every output as a line; omitted ⇒ each
|
|
297
|
+
* output takes its op's own mark (`outputMark`). Only a `lines` study reads
|
|
298
|
+
* it ({@link offersOutputBars}): a single-output histogram (an Awesome
|
|
299
|
+
* Oscillator) is `style: 'bar'`, and becomes a line by its `style`.
|
|
300
|
+
*/
|
|
301
|
+
outputBars?: boolean;
|
|
284
302
|
}
|
|
285
303
|
/** The textures in display order. */
|
|
286
304
|
export declare const LINE_DASHES: readonly LineDash[];
|
package/dist/series.js
CHANGED
|
@@ -23,6 +23,16 @@ export function hasBarOutput(c) {
|
|
|
23
23
|
return false;
|
|
24
24
|
return configOutputs(c).some((o) => o.mark === 'bar');
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Whether {@link SeriesConfig.outputBars} means anything for a config: a
|
|
28
|
+
* `lines` study whose op draws an output as bars (a MACD), however it is drawn
|
|
29
|
+
* now. {@link hasBarOutput} answers "does it draw bars?", which turns false
|
|
30
|
+
* the moment the bars become lines — a host gating its bars/lines control on
|
|
31
|
+
* that would hide the control with no way back.
|
|
32
|
+
*/
|
|
33
|
+
export function offersOutputBars(c) {
|
|
34
|
+
return hasBarOutput({ ...c, outputBars: undefined });
|
|
35
|
+
}
|
|
26
36
|
/**
|
|
27
37
|
* The per-output theme key for a `lines` config.
|
|
28
38
|
*
|
|
@@ -49,10 +59,12 @@ export const outputKey = (id, i) => `${id}__o${i}`;
|
|
|
49
59
|
* throwing (a persisted config can outlive the op that named it).
|
|
50
60
|
*/
|
|
51
61
|
export function configOutputs(c) {
|
|
62
|
+
// `outputBars: false` draws an op's bar outputs as lines.
|
|
63
|
+
const markOf = (op, name) => c.outputBars === false ? 'line' : outputMark(op, name);
|
|
52
64
|
if (!c.derive && c.fan && c.fan.length > 0)
|
|
53
65
|
return c.fan.map((column) => ({ name: column, column, mark: 'line' }));
|
|
54
66
|
if (c.derive && c.fan && c.fan.length > 0) {
|
|
55
|
-
const mark =
|
|
67
|
+
const mark = markOf(c.derive.op, '');
|
|
56
68
|
const derive = c.derive;
|
|
57
69
|
return c.fan.map((name) => ({ name, column: deriveId(withFanOutput(derive, name)), mark }));
|
|
58
70
|
}
|
|
@@ -63,7 +75,7 @@ export function configOutputs(c) {
|
|
|
63
75
|
return outs.map((name) => ({
|
|
64
76
|
name,
|
|
65
77
|
column: `${c.column}${name}`,
|
|
66
|
-
mark:
|
|
78
|
+
mark: markOf(op, name),
|
|
67
79
|
}));
|
|
68
80
|
}
|
|
69
81
|
return [{ name: '', column: c.column, mark: 'line' }];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tidal-ts/chart",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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.14.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@pond-ts/charts": "^0.73.0",
|