@kumo-charts/core 1.0.0-beta.6 → 1.0.0-beta.7
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 +201 -201
- package/NOTICE +11 -11
- package/README.md +23 -23
- package/dist/{aggregator-CsTcgTRK.js → aggregator-DFCDVoFt.js} +3 -3
- package/dist/{alert-book-DNP68WX7.js → alert-book-KgUNJ1Pm.js} +5 -4
- package/dist/alert-engine.d.ts +5 -5
- package/dist/alert-engine.js +10 -10
- package/dist/{alerts-Bv5u4-99.js → alerts-sN1NVz-X.js} +19 -7
- package/dist/alerts.d.ts +1 -1
- package/dist/alerts.js +1 -1
- package/dist/all.d.ts +9 -9
- package/dist/all.js +9 -9
- package/dist/{api-BxS-GfYB.d.ts → api-BWC_Cce5.d.ts} +15 -1
- package/dist/{api-BlJUtij_.d.ts → api-DgviKlaI.d.ts} +1 -1
- package/dist/{bar-store-B_NkvUnA.js → bar-store-B4HFH1h6.js} +21 -3
- package/dist/{calendar-BkI9B9A5.js → calendar-xZYfA5bX.js} +4 -4
- package/dist/{chart-types-pzeZDEp9.js → chart-types-DtRsOwjT.js} +3 -3
- package/dist/chart-types.d.ts +1 -1
- package/dist/chart-types.js +1 -1
- package/dist/collection-RZyV3hnM.js +71 -0
- package/dist/{color-1Osbv2TE.js → color-AsBx5M66.js} +1 -1
- package/dist/{data-B75gRyuP.d.ts → data-RRHroFqK.d.ts} +34 -2
- package/dist/{drawings-DMRwbLsg.js → drawings-C-jyagJI.js} +137 -125
- package/dist/drawings.d.ts +3 -3
- package/dist/drawings.js +1 -1
- package/dist/{frame-Bt85Ejw7.js → frame-790ompHn.js} +5 -6
- package/dist/{index-Bfi0g81h.d.ts → index-B5nL4-fG.d.ts} +4 -2
- package/dist/{index-D12U6YKZ.d.ts → index-BMRUiN6F.d.ts} +2 -2
- package/dist/{index-SSXLg0b-.d.ts → index-Bgl-FJT3.d.ts} +3 -3
- package/dist/{index-BoRy0gWB.d.ts → index-Bp1gL2SV.d.ts} +1 -1
- package/dist/{index-DTrnOP7Q.d.ts → index-CsFnU-ko.d.ts} +1 -1
- package/dist/{index-BpyqTH6i.d.ts → index-D5fdjNJv.d.ts} +14 -2
- package/dist/{index-DvbA0QtQ.d.ts → index-cuDsywlB.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +280 -107
- package/dist/{indicator-store-CSNYNv-H.js → indicator-store-Cj8FkdLe.js} +11 -5
- package/dist/{indicators-7G1DqNSH.js → indicators-KKeZmC6g.js} +30 -9
- package/dist/indicators.d.ts +2 -2
- package/dist/indicators.js +2 -2
- package/dist/kumo-charts.iife.js +7 -7
- package/dist/{module-DxdViSuj.d.ts → module-ma1-rklb.d.ts} +2 -2
- package/dist/{modules-RlaXjRWe.js → modules-D_E0wmaT.js} +1 -1
- package/dist/{price-line-BPw9VyW3.js → price-line-Ctf8YIXI.js} +77 -89
- package/dist/{price-line-CdM5YNlZ.d.ts → price-line-exqgokHI.d.ts} +3 -1
- package/dist/{price-lines-CaLOO6qa.js → price-lines-C9xony-Z.js} +1 -1
- package/dist/{registry-f-A949ov.js → registry-DpycnxXe.js} +8 -4
- package/dist/{replay-_1IoxPdh.js → replay-BglWO-Se.js} +3 -3
- package/dist/replay.d.ts +1 -1
- package/dist/replay.js +1 -1
- package/dist/{series-store-Brd46VuC.js → series-store-DwvvS42F.js} +3 -3
- package/dist/{time-BN0L-hLy.js → time-QUqwrKFO.js} +1 -1
- package/dist/{trading-CjKK5irF.js → trading-BY4NVox9.js} +38 -17
- package/dist/trading.d.ts +1 -1
- package/dist/trading.js +1 -1
- package/dist/{transforms-CtdsqwVk.js → transforms-D07qL7UT.js} +3 -3
- package/dist/{types-Bgjeo6w6.js → types-CEVVGcR9.js} +6 -2
- package/dist/{types-uoxTaiGv.js → types-CgerhCJ3.js} +3 -1
- package/dist/{types-xV6t4aad.d.ts → types-CrxgaGh5.d.ts} +14 -2
- package/dist/{validate-YdhjgZ6g.js → validate-B_z8rO0I.js} +4 -1
- package/dist/{value-format-BieuAeNK.js → value-format-DwSqOZkc.js} +6 -6
- package/dist/{values-Cw8XKIVE.js → values-CIb5EJ5-.js} +18 -10
- package/dist/{values-CtBpceAo.js → values-Hk0_RbLE.js} +5 -5
- package/dist/{volume-profile-ZWM9N-I-.js → volume-profile-Ci-AGdvp.js} +5 -8
- package/dist/volume-profile.d.ts +1 -1
- package/dist/volume-profile.js +1 -1
- package/dist/{watermark-qCkQw950.js → watermark--TmdUE3C.js} +3 -3
- package/dist/watermark.d.ts +1 -1
- package/dist/watermark.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as toTime } from "./time-
|
|
3
|
-
import { a as chartLayout, i as clamp, n as formatPaneValue, r as TimeMarks, t as buildFrame } from "./frame-
|
|
4
|
-
import { a as LEFT_SCALE, c as RIGHT_SCALE, i as withAlpha, n as checkColor, o as MAIN_PANE_ID, s as PaneStore } from "./color-
|
|
5
|
-
import {
|
|
6
|
-
import { r as parseBar, t as BarStore } from "./bar-store-
|
|
7
|
-
import { t as SeriesStore } from "./series-store-
|
|
8
|
-
import { r as createSeriesApi, t as createTransformsApi } from "./transforms-
|
|
9
|
-
import { i as checkTimeframe, l as parseInterval, n as createCalendar, o as formatInterval, p as Clock, r as canBuildTimeframe, s as intervalDuration } from "./calendar-
|
|
10
|
-
import { i as lightTheme, n as createDefaultOptions, r as darkTheme, s as textsOf, t as Registry } from "./registry-
|
|
1
|
+
import { c as checkOneOf, d as fieldsOf, f as ChartError, h as runEach, i as checkFunction, l as checkString, m as fail, o as checkNumber, p as describeValue, r as checkFields, s as checkObject, t as checkArray } from "./validate-B_z8rO0I.js";
|
|
2
|
+
import { n as toTime } from "./time-QUqwrKFO.js";
|
|
3
|
+
import { a as chartLayout, i as clamp, n as formatPaneValue, r as TimeMarks, t as buildFrame } from "./frame-790ompHn.js";
|
|
4
|
+
import { a as LEFT_SCALE, c as RIGHT_SCALE, i as withAlpha, n as checkColor, o as MAIN_PANE_ID, s as PaneStore } from "./color-AsBx5M66.js";
|
|
5
|
+
import { a as isPlainObject, n as LINE_STYLES, t as LABEL_ANCHORS } from "./types-CgerhCJ3.js";
|
|
6
|
+
import { r as parseBar, t as BarStore } from "./bar-store-B4HFH1h6.js";
|
|
7
|
+
import { t as SeriesStore } from "./series-store-DwvvS42F.js";
|
|
8
|
+
import { r as createSeriesApi, t as createTransformsApi } from "./transforms-D07qL7UT.js";
|
|
9
|
+
import { i as checkTimeframe, l as parseInterval, n as createCalendar, o as formatInterval, p as Clock, r as canBuildTimeframe, s as intervalDuration } from "./calendar-xZYfA5bX.js";
|
|
10
|
+
import { i as lightTheme, n as createDefaultOptions, r as darkTheme, s as textsOf, t as Registry } from "./registry-DpycnxXe.js";
|
|
11
11
|
import { t as PRICE_SOURCES } from "./types-BT7GXg-l.js";
|
|
12
|
-
import { n as MarketData, r as resolveOptions, t as Values } from "./values-
|
|
12
|
+
import { n as MarketData, r as resolveOptions, t as Values } from "./values-CIb5EJ5-.js";
|
|
13
13
|
import { a as font, i as drawLabel, n as applyStroke, o as isolated, s as snap } from "./canvas-BFRISb50.js";
|
|
14
|
-
import { a as paletteColor, n as formatValue, o as seriesFormat, r as BufferPool } from "./value-format-
|
|
14
|
+
import { a as paletteColor, n as formatValue, o as seriesFormat, r as BufferPool } from "./value-format-DwSqOZkc.js";
|
|
15
15
|
import { n as shapeDirection, r as traceShape } from "./shapes-BS99dAcE.js";
|
|
16
16
|
import { a as hollowCandlesSeries, i as highLowSeries, n as candlesSeries, o as ohlcSeries } from "./bars-BMdpzGEx.js";
|
|
17
17
|
import { t as IconCache } from "./icon-cache-9DXKBCfA.js";
|
|
18
|
-
import {
|
|
18
|
+
import { i as isPinned } from "./price-line-Ctf8YIXI.js";
|
|
19
|
+
import { r as moduleSpecs, t as createModule } from "./modules-D_E0wmaT.js";
|
|
19
20
|
//#region src/chart/api/data.ts
|
|
20
21
|
const SET_FIELDS = fieldsOf({ interval: true });
|
|
21
22
|
function createDataApi(core) {
|
|
22
23
|
return {
|
|
23
24
|
set: (bars, options = {}) => {
|
|
25
|
+
checkArray("bars", bars);
|
|
24
26
|
checkFields("data.set() options", options, SET_FIELDS);
|
|
25
27
|
core.run(() => {
|
|
26
28
|
core.setData(bars, options.interval);
|
|
@@ -32,7 +34,10 @@ function createDataApi(core) {
|
|
|
32
34
|
});
|
|
33
35
|
},
|
|
34
36
|
addTrades: (trade) => core.run(() => core.addTrades(Array.isArray(trade) ? trade : [trade])),
|
|
35
|
-
prepend: (bars) =>
|
|
37
|
+
prepend: (bars) => {
|
|
38
|
+
checkArray("bars", bars);
|
|
39
|
+
return core.run(() => core.prependData(bars));
|
|
40
|
+
},
|
|
36
41
|
clear: () => {
|
|
37
42
|
core.run(() => {
|
|
38
43
|
core.clearData();
|
|
@@ -187,7 +192,9 @@ function createTimeScaleApi(core) {
|
|
|
187
192
|
to: core.bars.time(visible.to)
|
|
188
193
|
} : null;
|
|
189
194
|
},
|
|
190
|
-
setVisibleRange: (
|
|
195
|
+
setVisibleRange: (range) => {
|
|
196
|
+
checkObject("range", range);
|
|
197
|
+
const { from, to } = range;
|
|
191
198
|
const start = core.bars.logicalIndexOf(toTime(from, "range.from"));
|
|
192
199
|
const end = core.bars.logicalIndexOf(toTime(to, "range.to"));
|
|
193
200
|
if (Number.isFinite(start) && Number.isFinite(end)) mutate(() => {
|
|
@@ -202,6 +209,7 @@ function createTimeScaleApi(core) {
|
|
|
202
209
|
return core.bars.length > 0 ? scale.logicalRange() : null;
|
|
203
210
|
},
|
|
204
211
|
setVisibleLogicalRange: (range) => {
|
|
212
|
+
checkObject("range", range);
|
|
205
213
|
checkNumber("range.from", range.from);
|
|
206
214
|
checkNumber("range.to", range.to);
|
|
207
215
|
mutate(() => {
|
|
@@ -487,11 +495,176 @@ function decimalsOf(value, atLeast = 0, max = 8) {
|
|
|
487
495
|
return precision;
|
|
488
496
|
}
|
|
489
497
|
//#endregion
|
|
498
|
+
//#region src/render/axis-labels.ts
|
|
499
|
+
/** How tall a label of `lines` lines is. */
|
|
500
|
+
function labelHeight$1(options, lines) {
|
|
501
|
+
return (options.font.size + 8 - 6) * lines + 6;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The middle of the first line of a label of `lines` lines whose line is at `y`: there, or above it as much as centers
|
|
505
|
+
* the whole label on it (`priceScale.labelAnchor`).
|
|
506
|
+
*/
|
|
507
|
+
function firstLineY(options, y, lines) {
|
|
508
|
+
return options.priceScale.labelAnchor === "middle" ? y - (labelHeight$1(options, lines) - labelHeight$1(options, 1)) / 2 : y;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Where the labels of series' values go on an axis, at their values where they do not overlap:
|
|
512
|
+
* moved apart, as charting platforms do, those above the latest price's label (`fixed`, which
|
|
513
|
+
* stays) up from it and the others down, each past the one before.
|
|
514
|
+
*/
|
|
515
|
+
function spreadLabels(ys, height, fixed) {
|
|
516
|
+
const placed = [...ys];
|
|
517
|
+
const order = ys.map((_, index) => index).sort((a, b) => (ys[a] ?? 0) - (ys[b] ?? 0));
|
|
518
|
+
const middle = fixed ? (fixed.top + fixed.bottom) / 2 : Number.NEGATIVE_INFINITY;
|
|
519
|
+
let edge = fixed?.top ?? Number.POSITIVE_INFINITY;
|
|
520
|
+
for (const index of order.filter((each) => (ys[each] ?? 0) <= middle).reverse()) {
|
|
521
|
+
placed[index] = Math.min(ys[index] ?? 0, edge - height / 2);
|
|
522
|
+
edge = (placed[index] ?? 0) - height / 2;
|
|
523
|
+
}
|
|
524
|
+
edge = fixed?.bottom ?? Number.NEGATIVE_INFINITY;
|
|
525
|
+
for (const index of order.filter((each) => (ys[each] ?? 0) > middle)) {
|
|
526
|
+
placed[index] = Math.max(ys[index] ?? 0, edge + height / 2);
|
|
527
|
+
edge = (placed[index] ?? 0) + height / 2;
|
|
528
|
+
}
|
|
529
|
+
return placed;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* The labels of the latest values on the price axes, apart from each other and from the label
|
|
533
|
+
* of the latest price, which has a second line with the countdown.
|
|
534
|
+
*/
|
|
535
|
+
function placeAxisLabels(frame, options, countdown) {
|
|
536
|
+
if (!options.priceScale.visible) return [];
|
|
537
|
+
const latest = options.latestPrice.label ? frame.latest : null;
|
|
538
|
+
const lines = countdown ? 2 : 1;
|
|
539
|
+
const height = labelHeight$1(options, 1);
|
|
540
|
+
const live = latest?.live ?? null;
|
|
541
|
+
const latestY = latest ? firstLineY(options, latest.y, lines) : 0;
|
|
542
|
+
const placed = [];
|
|
543
|
+
for (const pane of frame.panes) for (const side of ["right", "left"]) {
|
|
544
|
+
const axis = side === "right" ? pane.axis : pane.left?.axis;
|
|
545
|
+
const main = pane === frame.main && side === "right";
|
|
546
|
+
const marks = [...pane.marks.filter((mark) => mark.side === side), ...main && live && Number.isFinite(live.y) ? [live] : []];
|
|
547
|
+
const top = latestY - height / 2;
|
|
548
|
+
const fixed = latest && main && Number.isFinite(latest.y) ? {
|
|
549
|
+
top,
|
|
550
|
+
bottom: top + labelHeight$1(options, lines)
|
|
551
|
+
} : null;
|
|
552
|
+
const ys = spreadLabels(marks.map((mark) => mark.y), height, fixed);
|
|
553
|
+
if (axis) marks.forEach((mark, index) => {
|
|
554
|
+
placed.push({
|
|
555
|
+
axis,
|
|
556
|
+
y: ys[index] ?? mark.y,
|
|
557
|
+
lines: 1,
|
|
558
|
+
mark
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
if (latest) placed.push({
|
|
563
|
+
axis: frame.main.axis,
|
|
564
|
+
y: latestY,
|
|
565
|
+
lines,
|
|
566
|
+
mark: null
|
|
567
|
+
});
|
|
568
|
+
return placed;
|
|
569
|
+
}
|
|
570
|
+
//#endregion
|
|
490
571
|
//#region src/render/axis-covers.ts
|
|
491
572
|
const NO_COVERS = {
|
|
492
573
|
price: [],
|
|
493
574
|
time: null
|
|
494
575
|
};
|
|
576
|
+
/** The height of the crosshair's labels on the axes, and of each of the lines under its price. */
|
|
577
|
+
const labelHeight = (options) => options.font.size + 8;
|
|
578
|
+
/** With lines under it, the price and each line take as much room, close together inside `BLOCK_PADDING`. */
|
|
579
|
+
const lineHeight = (options) => options.font.size + 2;
|
|
580
|
+
const BLOCK_PADDING = 3;
|
|
581
|
+
/**
|
|
582
|
+
* Where the crosshair's price label at `y` lies with `lines` lines of text (`crosshair.priceLines`). As
|
|
583
|
+
* `priceScale.labelAnchor` says, the whole label is centered on `y`, within the plot, or the price stays at `y` and the
|
|
584
|
+
* lines are evenly under it, or over it where the plot has no room under it. Without lines, the label is as the time
|
|
585
|
+
* label is. With `crosshair.avoidLabels`, it is moved clear of the labels of the latest price and values.
|
|
586
|
+
*/
|
|
587
|
+
function priceLabelSpan(frame, options, y, lines) {
|
|
588
|
+
const at = labelAt(frame, options, y, lines);
|
|
589
|
+
return options.crosshair.avoidLabels ? clearOf(frame, at, y, occupied(frame, options)) : at;
|
|
590
|
+
}
|
|
591
|
+
/** Where the label lies at the pointer. */
|
|
592
|
+
function labelAt(frame, options, y, lines) {
|
|
593
|
+
if (lines === 0) {
|
|
594
|
+
const half = labelHeight(options) / 2;
|
|
595
|
+
return {
|
|
596
|
+
top: y - half,
|
|
597
|
+
bottom: y + half,
|
|
598
|
+
priceY: y,
|
|
599
|
+
lineY: () => y
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
const line = lineHeight(options);
|
|
603
|
+
const half = line / 2 + BLOCK_PADDING;
|
|
604
|
+
const plotBottom = frame.layout.timeAxis?.y ?? frame.layout.height;
|
|
605
|
+
if (options.priceScale.labelAnchor === "middle") {
|
|
606
|
+
const height = 2 * half + lines * line;
|
|
607
|
+
const top = Math.max(0, Math.min(y - height / 2, plotBottom - height));
|
|
608
|
+
return moved({
|
|
609
|
+
top: 0,
|
|
610
|
+
bottom: height,
|
|
611
|
+
priceY: half,
|
|
612
|
+
lineY: (index) => half + line * (index + 1)
|
|
613
|
+
}, top);
|
|
614
|
+
}
|
|
615
|
+
if (y + half + lines * line <= plotBottom) return {
|
|
616
|
+
top: y - half,
|
|
617
|
+
bottom: y + half + lines * line,
|
|
618
|
+
priceY: y,
|
|
619
|
+
lineY: (index) => y + line * (index + 1)
|
|
620
|
+
};
|
|
621
|
+
return {
|
|
622
|
+
top: y - half - lines * line,
|
|
623
|
+
bottom: y + half,
|
|
624
|
+
priceY: y,
|
|
625
|
+
lineY: (index) => y - line * (lines - index)
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
/** The label `by` lower. */
|
|
629
|
+
function moved(span, by) {
|
|
630
|
+
return {
|
|
631
|
+
top: span.top + by,
|
|
632
|
+
bottom: span.bottom + by,
|
|
633
|
+
priceY: span.priceY + by,
|
|
634
|
+
lineY: (index) => span.lineY(index) + by
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
/** Where the labels of the latest price and values lie on the right price axes, in the chart's coordinates. */
|
|
638
|
+
function occupied(frame, options) {
|
|
639
|
+
const right = new Set(frame.panes.map((pane) => pane.axis));
|
|
640
|
+
const first = labelHeight$1(options, 1) / 2;
|
|
641
|
+
return placeAxisLabels(frame, options, (frame.latest?.countdown ?? null) !== null).filter((label) => right.has(label.axis)).map((label) => {
|
|
642
|
+
const top = label.axis.y + label.y - first;
|
|
643
|
+
return {
|
|
644
|
+
top,
|
|
645
|
+
bottom: top + labelHeight$1(options, label.lines)
|
|
646
|
+
};
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* The label clear of `taken`: where it would cover some, against them on the side of the pointer at `y`, or on the
|
|
651
|
+
* other where the plot has no room there. Labels closer together than the label is tall are passed as one.
|
|
652
|
+
*/
|
|
653
|
+
function clearOf(frame, span, y, taken) {
|
|
654
|
+
const height = span.bottom - span.top;
|
|
655
|
+
const groups = [];
|
|
656
|
+
for (const each of [...taken].sort((a, b) => a.top - b.top)) {
|
|
657
|
+
const last = groups[groups.length - 1];
|
|
658
|
+
if (last && each.top < last.bottom + height) last.bottom = Math.max(last.bottom, each.bottom);
|
|
659
|
+
else groups.push({ ...each });
|
|
660
|
+
}
|
|
661
|
+
const covered = groups.find((group) => span.top < group.bottom && span.bottom > group.top);
|
|
662
|
+
if (!covered) return span;
|
|
663
|
+
const plotBottom = frame.layout.timeAxis?.y ?? frame.layout.height;
|
|
664
|
+
const above = covered.top - height >= 0;
|
|
665
|
+
const below = covered.bottom + height <= plotBottom;
|
|
666
|
+
return moved(span, y < (covered.top + covered.bottom) / 2 && above || !below ? covered.top - span.bottom : covered.bottom - span.top);
|
|
667
|
+
}
|
|
495
668
|
/** Where the crosshair's time label of `width` is centered: at its line, within the plot. */
|
|
496
669
|
function timeLabelCenter(frame, x, width) {
|
|
497
670
|
return Math.min(Math.max(x, width / 2), Math.max(width / 2, frame.layout.plotWidth - width / 2));
|
|
@@ -502,22 +675,23 @@ function crosshairCovers(frame, options, crosshair, measure) {
|
|
|
502
675
|
const price = [];
|
|
503
676
|
const { y } = crosshair;
|
|
504
677
|
if (y !== null && options.priceScale.visible) {
|
|
505
|
-
const half = (options
|
|
678
|
+
const half = labelHeight(options) / 2;
|
|
679
|
+
const right = priceLabelSpan(frame, options, y, crosshair.priceLines.length);
|
|
506
680
|
for (const pane of frame.panes) {
|
|
507
|
-
const top =
|
|
508
|
-
const bottom =
|
|
509
|
-
if (bottom > 0 && top < pane.axis.height) {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
681
|
+
const top = right.top - pane.axis.y;
|
|
682
|
+
const bottom = right.bottom - pane.axis.y;
|
|
683
|
+
if (crosshair.priceText !== null && bottom > 0 && top < pane.axis.height) price.push({
|
|
684
|
+
axis: pane.axis,
|
|
685
|
+
top,
|
|
686
|
+
bottom
|
|
687
|
+
});
|
|
688
|
+
const leftTop = y - half - pane.axis.y;
|
|
689
|
+
const leftBottom = y + half - pane.axis.y;
|
|
690
|
+
if (crosshair.leftPriceText !== null && pane.left && leftBottom > 0 && leftTop < pane.axis.height) price.push({
|
|
691
|
+
axis: pane.left.axis,
|
|
692
|
+
top: leftTop,
|
|
693
|
+
bottom: leftBottom
|
|
694
|
+
});
|
|
521
695
|
}
|
|
522
696
|
}
|
|
523
697
|
let time = null;
|
|
@@ -613,71 +787,6 @@ function paintMagnifier(ctx, sources, point, layout, pixelRatio, theme) {
|
|
|
613
787
|
ctx.stroke();
|
|
614
788
|
}
|
|
615
789
|
//#endregion
|
|
616
|
-
//#region src/render/axis-labels.ts
|
|
617
|
-
/** How tall a label of `lines` lines is. */
|
|
618
|
-
function labelHeight(options, lines) {
|
|
619
|
-
return (options.font.size + 8 - 6) * lines + 6;
|
|
620
|
-
}
|
|
621
|
-
/**
|
|
622
|
-
* Where the labels of series' values go on an axis, at their values where they do not overlap:
|
|
623
|
-
* moved apart, as charting platforms do, those above the latest price's label (`fixed`, which
|
|
624
|
-
* stays) up from it and the others down, each past the one before.
|
|
625
|
-
*/
|
|
626
|
-
function spreadLabels(ys, height, fixed) {
|
|
627
|
-
const placed = [...ys];
|
|
628
|
-
const order = ys.map((_, index) => index).sort((a, b) => (ys[a] ?? 0) - (ys[b] ?? 0));
|
|
629
|
-
const middle = fixed ? (fixed.top + fixed.bottom) / 2 : Number.NEGATIVE_INFINITY;
|
|
630
|
-
let edge = fixed?.top ?? Number.POSITIVE_INFINITY;
|
|
631
|
-
for (const index of order.filter((each) => (ys[each] ?? 0) <= middle).reverse()) {
|
|
632
|
-
placed[index] = Math.min(ys[index] ?? 0, edge - height / 2);
|
|
633
|
-
edge = (placed[index] ?? 0) - height / 2;
|
|
634
|
-
}
|
|
635
|
-
edge = fixed?.bottom ?? Number.NEGATIVE_INFINITY;
|
|
636
|
-
for (const index of order.filter((each) => (ys[each] ?? 0) > middle)) {
|
|
637
|
-
placed[index] = Math.max(ys[index] ?? 0, edge + height / 2);
|
|
638
|
-
edge = (placed[index] ?? 0) + height / 2;
|
|
639
|
-
}
|
|
640
|
-
return placed;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* The labels of the latest values on the price axes, apart from each other and from the label
|
|
644
|
-
* of the latest price, which has a second line with the countdown.
|
|
645
|
-
*/
|
|
646
|
-
function placeAxisLabels(frame, options, countdown) {
|
|
647
|
-
if (!options.priceScale.visible) return [];
|
|
648
|
-
const latest = options.latestPrice.label ? frame.latest : null;
|
|
649
|
-
const lines = countdown ? 2 : 1;
|
|
650
|
-
const height = labelHeight(options, 1);
|
|
651
|
-
const live = latest?.live ?? null;
|
|
652
|
-
const placed = [];
|
|
653
|
-
for (const pane of frame.panes) for (const side of ["right", "left"]) {
|
|
654
|
-
const axis = side === "right" ? pane.axis : pane.left?.axis;
|
|
655
|
-
const main = pane === frame.main && side === "right";
|
|
656
|
-
const marks = [...pane.marks.filter((mark) => mark.side === side), ...main && live && Number.isFinite(live.y) ? [live] : []];
|
|
657
|
-
const top = latest ? latest.y - height / 2 : 0;
|
|
658
|
-
const fixed = latest && main && Number.isFinite(latest.y) ? {
|
|
659
|
-
top,
|
|
660
|
-
bottom: top + labelHeight(options, lines)
|
|
661
|
-
} : null;
|
|
662
|
-
const ys = spreadLabels(marks.map((mark) => mark.y), height, fixed);
|
|
663
|
-
if (axis) marks.forEach((mark, index) => {
|
|
664
|
-
placed.push({
|
|
665
|
-
axis,
|
|
666
|
-
y: ys[index] ?? mark.y,
|
|
667
|
-
lines: 1,
|
|
668
|
-
mark
|
|
669
|
-
});
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
if (latest) placed.push({
|
|
673
|
-
axis: frame.main.axis,
|
|
674
|
-
y: latest.y,
|
|
675
|
-
lines,
|
|
676
|
-
mark: null
|
|
677
|
-
});
|
|
678
|
-
return placed;
|
|
679
|
-
}
|
|
680
|
-
//#endregion
|
|
681
790
|
//#region src/render/scene-painter.ts
|
|
682
791
|
const AXIS_LABEL_PADDING = 8;
|
|
683
792
|
function paintJob(ctx, job, pane, pixelRatio, barSpacing) {
|
|
@@ -915,7 +1024,7 @@ function paintPriceAxes(ctx, frame, options, pixelRatio, crosshair) {
|
|
|
915
1024
|
return {
|
|
916
1025
|
axis: label.axis,
|
|
917
1026
|
top,
|
|
918
|
-
bottom: top + labelHeight(options, label.lines)
|
|
1027
|
+
bottom: top + labelHeight$1(options, label.lines)
|
|
919
1028
|
};
|
|
920
1029
|
}), ...crosshair.price];
|
|
921
1030
|
const labels = (axis, ticks, x) => {
|
|
@@ -1200,7 +1309,7 @@ var Surface = class {
|
|
|
1200
1309
|
this.resizeObserver?.disconnect();
|
|
1201
1310
|
this.resizeObserver = null;
|
|
1202
1311
|
if (enabled) {
|
|
1203
|
-
const observer = new ResizeObserver((entries) => {
|
|
1312
|
+
const observer = new this.view.ResizeObserver((entries) => {
|
|
1204
1313
|
const size = entries.at(-1)?.contentRect;
|
|
1205
1314
|
if (size && this.resize(size.width, size.height)) this.onChange();
|
|
1206
1315
|
});
|
|
@@ -1257,11 +1366,12 @@ var Surface = class {
|
|
|
1257
1366
|
ctx.setTransform(this.ratio, 0, 0, this.ratio, this.ratio * originX, 0);
|
|
1258
1367
|
return ctx;
|
|
1259
1368
|
}
|
|
1260
|
-
/** Draws all layers onto one canvas, for screenshots. */
|
|
1369
|
+
/** Draws all layers onto one canvas, for screenshots; a chart with no size (hidden, or squeezed to nothing) gives an empty one. */
|
|
1261
1370
|
composite() {
|
|
1262
1371
|
const output = this.container.ownerDocument.createElement("canvas");
|
|
1263
1372
|
output.width = this.layers.scene.canvas.width;
|
|
1264
1373
|
output.height = this.layers.scene.canvas.height;
|
|
1374
|
+
if (output.width === 0 || output.height === 0) return output;
|
|
1265
1375
|
const ctx = output.getContext("2d") ?? fail("The browser does not provide a 2D canvas context.");
|
|
1266
1376
|
for (const name of LAYERS) ctx.drawImage(this.layers[name].canvas, 0, 0);
|
|
1267
1377
|
return output;
|
|
@@ -2127,6 +2237,7 @@ var InputController = class {
|
|
|
2127
2237
|
return;
|
|
2128
2238
|
}
|
|
2129
2239
|
if (region.kind === "price-axis" && this.host.enabled("axisScale")) {
|
|
2240
|
+
if (!this.host.scalesPrice(region.paneId, region.scale)) return;
|
|
2130
2241
|
this.gesture = {
|
|
2131
2242
|
kind: "price-axis",
|
|
2132
2243
|
pointerId,
|
|
@@ -2257,6 +2368,7 @@ var InputController = class {
|
|
|
2257
2368
|
};
|
|
2258
2369
|
this.gesture = pan;
|
|
2259
2370
|
this.root.style.cursor = "grabbing";
|
|
2371
|
+
this.showTooltip(null);
|
|
2260
2372
|
this.movePan(pan, point, performance.now());
|
|
2261
2373
|
}
|
|
2262
2374
|
movePan(gesture, point, time) {
|
|
@@ -2354,7 +2466,13 @@ var InputController = class {
|
|
|
2354
2466
|
});
|
|
2355
2467
|
}
|
|
2356
2468
|
}
|
|
2469
|
+
/** The tooltip of what is under the pointer, as the root's `title`: the browser shows it after a moment. */
|
|
2470
|
+
showTooltip(text) {
|
|
2471
|
+
if (text === null) this.root.removeAttribute("title");
|
|
2472
|
+
else if (this.root.getAttribute("title") !== text) this.root.setAttribute("title", text);
|
|
2473
|
+
}
|
|
2357
2474
|
updateCursor(target, point) {
|
|
2475
|
+
this.showTooltip(this.gesture.kind === "idle" ? target?.tooltip ?? null : null);
|
|
2358
2476
|
if (target) {
|
|
2359
2477
|
this.root.style.cursor = target.cursor;
|
|
2360
2478
|
return;
|
|
@@ -2365,7 +2483,7 @@ var InputController = class {
|
|
|
2365
2483
|
}
|
|
2366
2484
|
const region = this.host.regionAt(point);
|
|
2367
2485
|
const axisScale = this.host.enabled("axisScale");
|
|
2368
|
-
this.root.style.cursor = region.kind === "separator" ? "row-resize" : region.kind === "price-axis" && axisScale ? "ns-resize" : region.kind === "time-axis" && axisScale ? "ew-resize" : region.kind === "plot" ? "crosshair" : "";
|
|
2486
|
+
this.root.style.cursor = region.kind === "separator" ? "row-resize" : region.kind === "price-axis" && axisScale && this.host.scalesPrice(region.paneId, region.scale) ? "ns-resize" : region.kind === "time-axis" && axisScale ? "ew-resize" : region.kind === "plot" ? "crosshair" : "";
|
|
2369
2487
|
}
|
|
2370
2488
|
/** The two fingers on the chart, while there are two. */
|
|
2371
2489
|
fingers() {
|
|
@@ -2441,6 +2559,7 @@ var InputController = class {
|
|
|
2441
2559
|
this.wheel.pinch = 0;
|
|
2442
2560
|
const region = this.host.regionAt(point);
|
|
2443
2561
|
if (region.kind === "price-axis") {
|
|
2562
|
+
if (!this.host.scalesPrice(region.paneId, region.scale)) return;
|
|
2444
2563
|
this.host.zoomPrice(region.paneId, region.scale, Math.exp(-(y + pinch) * WHEEL_ZOOM_SPEED), point.y);
|
|
2445
2564
|
this.followPointer();
|
|
2446
2565
|
return;
|
|
@@ -2575,6 +2694,10 @@ var ObjectsController = class {
|
|
|
2575
2694
|
edit(target) {
|
|
2576
2695
|
return this.domain(target.kind)?.edit?.(target.id) ?? false;
|
|
2577
2696
|
}
|
|
2697
|
+
/** Where the line a pinned label stands for lies, or `null`. */
|
|
2698
|
+
reveal(context, target) {
|
|
2699
|
+
return this.domain(target.kind)?.reveal?.(context, target) ?? null;
|
|
2700
|
+
}
|
|
2578
2701
|
paint(context) {
|
|
2579
2702
|
for (const { domain } of this.domains) domain.paint(context);
|
|
2580
2703
|
}
|
|
@@ -2821,6 +2944,7 @@ function crosshairView(sources, frame, crosshair) {
|
|
|
2821
2944
|
y: pane ? crosshair.y : null,
|
|
2822
2945
|
timeText,
|
|
2823
2946
|
priceText: pane && crosshair.price !== null ? formatPaneValue(sources, pane, crosshair.price) : null,
|
|
2947
|
+
priceLines: pane && crosshair.price !== null && options.crosshair.priceLines ? options.crosshair.priceLines(crosshair.price, pane.id).filter((line) => typeof line === "string" && line !== "") : [],
|
|
2824
2948
|
leftPriceText: pane?.left ? leftValueText(sources, pane, crosshair.y) : null
|
|
2825
2949
|
};
|
|
2826
2950
|
}
|
|
@@ -3012,10 +3136,14 @@ function paintCrosshair(ctx, frame, options, pixelRatio, crosshair) {
|
|
|
3012
3136
|
paddingX: 6,
|
|
3013
3137
|
height
|
|
3014
3138
|
};
|
|
3015
|
-
if (crosshair.priceText !== null && crosshair.y !== null && options.priceScale.visible)
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3139
|
+
if (crosshair.priceText !== null && crosshair.y !== null && options.priceScale.visible) {
|
|
3140
|
+
const span = priceLabelSpan(frame, options, crosshair.y, crosshair.priceLines.length);
|
|
3141
|
+
if (crosshair.priceLines.length === 0) drawLabel(ctx, crosshair.priceText, frame.layout.plotWidth + 1, span.priceY, {
|
|
3142
|
+
...label,
|
|
3143
|
+
align: "left"
|
|
3144
|
+
});
|
|
3145
|
+
else paintPriceBlock(ctx, frame, options, crosshair.priceText, crosshair.priceLines, span);
|
|
3146
|
+
}
|
|
3019
3147
|
if (crosshair.leftPriceText !== null && crosshair.y !== null && options.priceScale.visible) drawLabel(ctx, crosshair.leftPriceText, -1, crosshair.y, {
|
|
3020
3148
|
...label,
|
|
3021
3149
|
align: "right"
|
|
@@ -3030,6 +3158,26 @@ function paintCrosshair(ctx, frame, options, pixelRatio, crosshair) {
|
|
|
3030
3158
|
});
|
|
3031
3159
|
}
|
|
3032
3160
|
}
|
|
3161
|
+
/**
|
|
3162
|
+
* The crosshair's price label with its lines (`crosshair.priceLines`): one box, as wide as its widest text, where `span`
|
|
3163
|
+
* puts it and its texts.
|
|
3164
|
+
*/
|
|
3165
|
+
function paintPriceBlock(ctx, frame, options, price, lines, span) {
|
|
3166
|
+
const { theme } = options;
|
|
3167
|
+
const width = Math.max(...[price, ...lines].map((text) => ctx.measureText(text).width)) + 12;
|
|
3168
|
+
const left = frame.layout.plotWidth + 1;
|
|
3169
|
+
ctx.fillStyle = theme.crosshairLabelBackground;
|
|
3170
|
+
ctx.beginPath();
|
|
3171
|
+
ctx.roundRect(left, span.top, width, span.bottom - span.top, 2);
|
|
3172
|
+
ctx.fill();
|
|
3173
|
+
ctx.fillStyle = theme.crosshairLabelText;
|
|
3174
|
+
ctx.textAlign = "center";
|
|
3175
|
+
ctx.textBaseline = "middle";
|
|
3176
|
+
ctx.fillText(price, left + width / 2, span.priceY + .5);
|
|
3177
|
+
lines.forEach((line, index) => {
|
|
3178
|
+
ctx.fillText(line, left + width / 2, span.lineY(index) + .5);
|
|
3179
|
+
});
|
|
3180
|
+
}
|
|
3033
3181
|
/** Paints a legend button: its icon, on a faint square while the pointer is on it. */
|
|
3034
3182
|
function paintLegendButton(ctx, options, icons, button, rect, hovered) {
|
|
3035
3183
|
const { theme } = options;
|
|
@@ -3213,6 +3361,21 @@ function command(core, name) {
|
|
|
3213
3361
|
}
|
|
3214
3362
|
return false;
|
|
3215
3363
|
}
|
|
3364
|
+
/**
|
|
3365
|
+
* Brings the line a label kept at an edge of the plot stands for to the middle of its pane, the
|
|
3366
|
+
* price scale then kept as it is by hand.
|
|
3367
|
+
*/
|
|
3368
|
+
function revealPinned(core, target) {
|
|
3369
|
+
const place = core.objects.reveal(core.objectContext(), target);
|
|
3370
|
+
const pane = place && core.shownFrame().panes.find((each) => each.id === place.pane);
|
|
3371
|
+
const scale = place && core.panes.findScale(place.pane, place.scale)?.scale;
|
|
3372
|
+
if (!place || !pane || !scale) return;
|
|
3373
|
+
const y = scale.valueToY(place.value);
|
|
3374
|
+
if (Number.isFinite(y)) {
|
|
3375
|
+
scale.lead.pan(pane.plot.height / 2 - y);
|
|
3376
|
+
core.invalidate();
|
|
3377
|
+
}
|
|
3378
|
+
}
|
|
3216
3379
|
function regionAt(frame, point) {
|
|
3217
3380
|
const { layout } = frame;
|
|
3218
3381
|
for (const separator of layout.separators) if (point.y >= separator.y - SEPARATOR_GRAB && point.y <= separator.y + separator.height + SEPARATOR_GRAB) return {
|
|
@@ -3458,6 +3621,7 @@ function createInteractionHost(core) {
|
|
|
3458
3621
|
});
|
|
3459
3622
|
return;
|
|
3460
3623
|
}
|
|
3624
|
+
if (target && isPinned(target.part)) revealPinned(core, target);
|
|
3461
3625
|
core.selectByUser(target ? {
|
|
3462
3626
|
kind: target.kind,
|
|
3463
3627
|
id: target.id
|
|
@@ -3474,7 +3638,10 @@ function createInteractionHost(core) {
|
|
|
3474
3638
|
core.timeScale.reset(core.options.timeScale.barSpacing);
|
|
3475
3639
|
core.invalidate();
|
|
3476
3640
|
}
|
|
3477
|
-
if (core.bus.has("doubleClick"))
|
|
3641
|
+
if (core.bus.has("doubleClick")) {
|
|
3642
|
+
const target = region.kind === "plot" ? core.hitTest(point) : null;
|
|
3643
|
+
core.bus.emit("doubleClick", pointerEvent(core, point, target));
|
|
3644
|
+
}
|
|
3478
3645
|
});
|
|
3479
3646
|
},
|
|
3480
3647
|
contextMenu: (point, target) => act(core, () => {
|
|
@@ -3506,6 +3673,10 @@ function createInteractionHost(core) {
|
|
|
3506
3673
|
if (pane) core.panes.findScale(paneId, scale)?.scale.lead.zoom(factor, anchorY - pane.plot.y);
|
|
3507
3674
|
});
|
|
3508
3675
|
},
|
|
3676
|
+
scalesPrice: (paneId, scale) => {
|
|
3677
|
+
const mode = core.isDestroyed ? null : core.panes.findScale(paneId, scale)?.scale.lead.mode;
|
|
3678
|
+
return mode !== "percent" && mode !== "indexed";
|
|
3679
|
+
},
|
|
3509
3680
|
beginPaneResize: (above, below) => paneResize(core, above, below),
|
|
3510
3681
|
command: (name) => act(core, () => command(core, name), false),
|
|
3511
3682
|
editObject: (target) => act(core, () => core.objects.edit(target), false),
|
|
@@ -4155,7 +4326,7 @@ var ChartCore = class {
|
|
|
4155
4326
|
let crosshair = null;
|
|
4156
4327
|
attempt(() => {
|
|
4157
4328
|
this.tracker.sync(frame);
|
|
4158
|
-
crosshair = crosshairView(this, frame, this.tracker.value);
|
|
4329
|
+
crosshair = this.objects.hovered?.kind === "order" ? null : crosshairView(this, frame, this.tracker.value);
|
|
4159
4330
|
});
|
|
4160
4331
|
const labelFont = font(options.font.size, options.font.family);
|
|
4161
4332
|
const covers = crosshairCovers(frame, options, crosshair, (text) => this.measureText(text, labelFont));
|
|
@@ -4231,7 +4402,7 @@ function assertEnvironment(container) {
|
|
|
4231
4402
|
if (typeof HTMLElement === "undefined" || !(container instanceof HTMLElement)) fail("createChart() needs an HTMLElement container.");
|
|
4232
4403
|
const view = container.ownerDocument.defaultView ?? fail("The container is not attached to a window.");
|
|
4233
4404
|
const missing = [
|
|
4234
|
-
["ResizeObserver", typeof
|
|
4405
|
+
["ResizeObserver", typeof view.ResizeObserver === "function"],
|
|
4235
4406
|
["PointerEvent", typeof globalThis.PointerEvent === "function"],
|
|
4236
4407
|
["Path2D", typeof globalThis.Path2D === "function"],
|
|
4237
4408
|
["matchMedia", typeof view.matchMedia === "function"],
|
|
@@ -4464,6 +4635,7 @@ function createChart(container, options) {
|
|
|
4464
4635
|
});
|
|
4465
4636
|
},
|
|
4466
4637
|
batch: (operation) => {
|
|
4638
|
+
checkFunction("operation", operation);
|
|
4467
4639
|
core.run(operation);
|
|
4468
4640
|
},
|
|
4469
4641
|
on: (type, listener) => core.bus.on(type, listener),
|
|
@@ -4512,6 +4684,7 @@ function createChart(container, options) {
|
|
|
4512
4684
|
select: (selection) => {
|
|
4513
4685
|
core.run(() => {
|
|
4514
4686
|
if (selection !== null) {
|
|
4687
|
+
checkObject("selection", selection);
|
|
4515
4688
|
checkOneOf("selection.kind", selection.kind, core.objects.kinds());
|
|
4516
4689
|
checkString("selection.id", selection.id);
|
|
4517
4690
|
if (!core.objects.exists(selection)) fail(`There is no ${selection.kind} with id "${selection.id}".`);
|
|
@@ -4563,4 +4736,4 @@ function createChart(container, options) {
|
|
|
4563
4736
|
return chart;
|
|
4564
4737
|
}
|
|
4565
4738
|
//#endregion
|
|
4566
|
-
export { ChartError, LINE_STYLES, PRICE_SOURCES, canBuildTimeframe, checkColor, checkTimeframe, createCalendar, createChart, createModule, darkTheme, formatInterval, intervalDuration, lightTheme, parseBar, parseInterval, withAlpha };
|
|
4739
|
+
export { ChartError, LABEL_ANCHORS, LINE_STYLES, PRICE_SOURCES, canBuildTimeframe, checkColor, checkTimeframe, createCalendar, createChart, createModule, darkTheme, formatInterval, intervalDuration, lightTheme, parseBar, parseInterval, withAlpha };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as IdSequence, n as checkColor } from "./color-
|
|
3
|
-
import {
|
|
4
|
-
import { i as identityBucketer, r as followBars } from "./aggregator-
|
|
5
|
-
import { c as nominalMs, l as parseInterval, o as formatInterval, r as canBuildTimeframe, u as sameInterval } from "./calendar-
|
|
1
|
+
import { c as checkOneOf, d as fieldsOf, l as checkString, m as fail, n as checkBoolean, o as checkNumber, r as checkFields, s as checkObject, t as checkArray } from "./validate-B_z8rO0I.js";
|
|
2
|
+
import { l as IdSequence, n as checkColor } from "./color-AsBx5M66.js";
|
|
3
|
+
import { n as LINE_STYLES } from "./types-CgerhCJ3.js";
|
|
4
|
+
import { i as identityBucketer, r as followBars } from "./aggregator-DFCDVoFt.js";
|
|
5
|
+
import { c as nominalMs, l as parseInterval, o as formatInterval, r as canBuildTimeframe, u as sameInterval } from "./calendar-xZYfA5bX.js";
|
|
6
6
|
import { t as PRICE_SOURCES } from "./types-BT7GXg-l.js";
|
|
7
7
|
import { t as MARKER_SHAPES } from "./shapes-BS99dAcE.js";
|
|
8
8
|
//#region src/indicators/definition.ts
|
|
@@ -721,6 +721,7 @@ const INPUT_FIELDS = fieldsOf({
|
|
|
721
721
|
source: true,
|
|
722
722
|
timeframe: true,
|
|
723
723
|
visible: true,
|
|
724
|
+
lastValueLabel: true,
|
|
724
725
|
colors: true,
|
|
725
726
|
styles: true,
|
|
726
727
|
levels: true
|
|
@@ -731,6 +732,7 @@ const PATCH_FIELDS = fieldsOf({
|
|
|
731
732
|
source: true,
|
|
732
733
|
timeframe: true,
|
|
733
734
|
visible: true,
|
|
735
|
+
lastValueLabel: true,
|
|
734
736
|
scale: true,
|
|
735
737
|
colors: true,
|
|
736
738
|
styles: true,
|
|
@@ -828,6 +830,7 @@ function parseSettings(definition, input) {
|
|
|
828
830
|
outputs,
|
|
829
831
|
fills,
|
|
830
832
|
visible: input.visible === void 0 ? true : checkBoolean("indicator.visible", input.visible),
|
|
833
|
+
lastValueLabel: input.lastValueLabel === void 0 ? false : checkBoolean("indicator.lastValueLabel", input.lastValueLabel),
|
|
831
834
|
colors: byOutput(input.type, {}, input.colors, outputs, "colors", checkColor),
|
|
832
835
|
styles: byOutput(input.type, {}, input.styles, outputs, "styles", checkStyle),
|
|
833
836
|
levels: input.levels === void 0 ? null : checkLevels(input.levels)
|
|
@@ -910,6 +913,7 @@ var IndicatorStore = class IndicatorStore {
|
|
|
910
913
|
source: typeof entry.source === "string" ? entry.source : { ...entry.source },
|
|
911
914
|
timeframe: timeframe ? formatInterval(timeframe) : null,
|
|
912
915
|
visible: entry.visible,
|
|
916
|
+
lastValueLabel: entry.lastValueLabel,
|
|
913
917
|
colors: { ...entry.colors },
|
|
914
918
|
styles: structuredClone(entry.styles),
|
|
915
919
|
levels: entry.levels === null ? null : [...entry.levels]
|
|
@@ -1018,6 +1022,7 @@ var IndicatorStore = class IndicatorStore {
|
|
|
1018
1022
|
const styles = byOutput(entry.type, entry.styles, patch.styles, outputs, "styles", checkStyle);
|
|
1019
1023
|
const levels = patch.levels === void 0 ? entry.levels : patch.levels === null ? null : checkLevels(patch.levels);
|
|
1020
1024
|
const visible = patch.visible === void 0 ? entry.visible : checkBoolean("indicator.visible", patch.visible);
|
|
1025
|
+
const lastValueLabel = patch.lastValueLabel === void 0 ? entry.lastValueLabel : checkBoolean("indicator.lastValueLabel", patch.lastValueLabel);
|
|
1021
1026
|
const scale = patch.scale === void 0 ? entry.scale : checkString("indicator.scale", patch.scale);
|
|
1022
1027
|
if (patch.params !== void 0 || patch.source !== void 0 || patch.timeframe !== void 0) entry.series = this.series(entry.definition, params, outputs, source, upstream, timeframe);
|
|
1023
1028
|
entry.params = params;
|
|
@@ -1030,6 +1035,7 @@ var IndicatorStore = class IndicatorStore {
|
|
|
1030
1035
|
entry.styles = styles;
|
|
1031
1036
|
entry.levels = levels;
|
|
1032
1037
|
entry.visible = visible;
|
|
1038
|
+
entry.lastValueLabel = lastValueLabel;
|
|
1033
1039
|
entry.scale = scale;
|
|
1034
1040
|
this.release();
|
|
1035
1041
|
}
|