@tradecanvas/chart 1.47.0 → 1.48.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/Chart.d.ts.map +1 -1
- package/dist/{LayoutSession-Ccv3vSuZ.js → LayoutSession-DSoR1CO8.js} +4 -4
- package/dist/LayoutSession-DSoR1CO8.js.map +1 -0
- package/dist/LayoutSession-axKXx35N.cjs +2 -0
- package/dist/LayoutSession-axKXx35N.cjs.map +1 -0
- package/dist/frameworks/feedBars.d.ts +37 -0
- package/dist/frameworks/feedBars.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +127 -81
- package/dist/index.js.map +1 -1
- package/dist/widget/index.cjs +2 -2
- package/dist/widget/index.js +81 -81
- package/package.json +3 -3
- package/dist/LayoutSession-Ccv3vSuZ.js.map +0 -1
- package/dist/LayoutSession-DNkU8T33.cjs +0 -2
- package/dist/LayoutSession-DNkU8T33.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as ee, m as te, n as ne, o as re, p as ie, r as ae, s as oe, t as se, u as ce, v as le, x as ue, y as de } from "./LayoutSession-
|
|
2
|
-
import { CHART_STYLE_KEYS as fe, DARK_TERMINAL as pe, DARK_THEME as me, DARK_THEME as he, DEFAULT_DRAWING_STYLE as ge, DEFAULT_RECONNECT as _e, DEFAULT_SIGNAL_STYLE as ve, DEFAULT_STREAM_CONFIG as ye, DEFAULT_TIMEFRAME_FAVORITES as be, DEFAULT_TRADE_ZONE_STYLE as xe, DEFAULT_TRADING_CONFIG as Se, HNX_SESSIONS as Ce, HOSE_SESSIONS as
|
|
3
|
-
import { AlertManager as
|
|
1
|
+
import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, i as u, l as ee, m as te, n as ne, o as re, p as ie, r as ae, s as oe, t as se, u as ce, v as le, w as d, x as ue, y as de } from "./LayoutSession-DSoR1CO8.js";
|
|
2
|
+
import { CHART_STYLE_KEYS as fe, DARK_TERMINAL as pe, DARK_THEME as me, DARK_THEME as he, DEFAULT_DRAWING_STYLE as ge, DEFAULT_RECONNECT as _e, DEFAULT_SIGNAL_STYLE as ve, DEFAULT_STREAM_CONFIG as ye, DEFAULT_TIMEFRAME_FAVORITES as be, DEFAULT_TRADE_ZONE_STYLE as xe, DEFAULT_TRADING_CONFIG as Se, HNX_SESSIONS as Ce, HOSE_SESSIONS as we, LIGHT_THEME as Te, LIGHT_THEME as Ee, MARKET_CRYPTO as f, MARKET_HNX as p, MARKET_HOSE as m, MARKET_HOSE_ETF as h, MARKET_NYSE as g, MARKET_UPCOM as _, MARKET_VN30F as v, MS_TIME_THRESHOLD as y, PRICE_SOURCES as b, TC_PALETTE as x, TC_SERIES_COLORS as S, TIMEFRAMES_CRYPTO as C, TIMEFRAMES_FOREX as w, TIMEFRAMES_STOCK as T, UPCOM_SESSIONS as E, VN30F_SESSIONS as D, VN_COLORS as De, VOLUME_ALPHA as Oe, barTimeUnit as ke, barsAreDaily as Ae, computePriceLimits as je, createVNTheme as Me, formatFraction as Ne, formatNumber as Pe, formatVND as Fe, formatVolumeLoc as Ie, fractionTick as Le, getCurrentSession as Re, getLocale as ze, indicatorSource as Be, isPriceSource as Ve, isTimeFrame as He, isValidTimeZone as Ue, marketStatus as We, normalizeBar as Ge, normalizeBarTime as Ke, offsetAt as qe, parseIndicatorSource as Je, parseTimeframe as Ye, pickBaseTimeframe as Xe, priceFormatterFor as Ze, priceStepAt as Qe, rankSymbols as $e, readNews as et, readQuote as tt, registerLocale as nt, resampleBars as rt, roundToPriceStep as it, scaleMarketPrices as at, setLocale as ot, sourcePrice as st, stepDecimals as ct, symbolTimeZone as lt, t as ut, tickBarCount as dt, timeframeBucketStart as ft, timeframeToMs as pt, vn30fContracts as mt, vn30fLastTradingDay as ht, volumeColor as gt, wallToUtc as _t, zoneOffsetMinutes as vt } from "@tradecanvas/commons";
|
|
3
|
+
import { AlertManager as yt, Animator as bt, BarCountdown as xt, BaseFinanceChart as O, BinanceAdapter as St, BybitAdapter as Ct, CANDLE_PATTERNS as wt, ChartLegend as Tt, ChartStateManager as Et, CoinbaseAdapter as Dt, CompareRenderer as Ot, CrosshairTooltip as kt, CurrentPriceLine as At, DEFAULT_LEGEND_CONFIG as jt, DEFAULT_MAX_WEBGL_CHARTS as Mt, DEFAULT_SESSION_HOURS as Nt, DataExporter as Pt, DrawingBase as Ft, Easing as It, FinanceCrosshair as k, GROUP_HEADER as Lt, INDICATOR_CATEGORIES as Rt, IndicatorBase as zt, IndicatorValueMap as Bt, KeyboardHandler as Vt, KrakenAdapter as Ht, MAX_ALERT_BARS as Ut, MIN_ALERT_BARS as Wt, MockAdapter as Gt, PaperExecutionAdapter as Kt, PollingAdapter as qt, RANGE_PRESETS as Jt, ReplayManager as Yt, ResamplingAdapter as Xt, Screenshot as Zt, SessionBreaks as Qt, SessionShading as $t, SignalMarkerManager as en, StreamManager as tn, TickAggregator as nn, TickBarAdapter as rn, TickBarBuilder as an, TradeZoneManager as on, UndoRedoManager as A, VolumeRenderer as sn, Watermark as cn, WebSocketAdapter as ln, barIndexToTime as un, barIndexToX as dn, barIndexToX as j, canvasMeasure as fn, computeBarLayout as pn, computeCalendarLayout as mn, computeCounterClockLayout as hn, computeDonutLayout as gn, computeHistogramLayout as _n, computeMatrixLayout as vn, computeScatterLayout as yn, correlationMatrix as bn, counterClockPhase as xn, counterClockPhase as Sn, counterClockPoints as Cn, counterClockPoints as wn, detectCandlePatterns as Tn, formatTooltipTime as En, histogramBins as Dn, hitBar as M, hitDay as N, hitMatrixCell as P, hitSlice as F, indicatorCategory as On, isPriceLevelAlert as kn, layoutGroupedTreemap as An, layoutSquarifiedTreemap as jn, layoutUniformGrid as Mn, lttbDownsample as Nn, lttbVisibleIndices as Pn, nearestCounterClockPoint as I, nearestPoint as L, niceScale as Fn, priceToY as In, priceToYMapper as Ln, priceToYMapper as Rn, rangePresetStart as zn, renderBarChart as Bn, renderCalendar as Vn, renderCounterClock as Hn, renderDepthChart as Un, renderDonut as Wn, renderEquityCurve as Gn, renderGauge as Kn, renderHeatmap as qn, renderHistogram as Jn, renderMatrix as Yn, renderScatter as Xn, renderSparkline as Zn, renderWaterfall as Qn, servesTimeframe as $n, setMaxWebGLCharts as er, shownCount as tr, timeToX as nr, timestampToBarIndex as rr, timestampToBarIndex as ir, toHeikinAshi as ar, toKagi as or, toLineBreak as sr, toPointAndFigure as cr, toRangeBars as lr, toRenko as ur, withResampling as dr, withTickBars as fr, xToBarIndex as pr, xToBarIndex as R, xToTime as mr, yToPrice as hr, yToPrice as gr } from "@tradecanvas/core";
|
|
4
4
|
//#region src/frameworks/syncIndicators.ts
|
|
5
|
-
function
|
|
5
|
+
function _r(e) {
|
|
6
6
|
let { id: t, params: n = {}, position: r = null } = typeof e == "string" ? { id: e } : e;
|
|
7
7
|
return JSON.stringify([
|
|
8
8
|
t,
|
|
@@ -10,9 +10,9 @@ function pr(e) {
|
|
|
10
10
|
r
|
|
11
11
|
]);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function vr(e, t, n) {
|
|
14
14
|
let r = /* @__PURE__ */ new Map(), i = t.map((e) => {
|
|
15
|
-
let t =
|
|
15
|
+
let t = _r(e), n = r.get(t) ?? 0;
|
|
16
16
|
return r.set(t, n + 1), {
|
|
17
17
|
spec: e,
|
|
18
18
|
key: `${t}#${n}`
|
|
@@ -26,19 +26,65 @@ function mr(e, t, n) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
|
+
//#region src/frameworks/feedBars.ts
|
|
30
|
+
var z = (e, t) => e === t || e.time === t.time && e.open === t.open && e.high === t.high && e.low === t.low && e.close === t.close && e.volume === t.volume, B = (e) => ({
|
|
31
|
+
time: e.time,
|
|
32
|
+
open: e.open,
|
|
33
|
+
high: e.high,
|
|
34
|
+
low: e.low,
|
|
35
|
+
close: e.close,
|
|
36
|
+
volume: e.volume
|
|
37
|
+
}), V = (e) => e.length > 0 ? e[e.length - 1] : null;
|
|
38
|
+
function yr(e, t, n) {
|
|
39
|
+
for (let r = 0; r < n; r++) if (!z(e[r], t[r])) return !1;
|
|
40
|
+
return !0;
|
|
41
|
+
}
|
|
42
|
+
function br(e, t) {
|
|
43
|
+
if (e.isReplayActive()) return !0;
|
|
44
|
+
let n = V(e.getData());
|
|
45
|
+
return t.inReplay ? n?.time === t.last?.time : n === t.shownBar ? n?.time === t.last?.time || !e.isExtendedHoursVisible() : !1;
|
|
46
|
+
}
|
|
47
|
+
function xr(e, t) {
|
|
48
|
+
let n = [];
|
|
49
|
+
for (let r = t; r < e.length; r++) {
|
|
50
|
+
if (!d(e[r]) || !(e[r].time > e[r - 1].time)) return null;
|
|
51
|
+
n.push(B(e[r]));
|
|
52
|
+
}
|
|
53
|
+
return n;
|
|
54
|
+
}
|
|
55
|
+
function Sr(e, t, n) {
|
|
56
|
+
let r = n.length;
|
|
57
|
+
if (r === 0 || !n.last || !d(n.last) || t.length < r || !br(e, n) || t !== n.source && (n.source.length !== r || !yr(n.source, t, r - 1))) return !1;
|
|
58
|
+
let i = t[r - 1];
|
|
59
|
+
if (i.time !== n.last.time || !d(i)) return !1;
|
|
60
|
+
let a = xr(t, r);
|
|
61
|
+
return a ? (z(i, n.last) || e.updateLastBar(B(i)), a.length === 1 ? e.appendBar(a[0]) : a.length > 1 && e.appendBars(a), !0) : !1;
|
|
62
|
+
}
|
|
63
|
+
function Cr(e, t, n) {
|
|
64
|
+
(!n || !Sr(e, t, n)) && e.setData(t.map(B));
|
|
65
|
+
let r = t.length > 0 ? B(t[t.length - 1]) : null, i = e.isReplayActive();
|
|
66
|
+
return {
|
|
67
|
+
source: t,
|
|
68
|
+
length: t.length,
|
|
69
|
+
last: r,
|
|
70
|
+
shownBar: i ? null : V(e.getData()),
|
|
71
|
+
inReplay: i
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
29
75
|
//#region src/plugins/overlayScale.ts
|
|
30
|
-
function
|
|
31
|
-
let { viewport: t, data: n } = e, r =
|
|
76
|
+
function wr(e) {
|
|
77
|
+
let { viewport: t, data: n } = e, r = Rn(t), i = n.length - 1, a = Math.max(0, Math.floor(t.visibleRange.from)), o = Math.min(i, Math.ceil(t.visibleRange.to)), s = (e) => n.length > 0 ? ir(e, n) : e;
|
|
32
78
|
return {
|
|
33
|
-
timeToX: (e) =>
|
|
79
|
+
timeToX: (e) => j(s(e), t),
|
|
34
80
|
xToTime: (e) => {
|
|
35
|
-
let r =
|
|
36
|
-
return n.length > 0 ?
|
|
81
|
+
let r = R(e, t);
|
|
82
|
+
return n.length > 0 ? un(r, n) : r;
|
|
37
83
|
},
|
|
38
|
-
indexToX: (e) =>
|
|
39
|
-
xToIndex: (e) =>
|
|
84
|
+
indexToX: (e) => j(e, t),
|
|
85
|
+
xToIndex: (e) => R(e, t),
|
|
40
86
|
priceToY: r,
|
|
41
|
-
yToPrice: (e) =>
|
|
87
|
+
yToPrice: (e) => gr(e, t),
|
|
42
88
|
barWidth: t.barWidth,
|
|
43
89
|
visible: o < a ? {
|
|
44
90
|
from: 0,
|
|
@@ -84,7 +130,7 @@ var H = {
|
|
|
84
130
|
cols: 2,
|
|
85
131
|
rows: 3
|
|
86
132
|
}
|
|
87
|
-
},
|
|
133
|
+
}, Tr = class {
|
|
88
134
|
root;
|
|
89
135
|
cells = [];
|
|
90
136
|
layout;
|
|
@@ -191,13 +237,13 @@ var H = {
|
|
|
191
237
|
this.cells = [], this.root.remove();
|
|
192
238
|
}
|
|
193
239
|
}
|
|
194
|
-
},
|
|
240
|
+
}, Er = class extends O {
|
|
195
241
|
options;
|
|
196
242
|
constructor(e, t) {
|
|
197
243
|
super(e, t.theme), this.options = t, this.requestRender();
|
|
198
244
|
}
|
|
199
245
|
renderChart(e, t, n, r) {
|
|
200
|
-
|
|
246
|
+
Zn(e, t, n, this.options, r);
|
|
201
247
|
}
|
|
202
248
|
update(e) {
|
|
203
249
|
this.options = {
|
|
@@ -211,15 +257,15 @@ var H = {
|
|
|
211
257
|
...e
|
|
212
258
|
}, this.requestRender();
|
|
213
259
|
}
|
|
214
|
-
},
|
|
260
|
+
}, Dr = class extends O {
|
|
215
261
|
options;
|
|
216
262
|
crosshair = null;
|
|
217
263
|
constructor(e, t) {
|
|
218
|
-
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new
|
|
264
|
+
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new k(this.canvas, () => this.requestRender())), this.requestRender();
|
|
219
265
|
}
|
|
220
266
|
renderChart(e, t, n, r) {
|
|
221
267
|
let i = this.crosshair?.getPosition() ?? null;
|
|
222
|
-
|
|
268
|
+
Un(e, t, n, this.options, r, i);
|
|
223
269
|
}
|
|
224
270
|
update(e) {
|
|
225
271
|
this.options = {
|
|
@@ -236,15 +282,15 @@ var H = {
|
|
|
236
282
|
destroy() {
|
|
237
283
|
this.crosshair?.destroy(), super.destroy();
|
|
238
284
|
}
|
|
239
|
-
}, U = class extends
|
|
285
|
+
}, U = class extends O {
|
|
240
286
|
options;
|
|
241
287
|
crosshair = null;
|
|
242
288
|
constructor(e, t) {
|
|
243
|
-
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new
|
|
289
|
+
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new k(this.canvas, () => this.requestRender())), this.requestRender();
|
|
244
290
|
}
|
|
245
291
|
renderChart(e, t, n, r) {
|
|
246
292
|
let i = this.crosshair?.getPosition() ?? null;
|
|
247
|
-
|
|
293
|
+
Gn(e, t, n, this.options, r, i);
|
|
248
294
|
}
|
|
249
295
|
update(e, t) {
|
|
250
296
|
this.options = {
|
|
@@ -264,7 +310,7 @@ var H = {
|
|
|
264
310
|
destroy() {
|
|
265
311
|
this.crosshair?.destroy(), super.destroy();
|
|
266
312
|
}
|
|
267
|
-
}, W = class extends
|
|
313
|
+
}, W = class extends O {
|
|
268
314
|
options;
|
|
269
315
|
crosshair = null;
|
|
270
316
|
cachedRects = [];
|
|
@@ -274,7 +320,7 @@ var H = {
|
|
|
274
320
|
lastLayoutHeight = 0;
|
|
275
321
|
handleClick = null;
|
|
276
322
|
constructor(e, t) {
|
|
277
|
-
super(e, t.theme), this.options = t, this.currentData = t.data ?? [], t.crosshair !== !1 && (this.crosshair = new
|
|
323
|
+
super(e, t.theme), this.options = t, this.currentData = t.data ?? [], t.crosshair !== !1 && (this.crosshair = new k(this.canvas, () => this.requestRender())), t.onCellClick && (this.handleClick = (e) => {
|
|
278
324
|
let t = this.canvas.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
279
325
|
this.onCanvasClick(n, r);
|
|
280
326
|
}, this.canvas.addEventListener("click", this.handleClick)), this.applyLabel(), this.recomputeLayout(), this.requestRender();
|
|
@@ -291,20 +337,20 @@ var H = {
|
|
|
291
337
|
height: this.height
|
|
292
338
|
}, t = this.options.cellPadding ?? 2;
|
|
293
339
|
if (this.lastLayoutWidth = this.width, this.lastLayoutHeight = this.height, this.cachedGroups = [], this.options.grouped) {
|
|
294
|
-
let { groups: n, cells: r } =
|
|
340
|
+
let { groups: n, cells: r } = An(this.currentData.map((e) => ({
|
|
295
341
|
id: e.id,
|
|
296
342
|
weight: e.weight ?? (Math.abs(e.value) || 1),
|
|
297
343
|
group: e.group,
|
|
298
344
|
value: e.value
|
|
299
|
-
})), e, t,
|
|
345
|
+
})), e, t, Lt);
|
|
300
346
|
this.cachedRects = r, this.cachedGroups = n;
|
|
301
347
|
} else if (this.options.weighted) {
|
|
302
348
|
let n = this.currentData.map((e) => ({
|
|
303
349
|
id: e.id,
|
|
304
350
|
weight: e.weight ?? (Math.abs(e.value) || 1)
|
|
305
351
|
}));
|
|
306
|
-
this.cachedRects =
|
|
307
|
-
} else this.cachedRects =
|
|
352
|
+
this.cachedRects = jn(n, e, t);
|
|
353
|
+
} else this.cachedRects = Mn(this.currentData.map((e) => ({ id: e.id })), e, t);
|
|
308
354
|
}
|
|
309
355
|
onCanvasClick(e, t) {
|
|
310
356
|
if (this.options.onCellClick) for (let n of this.cachedRects) {
|
|
@@ -319,7 +365,7 @@ var H = {
|
|
|
319
365
|
renderChart(e, t, n, r) {
|
|
320
366
|
(t !== this.lastLayoutWidth || n !== this.lastLayoutHeight) && this.recomputeLayout();
|
|
321
367
|
let i = this.crosshair?.getPosition() ?? null;
|
|
322
|
-
|
|
368
|
+
qn(e, t, n, this.currentData, this.cachedRects, this.options, r, i, this.cachedGroups);
|
|
323
369
|
}
|
|
324
370
|
update(e) {
|
|
325
371
|
this.currentData = e, this.options = {
|
|
@@ -336,15 +382,15 @@ var H = {
|
|
|
336
382
|
destroy() {
|
|
337
383
|
this.crosshair?.destroy(), this.handleClick && this.canvas.removeEventListener("click", this.handleClick), super.destroy();
|
|
338
384
|
}
|
|
339
|
-
},
|
|
385
|
+
}, Or = class extends O {
|
|
340
386
|
options;
|
|
341
387
|
crosshair = null;
|
|
342
388
|
constructor(e, t) {
|
|
343
|
-
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new
|
|
389
|
+
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new k(this.canvas, () => this.requestRender())), this.requestRender();
|
|
344
390
|
}
|
|
345
391
|
renderChart(e, t, n, r) {
|
|
346
392
|
let i = this.crosshair?.getPosition() ?? null;
|
|
347
|
-
|
|
393
|
+
Qn(e, t, n, this.options, r, i);
|
|
348
394
|
}
|
|
349
395
|
update(e) {
|
|
350
396
|
this.options = {
|
|
@@ -361,12 +407,12 @@ var H = {
|
|
|
361
407
|
destroy() {
|
|
362
408
|
this.crosshair?.destroy(), super.destroy();
|
|
363
409
|
}
|
|
364
|
-
},
|
|
365
|
-
function
|
|
410
|
+
}, kr = 500;
|
|
411
|
+
function Ar(e) {
|
|
366
412
|
let t = 1 - e;
|
|
367
413
|
return 1 - t * t * t;
|
|
368
414
|
}
|
|
369
|
-
var
|
|
415
|
+
var jr = class extends O {
|
|
370
416
|
options;
|
|
371
417
|
currentValue;
|
|
372
418
|
targetValue;
|
|
@@ -377,7 +423,7 @@ var Sr = class extends j {
|
|
|
377
423
|
super(e, t.theme), this.options = t, this.currentValue = t.value, this.targetValue = t.value, this.requestRender();
|
|
378
424
|
}
|
|
379
425
|
renderChart(e, t, n, r) {
|
|
380
|
-
|
|
426
|
+
Kn(e, t, n, this.options, r, this.currentValue);
|
|
381
427
|
}
|
|
382
428
|
setValue(e) {
|
|
383
429
|
if (this.options.animate === !1) {
|
|
@@ -407,7 +453,7 @@ var Sr = class extends j {
|
|
|
407
453
|
if (this.animationFrameId !== null) return;
|
|
408
454
|
let e = () => {
|
|
409
455
|
if (this.animationFrameId = null, this.animationStart === null) return;
|
|
410
|
-
let t = this.options.animationDuration ??
|
|
456
|
+
let t = this.options.animationDuration ?? kr, n = performance.now() - this.animationStart, r = Math.min(1, n / Math.max(1, t)), i = Ar(r);
|
|
411
457
|
this.currentValue = this.animationFrom + (this.targetValue - this.animationFrom) * i, this.requestRender(), r < 1 ? this.animationFrameId = requestAnimationFrame(e) : (this.currentValue = this.targetValue, this.animationStart = null);
|
|
412
458
|
};
|
|
413
459
|
this.animationFrameId = requestAnimationFrame(e);
|
|
@@ -418,7 +464,7 @@ var Sr = class extends j {
|
|
|
418
464
|
destroy() {
|
|
419
465
|
this.cancelAnimation(), super.destroy();
|
|
420
466
|
}
|
|
421
|
-
}, G = class extends
|
|
467
|
+
}, G = class extends O {
|
|
422
468
|
options;
|
|
423
469
|
layout = null;
|
|
424
470
|
layoutFor = null;
|
|
@@ -433,11 +479,11 @@ var Sr = class extends j {
|
|
|
433
479
|
this.canvas.style.cursor = this.hits(this.layout, e.clientX - t.left, e.clientY - t.top) ? "pointer" : "";
|
|
434
480
|
};
|
|
435
481
|
constructor(e, t) {
|
|
436
|
-
super(e, t.theme), this.options = t, this.crosshair = new
|
|
482
|
+
super(e, t.theme), this.options = t, this.crosshair = new k(this.canvas, () => this.requestRender()), this.canvas.addEventListener("click", this.onClick), this.canvas.addEventListener("pointermove", this.onMove), this.applyLabel(), this.requestRender();
|
|
437
483
|
}
|
|
438
484
|
renderChart(e, t, n, r) {
|
|
439
485
|
let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition(), a = this.layoutFor;
|
|
440
|
-
(!this.layout || !a || a.options !== this.options || a.width !== t || a.height !== n || a.theme !== r) && (this.layout = this.compute(t, n, r,
|
|
486
|
+
(!this.layout || !a || a.options !== this.options || a.width !== t || a.height !== n || a.theme !== r) && (this.layout = this.compute(t, n, r, fn(e, r)), this.layoutFor = {
|
|
441
487
|
options: this.options,
|
|
442
488
|
width: t,
|
|
443
489
|
height: n,
|
|
@@ -456,12 +502,12 @@ var Sr = class extends j {
|
|
|
456
502
|
destroy() {
|
|
457
503
|
this.crosshair.destroy(), this.canvas.removeEventListener("click", this.onClick), this.canvas.removeEventListener("pointermove", this.onMove), super.destroy();
|
|
458
504
|
}
|
|
459
|
-
},
|
|
505
|
+
}, Mr = class extends G {
|
|
460
506
|
compute(e, t, n, r) {
|
|
461
|
-
return
|
|
507
|
+
return pn(this.options, e, t, n, r);
|
|
462
508
|
}
|
|
463
509
|
draw(e, t, n, r, i, a) {
|
|
464
|
-
|
|
510
|
+
Bn(e, t, n, this.options, r, i, a);
|
|
465
511
|
}
|
|
466
512
|
describe() {
|
|
467
513
|
return `Bar chart of ${this.options.series.map((e) => e.name).join(", ")}, ${this.options.categories.length} categories`;
|
|
@@ -470,10 +516,10 @@ var Sr = class extends j {
|
|
|
470
516
|
return this.options.onBarClick !== void 0;
|
|
471
517
|
}
|
|
472
518
|
hits(e, t, n) {
|
|
473
|
-
return
|
|
519
|
+
return M(e, t, n) !== null;
|
|
474
520
|
}
|
|
475
521
|
clickAt(e, t, n) {
|
|
476
|
-
let r =
|
|
522
|
+
let r = M(e, t, n);
|
|
477
523
|
r && this.options.onBarClick?.({
|
|
478
524
|
category: r.category,
|
|
479
525
|
series: r.series,
|
|
@@ -487,12 +533,12 @@ var Sr = class extends j {
|
|
|
487
533
|
series: t
|
|
488
534
|
});
|
|
489
535
|
}
|
|
490
|
-
},
|
|
536
|
+
}, Nr = class extends G {
|
|
491
537
|
compute(e, t, n, r) {
|
|
492
|
-
return
|
|
538
|
+
return gn(this.options, e, t, n, r);
|
|
493
539
|
}
|
|
494
540
|
draw(e, t, n, r, i, a) {
|
|
495
|
-
|
|
541
|
+
Wn(e, t, n, this.options, r, i, a);
|
|
496
542
|
}
|
|
497
543
|
describe() {
|
|
498
544
|
let e = this.options.data.filter((e) => Number.isFinite(e.value) && e.value > 0).map((e) => e.label).join(", ");
|
|
@@ -502,21 +548,21 @@ var Sr = class extends j {
|
|
|
502
548
|
return this.options.onSliceClick !== void 0;
|
|
503
549
|
}
|
|
504
550
|
hits(e, t, n) {
|
|
505
|
-
return
|
|
551
|
+
return F(e, t, n) !== null;
|
|
506
552
|
}
|
|
507
553
|
clickAt(e, t, n) {
|
|
508
|
-
let r =
|
|
554
|
+
let r = F(e, t, n);
|
|
509
555
|
r && this.options.onSliceClick?.(r.slice);
|
|
510
556
|
}
|
|
511
557
|
update(e) {
|
|
512
558
|
this.setOptions({ data: e });
|
|
513
559
|
}
|
|
514
|
-
},
|
|
560
|
+
}, Pr = class extends G {
|
|
515
561
|
compute(e, t, n, r) {
|
|
516
|
-
return
|
|
562
|
+
return yn(this.options, e, t, n, r);
|
|
517
563
|
}
|
|
518
564
|
draw(e, t, n, r, i, a) {
|
|
519
|
-
|
|
565
|
+
Xn(e, t, n, this.options, r, i, a);
|
|
520
566
|
}
|
|
521
567
|
describe() {
|
|
522
568
|
let e = this.options.series.reduce((e, t) => e + t.points.length, 0);
|
|
@@ -526,21 +572,21 @@ var Sr = class extends j {
|
|
|
526
572
|
return this.options.onPointClick !== void 0;
|
|
527
573
|
}
|
|
528
574
|
hits(e, t, n) {
|
|
529
|
-
return
|
|
575
|
+
return L(e, t, n) !== null;
|
|
530
576
|
}
|
|
531
577
|
clickAt(e, t, n) {
|
|
532
|
-
let r =
|
|
578
|
+
let r = L(e, t, n);
|
|
533
579
|
r && this.options.onPointClick?.(r.point, r.series);
|
|
534
580
|
}
|
|
535
581
|
update(e) {
|
|
536
582
|
this.setOptions({ series: e });
|
|
537
583
|
}
|
|
538
|
-
},
|
|
584
|
+
}, Fr = class extends G {
|
|
539
585
|
compute(e, t, n, r) {
|
|
540
|
-
return
|
|
586
|
+
return _n(this.options, e, t, n, r);
|
|
541
587
|
}
|
|
542
588
|
draw(e, t, n, r, i, a) {
|
|
543
|
-
|
|
589
|
+
Jn(e, t, n, this.options, r, i, a);
|
|
544
590
|
}
|
|
545
591
|
describe() {
|
|
546
592
|
return `Histogram of ${this.options.values.length} values`;
|
|
@@ -555,12 +601,12 @@ var Sr = class extends j {
|
|
|
555
601
|
update(e) {
|
|
556
602
|
this.setOptions({ values: e });
|
|
557
603
|
}
|
|
558
|
-
},
|
|
604
|
+
}, Ir = class extends G {
|
|
559
605
|
compute(e, t, n, r) {
|
|
560
|
-
return
|
|
606
|
+
return mn(this.options, e, t, n, r);
|
|
561
607
|
}
|
|
562
608
|
draw(e, t, n, r, i, a) {
|
|
563
|
-
|
|
609
|
+
Vn(e, t, n, this.options, r, i, a);
|
|
564
610
|
}
|
|
565
611
|
describe() {
|
|
566
612
|
let e = this.options.data.map((e) => e.date).filter((e) => /^\d{4}-\d{2}-\d{2}$/.test(e)).sort(), t = this.options.from ?? e[0], n = this.options.to ?? e[e.length - 1];
|
|
@@ -570,21 +616,21 @@ var Sr = class extends j {
|
|
|
570
616
|
return this.options.onDayClick !== void 0;
|
|
571
617
|
}
|
|
572
618
|
hits(e, t, n) {
|
|
573
|
-
return
|
|
619
|
+
return N(e, t, n)?.day !== void 0;
|
|
574
620
|
}
|
|
575
621
|
clickAt(e, t, n) {
|
|
576
|
-
let r =
|
|
622
|
+
let r = N(e, t, n)?.day;
|
|
577
623
|
r && this.options.onDayClick?.(r);
|
|
578
624
|
}
|
|
579
625
|
update(e) {
|
|
580
626
|
this.setOptions({ data: e });
|
|
581
627
|
}
|
|
582
|
-
}, K = 12,
|
|
628
|
+
}, K = 12, Lr = class extends G {
|
|
583
629
|
compute(e, t, n, r) {
|
|
584
|
-
return
|
|
630
|
+
return vn(this.options, e, t, n, r);
|
|
585
631
|
}
|
|
586
632
|
draw(e, t, n, r, i, a) {
|
|
587
|
-
|
|
633
|
+
Yn(e, t, n, this.options, r, i, a);
|
|
588
634
|
}
|
|
589
635
|
describe() {
|
|
590
636
|
let { rows: e, columns: t } = this.options;
|
|
@@ -594,21 +640,21 @@ var Sr = class extends j {
|
|
|
594
640
|
return this.options.onCellClick !== void 0;
|
|
595
641
|
}
|
|
596
642
|
hits(e, t, n) {
|
|
597
|
-
return
|
|
643
|
+
return P(e, t, n) !== null;
|
|
598
644
|
}
|
|
599
645
|
clickAt(e, t, n) {
|
|
600
|
-
let r =
|
|
646
|
+
let r = P(e, t, n);
|
|
601
647
|
r && this.options.onCellClick?.(r.cell);
|
|
602
648
|
}
|
|
603
649
|
update(e) {
|
|
604
650
|
this.setOptions({ values: e });
|
|
605
651
|
}
|
|
606
|
-
},
|
|
652
|
+
}, Rr = class extends G {
|
|
607
653
|
compute(e, t, n, r) {
|
|
608
|
-
return
|
|
654
|
+
return hn(this.options, e, t, n, r);
|
|
609
655
|
}
|
|
610
656
|
draw(e, t, n, r, i, a) {
|
|
611
|
-
|
|
657
|
+
Hn(e, t, n, this.options, r, i, a);
|
|
612
658
|
}
|
|
613
659
|
describe() {
|
|
614
660
|
return `Counter-clock chart of price against volume, ${this.options.period ?? 25}-bar averages`;
|
|
@@ -617,19 +663,19 @@ var Sr = class extends j {
|
|
|
617
663
|
return this.options.onPointClick !== void 0;
|
|
618
664
|
}
|
|
619
665
|
hits(e, t, n) {
|
|
620
|
-
return
|
|
666
|
+
return I(e, t, n) !== null;
|
|
621
667
|
}
|
|
622
668
|
clickAt(e, t, n) {
|
|
623
|
-
let r =
|
|
669
|
+
let r = I(e, t, n);
|
|
624
670
|
r && this.options.onPointClick?.(r.point);
|
|
625
671
|
}
|
|
626
672
|
getPhase() {
|
|
627
|
-
return
|
|
673
|
+
return Sn(wn(this.options.data, this.options.period ?? 25, tr(this.options)));
|
|
628
674
|
}
|
|
629
675
|
update(e) {
|
|
630
676
|
this.setOptions({ data: e });
|
|
631
677
|
}
|
|
632
|
-
},
|
|
678
|
+
}, zr = [
|
|
633
679
|
"Jan",
|
|
634
680
|
"Feb",
|
|
635
681
|
"Mar",
|
|
@@ -664,7 +710,7 @@ function Y(e) {
|
|
|
664
710
|
if (e.length === 0) return [];
|
|
665
711
|
let t = [];
|
|
666
712
|
for (let n of e) {
|
|
667
|
-
let e =
|
|
713
|
+
let e = ft(n.time, "1M"), r = t[t.length - 1];
|
|
668
714
|
r && r.key === e ? r.close = n.equity : t.push({
|
|
669
715
|
key: e,
|
|
670
716
|
close: n.equity
|
|
@@ -677,7 +723,7 @@ function Y(e) {
|
|
|
677
723
|
let a = new Date(e.key), o = a.getUTCFullYear(), s = a.getUTCMonth();
|
|
678
724
|
r.push({
|
|
679
725
|
id: `${o}-${String(s + 1).padStart(2, "0")}`,
|
|
680
|
-
label:
|
|
726
|
+
label: zr[s],
|
|
681
727
|
group: String(o),
|
|
682
728
|
value: i
|
|
683
729
|
});
|
|
@@ -737,9 +783,9 @@ function Q(e) {
|
|
|
737
783
|
//#endregion
|
|
738
784
|
//#region src/finance/PerformanceDashboard.ts
|
|
739
785
|
function $(e) {
|
|
740
|
-
return !e || e === "dark" ? he : e === "light" ?
|
|
786
|
+
return !e || e === "dark" ? he : e === "light" ? Ee : e;
|
|
741
787
|
}
|
|
742
|
-
var
|
|
788
|
+
var Br = class {
|
|
743
789
|
options;
|
|
744
790
|
theme;
|
|
745
791
|
root;
|
|
@@ -888,6 +934,6 @@ var jr = class {
|
|
|
888
934
|
}
|
|
889
935
|
};
|
|
890
936
|
//#endregion
|
|
891
|
-
export {
|
|
937
|
+
export { yt as AlertManager, bt as Animator, Mr as BarChart, xt as BarCountdown, St as BinanceAdapter, Ct as BybitAdapter, wt as CANDLE_PATTERNS, fe as CHART_STYLE_KEYS, Ir as CalendarChart, a as Chart, Tr as ChartGrid, Tt as ChartLegend, Et as ChartStateManager, Dt as CoinbaseAdapter, Ot as CompareRenderer, Rr as CounterClockChart, kt as CrosshairTooltip, At as CurrentPriceLine, pe as DARK_TERMINAL, me as DARK_THEME, ge as DEFAULT_DRAWING_STYLE, ue as DEFAULT_HISTORY_PAGE_SIZE, jt as DEFAULT_LEGEND_CONFIG, Mt as DEFAULT_MAX_WEBGL_CHARTS, _e as DEFAULT_RECONNECT, Nt as DEFAULT_SESSION_HOURS, ve as DEFAULT_SIGNAL_STYLE, ye as DEFAULT_STREAM_CONFIG, be as DEFAULT_TIMEFRAME_FAVORITES, xe as DEFAULT_TRADE_ZONE_STYLE, Se as DEFAULT_TRADING_CONFIG, Pt as DataExporter, e as DataManager, Dr as DepthChart, Nr as DonutChart, re as DragDropImporter, Ft as DrawingBase, ee as EXCHANGE_TIMEZONE, ce as EXCHANGE_TIME_ZONE, It as Easing, U as EquityCurveChart, jr as GaugeChart, t as HISTORY_RETRY_MS, Ce as HNX_SESSIONS, we as HOSE_SESSIONS, W as HeatmapChart, Fr as HistogramChart, Rt as INDICATOR_CATEGORIES, zt as IndicatorBase, Bt as IndicatorValueMap, Vt as KeyboardHandler, Ht as KrakenAdapter, Te as LIGHT_THEME, de as LayoutManager, se as LayoutSession, f as MARKET_CRYPTO, p as MARKET_HNX, m as MARKET_HOSE, h as MARKET_HOSE_ETF, g as MARKET_NYSE, _ as MARKET_UPCOM, v as MARKET_VN30F, Ut as MAX_ALERT_BARS, ne as MAX_LAYOUT_NAME, Wt as MIN_ALERT_BARS, y as MS_TIME_THRESHOLD, Lr as MatrixChart, Gt as MockAdapter, c as PLUGIN_API_VERSION, b as PRICE_SOURCES, Kt as PaperExecutionAdapter, Br as PerformanceDashboard, o as PluginManager, qt as PollingAdapter, Jt as RANGE_PRESETS, Yt as ReplayManager, Xt as ResamplingAdapter, Pr as ScatterChart, Zt as Screenshot, Qt as SessionBreaks, $t as SessionShading, en as SignalMarkerManager, Er as SparklineChart, tn as StreamManager, x as TC_PALETTE, S as TC_SERIES_COLORS, C as TIMEFRAMES_CRYPTO, w as TIMEFRAMES_FOREX, T as TIMEFRAMES_STOCK, i as ThemeManager, nn as TickAggregator, rn as TickBarAdapter, an as TickBarBuilder, on as TradeZoneManager, E as UPCOM_SESSIONS, A as UndoRedoManager, D as VN30F_SESSIONS, De as VN_COLORS, Oe as VOLUME_ALPHA, sn as VolumeRenderer, Or as WaterfallChart, cn as Watermark, ln as WebSocketAdapter, dn as barIndexToX, ke as barTimeUnit, Ae as barsAreDaily, ae as cleanLayoutName, s as clearGlobalPlugins, J as computeDrawdownCurve, Y as computeMonthlyReturns, je as computePriceLimits, bn as correlationMatrix, xn as counterClockPhase, Cn as counterClockPoints, Me as createVNTheme, Tn as detectCandlePatterns, Cr as feedBars, Ne as formatFraction, Pe as formatNumber, En as formatTooltipTime, Fe as formatVND, Ie as formatVolumeLoc, Le as fractionTick, Re as getCurrentSession, ie as getGlobalPlugins, ze as getLocale, Dn as histogramBins, On as indicatorCategory, Be as indicatorSource, kn as isPriceLevelAlert, Ve as isPriceSource, He as isTimeFrame, Ue as isValidTimeZone, u as localStorageLayouts, Nn as lttbDownsample, Pn as lttbVisibleIndices, We as marketStatus, r as memoryLayouts, Fn as niceScale, Ge as normalizeBar, Ke as normalizeBarTime, qe as offsetAt, wr as overlayScale, n as overlaysForLayer, Je as parseIndicatorSource, oe as parseOHLCV, Ye as parseTimeframe, Xe as pickBaseTimeframe, le as pluginKey, Ze as priceFormatterFor, Qe as priceStepAt, In as priceToY, Ln as priceToYMapper, zn as rangePresetStart, $e as rankSymbols, et as readNews, tt as readQuote, nt as registerLocale, te as registerPlugin, rt as resampleBars, it as roundToPriceStep, at as scaleMarketPrices, Q as selectKeyStats, $n as servesTimeframe, ot as setLocale, er as setMaxWebGLCharts, st as sourcePrice, ct as stepDecimals, lt as symbolTimeZone, vr as syncIndicators, ut as t, dt as tickBarCount, nr as timeToX, pt as timeframeToMs, rr as timestampToBarIndex, q as toEquityPoints, ar as toHeikinAshi, or as toKagi, sr as toLineBreak, cr as toPointAndFigure, lr as toRangeBars, ur as toRenko, l as unregisterPlugin, mt as vn30fContracts, ht as vn30fLastTradingDay, gt as volumeColor, _t as wallToUtc, dr as withResampling, fr as withTickBars, pr as xToBarIndex, mr as xToTime, hr as yToPrice, vt as zoneOffsetMinutes };
|
|
892
938
|
|
|
893
939
|
//# sourceMappingURL=index.js.map
|