@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
|
@@ -724,14 +724,14 @@ var z = 200, B = 80, V = (e) => e.position === "top" || e.position === "bottom",
|
|
|
724
724
|
}
|
|
725
725
|
}, un = 14, dn = 14, fn = 22, pn = 4;
|
|
726
726
|
function mn(e) {
|
|
727
|
-
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: o, fontSizeSmall: c, measure: l } = e, d = s(t, n), f =
|
|
727
|
+
let { min: t, max: n, lastPrice: r, locale: i, fontFamily: o, fontSizeSmall: c, measure: l } = e, d = e.tagPrecision ?? s(t, n), f = d, p = r === null ? [t, n] : [
|
|
728
728
|
t,
|
|
729
729
|
n,
|
|
730
730
|
r
|
|
731
731
|
], m = a;
|
|
732
732
|
for (let t of p) {
|
|
733
733
|
if (!Number.isFinite(t)) continue;
|
|
734
|
-
let n = e.format ? e.format(t) : u(t, d, i), r = e.format ? n : u(t, f, i);
|
|
734
|
+
let n = e.scaleLabel ? e.scaleLabel(t) : e.format ? e.format(t) : u(t, d, i), r = e.format ? n : u(t, f, i);
|
|
735
735
|
m = Math.max(m, l(n, `500 ${c}px ${o}`) + un, l(r, `bold 11px ${o}`) + dn, l(r, `600 ${c}px ${o}`) + fn);
|
|
736
736
|
}
|
|
737
737
|
return m <= a ? a : Math.ceil(m / pn) * pn;
|
|
@@ -888,7 +888,7 @@ function kn(e) {
|
|
|
888
888
|
if (typeof e == "number" && !Number.isFinite(e)) throw RangeError(`Invalid UTC offset: ${e}`);
|
|
889
889
|
}
|
|
890
890
|
var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
|
|
891
|
-
static version = "1.
|
|
891
|
+
static version = "1.18.0";
|
|
892
892
|
engine;
|
|
893
893
|
viewport;
|
|
894
894
|
dataManager;
|
|
@@ -1854,6 +1854,12 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
|
|
|
1854
1854
|
let { min: n, max: r } = this.viewport.getState().priceRange;
|
|
1855
1855
|
return Number(e.toFixed(this.marketPricePrecision ?? s(n, r)));
|
|
1856
1856
|
}
|
|
1857
|
+
getPriceStep() {
|
|
1858
|
+
let e = this.symbolInfo?.minTick ?? this.priceUnit ?? void 0;
|
|
1859
|
+
if (e !== void 0 && e > 0) return e;
|
|
1860
|
+
let { min: t, max: n } = this.viewport.getState().priceRange, r = this.marketPricePrecision ?? s(t, n);
|
|
1861
|
+
return Number((10 ** -r).toFixed(r));
|
|
1862
|
+
}
|
|
1857
1863
|
setPriceFormat(e) {
|
|
1858
1864
|
this.applyPriceFormat(e), this.updateViewportAndRender();
|
|
1859
1865
|
}
|
|
@@ -2345,7 +2351,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
|
|
|
2345
2351
|
this.eventBus.emit("dataUpdate", { connection: e });
|
|
2346
2352
|
}), this.streamManager.on("error", (e) => {
|
|
2347
2353
|
this.eventBus.emit("dataUpdate", { error: e.message });
|
|
2348
|
-
}), this.autoScrollOnNewBar = e.autoScroll !== !1, this.setStreamTarget(e.symbol, e.timeframe), this.streamAdapter = e.adapter;
|
|
2354
|
+
}), this.streamManager.on("symbolInfo", (e) => this.applyFeedSymbolInfo(e)), this.autoScrollOnNewBar = e.autoScroll !== !1, this.setStreamTarget(e.symbol, e.timeframe), this.streamAdapter = e.adapter;
|
|
2349
2355
|
let t = this.streamManager;
|
|
2350
2356
|
if (this.resolveStreamSymbol(e.adapter, e.symbol), await t.connect(e), this.streamManager !== t) return;
|
|
2351
2357
|
let n = ae(e.timeframe);
|
|
@@ -2668,7 +2674,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
|
|
|
2668
2674
|
this.symbolInfo = e ? {
|
|
2669
2675
|
...e,
|
|
2670
2676
|
sessions: e.sessions?.map((e) => ({ ...e }))
|
|
2671
|
-
} : null, this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
|
|
2677
|
+
} : null, this.priceAxis.setPriceTick(this.symbolInfo?.minTick ?? null), this.marketConfig?.pricePrecision === void 0 && this.applyPricePrecision(this.symbolInfo?.pricePrecision ?? null);
|
|
2672
2678
|
let t = (this.symbolInfo?.sessions ?? []).flatMap((e) => {
|
|
2673
2679
|
let t = x(e.start), n = x(e.end);
|
|
2674
2680
|
return t === null || n === null ? [] : [{
|
|
@@ -2686,11 +2692,23 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
|
|
|
2686
2692
|
getSymbolInfo() {
|
|
2687
2693
|
return this.symbolInfo;
|
|
2688
2694
|
}
|
|
2695
|
+
applyFeedSymbolInfo(e) {
|
|
2696
|
+
if (!e || typeof e != "object") return;
|
|
2697
|
+
let t = this.currentSymbol, n = (e) => !e || e.toUpperCase() === t.toUpperCase();
|
|
2698
|
+
if (!n(e.symbol)) return;
|
|
2699
|
+
let r = this.symbolInfo && n(this.symbolInfo.symbol) ? this.symbolInfo : null, i = {
|
|
2700
|
+
...r,
|
|
2701
|
+
...e,
|
|
2702
|
+
symbol: e.symbol || r?.symbol || t
|
|
2703
|
+
};
|
|
2704
|
+
r && JSON.stringify(i) === JSON.stringify(r) || (this.symbolInfoSeq++, this.setSymbolInfo(i));
|
|
2705
|
+
}
|
|
2689
2706
|
resolveStreamSymbol(e, t) {
|
|
2707
|
+
this.symbolInfo && this.symbolInfo.symbol !== t && this.setSymbolInfo(null);
|
|
2690
2708
|
let n = e.resolveSymbol?.bind(e);
|
|
2691
2709
|
if (!n) return;
|
|
2692
2710
|
let r = ++this.symbolInfoSeq;
|
|
2693
|
-
|
|
2711
|
+
Promise.resolve().then(() => n(t)).then((e) => {
|
|
2694
2712
|
e && r === this.symbolInfoSeq && this.currentSymbol === t && this.setSymbolInfo(e);
|
|
2695
2713
|
}, (e) => {
|
|
2696
2714
|
r === this.symbolInfoSeq && console.warn(`No symbol info for "${t}":`, e);
|
|
@@ -3295,7 +3313,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
|
|
|
3295
3313
|
e.pricePrecision !== void 0 && this.applyPricePrecision(e.pricePrecision), this.updateViewportAndRender();
|
|
3296
3314
|
}
|
|
3297
3315
|
applyPricePrecision(e) {
|
|
3298
|
-
this.marketPricePrecision = e, this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? An), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
|
|
3316
|
+
this.marketPricePrecision = e, this.priceAxis.setPricePrecision(e), this.tradingManager.setConfig({ pricePrecision: e ?? void 0 }), this.alertManager.setPricePrecision(e ?? An), this.streamManager?.priceLine.setPricePrecision(e), this.currentPriceLine.setPricePrecision(e), this.crosshairHandler.setPricePrecision(e), this.chartLegend.setPricePrecision(e), this.crosshairTooltip.setPricePrecision(e);
|
|
3299
3317
|
}
|
|
3300
3318
|
getMarket() {
|
|
3301
3319
|
return this.marketConfig;
|
|
@@ -3410,6 +3428,7 @@ var An = 2, jn = .08, Mn = 800, Nn = 20, Pn = 8, Fn = class {
|
|
|
3410
3428
|
tagPrecision: this.marketPricePrecision,
|
|
3411
3429
|
locale: this.numberLocale,
|
|
3412
3430
|
format: this.priceFormatter,
|
|
3431
|
+
scaleLabel: (e) => this.priceAxis.labelText(e, this.viewport.getState()),
|
|
3413
3432
|
fontFamily: t.font.family,
|
|
3414
3433
|
fontSizeSmall: t.font.sizeSmall,
|
|
3415
3434
|
measure: (e, t) => this.measureText(e, t)
|
|
@@ -4186,4 +4205,4 @@ var br = class {
|
|
|
4186
4205
|
//#endregion
|
|
4187
4206
|
export { Yt as C, F as S, H as _, hr as a, on as b, Fn as c, xn as d, W as f, vn as g, _n as h, gr as i, On as l, bn as m, _r as n, fr as o, yn as p, $ as r, rr as s, br as t, Sn as u, ln as v, I as x, L as y };
|
|
4188
4207
|
|
|
4189
|
-
//# sourceMappingURL=LayoutSession-
|
|
4208
|
+
//# sourceMappingURL=LayoutSession-DnVpA1Bg.js.map
|