@tradecanvas/core 0.4.0 → 0.5.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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/ui/ChartLegend.d.ts +2 -0
- package/dist/ui/ChartLegend.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4647,6 +4647,7 @@ var Ot = class {
|
|
|
4647
4647
|
timeframe = "";
|
|
4648
4648
|
hoverBar = null;
|
|
4649
4649
|
indicators = [];
|
|
4650
|
+
statusText = null;
|
|
4650
4651
|
setConfig(e) {
|
|
4651
4652
|
Object.assign(this.config, e);
|
|
4652
4653
|
}
|
|
@@ -4663,14 +4664,17 @@ var Ot = class {
|
|
|
4663
4664
|
setIndicatorValues(e) {
|
|
4664
4665
|
this.indicators = e;
|
|
4665
4666
|
}
|
|
4667
|
+
setStatusText(e) {
|
|
4668
|
+
this.statusText = e;
|
|
4669
|
+
}
|
|
4666
4670
|
render(e, t, n, r) {
|
|
4667
4671
|
if (!this.config.visible || r.length === 0) return;
|
|
4668
4672
|
let i = this.hoverBar ?? r[r.length - 1], a = r.length > 1 ? r[r.length - 2] : i, { chartRect: o } = t, s = this.config.fontSize, c = this.config.position === "top-left", l = c ? o.x + 8 : o.x + o.width - 8, u = o.y + 6;
|
|
4669
4673
|
if (e.textAlign = c ? "left" : "right", e.textBaseline = "top", this.config.showSymbol) {
|
|
4670
4674
|
e.font = `bold ${s + 2}px ${n.font.family}`, e.fillStyle = n.text;
|
|
4671
|
-
let t = [this.symbol, this.timeframe].filter(Boolean).join(" · ");
|
|
4672
|
-
e.fillText(
|
|
4673
|
-
}
|
|
4675
|
+
let t = [this.symbol, this.timeframe].filter(Boolean).join(" · "), r = this.statusText ? `${t} ${this.statusText}` : t;
|
|
4676
|
+
e.fillText(r, l, u), u += s + 6;
|
|
4677
|
+
} else this.statusText && (e.font = `${s}px ${n.font.family}`, e.fillStyle = n.textSecondary, e.fillText(this.statusText, l, u), u += s + 4);
|
|
4674
4678
|
if (this.config.showOHLC) {
|
|
4675
4679
|
e.font = `${s}px ${n.font.family}`;
|
|
4676
4680
|
let t = i.close >= i.open, r = (e) => e.toLocaleString(void 0, {
|