@tradecanvas/chart 1.16.1 → 1.18.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 +13 -0
- package/dist/Chart.d.ts.map +1 -1
- package/dist/LayoutSession-DSDt4JZQ.cjs +2 -0
- package/dist/LayoutSession-DSDt4JZQ.cjs.map +1 -0
- package/dist/{LayoutSession-D6CJzlWe.js → LayoutSession-DnVpA1Bg.js} +27 -8
- package/dist/LayoutSession-DnVpA1Bg.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -37
- package/dist/index.js.map +1 -1
- package/dist/layout/priceAxisWidth.d.ts +3 -1
- package/dist/layout/priceAxisWidth.d.ts.map +1 -1
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/overlayScale.d.ts +48 -0
- package/dist/plugins/overlayScale.d.ts.map +1 -0
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetDrawingSettings.d.ts +9 -0
- package/dist/widget/WidgetDrawingSettings.d.ts.map +1 -1
- package/dist/widget/index.cjs +2 -2
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +11 -2
- package/dist/widget/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/LayoutSession-BcDTB3LX.cjs +0 -2
- package/dist/LayoutSession-BcDTB3LX.cjs.map +0 -1
- package/dist/LayoutSession-D6CJzlWe.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as ee, n as te, o as ne, p as re, r as ie, s as ae, t as oe, u as se, v as ce, x as le, y as ue } from "./LayoutSession-
|
|
2
|
-
import { CHART_STYLE_KEYS as de, DARK_TERMINAL as fe, DARK_THEME as pe, DARK_THEME as
|
|
3
|
-
import { AlertManager as
|
|
1
|
+
import { S as e, _ as t, a as n, b as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as ee, n as te, o as ne, p as re, r as ie, s as ae, t as oe, u as se, v as ce, x as le, y as ue } from "./LayoutSession-DnVpA1Bg.js";
|
|
2
|
+
import { CHART_STYLE_KEYS as de, DARK_TERMINAL as fe, DARK_THEME as pe, DARK_THEME as me, DEFAULT_DRAWING_STYLE as he, DEFAULT_RECONNECT as d, DEFAULT_SIGNAL_STYLE as f, DEFAULT_STREAM_CONFIG as p, DEFAULT_TIMEFRAME_FAVORITES as m, DEFAULT_TRADE_ZONE_STYLE as h, DEFAULT_TRADING_CONFIG as g, LIGHT_THEME as _, LIGHT_THEME as v, MARKET_CRYPTO as y, MARKET_HNX as b, MARKET_HOSE as x, MARKET_NYSE as S, MARKET_UPCOM as C, PRICE_SOURCES as w, TC_PALETTE as T, TC_SERIES_COLORS as E, TIMEFRAMES_CRYPTO as D, TIMEFRAMES_FOREX as O, TIMEFRAMES_STOCK as k, VN_COLORS as A, VOLUME_ALPHA as j, barsAreDaily as M, computePriceLimits as N, createVNTheme as P, formatFraction as F, formatNumber as I, formatVND as L, formatVolumeLoc as R, fractionTick as ge, getCurrentSession as _e, getLocale as ve, indicatorSource as ye, isPriceSource as be, isTimeFrame as xe, isValidTimeZone as Se, marketStatus as Ce, normalizeBar as we, normalizeBarTime as Te, offsetAt as Ee, parseIndicatorSource as De, parseTimeframe as Oe, pickBaseTimeframe as ke, priceFormatterFor as Ae, rankSymbols as je, readNews as Me, readQuote as Ne, registerLocale as Pe, resampleBars as Fe, setLocale as Ie, sourcePrice as Le, stepDecimals as Re, t as ze, tickBarCount as Be, timeframeBucketStart as Ve, timeframeToMs as He, volumeColor as Ue, wallToUtc as We, zoneOffsetMinutes as Ge } from "@tradecanvas/commons";
|
|
3
|
+
import { AlertManager as Ke, Animator as qe, BarCountdown as Je, BaseFinanceChart as z, BinanceAdapter as Ye, BybitAdapter as Xe, ChartLegend as Ze, ChartStateManager as Qe, CoinbaseAdapter as $e, CompareRenderer as et, CrosshairTooltip as tt, CurrentPriceLine as nt, DEFAULT_LEGEND_CONFIG as rt, DEFAULT_MAX_WEBGL_CHARTS as it, DEFAULT_SESSION_HOURS as at, DataExporter as ot, DrawingBase as st, Easing as ct, FinanceCrosshair as B, IndicatorBase as lt, IndicatorValueMap as ut, KeyboardHandler as dt, KrakenAdapter as ft, MAX_ALERT_BARS as pt, MIN_ALERT_BARS as mt, MockAdapter as ht, PaperExecutionAdapter as gt, PollingAdapter as _t, RANGE_PRESETS as vt, ReplayManager as yt, ResamplingAdapter as bt, Screenshot as xt, SessionBreaks as St, SessionShading as Ct, SignalMarkerManager as wt, StreamManager as Tt, TickAggregator as Et, TickBarAdapter as Dt, TickBarBuilder as Ot, TradeZoneManager as kt, UndoRedoManager as At, VolumeRenderer as jt, Watermark as Mt, WebSocketAdapter as Nt, barIndexToTime as Pt, barIndexToX as Ft, barIndexToX as V, formatTooltipTime as It, isPriceLevelAlert as Lt, layoutSquarifiedTreemap as Rt, layoutUniformGrid as zt, lttbDownsample as Bt, lttbVisibleIndices as Vt, priceToY as Ht, priceToYMapper as Ut, priceToYMapper as Wt, rangePresetStart as Gt, renderDepthChart as Kt, renderEquityCurve as qt, renderGauge as Jt, renderHeatmap as Yt, renderSparkline as Xt, renderWaterfall as Zt, servesTimeframe as Qt, setMaxWebGLCharts as $t, timeToX as en, timestampToBarIndex as tn, timestampToBarIndex as nn, toHeikinAshi as rn, toKagi as an, toLineBreak as on, toPointAndFigure as sn, toRangeBars as cn, toRenko as ln, withResampling as un, withTickBars as dn, xToBarIndex as fn, xToBarIndex as H, xToTime as pn, yToPrice as mn, yToPrice as hn } from "@tradecanvas/core";
|
|
4
4
|
//#region src/frameworks/syncIndicators.ts
|
|
5
|
-
function
|
|
5
|
+
function gn(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 tn(e) {
|
|
|
10
10
|
r
|
|
11
11
|
]);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function _n(e, t, n) {
|
|
14
14
|
let r = /* @__PURE__ */ new Map(), i = t.map((e) => {
|
|
15
|
-
let t =
|
|
15
|
+
let t = gn(e), n = r.get(t) ?? 0;
|
|
16
16
|
return r.set(t, n + 1), {
|
|
17
17
|
spec: e,
|
|
18
18
|
key: `${t}#${n}`
|
|
@@ -26,6 +26,30 @@ function nn(e, t, n) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
//#endregion
|
|
29
|
+
//#region src/plugins/overlayScale.ts
|
|
30
|
+
function vn(e) {
|
|
31
|
+
let { viewport: t, data: n } = e, r = Wt(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 ? nn(e, n) : e;
|
|
32
|
+
return {
|
|
33
|
+
timeToX: (e) => V(s(e), t),
|
|
34
|
+
xToTime: (e) => {
|
|
35
|
+
let r = H(e, t);
|
|
36
|
+
return n.length > 0 ? Pt(r, n) : r;
|
|
37
|
+
},
|
|
38
|
+
indexToX: (e) => V(e, t),
|
|
39
|
+
xToIndex: (e) => H(e, t),
|
|
40
|
+
priceToY: r,
|
|
41
|
+
yToPrice: (e) => hn(e, t),
|
|
42
|
+
barWidth: t.barWidth,
|
|
43
|
+
visible: o < a ? {
|
|
44
|
+
from: 0,
|
|
45
|
+
to: -1
|
|
46
|
+
} : {
|
|
47
|
+
from: a,
|
|
48
|
+
to: o
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
29
53
|
//#region src/grid/ChartGrid.ts
|
|
30
54
|
var U = {
|
|
31
55
|
"1x1": {
|
|
@@ -60,7 +84,7 @@ var U = {
|
|
|
60
84
|
cols: 2,
|
|
61
85
|
rows: 3
|
|
62
86
|
}
|
|
63
|
-
},
|
|
87
|
+
}, yn = class {
|
|
64
88
|
root;
|
|
65
89
|
cells = [];
|
|
66
90
|
layout;
|
|
@@ -167,13 +191,13 @@ var U = {
|
|
|
167
191
|
this.cells = [], this.root.remove();
|
|
168
192
|
}
|
|
169
193
|
}
|
|
170
|
-
},
|
|
194
|
+
}, bn = class extends z {
|
|
171
195
|
options;
|
|
172
196
|
constructor(e, t) {
|
|
173
197
|
super(e, t.theme), this.options = t, this.requestRender();
|
|
174
198
|
}
|
|
175
199
|
renderChart(e, t, n, r) {
|
|
176
|
-
|
|
200
|
+
Xt(e, t, n, this.options, r);
|
|
177
201
|
}
|
|
178
202
|
update(e) {
|
|
179
203
|
this.options = {
|
|
@@ -187,15 +211,15 @@ var U = {
|
|
|
187
211
|
...e
|
|
188
212
|
}, this.requestRender();
|
|
189
213
|
}
|
|
190
|
-
},
|
|
214
|
+
}, xn = class extends z {
|
|
191
215
|
options;
|
|
192
216
|
crosshair = null;
|
|
193
217
|
constructor(e, t) {
|
|
194
|
-
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new
|
|
218
|
+
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new B(this.canvas, () => this.requestRender())), this.requestRender();
|
|
195
219
|
}
|
|
196
220
|
renderChart(e, t, n, r) {
|
|
197
221
|
let i = this.crosshair?.getPosition() ?? null;
|
|
198
|
-
|
|
222
|
+
Kt(e, t, n, this.options, r, i);
|
|
199
223
|
}
|
|
200
224
|
update(e) {
|
|
201
225
|
this.options = {
|
|
@@ -212,15 +236,15 @@ var U = {
|
|
|
212
236
|
destroy() {
|
|
213
237
|
this.crosshair?.destroy(), super.destroy();
|
|
214
238
|
}
|
|
215
|
-
},
|
|
239
|
+
}, W = class extends z {
|
|
216
240
|
options;
|
|
217
241
|
crosshair = null;
|
|
218
242
|
constructor(e, t) {
|
|
219
|
-
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new
|
|
243
|
+
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new B(this.canvas, () => this.requestRender())), this.requestRender();
|
|
220
244
|
}
|
|
221
245
|
renderChart(e, t, n, r) {
|
|
222
246
|
let i = this.crosshair?.getPosition() ?? null;
|
|
223
|
-
|
|
247
|
+
qt(e, t, n, this.options, r, i);
|
|
224
248
|
}
|
|
225
249
|
update(e, t) {
|
|
226
250
|
this.options = {
|
|
@@ -240,7 +264,7 @@ var U = {
|
|
|
240
264
|
destroy() {
|
|
241
265
|
this.crosshair?.destroy(), super.destroy();
|
|
242
266
|
}
|
|
243
|
-
},
|
|
267
|
+
}, G = class extends z {
|
|
244
268
|
options;
|
|
245
269
|
crosshair = null;
|
|
246
270
|
cachedRects = [];
|
|
@@ -249,7 +273,7 @@ var U = {
|
|
|
249
273
|
lastLayoutHeight = 0;
|
|
250
274
|
handleClick = null;
|
|
251
275
|
constructor(e, t) {
|
|
252
|
-
super(e, t.theme), this.options = t, this.currentData = t.data ?? [], t.crosshair !== !1 && (this.crosshair = new
|
|
276
|
+
super(e, t.theme), this.options = t, this.currentData = t.data ?? [], t.crosshair !== !1 && (this.crosshair = new B(this.canvas, () => this.requestRender())), t.onCellClick && (this.handleClick = (e) => {
|
|
253
277
|
let t = this.canvas.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
254
278
|
this.onCanvasClick(n, r);
|
|
255
279
|
}, this.canvas.addEventListener("click", this.handleClick)), this.recomputeLayout(), this.requestRender();
|
|
@@ -266,8 +290,8 @@ var U = {
|
|
|
266
290
|
id: e.id,
|
|
267
291
|
weight: e.weight ?? (Math.abs(e.value) || 1)
|
|
268
292
|
}));
|
|
269
|
-
this.cachedRects =
|
|
270
|
-
} else this.cachedRects =
|
|
293
|
+
this.cachedRects = Rt(n, e, t);
|
|
294
|
+
} else this.cachedRects = zt(this.currentData.map((e) => ({ id: e.id })), e, t);
|
|
271
295
|
}
|
|
272
296
|
onCanvasClick(e, t) {
|
|
273
297
|
if (this.options.onCellClick) for (let n of this.cachedRects) {
|
|
@@ -282,7 +306,7 @@ var U = {
|
|
|
282
306
|
renderChart(e, t, n, r) {
|
|
283
307
|
(t !== this.lastLayoutWidth || n !== this.lastLayoutHeight) && this.recomputeLayout();
|
|
284
308
|
let i = this.crosshair?.getPosition() ?? null;
|
|
285
|
-
|
|
309
|
+
Yt(e, t, n, this.currentData, this.cachedRects, this.options, r, i);
|
|
286
310
|
}
|
|
287
311
|
update(e) {
|
|
288
312
|
this.currentData = e, this.options = {
|
|
@@ -299,15 +323,15 @@ var U = {
|
|
|
299
323
|
destroy() {
|
|
300
324
|
this.crosshair?.destroy(), this.handleClick && this.canvas.removeEventListener("click", this.handleClick), super.destroy();
|
|
301
325
|
}
|
|
302
|
-
},
|
|
326
|
+
}, K = class extends z {
|
|
303
327
|
options;
|
|
304
328
|
crosshair = null;
|
|
305
329
|
constructor(e, t) {
|
|
306
|
-
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new
|
|
330
|
+
super(e, t.theme), this.options = t, t.crosshair !== !1 && (this.crosshair = new B(this.canvas, () => this.requestRender())), this.requestRender();
|
|
307
331
|
}
|
|
308
332
|
renderChart(e, t, n, r) {
|
|
309
333
|
let i = this.crosshair?.getPosition() ?? null;
|
|
310
|
-
|
|
334
|
+
Zt(e, t, n, this.options, r, i);
|
|
311
335
|
}
|
|
312
336
|
update(e) {
|
|
313
337
|
this.options = {
|
|
@@ -324,12 +348,12 @@ var U = {
|
|
|
324
348
|
destroy() {
|
|
325
349
|
this.crosshair?.destroy(), super.destroy();
|
|
326
350
|
}
|
|
327
|
-
},
|
|
328
|
-
function
|
|
351
|
+
}, Sn = 500;
|
|
352
|
+
function Cn(e) {
|
|
329
353
|
let t = 1 - e;
|
|
330
354
|
return 1 - t * t * t;
|
|
331
355
|
}
|
|
332
|
-
var
|
|
356
|
+
var wn = class extends z {
|
|
333
357
|
options;
|
|
334
358
|
currentValue;
|
|
335
359
|
targetValue;
|
|
@@ -340,7 +364,7 @@ var ln = class extends V {
|
|
|
340
364
|
super(e, t.theme), this.options = t, this.currentValue = t.value, this.targetValue = t.value, this.requestRender();
|
|
341
365
|
}
|
|
342
366
|
renderChart(e, t, n, r) {
|
|
343
|
-
|
|
367
|
+
Jt(e, t, n, this.options, r, this.currentValue);
|
|
344
368
|
}
|
|
345
369
|
setValue(e) {
|
|
346
370
|
if (this.options.animate === !1) {
|
|
@@ -370,7 +394,7 @@ var ln = class extends V {
|
|
|
370
394
|
if (this.animationFrameId !== null) return;
|
|
371
395
|
let e = () => {
|
|
372
396
|
if (this.animationFrameId = null, this.animationStart === null) return;
|
|
373
|
-
let t = this.options.animationDuration ??
|
|
397
|
+
let t = this.options.animationDuration ?? Sn, n = performance.now() - this.animationStart, r = Math.min(1, n / Math.max(1, t)), i = Cn(r);
|
|
374
398
|
this.currentValue = this.animationFrom + (this.targetValue - this.animationFrom) * i, this.requestRender(), r < 1 ? this.animationFrameId = requestAnimationFrame(e) : (this.currentValue = this.targetValue, this.animationStart = null);
|
|
375
399
|
};
|
|
376
400
|
this.animationFrameId = requestAnimationFrame(e);
|
|
@@ -381,7 +405,7 @@ var ln = class extends V {
|
|
|
381
405
|
destroy() {
|
|
382
406
|
this.cancelAnimation(), super.destroy();
|
|
383
407
|
}
|
|
384
|
-
},
|
|
408
|
+
}, Tn = [
|
|
385
409
|
"Jan",
|
|
386
410
|
"Feb",
|
|
387
411
|
"Mar",
|
|
@@ -416,7 +440,7 @@ function Y(e) {
|
|
|
416
440
|
if (e.length === 0) return [];
|
|
417
441
|
let t = [];
|
|
418
442
|
for (let n of e) {
|
|
419
|
-
let e =
|
|
443
|
+
let e = Ve(n.time, "1M"), r = t[t.length - 1];
|
|
420
444
|
r && r.key === e ? r.close = n.equity : t.push({
|
|
421
445
|
key: e,
|
|
422
446
|
close: n.equity
|
|
@@ -429,7 +453,7 @@ function Y(e) {
|
|
|
429
453
|
let a = new Date(e.key), o = a.getUTCFullYear(), s = a.getUTCMonth();
|
|
430
454
|
r.push({
|
|
431
455
|
id: `${o}-${String(s + 1).padStart(2, "0")}`,
|
|
432
|
-
label:
|
|
456
|
+
label: Tn[s],
|
|
433
457
|
group: String(o),
|
|
434
458
|
value: i
|
|
435
459
|
});
|
|
@@ -489,9 +513,9 @@ function Q(e) {
|
|
|
489
513
|
//#endregion
|
|
490
514
|
//#region src/finance/PerformanceDashboard.ts
|
|
491
515
|
function $(e) {
|
|
492
|
-
return !e || e === "dark" ?
|
|
516
|
+
return !e || e === "dark" ? me : e === "light" ? v : e;
|
|
493
517
|
}
|
|
494
|
-
var
|
|
518
|
+
var En = class {
|
|
495
519
|
options;
|
|
496
520
|
theme;
|
|
497
521
|
root;
|
|
@@ -534,7 +558,7 @@ var dn = class {
|
|
|
534
558
|
"gap:14px"
|
|
535
559
|
].join(";"), this.root.appendChild(o);
|
|
536
560
|
let s = this.buildPanel("Equity Curve", i, a);
|
|
537
|
-
s.wrap.style.gridColumn = "1 / -1", o.appendChild(s.wrap), this.equityChart = new
|
|
561
|
+
s.wrap.style.gridColumn = "1 / -1", o.appendChild(s.wrap), this.equityChart = new W(s.body, {
|
|
538
562
|
data: q(t.equityCurve),
|
|
539
563
|
theme: e,
|
|
540
564
|
lineColor: e.candleUp,
|
|
@@ -542,7 +566,7 @@ var dn = class {
|
|
|
542
566
|
crosshair: !0
|
|
543
567
|
});
|
|
544
568
|
let c = this.buildPanel("Drawdown", i, a);
|
|
545
|
-
o.appendChild(c.wrap), this.drawdownChart = new
|
|
569
|
+
o.appendChild(c.wrap), this.drawdownChart = new W(c.body, {
|
|
546
570
|
data: J(t.equityCurve),
|
|
547
571
|
theme: e,
|
|
548
572
|
lineColor: e.candleDown,
|
|
@@ -551,7 +575,7 @@ var dn = class {
|
|
|
551
575
|
valueFormat: (e) => `${e.toFixed(1)}%`
|
|
552
576
|
});
|
|
553
577
|
let l = Y(t.equityCurve), u = this.buildPanel("Monthly Returns", i, a);
|
|
554
|
-
o.appendChild(u.wrap), this.heatmap = new
|
|
578
|
+
o.appendChild(u.wrap), this.heatmap = new G(u.body, {
|
|
555
579
|
data: l,
|
|
556
580
|
theme: e,
|
|
557
581
|
showValues: !0,
|
|
@@ -640,6 +664,6 @@ var dn = class {
|
|
|
640
664
|
}
|
|
641
665
|
};
|
|
642
666
|
//#endregion
|
|
643
|
-
export {
|
|
667
|
+
export { Ke as AlertManager, qe as Animator, Je as BarCountdown, Ye as BinanceAdapter, Xe as BybitAdapter, de as CHART_STYLE_KEYS, i as Chart, yn as ChartGrid, Ze as ChartLegend, Qe as ChartStateManager, $e as CoinbaseAdapter, et as CompareRenderer, tt as CrosshairTooltip, nt as CurrentPriceLine, fe as DARK_TERMINAL, pe as DARK_THEME, he as DEFAULT_DRAWING_STYLE, r as DEFAULT_HISTORY_PAGE_SIZE, rt as DEFAULT_LEGEND_CONFIG, it as DEFAULT_MAX_WEBGL_CHARTS, d as DEFAULT_RECONNECT, at as DEFAULT_SESSION_HOURS, f as DEFAULT_SIGNAL_STYLE, p as DEFAULT_STREAM_CONFIG, m as DEFAULT_TIMEFRAME_FAVORITES, h as DEFAULT_TRADE_ZONE_STYLE, g as DEFAULT_TRADING_CONFIG, ot as DataExporter, e as DataManager, xn as DepthChart, ne as DragDropImporter, st as DrawingBase, u as EXCHANGE_TIMEZONE, ct as Easing, W as EquityCurveChart, wn as GaugeChart, le as HISTORY_RETRY_MS, G as HeatmapChart, lt as IndicatorBase, ut as IndicatorValueMap, dt as KeyboardHandler, ft as KrakenAdapter, _ as LIGHT_THEME, ce as LayoutManager, oe as LayoutSession, y as MARKET_CRYPTO, b as MARKET_HNX, x as MARKET_HOSE, S as MARKET_NYSE, C as MARKET_UPCOM, pt as MAX_ALERT_BARS, te as MAX_LAYOUT_NAME, mt as MIN_ALERT_BARS, ht as MockAdapter, c as PLUGIN_API_VERSION, w as PRICE_SOURCES, gt as PaperExecutionAdapter, En as PerformanceDashboard, se as PluginManager, _t as PollingAdapter, vt as RANGE_PRESETS, yt as ReplayManager, bt as ResamplingAdapter, xt as Screenshot, St as SessionBreaks, Ct as SessionShading, wt as SignalMarkerManager, bn as SparklineChart, Tt as StreamManager, T as TC_PALETTE, E as TC_SERIES_COLORS, D as TIMEFRAMES_CRYPTO, O as TIMEFRAMES_FOREX, k as TIMEFRAMES_STOCK, ue as ThemeManager, Et as TickAggregator, Dt as TickBarAdapter, Ot as TickBarBuilder, kt as TradeZoneManager, At as UndoRedoManager, A as VN_COLORS, j as VOLUME_ALPHA, jt as VolumeRenderer, K as WaterfallChart, Mt as Watermark, Nt as WebSocketAdapter, Ft as barIndexToX, M as barsAreDaily, ie as cleanLayoutName, a as clearGlobalPlugins, J as computeDrawdownCurve, Y as computeMonthlyReturns, N as computePriceLimits, P as createVNTheme, F as formatFraction, I as formatNumber, It as formatTooltipTime, L as formatVND, R as formatVolumeLoc, ge as fractionTick, _e as getCurrentSession, o as getGlobalPlugins, ve as getLocale, ye as indicatorSource, Lt as isPriceLevelAlert, be as isPriceSource, xe as isTimeFrame, Se as isValidTimeZone, l as localStorageLayouts, Bt as lttbDownsample, Vt as lttbVisibleIndices, Ce as marketStatus, n as memoryLayouts, we as normalizeBar, Te as normalizeBarTime, Ee as offsetAt, vn as overlayScale, s as overlaysForLayer, De as parseIndicatorSource, ae as parseOHLCV, Oe as parseTimeframe, ke as pickBaseTimeframe, t as pluginKey, Ae as priceFormatterFor, Ht as priceToY, Ut as priceToYMapper, Gt as rangePresetStart, je as rankSymbols, Me as readNews, Ne as readQuote, Pe as registerLocale, re as registerPlugin, Fe as resampleBars, Q as selectKeyStats, Qt as servesTimeframe, Ie as setLocale, $t as setMaxWebGLCharts, Le as sourcePrice, Re as stepDecimals, _n as syncIndicators, ze as t, Be as tickBarCount, en as timeToX, He as timeframeToMs, tn as timestampToBarIndex, q as toEquityPoints, rn as toHeikinAshi, an as toKagi, on as toLineBreak, sn as toPointAndFigure, cn as toRangeBars, ln as toRenko, ee as unregisterPlugin, Ue as volumeColor, We as wallToUtc, un as withResampling, dn as withTickBars, fn as xToBarIndex, pn as xToTime, mn as yToPrice, Ge as zoneOffsetMinutes };
|
|
644
668
|
|
|
645
669
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/frameworks/syncIndicators.ts","../src/grid/ChartGrid.ts","../src/finance/SparklineChart.ts","../src/finance/DepthChart.ts","../src/finance/EquityCurveChart.ts","../src/finance/HeatmapChart.ts","../src/finance/WaterfallChart.ts","../src/finance/GaugeChart.ts","../src/finance/performanceData.ts","../src/finance/PerformanceDashboard.ts"],"sourcesContent":["import type { PanelPosition } from '@tradecanvas/commons';\n\n/**\n * An indicator a framework component shows: its id (`'rsi'`), or its id with\n * its inputs and, for one in a pane, where the pane goes.\n */\nexport type IndicatorSpec =\n | string\n | { id: string; params?: Record<string, number | string | boolean>; position?: PanelPosition };\n\n/** What the components need of a chart to keep its indicators in step. */\nexport interface IndicatorHost {\n addIndicator(...args: [string, Record<string, number | string | boolean>?, PanelPosition?]): string | null;\n removeIndicator(instanceId: string): void;\n}\n\n/** One spec as text: the same indicator with the same inputs (in any order) and place reads the same. */\nfunction specKey(spec: IndicatorSpec): string {\n const { id, params = {}, position = null } = typeof spec === 'string' ? { id: spec } : spec;\n return JSON.stringify([id, Object.keys(params).sort().map((k) => [k, params[k]]), position]);\n}\n\n/**\n * Brings the chart's indicators to `specs`: those no longer asked for go,\n * new ones come, and one whose inputs or place changed is put back with\n * them. `current` maps each spec (and its count, for two alike) to its\n * instance on the chart, and is kept up to date.\n */\nexport function syncIndicators(chart: IndicatorHost, specs: readonly IndicatorSpec[], current: Map<string, string>): void {\n const seen = new Map<string, number>();\n const wanted = specs.map((spec) => {\n const key = specKey(spec);\n const n = seen.get(key) ?? 0;\n seen.set(key, n + 1);\n return { spec, key: `${key}#${n}` };\n });\n const keys = new Set(wanted.map((w) => w.key));\n for (const [key, instanceId] of [...current]) {\n if (keys.has(key)) continue;\n chart.removeIndicator(instanceId);\n current.delete(key);\n }\n for (const { spec, key } of wanted) {\n if (current.has(key)) continue;\n const instanceId = typeof spec === 'string'\n ? chart.addIndicator(spec)\n : spec.position !== undefined\n ? chart.addIndicator(spec.id, spec.params ?? {}, spec.position)\n : chart.addIndicator(spec.id, spec.params ?? {});\n if (instanceId) current.set(key, instanceId);\n }\n}\n","import type { ChartOptions, Theme, TimeFrame, DataSeries, DataAdapter, StreamConfig } from '@tradecanvas/commons';\nimport { Chart } from '../Chart.js';\n\nexport type GridLayout = '1x1' | '1x2' | '2x1' | '2x2' | '1x3' | '3x1' | '2x3' | '3x2';\n\nexport interface GridCellConfig {\n symbol?: string;\n timeframe?: TimeFrame;\n chartOptions?: Partial<ChartOptions>;\n}\n\nexport interface ChartGridOptions {\n layout?: GridLayout;\n theme?: ChartOptions['theme'];\n syncCrosshair?: boolean;\n syncTimeAxis?: boolean;\n gap?: number;\n cells?: GridCellConfig[];\n chartOptions?: Partial<ChartOptions>;\n}\n\ninterface GridCell {\n container: HTMLDivElement;\n chart: Chart;\n symbol: string;\n timeframe: TimeFrame;\n}\n\nconst LAYOUT_MAP: Record<GridLayout, { cols: number; rows: number }> = {\n '1x1': { cols: 1, rows: 1 },\n '1x2': { cols: 2, rows: 1 },\n '2x1': { cols: 1, rows: 2 },\n '2x2': { cols: 2, rows: 2 },\n '1x3': { cols: 3, rows: 1 },\n '3x1': { cols: 1, rows: 3 },\n '2x3': { cols: 3, rows: 2 },\n '3x2': { cols: 2, rows: 3 },\n};\n\nexport class ChartGrid {\n private root: HTMLDivElement;\n private cells: GridCell[] = [];\n private layout: GridLayout;\n private options: ChartGridOptions;\n private destroyed = false;\n private syncing = false;\n\n constructor(container: HTMLElement, options: ChartGridOptions = {}) {\n this.options = options;\n this.layout = options.layout ?? '2x2';\n\n this.root = document.createElement('div');\n this.root.style.cssText = 'display:grid;width:100%;height:100%;overflow:hidden;';\n container.appendChild(this.root);\n\n this.applyLayout();\n this.createCells();\n }\n\n private applyLayout(): void {\n const { cols, rows } = LAYOUT_MAP[this.layout];\n const gap = this.options.gap ?? 1;\n this.root.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n this.root.style.gridTemplateRows = `repeat(${rows}, 1fr)`;\n this.root.style.gap = `${gap}px`;\n }\n\n private createCells(): void {\n const { cols, rows } = LAYOUT_MAP[this.layout];\n const count = cols * rows;\n for (let i = 0; i < count; i++) this.cells.push(this.createCell(i));\n }\n\n private createCell(i: number): GridCell {\n const cellConfig = this.options.cells?.[i] ?? {};\n\n const cellEl = document.createElement('div');\n cellEl.style.cssText = 'position:relative;overflow:hidden;min-width:0;min-height:0;';\n this.root.appendChild(cellEl);\n\n const chartOpts: ChartOptions = {\n chartType: 'candlestick',\n autoScale: true,\n features: {\n crosshair: true,\n keyboard: true,\n volume: true,\n legend: true,\n priceAxis: true,\n timeAxis: true,\n grid: true,\n },\n ...this.options.chartOptions,\n ...cellConfig.chartOptions,\n theme: this.options.theme,\n };\n\n const chart = new Chart(cellEl, chartOpts);\n\n const cell: GridCell = {\n container: cellEl,\n chart,\n symbol: cellConfig.symbol ?? `Chart ${i + 1}`,\n timeframe: cellConfig.timeframe ?? '5m',\n };\n\n // Charts can differ in symbol and timeframe, so the crosshair is linked by\n // time: the others show a vertical line on the bar containing that time.\n if (this.options.syncCrosshair !== false) {\n chart.on('crosshairMove', (e) => {\n const time = e.payload.bar?.time;\n if (time === undefined) return;\n for (const other of this.cells) {\n if (other.chart !== chart) other.chart.setCrosshairTime(time);\n }\n });\n chart.on('crosshairLeave', () => {\n for (const other of this.cells) {\n if (other.chart !== chart) other.chart.setCrosshairTime(null);\n }\n });\n }\n\n if (this.options.syncTimeAxis !== false) {\n chart.on('visibleRangeChange', (e) => {\n if (this.syncing) return;\n this.syncing = true;\n const { from, to } = e.payload;\n const srcData = chart.getData();\n if (srcData.length > 0 && from >= 0 && to < srcData.length) {\n const fromTime = srcData[from]?.time;\n const toTime = srcData[to]?.time;\n if (fromTime && toTime) {\n for (const other of this.cells) {\n if (other.chart !== chart) {\n other.chart.setVisibleRange(fromTime, toTime);\n }\n }\n }\n }\n this.syncing = false;\n });\n }\n\n return cell;\n }\n\n setLayout(layout: GridLayout): void {\n if (layout === this.layout) return;\n const oldCount = this.cells.length;\n const { cols, rows } = LAYOUT_MAP[layout];\n const newCount = cols * rows;\n\n if (newCount < oldCount) {\n for (let i = oldCount - 1; i >= newCount; i--) {\n const cell = this.cells[i];\n cell.chart.destroy();\n cell.container.remove();\n this.cells.pop();\n }\n }\n\n this.layout = layout;\n this.applyLayout();\n\n // New cells get the same options and linking as the first ones.\n for (let i = oldCount; i < newCount; i++) this.cells.push(this.createCell(i));\n }\n\n getChart(index: number): Chart | null {\n return this.cells[index]?.chart ?? null;\n }\n\n getCharts(): Chart[] {\n return this.cells.map(c => c.chart);\n }\n\n getCellCount(): number {\n return this.cells.length;\n }\n\n setData(index: number, data: DataSeries): void {\n this.cells[index]?.chart.setData(data);\n }\n\n setAllData(data: DataSeries): void {\n for (const cell of this.cells) {\n cell.chart.setData(data);\n }\n }\n\n async connectCell(index: number, config: StreamConfig): Promise<void> {\n const cell = this.cells[index];\n if (!cell) return;\n cell.symbol = config.symbol;\n cell.timeframe = config.timeframe;\n await cell.chart.connect(config);\n }\n\n /**\n * Connect each chart to a symbol. An adapter keeps one stream, so pass a\n * function that makes one per chart (`() => new BinanceAdapter()`); a single\n * adapter object serves one chart only.\n */\n async connectAll(\n adapter: DataAdapter | ((symbol: string, index: number) => DataAdapter),\n symbols: string[],\n timeframe: TimeFrame,\n historyLimit = 500,\n ): Promise<void> {\n const promises: Promise<void>[] = [];\n for (let i = 0; i < this.cells.length && i < symbols.length; i++) {\n promises.push(this.connectCell(i, {\n adapter: typeof adapter === 'function' ? adapter(symbols[i], i) : adapter,\n symbol: symbols[i],\n timeframe,\n historyLimit,\n }));\n }\n await Promise.all(promises);\n }\n\n setTheme(theme: Theme): void {\n for (const cell of this.cells) {\n cell.chart.setTheme(theme);\n }\n }\n\n destroy(): void {\n if (this.destroyed) return;\n this.destroyed = true;\n for (const cell of this.cells) {\n cell.chart.destroy();\n cell.container.remove();\n }\n this.cells = [];\n this.root.remove();\n }\n}\n","import type { SparklineOptions, Theme } from '@tradecanvas/commons';\nimport { BaseFinanceChart, renderSparkline } from '@tradecanvas/core';\n\nexport class SparklineChart extends BaseFinanceChart {\n private options: SparklineOptions;\n\n constructor(container: HTMLElement, options: SparklineOptions) {\n super(container, options.theme);\n this.options = options;\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n renderSparkline(ctx, width, height, this.options, theme);\n }\n\n update(data: number[]): void {\n this.options = { ...this.options, data };\n this.requestRender();\n }\n\n setOptions(opts: Partial<SparklineOptions>): void {\n this.options = { ...this.options, ...opts };\n this.requestRender();\n }\n}\n","import type { DepthChartOptions, DepthData, Theme } from '@tradecanvas/commons';\nimport { BaseFinanceChart, FinanceCrosshair, renderDepthChart } from '@tradecanvas/core';\n\nexport class DepthChart extends BaseFinanceChart {\n private options: DepthChartOptions;\n private crosshair: FinanceCrosshair | null = null;\n\n constructor(container: HTMLElement, options: DepthChartOptions) {\n super(container, options.theme);\n this.options = options;\n\n if (options.crosshair !== false) {\n this.crosshair = new FinanceCrosshair(this.canvas, () => this.requestRender());\n }\n\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n const pos = this.crosshair?.getPosition() ?? null;\n renderDepthChart(ctx, width, height, this.options, theme, pos);\n }\n\n update(data: DepthData): void {\n this.options = { ...this.options, data };\n this.requestRender();\n }\n\n setOptions(opts: Partial<DepthChartOptions>): void {\n this.options = { ...this.options, ...opts };\n this.requestRender();\n }\n\n destroy(): void {\n this.crosshair?.destroy();\n super.destroy();\n }\n}\n","import type { EquityCurveOptions, EquityPoint, Theme } from '@tradecanvas/commons';\nimport { BaseFinanceChart, FinanceCrosshair, renderEquityCurve } from '@tradecanvas/core';\n\nexport class EquityCurveChart extends BaseFinanceChart {\n private options: EquityCurveOptions;\n private crosshair: FinanceCrosshair | null = null;\n\n constructor(container: HTMLElement, options: EquityCurveOptions) {\n super(container, options.theme);\n this.options = options;\n\n if (options.crosshair !== false) {\n this.crosshair = new FinanceCrosshair(this.canvas, () => this.requestRender());\n }\n\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n const pos = this.crosshair?.getPosition() ?? null;\n renderEquityCurve(ctx, width, height, this.options, theme, pos);\n }\n\n update(data: EquityPoint[], benchmark?: EquityPoint[]): void {\n this.options = { ...this.options, data };\n if (benchmark !== undefined) {\n this.options = { ...this.options, benchmark };\n }\n this.requestRender();\n }\n\n setOptions(opts: Partial<EquityCurveOptions>): void {\n this.options = { ...this.options, ...opts };\n this.requestRender();\n }\n\n destroy(): void {\n this.crosshair?.destroy();\n super.destroy();\n }\n}\n","import type { HeatmapCell, HeatmapOptions, Theme } from '@tradecanvas/commons';\nimport {\n BaseFinanceChart,\n FinanceCrosshair,\n layoutUniformGrid,\n layoutSquarifiedTreemap,\n renderHeatmap,\n} from '@tradecanvas/core';\nimport type { LayoutRect } from '@tradecanvas/core';\n\nexport class HeatmapChart extends BaseFinanceChart {\n private options: HeatmapOptions;\n private crosshair: FinanceCrosshair | null = null;\n private cachedRects: LayoutRect[] = [];\n private currentData: HeatmapCell[] = [];\n private lastLayoutWidth = 0;\n private lastLayoutHeight = 0;\n private handleClick: ((e: MouseEvent) => void) | null = null;\n\n constructor(container: HTMLElement, options: HeatmapOptions) {\n super(container, options.theme);\n this.options = options;\n this.currentData = options.data ?? [];\n\n if (options.crosshair !== false) {\n this.crosshair = new FinanceCrosshair(this.canvas, () => this.requestRender());\n }\n\n if (options.onCellClick) {\n this.handleClick = (e: MouseEvent) => {\n const rect = this.canvas.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n this.onCanvasClick(x, y);\n };\n this.canvas.addEventListener('click', this.handleClick);\n }\n\n this.recomputeLayout();\n this.requestRender();\n }\n\n private recomputeLayout(): void {\n const bounds = { x: 0, y: 0, width: this.width, height: this.height };\n const padding = this.options.cellPadding ?? 2;\n this.lastLayoutWidth = this.width;\n this.lastLayoutHeight = this.height;\n\n if (this.options.weighted) {\n const weighted = this.currentData.map(c => ({\n id: c.id,\n weight: c.weight ?? (Math.abs(c.value) || 1),\n }));\n this.cachedRects = layoutSquarifiedTreemap(weighted, bounds, padding);\n } else {\n this.cachedRects = layoutUniformGrid(\n this.currentData.map(c => ({ id: c.id })),\n bounds,\n padding,\n );\n }\n }\n\n private onCanvasClick(x: number, y: number): void {\n if (!this.options.onCellClick) return;\n\n for (const lr of this.cachedRects) {\n const r = lr.rect;\n if (x >= r.x && x <= r.x + r.width && y >= r.y && y <= r.y + r.height) {\n const cell = this.currentData.find(c => c.id === lr.id);\n if (cell) this.options.onCellClick(cell);\n return;\n }\n }\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n if (width !== this.lastLayoutWidth || height !== this.lastLayoutHeight) {\n this.recomputeLayout();\n }\n\n const pos = this.crosshair?.getPosition() ?? null;\n renderHeatmap(ctx, width, height, this.currentData, this.cachedRects, this.options, theme, pos);\n }\n\n update(data: HeatmapCell[]): void {\n this.currentData = data;\n this.options = { ...this.options, data };\n this.recomputeLayout();\n this.requestRender();\n }\n\n setOptions(opts: Partial<HeatmapOptions>): void {\n this.options = { ...this.options, ...opts };\n if (opts.data) {\n this.currentData = opts.data;\n }\n this.recomputeLayout();\n this.requestRender();\n }\n\n destroy(): void {\n this.crosshair?.destroy();\n if (this.handleClick) {\n this.canvas.removeEventListener('click', this.handleClick);\n }\n super.destroy();\n }\n}\n","import type { Theme, WaterfallBar, WaterfallOptions } from '@tradecanvas/commons';\nimport { BaseFinanceChart, FinanceCrosshair, renderWaterfall } from '@tradecanvas/core';\n\nexport class WaterfallChart extends BaseFinanceChart {\n private options: WaterfallOptions;\n private crosshair: FinanceCrosshair | null = null;\n\n constructor(container: HTMLElement, options: WaterfallOptions) {\n super(container, options.theme);\n this.options = options;\n\n if (options.crosshair !== false) {\n this.crosshair = new FinanceCrosshair(this.canvas, () => this.requestRender());\n }\n\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n const pos = this.crosshair?.getPosition() ?? null;\n renderWaterfall(ctx, width, height, this.options, theme, pos);\n }\n\n update(data: WaterfallBar[]): void {\n this.options = { ...this.options, data };\n this.requestRender();\n }\n\n setOptions(opts: Partial<WaterfallOptions>): void {\n this.options = { ...this.options, ...opts };\n this.requestRender();\n }\n\n destroy(): void {\n this.crosshair?.destroy();\n super.destroy();\n }\n}\n","import type { GaugeOptions, Theme } from '@tradecanvas/commons';\nimport { BaseFinanceChart, renderGauge } from '@tradecanvas/core';\n\nconst DEFAULT_ANIMATION_MS = 500;\n\nfunction easeOutCubic(t: number): number {\n const inv = 1 - t;\n return 1 - inv * inv * inv;\n}\n\nexport class GaugeChart extends BaseFinanceChart {\n private options: GaugeOptions;\n private currentValue: number;\n private targetValue: number;\n private animationStart: number | null = null;\n private animationFrom = 0;\n private animationFrameId: number | null = null;\n\n constructor(container: HTMLElement, options: GaugeOptions) {\n super(container, options.theme);\n this.options = options;\n this.currentValue = options.value;\n this.targetValue = options.value;\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n renderGauge(ctx, width, height, this.options, theme, this.currentValue);\n }\n\n setValue(value: number): void {\n const animate = this.options.animate !== false;\n if (!animate) {\n this.cancelAnimation();\n this.currentValue = value;\n this.targetValue = value;\n this.options = { ...this.options, value };\n this.requestRender();\n return;\n }\n\n this.targetValue = value;\n this.animationFrom = this.currentValue;\n this.animationStart = performance.now();\n this.options = { ...this.options, value };\n this.startAnimationLoop();\n }\n\n setOptions(opts: Partial<GaugeOptions>): void {\n const next = { ...this.options, ...opts };\n // If `value` is part of the partial, route through animation path\n if (opts.value !== undefined && opts.value !== this.targetValue) {\n this.options = next;\n this.setValue(opts.value);\n return;\n }\n this.options = next;\n this.requestRender();\n }\n\n private startAnimationLoop(): void {\n if (this.animationFrameId !== null) return;\n const step = (): void => {\n this.animationFrameId = null;\n if (this.animationStart === null) return;\n\n const duration = this.options.animationDuration ?? DEFAULT_ANIMATION_MS;\n const elapsed = performance.now() - this.animationStart;\n const t = Math.min(1, elapsed / Math.max(1, duration));\n const eased = easeOutCubic(t);\n this.currentValue = this.animationFrom + (this.targetValue - this.animationFrom) * eased;\n\n this.requestRender();\n\n if (t < 1) {\n this.animationFrameId = requestAnimationFrame(step);\n } else {\n this.currentValue = this.targetValue;\n this.animationStart = null;\n }\n };\n this.animationFrameId = requestAnimationFrame(step);\n }\n\n private cancelAnimation(): void {\n if (this.animationFrameId !== null) {\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n }\n this.animationStart = null;\n }\n\n destroy(): void {\n this.cancelAnimation();\n super.destroy();\n }\n}\n","import type { EquityPoint, HeatmapCell } from '@tradecanvas/commons';\nimport { timeframeBucketStart } from '@tradecanvas/commons';\n\n/** Minimal equity sample shape — structurally satisfied by analytics' EquityPoint. */\nexport interface EquitySample {\n time: number;\n equity: number;\n}\n\n/** Subset of analytics RiskMetrics needed to render the stats strip. */\nexport interface RiskMetricsLike {\n totalReturnPct: number;\n cagr: number;\n sharpe: number;\n sortino: number;\n maxDrawdownPct: number;\n winRate: number;\n profitFactor: number;\n trades: number;\n}\n\nexport interface DashboardStat {\n label: string;\n value: string;\n tone: 'positive' | 'negative' | 'neutral';\n}\n\nconst MONTH_LABELS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\n/** Map an analytics equity curve to the finance EquityCurveChart point shape. */\nexport function toEquityPoints(curve: ReadonlyArray<EquitySample>): EquityPoint[] {\n return curve.map((p) => ({ time: p.time, value: p.equity }));\n}\n\n/**\n * Underwater drawdown curve as a percentage (<= 0). Each point is the equity's\n * shortfall from the running peak: `equity / peak - 1`, expressed in percent.\n */\nexport function computeDrawdownCurve(curve: ReadonlyArray<EquitySample>): EquityPoint[] {\n let peak = -Infinity;\n return curve.map((p) => {\n if (p.equity > peak) peak = p.equity;\n const dd = peak > 0 ? (p.equity / peak - 1) * 100 : 0;\n return { time: p.time, value: dd };\n });\n}\n\n/**\n * Calendar-month returns as heatmap cells. Each month's return is chained off\n * the prior month's closing equity (the first month chains off its own opening\n * equity), so the series reads as sequential monthly performance. `group` is\n * the year and `value` is the return in percent.\n */\nexport function computeMonthlyReturns(curve: ReadonlyArray<EquitySample>): HeatmapCell[] {\n if (curve.length === 0) return [];\n\n // Collapse the curve to one closing equity per calendar month, in order.\n const months: { key: number; close: number }[] = [];\n for (const p of curve) {\n const key = timeframeBucketStart(p.time, '1M');\n const last = months[months.length - 1];\n if (last && last.key === key) {\n last.close = p.equity;\n } else {\n months.push({ key, close: p.equity });\n }\n }\n\n let prevClose = curve[0].equity;\n const cells: HeatmapCell[] = [];\n for (const m of months) {\n const base = prevClose === 0 ? 1 : prevClose;\n const returnPct = (m.close / base - 1) * 100;\n prevClose = m.close;\n const d = new Date(m.key);\n const year = d.getUTCFullYear();\n const month = d.getUTCMonth();\n cells.push({\n id: `${year}-${String(month + 1).padStart(2, '0')}`,\n label: MONTH_LABELS[month],\n group: String(year),\n value: returnPct,\n });\n }\n return cells;\n}\n\nfunction pct(value: number): string {\n const sign = value > 0 ? '+' : '';\n return `${sign}${value.toFixed(2)}%`;\n}\n\nfunction tone(value: number): DashboardStat['tone'] {\n if (value > 0) return 'positive';\n if (value < 0) return 'negative';\n return 'neutral';\n}\n\n/** The headline stats rendered as cards above the charts. */\nexport function selectKeyStats(metrics: RiskMetricsLike): DashboardStat[] {\n return [\n { label: 'Total Return', value: pct(metrics.totalReturnPct), tone: tone(metrics.totalReturnPct) },\n { label: 'CAGR', value: pct(metrics.cagr * 100), tone: tone(metrics.cagr) },\n { label: 'Sharpe', value: metrics.sharpe.toFixed(2), tone: tone(metrics.sharpe) },\n { label: 'Sortino', value: metrics.sortino.toFixed(2), tone: tone(metrics.sortino) },\n { label: 'Max Drawdown', value: pct(metrics.maxDrawdownPct), tone: 'negative' },\n { label: 'Win Rate', value: `${(metrics.winRate * 100).toFixed(1)}%`, tone: 'neutral' },\n { label: 'Profit Factor', value: Number.isFinite(metrics.profitFactor) ? metrics.profitFactor.toFixed(2) : '∞', tone: tone(metrics.profitFactor - 1) },\n { label: 'Trades', value: String(metrics.trades), tone: 'neutral' },\n ];\n}\n","import type { Theme, ThemeName } from '@tradecanvas/commons';\nimport { DARK_THEME, LIGHT_THEME } from '@tradecanvas/commons';\nimport { EquityCurveChart } from './EquityCurveChart.js';\nimport { HeatmapChart } from './HeatmapChart.js';\nimport {\n toEquityPoints,\n computeDrawdownCurve,\n computeMonthlyReturns,\n selectKeyStats,\n type EquitySample,\n type RiskMetricsLike,\n type DashboardStat,\n} from './performanceData.js';\n\n/** Structurally satisfied by analytics' `BacktestResult`. */\nexport interface PerformanceResult {\n equityCurve: ReadonlyArray<EquitySample>;\n metrics: RiskMetricsLike;\n}\n\nexport interface PerformanceDashboardOptions {\n result: PerformanceResult;\n theme?: ThemeName | Theme;\n title?: string;\n subtitle?: string;\n}\n\nfunction resolveTheme(theme?: ThemeName | Theme): Theme {\n if (!theme || theme === 'dark') return DARK_THEME;\n if (theme === 'light') return LIGHT_THEME;\n return theme as Theme;\n}\n\n/**\n * A composed strategy-performance dashboard: a headline stats strip, an equity\n * curve, an underwater drawdown panel, and a monthly-returns heatmap. Built\n * entirely from a backtest `result`, reusing the finance chart renderers.\n *\n * ```ts\n * const result = new Backtester(opts).run(bars, strategy);\n * const dash = new PerformanceDashboard(el, { result, theme: 'dark' });\n * ```\n */\nexport class PerformanceDashboard {\n private options: PerformanceDashboardOptions;\n private theme: Theme;\n private root: HTMLDivElement;\n private equityChart: EquityCurveChart | null = null;\n private drawdownChart: EquityCurveChart | null = null;\n private heatmap: HeatmapChart | null = null;\n\n constructor(container: HTMLElement, options: PerformanceDashboardOptions) {\n this.options = options;\n this.theme = resolveTheme(options.theme);\n this.root = document.createElement('div');\n this.build();\n container.appendChild(this.root);\n }\n\n private build(): void {\n const t = this.theme;\n const { result, title, subtitle } = this.options;\n const surface = this.panelBackground();\n const border = t.grid;\n\n this.root.style.cssText = [\n 'display:flex',\n 'flex-direction:column',\n 'gap:14px',\n 'width:100%',\n 'box-sizing:border-box',\n 'padding:16px',\n `background:${t.background}`,\n `color:${t.text}`,\n `font-family:${t.font.family}`,\n ].join(';');\n\n if (title || subtitle) {\n const header = document.createElement('div');\n if (title) {\n const h = document.createElement('div');\n h.textContent = title;\n h.style.cssText = `font-size:${t.font.sizeLarge}px;font-weight:600;letter-spacing:-0.01em;`;\n header.appendChild(h);\n }\n if (subtitle) {\n const s = document.createElement('div');\n s.textContent = subtitle;\n s.style.cssText = `font-size:${t.font.sizeSmall}px;color:${t.textSecondary};margin-top:2px;`;\n header.appendChild(s);\n }\n this.root.appendChild(header);\n }\n\n // Stats strip\n this.root.appendChild(this.buildStatsStrip(selectKeyStats(result.metrics), surface, border));\n\n // Chart grid\n const grid = document.createElement('div');\n grid.style.cssText = [\n 'display:grid',\n 'grid-template-columns:repeat(auto-fit, minmax(280px, 1fr))',\n 'grid-auto-rows:220px',\n 'gap:14px',\n ].join(';');\n this.root.appendChild(grid);\n\n const equityPanel = this.buildPanel('Equity Curve', surface, border);\n equityPanel.wrap.style.gridColumn = '1 / -1';\n grid.appendChild(equityPanel.wrap);\n this.equityChart = new EquityCurveChart(equityPanel.body, {\n data: toEquityPoints(result.equityCurve),\n theme: t,\n lineColor: t.candleUp,\n fillArea: true,\n crosshair: true,\n });\n\n const ddPanel = this.buildPanel('Drawdown', surface, border);\n grid.appendChild(ddPanel.wrap);\n this.drawdownChart = new EquityCurveChart(ddPanel.body, {\n data: computeDrawdownCurve(result.equityCurve),\n theme: t,\n lineColor: t.candleDown,\n fillArea: true,\n crosshair: true,\n valueFormat: (v) => `${v.toFixed(1)}%`,\n });\n\n const monthlyCells = computeMonthlyReturns(result.equityCurve);\n const heatPanel = this.buildPanel('Monthly Returns', surface, border);\n grid.appendChild(heatPanel.wrap);\n this.heatmap = new HeatmapChart(heatPanel.body, {\n data: monthlyCells,\n theme: t,\n showValues: true,\n valueFormat: (v) => `${v >= 0 ? '+' : ''}${v.toFixed(1)}`,\n colorScale: { negative: t.candleDown, zero: surface, positive: t.candleUp },\n });\n }\n\n private buildStatsStrip(stats: DashboardStat[], surface: string, border: string): HTMLDivElement {\n const strip = document.createElement('div');\n strip.style.cssText = [\n 'display:grid',\n 'grid-template-columns:repeat(auto-fit, minmax(120px, 1fr))',\n 'gap:10px',\n ].join(';');\n\n const t = this.theme;\n for (const stat of stats) {\n const card = document.createElement('div');\n card.style.cssText = [\n `background:${surface}`,\n `border:1px solid ${border}`,\n 'border-radius:10px',\n 'padding:10px 12px',\n 'display:flex',\n 'flex-direction:column',\n 'gap:4px',\n ].join(';');\n\n const label = document.createElement('div');\n label.textContent = stat.label;\n label.style.cssText = `font-size:${t.font.sizeSmall}px;color:${t.textSecondary};text-transform:uppercase;letter-spacing:0.04em;`;\n\n const value = document.createElement('div');\n value.textContent = stat.value;\n const color = stat.tone === 'positive' ? t.candleUp : stat.tone === 'negative' ? t.candleDown : t.text;\n value.style.cssText = `font-size:${t.font.sizeLarge}px;font-weight:600;color:${color};font-variant-numeric:tabular-nums;`;\n\n card.appendChild(label);\n card.appendChild(value);\n strip.appendChild(card);\n }\n return strip;\n }\n\n private buildPanel(title: string, surface: string, border: string): { wrap: HTMLDivElement; body: HTMLDivElement } {\n const t = this.theme;\n const wrap = document.createElement('div');\n wrap.style.cssText = [\n `background:${surface}`,\n `border:1px solid ${border}`,\n 'border-radius:10px',\n 'overflow:hidden',\n 'display:flex',\n 'flex-direction:column',\n ].join(';');\n\n const head = document.createElement('div');\n head.textContent = title;\n head.style.cssText = [\n `font-size:${t.font.sizeSmall}px`,\n 'font-weight:600',\n `color:${t.textSecondary}`,\n 'padding:8px 12px',\n `border-bottom:1px solid ${border}`,\n 'text-transform:uppercase',\n 'letter-spacing:0.04em',\n ].join(';');\n\n const body = document.createElement('div');\n body.style.cssText = 'flex:1;min-height:0;position:relative;';\n\n wrap.appendChild(head);\n wrap.appendChild(body);\n return { wrap, body };\n }\n\n /** A subtle surface tint distinct from the page background, per theme. */\n private panelBackground(): string {\n return this.theme.name === 'light' ? 'rgba(0,0,0,0.02)' : 'rgba(255,255,255,0.03)';\n }\n\n /** Replace the displayed result and re-render all panels. */\n update(result: PerformanceResult): void {\n this.options = { ...this.options, result };\n this.destroyCharts();\n this.root.replaceChildren();\n this.build();\n }\n\n setTheme(theme: ThemeName | Theme): void {\n this.theme = resolveTheme(theme);\n this.options = { ...this.options, theme };\n this.destroyCharts();\n this.root.replaceChildren();\n this.build();\n }\n\n private destroyCharts(): void {\n this.equityChart?.destroy();\n this.drawdownChart?.destroy();\n this.heatmap?.destroy();\n this.equityChart = null;\n this.drawdownChart = null;\n this.heatmap = null;\n }\n\n destroy(): void {\n this.destroyCharts();\n this.root.remove();\n }\n}\n"],"mappings":";;;;AAiBA,SAAS,GAAQ,GAA6B;CAC5C,IAAM,EAAE,OAAI,YAAS,EAAE,EAAE,cAAW,SAAS,OAAO,KAAS,WAAW,EAAE,IAAI,GAAM,GAAG;AACvF,QAAO,KAAK,UAAU;EAAC;EAAI,OAAO,KAAK,EAAO,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG,EAAO,GAAG,CAAC;EAAE;EAAS,CAAC;;AAS9F,SAAgB,GAAe,GAAsB,GAAiC,GAAoC;CACxH,IAAM,oBAAO,IAAI,KAAqB,EAChC,IAAS,EAAM,KAAK,MAAS;EACjC,IAAM,IAAM,GAAQ,EAAK,EACnB,IAA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;GACD,CAAC,KAAK,IAAI;EAEX,IAAM,IAAO,SAAS,cAAc,MAAM;AAK1C,SAJA,EAAK,MAAM,UAAU,0CAErB,EAAK,YAAY,EAAK,EACtB,EAAK,YAAY,EAAK,EACf;GAAE;GAAM;GAAM;;CAIvB,kBAAkC;AAChC,SAAO,KAAK,MAAM,SAAS,UAAU,qBAAqB;;CAI5D,OAAO,GAAiC;AAItC,EAHA,KAAK,UAAU;GAAE,GAAG,KAAK;GAAS;GAAQ,EAC1C,KAAK,eAAe,EACpB,KAAK,KAAK,iBAAiB,EAC3B,KAAK,OAAO;;CAGd,SAAS,GAAgC;AAKvC,EAJA,KAAK,QAAQ,EAAa,EAAM,EAChC,KAAK,UAAU;GAAE,GAAG,KAAK;GAAS;GAAO,EACzC,KAAK,eAAe,EACpB,KAAK,KAAK,iBAAiB,EAC3B,KAAK,OAAO;;CAGd,gBAA8B;AAM5B,EALA,KAAK,aAAa,SAAS,EAC3B,KAAK,eAAe,SAAS,EAC7B,KAAK,SAAS,SAAS,EACvB,KAAK,cAAc,MACnB,KAAK,gBAAgB,MACrB,KAAK,UAAU;;CAGjB,UAAgB;AAEd,EADA,KAAK,eAAe,EACpB,KAAK,KAAK,QAAQ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/frameworks/syncIndicators.ts","../src/plugins/overlayScale.ts","../src/grid/ChartGrid.ts","../src/finance/SparklineChart.ts","../src/finance/DepthChart.ts","../src/finance/EquityCurveChart.ts","../src/finance/HeatmapChart.ts","../src/finance/WaterfallChart.ts","../src/finance/GaugeChart.ts","../src/finance/performanceData.ts","../src/finance/PerformanceDashboard.ts"],"sourcesContent":["import type { PanelPosition } from '@tradecanvas/commons';\n\n/**\n * An indicator a framework component shows: its id (`'rsi'`), or its id with\n * its inputs and, for one in a pane, where the pane goes.\n */\nexport type IndicatorSpec =\n | string\n | { id: string; params?: Record<string, number | string | boolean>; position?: PanelPosition };\n\n/** What the components need of a chart to keep its indicators in step. */\nexport interface IndicatorHost {\n addIndicator(...args: [string, Record<string, number | string | boolean>?, PanelPosition?]): string | null;\n removeIndicator(instanceId: string): void;\n}\n\n/** One spec as text: the same indicator with the same inputs (in any order) and place reads the same. */\nfunction specKey(spec: IndicatorSpec): string {\n const { id, params = {}, position = null } = typeof spec === 'string' ? { id: spec } : spec;\n return JSON.stringify([id, Object.keys(params).sort().map((k) => [k, params[k]]), position]);\n}\n\n/**\n * Brings the chart's indicators to `specs`: those no longer asked for go,\n * new ones come, and one whose inputs or place changed is put back with\n * them. `current` maps each spec (and its count, for two alike) to its\n * instance on the chart, and is kept up to date.\n */\nexport function syncIndicators(chart: IndicatorHost, specs: readonly IndicatorSpec[], current: Map<string, string>): void {\n const seen = new Map<string, number>();\n const wanted = specs.map((spec) => {\n const key = specKey(spec);\n const n = seen.get(key) ?? 0;\n seen.set(key, n + 1);\n return { spec, key: `${key}#${n}` };\n });\n const keys = new Set(wanted.map((w) => w.key));\n for (const [key, instanceId] of [...current]) {\n if (keys.has(key)) continue;\n chart.removeIndicator(instanceId);\n current.delete(key);\n }\n for (const { spec, key } of wanted) {\n if (current.has(key)) continue;\n const instanceId = typeof spec === 'string'\n ? chart.addIndicator(spec)\n : spec.position !== undefined\n ? chart.addIndicator(spec.id, spec.params ?? {}, spec.position)\n : chart.addIndicator(spec.id, spec.params ?? {});\n if (instanceId) current.set(key, instanceId);\n }\n}\n","import type { DataSeries, ViewportState } from '@tradecanvas/commons';\nimport {\n barIndexToTime,\n barIndexToX,\n priceToYMapper,\n timestampToBarIndex,\n xToBarIndex,\n yToPrice,\n} from '@tradecanvas/core';\n\n/**\n * Where things go on screen in one frame, as the chart itself places them:\n * bars by time or index, prices on a log or upside-down scale too. For an\n * overlay plugin's `render`, built from the context it is handed.\n *\n * Bars are those of `context.data`, the series on screen: on a Renko, Kagi,\n * point & figure, line break or range-bar chart they are its bricks or\n * columns, not the feed's bars (`chart.isTimeAligned()` says which). Times\n * between bars and past either end are placed in proportion once there are\n * two bars; with fewer, a time lands on the nearest bar.\n */\nexport interface FrameScale {\n /** x of the middle of the bar at `time` (the data's own unit); between bars and past either end in proportion. */\n timeToX(time: number): number;\n /** The bar time at `x`, extrapolated past either end of the data. */\n xToTime(x: number): number;\n /** x of the middle of bar `index` of the data. */\n indexToX(index: number): number;\n /** The bar index at `x`, rounded to the nearest bar. */\n xToIndex(x: number): number;\n priceToY(price: number): number;\n yToPrice(y: number): number;\n /** A bar's body width in pixels at this zoom. */\n readonly barWidth: number;\n /** The first and last bar indexes on screen, within the data; `to < from` when there is none. */\n readonly visible: { readonly from: number; readonly to: number };\n}\n\n/**\n * The scale of an overlay plugin's frame:\n *\n * ```ts\n * render(ctx, context) {\n * const s = overlayScale(context);\n * for (let i = s.visible.from; i <= s.visible.to; i++) {\n * ctx.fillRect(s.indexToX(i) - s.barWidth / 2, s.priceToY(context.data[i].high), s.barWidth, 2);\n * }\n * }\n * ```\n */\nexport function overlayScale(context: { viewport: ViewportState; data: DataSeries }): FrameScale {\n const { viewport, data } = context;\n const toY = priceToYMapper(viewport);\n const last = data.length - 1;\n const from = Math.max(0, Math.floor(viewport.visibleRange.from));\n const to = Math.min(last, Math.ceil(viewport.visibleRange.to));\n const indexOf = (time: number) => (data.length > 0 ? timestampToBarIndex(time, data) : time);\n return {\n timeToX: (time) => barIndexToX(indexOf(time), viewport),\n xToTime: (x) => {\n const index = xToBarIndex(x, viewport);\n return data.length > 0 ? barIndexToTime(index, data) : index;\n },\n indexToX: (index) => barIndexToX(index, viewport),\n xToIndex: (x) => xToBarIndex(x, viewport),\n priceToY: toY,\n yToPrice: (y) => yToPrice(y, viewport),\n barWidth: viewport.barWidth,\n visible: to < from ? { from: 0, to: -1 } : { from, to },\n };\n}\n","import type { ChartOptions, Theme, TimeFrame, DataSeries, DataAdapter, StreamConfig } from '@tradecanvas/commons';\nimport { Chart } from '../Chart.js';\n\nexport type GridLayout = '1x1' | '1x2' | '2x1' | '2x2' | '1x3' | '3x1' | '2x3' | '3x2';\n\nexport interface GridCellConfig {\n symbol?: string;\n timeframe?: TimeFrame;\n chartOptions?: Partial<ChartOptions>;\n}\n\nexport interface ChartGridOptions {\n layout?: GridLayout;\n theme?: ChartOptions['theme'];\n syncCrosshair?: boolean;\n syncTimeAxis?: boolean;\n gap?: number;\n cells?: GridCellConfig[];\n chartOptions?: Partial<ChartOptions>;\n}\n\ninterface GridCell {\n container: HTMLDivElement;\n chart: Chart;\n symbol: string;\n timeframe: TimeFrame;\n}\n\nconst LAYOUT_MAP: Record<GridLayout, { cols: number; rows: number }> = {\n '1x1': { cols: 1, rows: 1 },\n '1x2': { cols: 2, rows: 1 },\n '2x1': { cols: 1, rows: 2 },\n '2x2': { cols: 2, rows: 2 },\n '1x3': { cols: 3, rows: 1 },\n '3x1': { cols: 1, rows: 3 },\n '2x3': { cols: 3, rows: 2 },\n '3x2': { cols: 2, rows: 3 },\n};\n\nexport class ChartGrid {\n private root: HTMLDivElement;\n private cells: GridCell[] = [];\n private layout: GridLayout;\n private options: ChartGridOptions;\n private destroyed = false;\n private syncing = false;\n\n constructor(container: HTMLElement, options: ChartGridOptions = {}) {\n this.options = options;\n this.layout = options.layout ?? '2x2';\n\n this.root = document.createElement('div');\n this.root.style.cssText = 'display:grid;width:100%;height:100%;overflow:hidden;';\n container.appendChild(this.root);\n\n this.applyLayout();\n this.createCells();\n }\n\n private applyLayout(): void {\n const { cols, rows } = LAYOUT_MAP[this.layout];\n const gap = this.options.gap ?? 1;\n this.root.style.gridTemplateColumns = `repeat(${cols}, 1fr)`;\n this.root.style.gridTemplateRows = `repeat(${rows}, 1fr)`;\n this.root.style.gap = `${gap}px`;\n }\n\n private createCells(): void {\n const { cols, rows } = LAYOUT_MAP[this.layout];\n const count = cols * rows;\n for (let i = 0; i < count; i++) this.cells.push(this.createCell(i));\n }\n\n private createCell(i: number): GridCell {\n const cellConfig = this.options.cells?.[i] ?? {};\n\n const cellEl = document.createElement('div');\n cellEl.style.cssText = 'position:relative;overflow:hidden;min-width:0;min-height:0;';\n this.root.appendChild(cellEl);\n\n const chartOpts: ChartOptions = {\n chartType: 'candlestick',\n autoScale: true,\n features: {\n crosshair: true,\n keyboard: true,\n volume: true,\n legend: true,\n priceAxis: true,\n timeAxis: true,\n grid: true,\n },\n ...this.options.chartOptions,\n ...cellConfig.chartOptions,\n theme: this.options.theme,\n };\n\n const chart = new Chart(cellEl, chartOpts);\n\n const cell: GridCell = {\n container: cellEl,\n chart,\n symbol: cellConfig.symbol ?? `Chart ${i + 1}`,\n timeframe: cellConfig.timeframe ?? '5m',\n };\n\n // Charts can differ in symbol and timeframe, so the crosshair is linked by\n // time: the others show a vertical line on the bar containing that time.\n if (this.options.syncCrosshair !== false) {\n chart.on('crosshairMove', (e) => {\n const time = e.payload.bar?.time;\n if (time === undefined) return;\n for (const other of this.cells) {\n if (other.chart !== chart) other.chart.setCrosshairTime(time);\n }\n });\n chart.on('crosshairLeave', () => {\n for (const other of this.cells) {\n if (other.chart !== chart) other.chart.setCrosshairTime(null);\n }\n });\n }\n\n if (this.options.syncTimeAxis !== false) {\n chart.on('visibleRangeChange', (e) => {\n if (this.syncing) return;\n this.syncing = true;\n const { from, to } = e.payload;\n const srcData = chart.getData();\n if (srcData.length > 0 && from >= 0 && to < srcData.length) {\n const fromTime = srcData[from]?.time;\n const toTime = srcData[to]?.time;\n if (fromTime && toTime) {\n for (const other of this.cells) {\n if (other.chart !== chart) {\n other.chart.setVisibleRange(fromTime, toTime);\n }\n }\n }\n }\n this.syncing = false;\n });\n }\n\n return cell;\n }\n\n setLayout(layout: GridLayout): void {\n if (layout === this.layout) return;\n const oldCount = this.cells.length;\n const { cols, rows } = LAYOUT_MAP[layout];\n const newCount = cols * rows;\n\n if (newCount < oldCount) {\n for (let i = oldCount - 1; i >= newCount; i--) {\n const cell = this.cells[i];\n cell.chart.destroy();\n cell.container.remove();\n this.cells.pop();\n }\n }\n\n this.layout = layout;\n this.applyLayout();\n\n // New cells get the same options and linking as the first ones.\n for (let i = oldCount; i < newCount; i++) this.cells.push(this.createCell(i));\n }\n\n getChart(index: number): Chart | null {\n return this.cells[index]?.chart ?? null;\n }\n\n getCharts(): Chart[] {\n return this.cells.map(c => c.chart);\n }\n\n getCellCount(): number {\n return this.cells.length;\n }\n\n setData(index: number, data: DataSeries): void {\n this.cells[index]?.chart.setData(data);\n }\n\n setAllData(data: DataSeries): void {\n for (const cell of this.cells) {\n cell.chart.setData(data);\n }\n }\n\n async connectCell(index: number, config: StreamConfig): Promise<void> {\n const cell = this.cells[index];\n if (!cell) return;\n cell.symbol = config.symbol;\n cell.timeframe = config.timeframe;\n await cell.chart.connect(config);\n }\n\n /**\n * Connect each chart to a symbol. An adapter keeps one stream, so pass a\n * function that makes one per chart (`() => new BinanceAdapter()`); a single\n * adapter object serves one chart only.\n */\n async connectAll(\n adapter: DataAdapter | ((symbol: string, index: number) => DataAdapter),\n symbols: string[],\n timeframe: TimeFrame,\n historyLimit = 500,\n ): Promise<void> {\n const promises: Promise<void>[] = [];\n for (let i = 0; i < this.cells.length && i < symbols.length; i++) {\n promises.push(this.connectCell(i, {\n adapter: typeof adapter === 'function' ? adapter(symbols[i], i) : adapter,\n symbol: symbols[i],\n timeframe,\n historyLimit,\n }));\n }\n await Promise.all(promises);\n }\n\n setTheme(theme: Theme): void {\n for (const cell of this.cells) {\n cell.chart.setTheme(theme);\n }\n }\n\n destroy(): void {\n if (this.destroyed) return;\n this.destroyed = true;\n for (const cell of this.cells) {\n cell.chart.destroy();\n cell.container.remove();\n }\n this.cells = [];\n this.root.remove();\n }\n}\n","import type { SparklineOptions, Theme } from '@tradecanvas/commons';\nimport { BaseFinanceChart, renderSparkline } from '@tradecanvas/core';\n\nexport class SparklineChart extends BaseFinanceChart {\n private options: SparklineOptions;\n\n constructor(container: HTMLElement, options: SparklineOptions) {\n super(container, options.theme);\n this.options = options;\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n renderSparkline(ctx, width, height, this.options, theme);\n }\n\n update(data: number[]): void {\n this.options = { ...this.options, data };\n this.requestRender();\n }\n\n setOptions(opts: Partial<SparklineOptions>): void {\n this.options = { ...this.options, ...opts };\n this.requestRender();\n }\n}\n","import type { DepthChartOptions, DepthData, Theme } from '@tradecanvas/commons';\nimport { BaseFinanceChart, FinanceCrosshair, renderDepthChart } from '@tradecanvas/core';\n\nexport class DepthChart extends BaseFinanceChart {\n private options: DepthChartOptions;\n private crosshair: FinanceCrosshair | null = null;\n\n constructor(container: HTMLElement, options: DepthChartOptions) {\n super(container, options.theme);\n this.options = options;\n\n if (options.crosshair !== false) {\n this.crosshair = new FinanceCrosshair(this.canvas, () => this.requestRender());\n }\n\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n const pos = this.crosshair?.getPosition() ?? null;\n renderDepthChart(ctx, width, height, this.options, theme, pos);\n }\n\n update(data: DepthData): void {\n this.options = { ...this.options, data };\n this.requestRender();\n }\n\n setOptions(opts: Partial<DepthChartOptions>): void {\n this.options = { ...this.options, ...opts };\n this.requestRender();\n }\n\n destroy(): void {\n this.crosshair?.destroy();\n super.destroy();\n }\n}\n","import type { EquityCurveOptions, EquityPoint, Theme } from '@tradecanvas/commons';\nimport { BaseFinanceChart, FinanceCrosshair, renderEquityCurve } from '@tradecanvas/core';\n\nexport class EquityCurveChart extends BaseFinanceChart {\n private options: EquityCurveOptions;\n private crosshair: FinanceCrosshair | null = null;\n\n constructor(container: HTMLElement, options: EquityCurveOptions) {\n super(container, options.theme);\n this.options = options;\n\n if (options.crosshair !== false) {\n this.crosshair = new FinanceCrosshair(this.canvas, () => this.requestRender());\n }\n\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n const pos = this.crosshair?.getPosition() ?? null;\n renderEquityCurve(ctx, width, height, this.options, theme, pos);\n }\n\n update(data: EquityPoint[], benchmark?: EquityPoint[]): void {\n this.options = { ...this.options, data };\n if (benchmark !== undefined) {\n this.options = { ...this.options, benchmark };\n }\n this.requestRender();\n }\n\n setOptions(opts: Partial<EquityCurveOptions>): void {\n this.options = { ...this.options, ...opts };\n this.requestRender();\n }\n\n destroy(): void {\n this.crosshair?.destroy();\n super.destroy();\n }\n}\n","import type { HeatmapCell, HeatmapOptions, Theme } from '@tradecanvas/commons';\nimport {\n BaseFinanceChart,\n FinanceCrosshair,\n layoutUniformGrid,\n layoutSquarifiedTreemap,\n renderHeatmap,\n} from '@tradecanvas/core';\nimport type { LayoutRect } from '@tradecanvas/core';\n\nexport class HeatmapChart extends BaseFinanceChart {\n private options: HeatmapOptions;\n private crosshair: FinanceCrosshair | null = null;\n private cachedRects: LayoutRect[] = [];\n private currentData: HeatmapCell[] = [];\n private lastLayoutWidth = 0;\n private lastLayoutHeight = 0;\n private handleClick: ((e: MouseEvent) => void) | null = null;\n\n constructor(container: HTMLElement, options: HeatmapOptions) {\n super(container, options.theme);\n this.options = options;\n this.currentData = options.data ?? [];\n\n if (options.crosshair !== false) {\n this.crosshair = new FinanceCrosshair(this.canvas, () => this.requestRender());\n }\n\n if (options.onCellClick) {\n this.handleClick = (e: MouseEvent) => {\n const rect = this.canvas.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n this.onCanvasClick(x, y);\n };\n this.canvas.addEventListener('click', this.handleClick);\n }\n\n this.recomputeLayout();\n this.requestRender();\n }\n\n private recomputeLayout(): void {\n const bounds = { x: 0, y: 0, width: this.width, height: this.height };\n const padding = this.options.cellPadding ?? 2;\n this.lastLayoutWidth = this.width;\n this.lastLayoutHeight = this.height;\n\n if (this.options.weighted) {\n const weighted = this.currentData.map(c => ({\n id: c.id,\n weight: c.weight ?? (Math.abs(c.value) || 1),\n }));\n this.cachedRects = layoutSquarifiedTreemap(weighted, bounds, padding);\n } else {\n this.cachedRects = layoutUniformGrid(\n this.currentData.map(c => ({ id: c.id })),\n bounds,\n padding,\n );\n }\n }\n\n private onCanvasClick(x: number, y: number): void {\n if (!this.options.onCellClick) return;\n\n for (const lr of this.cachedRects) {\n const r = lr.rect;\n if (x >= r.x && x <= r.x + r.width && y >= r.y && y <= r.y + r.height) {\n const cell = this.currentData.find(c => c.id === lr.id);\n if (cell) this.options.onCellClick(cell);\n return;\n }\n }\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n if (width !== this.lastLayoutWidth || height !== this.lastLayoutHeight) {\n this.recomputeLayout();\n }\n\n const pos = this.crosshair?.getPosition() ?? null;\n renderHeatmap(ctx, width, height, this.currentData, this.cachedRects, this.options, theme, pos);\n }\n\n update(data: HeatmapCell[]): void {\n this.currentData = data;\n this.options = { ...this.options, data };\n this.recomputeLayout();\n this.requestRender();\n }\n\n setOptions(opts: Partial<HeatmapOptions>): void {\n this.options = { ...this.options, ...opts };\n if (opts.data) {\n this.currentData = opts.data;\n }\n this.recomputeLayout();\n this.requestRender();\n }\n\n destroy(): void {\n this.crosshair?.destroy();\n if (this.handleClick) {\n this.canvas.removeEventListener('click', this.handleClick);\n }\n super.destroy();\n }\n}\n","import type { Theme, WaterfallBar, WaterfallOptions } from '@tradecanvas/commons';\nimport { BaseFinanceChart, FinanceCrosshair, renderWaterfall } from '@tradecanvas/core';\n\nexport class WaterfallChart extends BaseFinanceChart {\n private options: WaterfallOptions;\n private crosshair: FinanceCrosshair | null = null;\n\n constructor(container: HTMLElement, options: WaterfallOptions) {\n super(container, options.theme);\n this.options = options;\n\n if (options.crosshair !== false) {\n this.crosshair = new FinanceCrosshair(this.canvas, () => this.requestRender());\n }\n\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n const pos = this.crosshair?.getPosition() ?? null;\n renderWaterfall(ctx, width, height, this.options, theme, pos);\n }\n\n update(data: WaterfallBar[]): void {\n this.options = { ...this.options, data };\n this.requestRender();\n }\n\n setOptions(opts: Partial<WaterfallOptions>): void {\n this.options = { ...this.options, ...opts };\n this.requestRender();\n }\n\n destroy(): void {\n this.crosshair?.destroy();\n super.destroy();\n }\n}\n","import type { GaugeOptions, Theme } from '@tradecanvas/commons';\nimport { BaseFinanceChart, renderGauge } from '@tradecanvas/core';\n\nconst DEFAULT_ANIMATION_MS = 500;\n\nfunction easeOutCubic(t: number): number {\n const inv = 1 - t;\n return 1 - inv * inv * inv;\n}\n\nexport class GaugeChart extends BaseFinanceChart {\n private options: GaugeOptions;\n private currentValue: number;\n private targetValue: number;\n private animationStart: number | null = null;\n private animationFrom = 0;\n private animationFrameId: number | null = null;\n\n constructor(container: HTMLElement, options: GaugeOptions) {\n super(container, options.theme);\n this.options = options;\n this.currentValue = options.value;\n this.targetValue = options.value;\n this.requestRender();\n }\n\n protected renderChart(\n ctx: CanvasRenderingContext2D,\n width: number,\n height: number,\n theme: Theme,\n ): void {\n renderGauge(ctx, width, height, this.options, theme, this.currentValue);\n }\n\n setValue(value: number): void {\n const animate = this.options.animate !== false;\n if (!animate) {\n this.cancelAnimation();\n this.currentValue = value;\n this.targetValue = value;\n this.options = { ...this.options, value };\n this.requestRender();\n return;\n }\n\n this.targetValue = value;\n this.animationFrom = this.currentValue;\n this.animationStart = performance.now();\n this.options = { ...this.options, value };\n this.startAnimationLoop();\n }\n\n setOptions(opts: Partial<GaugeOptions>): void {\n const next = { ...this.options, ...opts };\n // If `value` is part of the partial, route through animation path\n if (opts.value !== undefined && opts.value !== this.targetValue) {\n this.options = next;\n this.setValue(opts.value);\n return;\n }\n this.options = next;\n this.requestRender();\n }\n\n private startAnimationLoop(): void {\n if (this.animationFrameId !== null) return;\n const step = (): void => {\n this.animationFrameId = null;\n if (this.animationStart === null) return;\n\n const duration = this.options.animationDuration ?? DEFAULT_ANIMATION_MS;\n const elapsed = performance.now() - this.animationStart;\n const t = Math.min(1, elapsed / Math.max(1, duration));\n const eased = easeOutCubic(t);\n this.currentValue = this.animationFrom + (this.targetValue - this.animationFrom) * eased;\n\n this.requestRender();\n\n if (t < 1) {\n this.animationFrameId = requestAnimationFrame(step);\n } else {\n this.currentValue = this.targetValue;\n this.animationStart = null;\n }\n };\n this.animationFrameId = requestAnimationFrame(step);\n }\n\n private cancelAnimation(): void {\n if (this.animationFrameId !== null) {\n cancelAnimationFrame(this.animationFrameId);\n this.animationFrameId = null;\n }\n this.animationStart = null;\n }\n\n destroy(): void {\n this.cancelAnimation();\n super.destroy();\n }\n}\n","import type { EquityPoint, HeatmapCell } from '@tradecanvas/commons';\nimport { timeframeBucketStart } from '@tradecanvas/commons';\n\n/** Minimal equity sample shape — structurally satisfied by analytics' EquityPoint. */\nexport interface EquitySample {\n time: number;\n equity: number;\n}\n\n/** Subset of analytics RiskMetrics needed to render the stats strip. */\nexport interface RiskMetricsLike {\n totalReturnPct: number;\n cagr: number;\n sharpe: number;\n sortino: number;\n maxDrawdownPct: number;\n winRate: number;\n profitFactor: number;\n trades: number;\n}\n\nexport interface DashboardStat {\n label: string;\n value: string;\n tone: 'positive' | 'negative' | 'neutral';\n}\n\nconst MONTH_LABELS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\n/** Map an analytics equity curve to the finance EquityCurveChart point shape. */\nexport function toEquityPoints(curve: ReadonlyArray<EquitySample>): EquityPoint[] {\n return curve.map((p) => ({ time: p.time, value: p.equity }));\n}\n\n/**\n * Underwater drawdown curve as a percentage (<= 0). Each point is the equity's\n * shortfall from the running peak: `equity / peak - 1`, expressed in percent.\n */\nexport function computeDrawdownCurve(curve: ReadonlyArray<EquitySample>): EquityPoint[] {\n let peak = -Infinity;\n return curve.map((p) => {\n if (p.equity > peak) peak = p.equity;\n const dd = peak > 0 ? (p.equity / peak - 1) * 100 : 0;\n return { time: p.time, value: dd };\n });\n}\n\n/**\n * Calendar-month returns as heatmap cells. Each month's return is chained off\n * the prior month's closing equity (the first month chains off its own opening\n * equity), so the series reads as sequential monthly performance. `group` is\n * the year and `value` is the return in percent.\n */\nexport function computeMonthlyReturns(curve: ReadonlyArray<EquitySample>): HeatmapCell[] {\n if (curve.length === 0) return [];\n\n // Collapse the curve to one closing equity per calendar month, in order.\n const months: { key: number; close: number }[] = [];\n for (const p of curve) {\n const key = timeframeBucketStart(p.time, '1M');\n const last = months[months.length - 1];\n if (last && last.key === key) {\n last.close = p.equity;\n } else {\n months.push({ key, close: p.equity });\n }\n }\n\n let prevClose = curve[0].equity;\n const cells: HeatmapCell[] = [];\n for (const m of months) {\n const base = prevClose === 0 ? 1 : prevClose;\n const returnPct = (m.close / base - 1) * 100;\n prevClose = m.close;\n const d = new Date(m.key);\n const year = d.getUTCFullYear();\n const month = d.getUTCMonth();\n cells.push({\n id: `${year}-${String(month + 1).padStart(2, '0')}`,\n label: MONTH_LABELS[month],\n group: String(year),\n value: returnPct,\n });\n }\n return cells;\n}\n\nfunction pct(value: number): string {\n const sign = value > 0 ? '+' : '';\n return `${sign}${value.toFixed(2)}%`;\n}\n\nfunction tone(value: number): DashboardStat['tone'] {\n if (value > 0) return 'positive';\n if (value < 0) return 'negative';\n return 'neutral';\n}\n\n/** The headline stats rendered as cards above the charts. */\nexport function selectKeyStats(metrics: RiskMetricsLike): DashboardStat[] {\n return [\n { label: 'Total Return', value: pct(metrics.totalReturnPct), tone: tone(metrics.totalReturnPct) },\n { label: 'CAGR', value: pct(metrics.cagr * 100), tone: tone(metrics.cagr) },\n { label: 'Sharpe', value: metrics.sharpe.toFixed(2), tone: tone(metrics.sharpe) },\n { label: 'Sortino', value: metrics.sortino.toFixed(2), tone: tone(metrics.sortino) },\n { label: 'Max Drawdown', value: pct(metrics.maxDrawdownPct), tone: 'negative' },\n { label: 'Win Rate', value: `${(metrics.winRate * 100).toFixed(1)}%`, tone: 'neutral' },\n { label: 'Profit Factor', value: Number.isFinite(metrics.profitFactor) ? metrics.profitFactor.toFixed(2) : '∞', tone: tone(metrics.profitFactor - 1) },\n { label: 'Trades', value: String(metrics.trades), tone: 'neutral' },\n ];\n}\n","import type { Theme, ThemeName } from '@tradecanvas/commons';\nimport { DARK_THEME, LIGHT_THEME } from '@tradecanvas/commons';\nimport { EquityCurveChart } from './EquityCurveChart.js';\nimport { HeatmapChart } from './HeatmapChart.js';\nimport {\n toEquityPoints,\n computeDrawdownCurve,\n computeMonthlyReturns,\n selectKeyStats,\n type EquitySample,\n type RiskMetricsLike,\n type DashboardStat,\n} from './performanceData.js';\n\n/** Structurally satisfied by analytics' `BacktestResult`. */\nexport interface PerformanceResult {\n equityCurve: ReadonlyArray<EquitySample>;\n metrics: RiskMetricsLike;\n}\n\nexport interface PerformanceDashboardOptions {\n result: PerformanceResult;\n theme?: ThemeName | Theme;\n title?: string;\n subtitle?: string;\n}\n\nfunction resolveTheme(theme?: ThemeName | Theme): Theme {\n if (!theme || theme === 'dark') return DARK_THEME;\n if (theme === 'light') return LIGHT_THEME;\n return theme as Theme;\n}\n\n/**\n * A composed strategy-performance dashboard: a headline stats strip, an equity\n * curve, an underwater drawdown panel, and a monthly-returns heatmap. Built\n * entirely from a backtest `result`, reusing the finance chart renderers.\n *\n * ```ts\n * const result = new Backtester(opts).run(bars, strategy);\n * const dash = new PerformanceDashboard(el, { result, theme: 'dark' });\n * ```\n */\nexport class PerformanceDashboard {\n private options: PerformanceDashboardOptions;\n private theme: Theme;\n private root: HTMLDivElement;\n private equityChart: EquityCurveChart | null = null;\n private drawdownChart: EquityCurveChart | null = null;\n private heatmap: HeatmapChart | null = null;\n\n constructor(container: HTMLElement, options: PerformanceDashboardOptions) {\n this.options = options;\n this.theme = resolveTheme(options.theme);\n this.root = document.createElement('div');\n this.build();\n container.appendChild(this.root);\n }\n\n private build(): void {\n const t = this.theme;\n const { result, title, subtitle } = this.options;\n const surface = this.panelBackground();\n const border = t.grid;\n\n this.root.style.cssText = [\n 'display:flex',\n 'flex-direction:column',\n 'gap:14px',\n 'width:100%',\n 'box-sizing:border-box',\n 'padding:16px',\n `background:${t.background}`,\n `color:${t.text}`,\n `font-family:${t.font.family}`,\n ].join(';');\n\n if (title || subtitle) {\n const header = document.createElement('div');\n if (title) {\n const h = document.createElement('div');\n h.textContent = title;\n h.style.cssText = `font-size:${t.font.sizeLarge}px;font-weight:600;letter-spacing:-0.01em;`;\n header.appendChild(h);\n }\n if (subtitle) {\n const s = document.createElement('div');\n s.textContent = subtitle;\n s.style.cssText = `font-size:${t.font.sizeSmall}px;color:${t.textSecondary};margin-top:2px;`;\n header.appendChild(s);\n }\n this.root.appendChild(header);\n }\n\n // Stats strip\n this.root.appendChild(this.buildStatsStrip(selectKeyStats(result.metrics), surface, border));\n\n // Chart grid\n const grid = document.createElement('div');\n grid.style.cssText = [\n 'display:grid',\n 'grid-template-columns:repeat(auto-fit, minmax(280px, 1fr))',\n 'grid-auto-rows:220px',\n 'gap:14px',\n ].join(';');\n this.root.appendChild(grid);\n\n const equityPanel = this.buildPanel('Equity Curve', surface, border);\n equityPanel.wrap.style.gridColumn = '1 / -1';\n grid.appendChild(equityPanel.wrap);\n this.equityChart = new EquityCurveChart(equityPanel.body, {\n data: toEquityPoints(result.equityCurve),\n theme: t,\n lineColor: t.candleUp,\n fillArea: true,\n crosshair: true,\n });\n\n const ddPanel = this.buildPanel('Drawdown', surface, border);\n grid.appendChild(ddPanel.wrap);\n this.drawdownChart = new EquityCurveChart(ddPanel.body, {\n data: computeDrawdownCurve(result.equityCurve),\n theme: t,\n lineColor: t.candleDown,\n fillArea: true,\n crosshair: true,\n valueFormat: (v) => `${v.toFixed(1)}%`,\n });\n\n const monthlyCells = computeMonthlyReturns(result.equityCurve);\n const heatPanel = this.buildPanel('Monthly Returns', surface, border);\n grid.appendChild(heatPanel.wrap);\n this.heatmap = new HeatmapChart(heatPanel.body, {\n data: monthlyCells,\n theme: t,\n showValues: true,\n valueFormat: (v) => `${v >= 0 ? '+' : ''}${v.toFixed(1)}`,\n colorScale: { negative: t.candleDown, zero: surface, positive: t.candleUp },\n });\n }\n\n private buildStatsStrip(stats: DashboardStat[], surface: string, border: string): HTMLDivElement {\n const strip = document.createElement('div');\n strip.style.cssText = [\n 'display:grid',\n 'grid-template-columns:repeat(auto-fit, minmax(120px, 1fr))',\n 'gap:10px',\n ].join(';');\n\n const t = this.theme;\n for (const stat of stats) {\n const card = document.createElement('div');\n card.style.cssText = [\n `background:${surface}`,\n `border:1px solid ${border}`,\n 'border-radius:10px',\n 'padding:10px 12px',\n 'display:flex',\n 'flex-direction:column',\n 'gap:4px',\n ].join(';');\n\n const label = document.createElement('div');\n label.textContent = stat.label;\n label.style.cssText = `font-size:${t.font.sizeSmall}px;color:${t.textSecondary};text-transform:uppercase;letter-spacing:0.04em;`;\n\n const value = document.createElement('div');\n value.textContent = stat.value;\n const color = stat.tone === 'positive' ? t.candleUp : stat.tone === 'negative' ? t.candleDown : t.text;\n value.style.cssText = `font-size:${t.font.sizeLarge}px;font-weight:600;color:${color};font-variant-numeric:tabular-nums;`;\n\n card.appendChild(label);\n card.appendChild(value);\n strip.appendChild(card);\n }\n return strip;\n }\n\n private buildPanel(title: string, surface: string, border: string): { wrap: HTMLDivElement; body: HTMLDivElement } {\n const t = this.theme;\n const wrap = document.createElement('div');\n wrap.style.cssText = [\n `background:${surface}`,\n `border:1px solid ${border}`,\n 'border-radius:10px',\n 'overflow:hidden',\n 'display:flex',\n 'flex-direction:column',\n ].join(';');\n\n const head = document.createElement('div');\n head.textContent = title;\n head.style.cssText = [\n `font-size:${t.font.sizeSmall}px`,\n 'font-weight:600',\n `color:${t.textSecondary}`,\n 'padding:8px 12px',\n `border-bottom:1px solid ${border}`,\n 'text-transform:uppercase',\n 'letter-spacing:0.04em',\n ].join(';');\n\n const body = document.createElement('div');\n body.style.cssText = 'flex:1;min-height:0;position:relative;';\n\n wrap.appendChild(head);\n wrap.appendChild(body);\n return { wrap, body };\n }\n\n /** A subtle surface tint distinct from the page background, per theme. */\n private panelBackground(): string {\n return this.theme.name === 'light' ? 'rgba(0,0,0,0.02)' : 'rgba(255,255,255,0.03)';\n }\n\n /** Replace the displayed result and re-render all panels. */\n update(result: PerformanceResult): void {\n this.options = { ...this.options, result };\n this.destroyCharts();\n this.root.replaceChildren();\n this.build();\n }\n\n setTheme(theme: ThemeName | Theme): void {\n this.theme = resolveTheme(theme);\n this.options = { ...this.options, theme };\n this.destroyCharts();\n this.root.replaceChildren();\n this.build();\n }\n\n private destroyCharts(): void {\n this.equityChart?.destroy();\n this.drawdownChart?.destroy();\n this.heatmap?.destroy();\n this.equityChart = null;\n this.drawdownChart = null;\n this.heatmap = null;\n }\n\n destroy(): void {\n this.destroyCharts();\n this.root.remove();\n }\n}\n"],"mappings":";;;;AAiBA,SAAS,GAAQ,GAA6B;CAC5C,IAAM,EAAE,OAAI,YAAS,EAAE,EAAE,cAAW,SAAS,OAAO,KAAS,WAAW,EAAE,IAAI,GAAM,GAAG;AACvF,QAAO,KAAK,UAAU;EAAC;EAAI,OAAO,KAAK,EAAO,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG,EAAO,GAAG,CAAC;EAAE;EAAS,CAAC;;AAS9F,SAAgB,GAAe,GAAsB,GAAiC,GAAoC;CACxH,IAAM,oBAAO,IAAI,KAAqB,EAChC,IAAS,EAAM,KAAK,MAAS;EACjC,IAAM,IAAM,GAAQ,EAAK,EACnB,IAAI,EAAK,IAAI,EAAI,IAAI;AAE3B,SADA,EAAK,IAAI,GAAK,IAAI,EAAE,EACb;GAAE;GAAM,KAAK,GAAG,EAAI,GAAG;GAAK;GACnC,EACI,IAAO,IAAI,IAAI,EAAO,KAAK,MAAM,EAAE,IAAI,CAAC;AAC9C,MAAK,IAAM,CAAC,GAAK,MAAe,CAAC,GAAG,EAAQ,CACtC,GAAK,IAAI,EAAI,KACjB,EAAM,gBAAgB,EAAW,EACjC,EAAQ,OAAO,EAAI;AAErB,MAAK,IAAM,EAAE,SAAM,YAAS,GAAQ;AAClC,MAAI,EAAQ,IAAI,EAAI,CAAE;EACtB,IAAM,IAAa,OAAO,KAAS,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,cAAc,MAAM;AAC1C,IAAK,MAAM,UAAU;GACnB,cAAc;GACd,oBAAoB;GACpB;GACA;GACA;GACA;GACD,CAAC,KAAK,IAAI;EAEX,IAAM,IAAO,SAAS,cAAc,MAAM;AAE1C,EADA,EAAK,cAAc,GACnB,EAAK,MAAM,UAAU;GACnB,aAAa,EAAE,KAAK,UAAU;GAC9B;GACA,SAAS,EAAE;GACX;GACA,2BAA2B;GAC3B;GACA;GACD,CAAC,KAAK,IAAI;EAEX,IAAM,IAAO,SAAS,cAAc,MAAM;AAK1C,SAJA,EAAK,MAAM,UAAU,0CAErB,EAAK,YAAY,EAAK,EACtB,EAAK,YAAY,EAAK,EACf;GAAE;GAAM;GAAM;;CAIvB,kBAAkC;AAChC,SAAO,KAAK,MAAM,SAAS,UAAU,qBAAqB;;CAI5D,OAAO,GAAiC;AAItC,EAHA,KAAK,UAAU;GAAE,GAAG,KAAK;GAAS;GAAQ,EAC1C,KAAK,eAAe,EACpB,KAAK,KAAK,iBAAiB,EAC3B,KAAK,OAAO;;CAGd,SAAS,GAAgC;AAKvC,EAJA,KAAK,QAAQ,EAAa,EAAM,EAChC,KAAK,UAAU;GAAE,GAAG,KAAK;GAAS;GAAO,EACzC,KAAK,eAAe,EACpB,KAAK,KAAK,iBAAiB,EAC3B,KAAK,OAAO;;CAGd,gBAA8B;AAM5B,EALA,KAAK,aAAa,SAAS,EAC3B,KAAK,eAAe,SAAS,EAC7B,KAAK,SAAS,SAAS,EACvB,KAAK,cAAc,MACnB,KAAK,gBAAgB,MACrB,KAAK,UAAU;;CAGjB,UAAgB;AAEd,EADA,KAAK,eAAe,EACpB,KAAK,KAAK,QAAQ"}
|
|
@@ -4,11 +4,13 @@ export interface PriceAxisWidthInput {
|
|
|
4
4
|
min: number;
|
|
5
5
|
max: number;
|
|
6
6
|
lastPrice: number | null;
|
|
7
|
-
/** Decimals for the
|
|
7
|
+
/** Decimals for the scale and its tags (a market's or symbol's `pricePrecision`), or null to fit the range. */
|
|
8
8
|
tagPrecision: number | null;
|
|
9
9
|
locale: string;
|
|
10
10
|
/** The chart's price format, when it has one: labels and tags print with it. */
|
|
11
11
|
format?: ((price: number) => string) | null;
|
|
12
|
+
/** The scale's label for a price as the axis writes it (its decimals, percent, a fraction), when known. */
|
|
13
|
+
scaleLabel?: ((price: number) => string) | null;
|
|
12
14
|
fontFamily: string;
|
|
13
15
|
fontSizeSmall: number;
|
|
14
16
|
measure: (text: string, font: string) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceAxisWidth.d.ts","sourceRoot":"","sources":["../../src/layout/priceAxisWidth.ts"],"names":[],"mappings":"AAUA,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB
|
|
1
|
+
{"version":3,"file":"priceAxisWidth.d.ts","sourceRoot":"","sources":["../../src/layout/priceAxisWidth.ts"],"names":[],"mappings":"AAUA,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,+GAA+G;IAC/G,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,IAAI,CAAC;IAC5C,2GAA2G;IAC3G,UAAU,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,IAAI,CAAC;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACjD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAoBzE;AAED,uFAAuF;AACvF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI5E"}
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ export { PluginManager } from './PluginManager.js';
|
|
|
2
2
|
export type { PluginManagerOptions } from './PluginManager.js';
|
|
3
3
|
export { registerPlugin, unregisterPlugin, getGlobalPlugins, clearGlobalPlugins, } from './registry.js';
|
|
4
4
|
export { PLUGIN_API_VERSION, pluginKey, overlaysForLayer } from './contracts.js';
|
|
5
|
+
export { overlayScale } from './overlayScale.js';
|
|
6
|
+
export type { FrameScale } from './overlayScale.js';
|
|
5
7
|
export type { ChartPlugin, ChartTypePlugin, OverlayPlugin, OverlayRenderContext, } from './contracts.js';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjF,YAAY,EACV,WAAW,EACX,eAAe,EACf,aAAa,EACb,oBAAoB,GACrB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EACV,WAAW,EACX,eAAe,EACf,aAAa,EACb,oBAAoB,GACrB,MAAM,gBAAgB,CAAC"}
|