charts-core 1.1.32 → 1.1.34
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/charts-core.js +176 -157
- package/dist/charts-core.js.map +1 -1
- package/dist/charts-core.umd.cjs +3 -3
- package/dist/charts-core.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/charts-core.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var Ns = Object.defineProperty;
|
|
2
2
|
var Fs = (i, e, t) => e in i ? Ns(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var f = (i, e, t) => Fs(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import * as
|
|
4
|
+
import * as E from "d3";
|
|
5
5
|
const Hs = (i) => {
|
|
6
6
|
const { svg: e, config: t, y: s, width: n } = i, { margin: a, yAxis: r } = t, { customTicks: o, tickFormat: c, tickValues: h, ticks: d, isShow: g } = r;
|
|
7
7
|
if (!g) return null;
|
|
8
8
|
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((p) => {
|
|
9
|
-
let _ =
|
|
9
|
+
let _ = E.axisRight(s);
|
|
10
10
|
o && c ? _ = _.tickFormat(c) : _ = _.tickFormat((v) => {
|
|
11
11
|
const b = Number(v), w = (x) => x.toString().replace(/\.0+$/, "");
|
|
12
12
|
return Math.abs(b) >= 1e12 ? w(b / 1e12) + "T" : Math.abs(b) >= 1e9 ? w(b / 1e9) + "B" : Math.abs(b) >= 1e6 ? w(b / 1e6) + "M" : Math.abs(b) >= 1e3 ? w(b / 1e3) + "K" : w(b);
|
|
@@ -20,7 +20,7 @@ const Hs = (i) => {
|
|
|
20
20
|
const v = _.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
|
|
21
21
|
p.selectAll(".tick").each(function(w, x) {
|
|
22
22
|
var $;
|
|
23
|
-
const y =
|
|
23
|
+
const y = E.select(this), C = y.select("text"), S = v[x], T = b - S, N = y.append("g").attr("transform", "translate(10, 0)");
|
|
24
24
|
C.attr("x", T), C.remove(), ($ = N.node()) == null || $.appendChild(C.node());
|
|
25
25
|
});
|
|
26
26
|
}).attr("font-family", "inherit");
|
|
@@ -28,7 +28,7 @@ const Hs = (i) => {
|
|
|
28
28
|
const { svg: e, config: t, x: s, height: n } = i, { margin: a, xAxis: r } = t, { isShow: o, tickValues: c, tickFormat: h, customTicks: d, ticks: g } = r;
|
|
29
29
|
if (!o) return null;
|
|
30
30
|
e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((p) => {
|
|
31
|
-
let _ =
|
|
31
|
+
let _ = E.axisBottom(s);
|
|
32
32
|
d ? (h && (_ = _.tickFormat(h)), g && (_ = Array.isArray(g) ? _.ticks(...g) : _.ticks(g)), c && (_ = _.tickValues(c))) : _.ticks(5), p.call(_);
|
|
33
33
|
}).call((p) => p.select(".domain").remove()).call((p) => {
|
|
34
34
|
let _ = [];
|
|
@@ -117,8 +117,8 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
117
117
|
show: (T) => C(T),
|
|
118
118
|
hide: S
|
|
119
119
|
} : null, r.forEach((T, N) => {
|
|
120
|
-
const $ = s(T.date),
|
|
121
|
-
te || qt(e, { x1: $, x2: $, y1:
|
|
120
|
+
const $ = s(T.date), G = n(T.value), Z = r[N - 1], te = N > 0 && Z && T.value === Z.value;
|
|
121
|
+
te || qt(e, { x1: $, x2: $, y1: G, y2: _ });
|
|
122
122
|
const K = $s(e, te, {
|
|
123
123
|
x: $,
|
|
124
124
|
y: _,
|
|
@@ -137,14 +137,14 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
137
137
|
}, Vs = (i) => {
|
|
138
138
|
const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
|
|
139
139
|
Bs(i), Hs(i), r && e.append("image").attr("xlink:href", t.theme === "dark" ? r.picDarkTheme : r.picLightTheme).attr("width", r.width).attr("height", r.height).attr("x", r.x ?? (s - a.left - a.right) / 2 - r.width / 2 + a.left).attr("y", r.y ?? (n - a.top - a.bottom) / 2 - r.height / 2 + a.top), zs(i);
|
|
140
|
-
},
|
|
140
|
+
}, Le = (i, e, t) => {
|
|
141
141
|
let s = i.select(`#${e}`);
|
|
142
142
|
return s.empty() && (s = i.append("linearGradient").attr("gradientUnits", "userSpaceOnUse").attr("id", e)), s.attr("x1", t.x1).attr("y1", t.x2).attr("x2", t.y1).attr("y2", t.y2), t.stops.forEach(({ offset: n, stopColor: a }) => {
|
|
143
143
|
s.append("stop").attr("offset", n).attr("stop-color", a);
|
|
144
144
|
}), s;
|
|
145
145
|
}, ve = (i) => {
|
|
146
|
-
const e =
|
|
147
|
-
return e.empty() ?
|
|
146
|
+
const e = E.select(i).select("defs");
|
|
147
|
+
return e.empty() ? E.select(i).append("defs") : e;
|
|
148
148
|
}, Tt = (i) => {
|
|
149
149
|
const {
|
|
150
150
|
y: e,
|
|
@@ -187,7 +187,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
187
187
|
...e == null ? void 0 : e.selection
|
|
188
188
|
}
|
|
189
189
|
}), Qt = (i, e = {}) => {
|
|
190
|
-
const t = i.node(), s = ve(t), n = (o, c) =>
|
|
190
|
+
const t = i.node(), s = ve(t), n = (o, c) => Le(s, o, {
|
|
191
191
|
x1: "0%",
|
|
192
192
|
y1: "0%",
|
|
193
193
|
x2: "0%",
|
|
@@ -227,7 +227,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
227
227
|
};
|
|
228
228
|
}, Ws = (i, e = {}) => {
|
|
229
229
|
const t = "sc-charts__hover-line", s = i.append("line").style("display", e.hidden ? "none" : "block").classed(t, !0), n = i.node(), a = ve(n);
|
|
230
|
-
return ((o, c) =>
|
|
230
|
+
return ((o, c) => Le(a, o, {
|
|
231
231
|
x1: "0%",
|
|
232
232
|
y1: "0%",
|
|
233
233
|
x2: "0%",
|
|
@@ -249,8 +249,8 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
249
249
|
s.remove();
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
-
}, ge = "sc-charts__range-tooltip", Kt =
|
|
253
|
-
const e =
|
|
252
|
+
}, ge = "sc-charts__range-tooltip", Kt = E.timeFormat("%b %e, %I:%M %p"), Ys = (i) => {
|
|
253
|
+
const e = E.format(",.2f");
|
|
254
254
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
255
255
|
};
|
|
256
256
|
function js(i) {
|
|
@@ -293,8 +293,8 @@ const Xs = (i) => {
|
|
|
293
293
|
p ? w = p({ left: n.date, right: a.date, direction: v }) : w = `${Kt(n.date)} to ${Kt(a.date)}`, t.textContent = b, s.textContent = w, requestAnimationFrame(() => {
|
|
294
294
|
const x = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), S = i.x(a.date);
|
|
295
295
|
let N = (C + S) / 2 - x.width / 2;
|
|
296
|
-
const $ = 0,
|
|
297
|
-
N < $ && (N = $), N >
|
|
296
|
+
const $ = 0, G = y.width - x.width;
|
|
297
|
+
N < $ && (N = $), N > G && (N = G), e.style.left = `${N}px`, e.style.top = `${o}px`;
|
|
298
298
|
});
|
|
299
299
|
}
|
|
300
300
|
c !== void 0 && (e.style.display = c ? "none" : "block");
|
|
@@ -303,17 +303,17 @@ const Xs = (i) => {
|
|
|
303
303
|
e.remove();
|
|
304
304
|
}
|
|
305
305
|
};
|
|
306
|
-
},
|
|
307
|
-
const e =
|
|
306
|
+
}, Ee = "sc-charts__hover-tooltip", _t = 16, Us = E.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
|
|
307
|
+
const e = E.format(",.2f");
|
|
308
308
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
309
309
|
};
|
|
310
310
|
function Zs(i) {
|
|
311
311
|
const e = document.createElement("div");
|
|
312
|
-
e.className = `${
|
|
312
|
+
e.className = `${Ee}-container`, e.style.position = "absolute", e.style.top = "0", e.style.pointerEvents = "none", e.style.display = "none", i.appendChild(e);
|
|
313
313
|
const t = document.createElement("div");
|
|
314
|
-
t.className = `${
|
|
314
|
+
t.className = `${Ee}-sum`;
|
|
315
315
|
const s = document.createElement("div");
|
|
316
|
-
return s.className = `${
|
|
316
|
+
return s.className = `${Ee}-time`, { wrapper: e, sumNode: t, timeNode: s };
|
|
317
317
|
}
|
|
318
318
|
function qs(i, e, t) {
|
|
319
319
|
return i ? e + _t + i.width < t ? e + _t : e - _t - i.width : null;
|
|
@@ -324,7 +324,7 @@ const Js = (i) => {
|
|
|
324
324
|
};
|
|
325
325
|
return {
|
|
326
326
|
className(a, r) {
|
|
327
|
-
a === "remove" ? e.classList.remove(`${
|
|
327
|
+
a === "remove" ? e.classList.remove(`${Ee}${r}`) : e.classList.add(`${Ee}${r}`);
|
|
328
328
|
},
|
|
329
329
|
update({ hidden: a, dataItem: r }) {
|
|
330
330
|
if (!i.config.hover.showDefaultTooltip) {
|
|
@@ -402,9 +402,9 @@ const Js = (i) => {
|
|
|
402
402
|
},
|
|
403
403
|
enableBelowZeroLine: !1,
|
|
404
404
|
curveTension: 1
|
|
405
|
-
}, tt = () =>
|
|
405
|
+
}, tt = () => E.curveMonotoneX, Ks = (i) => {
|
|
406
406
|
const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o = ve(r);
|
|
407
|
-
|
|
407
|
+
Le(o, "main-line-area-gradient", {
|
|
408
408
|
x1: "0%",
|
|
409
409
|
y1: "0%",
|
|
410
410
|
x2: "0%",
|
|
@@ -414,7 +414,7 @@ const Js = (i) => {
|
|
|
414
414
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
415
415
|
]
|
|
416
416
|
});
|
|
417
|
-
const h =
|
|
417
|
+
const h = E.area().x((p) => s(p.date)).y0(n.range()[0]).y1((p) => n(p.value)).curve(tt()), d = "sc-charts__main-line-area", g = e.append("path").datum(t).attr("d", h).attr("class", d).classed(`${d}_hidden`, !a.hasMainLineArea);
|
|
418
418
|
return {
|
|
419
419
|
className(p, _) {
|
|
420
420
|
p === "remove" ? g.classed(`${d}${_}`, !1) : g.classed(`${d}${_}`, !0);
|
|
@@ -431,7 +431,7 @@ const Js = (i) => {
|
|
|
431
431
|
};
|
|
432
432
|
}, en = (i, e = {}) => {
|
|
433
433
|
const t = "sc-charts__range-line-area", { svg: s, x: n, y: a, config: r, data: o, chartId: c } = i, { clip: h } = e, d = s.node(), g = ve(d), p = "range-line-area-gradient";
|
|
434
|
-
|
|
434
|
+
Le(g, p + "_up", {
|
|
435
435
|
x1: "0%",
|
|
436
436
|
y1: "0%",
|
|
437
437
|
x2: "0%",
|
|
@@ -440,7 +440,7 @@ const Js = (i) => {
|
|
|
440
440
|
{ offset: "0%", stopColor: "var(--sc-color-selection-up)" },
|
|
441
441
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
442
442
|
]
|
|
443
|
-
}),
|
|
443
|
+
}), Le(g, p + "_down", {
|
|
444
444
|
x1: "0%",
|
|
445
445
|
y1: "0%",
|
|
446
446
|
x2: "0%",
|
|
@@ -450,7 +450,7 @@ const Js = (i) => {
|
|
|
450
450
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
451
451
|
]
|
|
452
452
|
});
|
|
453
|
-
const _ =
|
|
453
|
+
const _ = E.area().x((y) => n(y.date)).y0(a.range()[0]).y1((y) => a(y.value)).curve(tt()), v = `${c}-clip-${t}`, w = g.append("clipPath").attr("id", v).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), x = s.append("path").datum(o).attr("d", _).attr("class", t).classed(`${t}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${v})`);
|
|
454
454
|
return {
|
|
455
455
|
className(y, C) {
|
|
456
456
|
y === "remove" ? x.classed(`${t}${C}`, !1) : x.classed(`${t}${C}`, !0);
|
|
@@ -463,7 +463,7 @@ const Js = (i) => {
|
|
|
463
463
|
}
|
|
464
464
|
};
|
|
465
465
|
}, vt = (i, e) => {
|
|
466
|
-
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = ve(d), p =
|
|
466
|
+
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = ve(d), p = E.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(tt()), _ = `${r}-clip-${o}`, b = g.append("clipPath").attr("id", _).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), w = t.append("path").classed(o, !0).datum(s).attr("d", p).attr("id", c).attr("clip-path", `url(#${_})`);
|
|
467
467
|
return {
|
|
468
468
|
className(x, y) {
|
|
469
469
|
x === "remove" ? w.classed(`${o}${y}`, !1) : w.classed(`${o}${y}`, !0);
|
|
@@ -476,13 +476,13 @@ const Js = (i) => {
|
|
|
476
476
|
}
|
|
477
477
|
};
|
|
478
478
|
}, tn = (i, e) => {
|
|
479
|
-
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), p = ve(g), _ =
|
|
479
|
+
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), p = ve(g), _ = E.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(tt()), v = `${r}-clip-${c}`, w = p.append("clipPath").attr("id", v).append("rect").attr("x", (d == null ? void 0 : d.x) || 0).attr("y", (d == null ? void 0 : d.y) || 0).attr("width", (d == null ? void 0 : d.width) || "100%").attr("height", (d == null ? void 0 : d.height) || "100%"), x = t.append("path").classed(c, !0).datum(s).attr("d", _).attr("id", h).attr("clip-path", `url(#${v})`);
|
|
480
480
|
return {
|
|
481
481
|
className(y, C) {
|
|
482
482
|
y === "remove" ? x.classed(`${c}${C}`, !1) : x.classed(`${c}${C}`, !0);
|
|
483
483
|
},
|
|
484
484
|
update({ data: y, clip: C, hidden: S }) {
|
|
485
|
-
y !== void 0 && x.datum(y).attr("d", _), S !== void 0 && x.classed(`${c}_hidden`, S), C !== void 0 && (o.hover.transitionName === "default" ? w.transition().duration(o.hover.transitionDuration).attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height).ease(
|
|
485
|
+
y !== void 0 && x.datum(y).attr("d", _), S !== void 0 && x.classed(`${c}_hidden`, S), C !== void 0 && (o.hover.transitionName === "default" ? w.transition().duration(o.hover.transitionDuration).attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height).ease(E.easeLinear) : w.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
|
|
486
486
|
},
|
|
487
487
|
destroy() {
|
|
488
488
|
x.remove();
|
|
@@ -768,28 +768,28 @@ const Js = (i) => {
|
|
|
768
768
|
(b, w) => Math.abs(s(b.date) - v) < Math.abs(s(w.date) - v) ? b : w
|
|
769
769
|
);
|
|
770
770
|
e.append("rect").attr("width", a - o.left - o.right).attr("height", r - o.top - o.bottom).attr("x", o.left).attr("y", o.top).attr("fill", "transparent").on("mousemove", function(v) {
|
|
771
|
-
const [b] =
|
|
771
|
+
const [b] = E.pointer(v, this), w = p(b);
|
|
772
772
|
!g && c.enable ? (i.action = "hover", ei(i, w)) : (i.action = g ? "selection" : "none", ti(i)), d && h.enable && (i.action = "selection", ln(i, d, w));
|
|
773
773
|
}).on("mouseleave", () => {
|
|
774
774
|
i.action = "none", g = !1, d = null, ti(i), ii(i);
|
|
775
775
|
}).on("mousedown", function(v) {
|
|
776
776
|
if (h.enable) {
|
|
777
777
|
g = !0, i.action = "selection";
|
|
778
|
-
const [b] =
|
|
778
|
+
const [b] = E.pointer(v, this);
|
|
779
779
|
d = p(b);
|
|
780
780
|
}
|
|
781
781
|
}).on("mouseup", function(v) {
|
|
782
|
-
const [b] =
|
|
782
|
+
const [b] = E.pointer(v, this), w = p(b);
|
|
783
783
|
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i, w);
|
|
784
784
|
});
|
|
785
785
|
}, hn = (i, e, t) => {
|
|
786
|
-
const { margin: s } = e, n =
|
|
786
|
+
const { margin: s } = e, n = E.scaleTime(), a = E.extent(i, (r) => new Date(r.date));
|
|
787
787
|
return a[0] == null || a[1] == null ? n : n.domain([a[0], a[1]]).range([s.left, t - s.right]);
|
|
788
788
|
}, dn = (i, e, t) => {
|
|
789
|
-
const { margin: s } = e, n =
|
|
790
|
-
return
|
|
789
|
+
const { margin: s } = e, n = E.max(i, (r) => r.value) ?? 0, a = E.min(i, (r) => r.value) ?? 0;
|
|
790
|
+
return E.scaleLinear().domain([a, n]).range([t - s.bottom, s.top]);
|
|
791
791
|
}, pr = (i, e) => {
|
|
792
|
-
const t =
|
|
792
|
+
const t = E.select(i);
|
|
793
793
|
if (t.empty())
|
|
794
794
|
return console.error(`Element with selector ${i} not found!`), null;
|
|
795
795
|
if (!e.chartId || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.chartId))
|
|
@@ -841,11 +841,11 @@ De.exports;
|
|
|
841
841
|
var si;
|
|
842
842
|
function fn() {
|
|
843
843
|
return si || (si = 1, function(i, e) {
|
|
844
|
-
var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", p = "[object Error]", _ = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", S = "[object RegExp]", T = "[object Set]", N = "[object String]", $ = "[object Undefined]",
|
|
845
|
-
F[K] = F[z] = F[
|
|
846
|
-
var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self, O = Re || $e || Function("return this")(), ee = e && !e.nodeType && e,
|
|
844
|
+
var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", p = "[object Error]", _ = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", S = "[object RegExp]", T = "[object Set]", N = "[object String]", $ = "[object Undefined]", G = "[object WeakMap]", Z = "[object ArrayBuffer]", te = "[object DataView]", K = "[object Float32Array]", z = "[object Float64Array]", W = "[object Int8Array]", P = "[object Int16Array]", oe = "[object Int32Array]", st = "[object Uint8Array]", le = "[object Uint8ClampedArray]", be = "[object Uint16Array]", ye = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Be = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, F = {};
|
|
845
|
+
F[K] = F[z] = F[W] = F[P] = F[oe] = F[st] = F[le] = F[be] = F[ye] = !0, F[o] = F[c] = F[Z] = F[d] = F[te] = F[g] = F[p] = F[_] = F[b] = F[w] = F[y] = F[S] = F[T] = F[N] = F[G] = !1;
|
|
846
|
+
var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self, O = Re || $e || Function("return this")(), ee = e && !e.nodeType && e, V = ee && !0 && i && !i.nodeType && i, Y = V && V.exports === ee, me = Y && Re.process, we = function() {
|
|
847
847
|
try {
|
|
848
|
-
var l =
|
|
848
|
+
var l = V && V.require && V.require("util").types;
|
|
849
849
|
return l || me && me.binding && me.binding("util");
|
|
850
850
|
} catch {
|
|
851
851
|
}
|
|
@@ -886,7 +886,7 @@ function fn() {
|
|
|
886
886
|
return l ? "Symbol(src)_1." + l : "";
|
|
887
887
|
}(), Ft = ze.toString, Si = Ve.call(Object), Ti = RegExp(
|
|
888
888
|
"^" + Ve.call(ae).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
889
|
-
), We =
|
|
889
|
+
), We = Y ? O.Buffer : void 0, Ht = O.Symbol, Bt = O.Uint8Array;
|
|
890
890
|
We && We.allocUnsafe;
|
|
891
891
|
var It = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = ze.propertyIsEnumerable, ki = Ce.splice, de = Ht ? Ht.toStringTag : void 0, Ye = function() {
|
|
892
892
|
try {
|
|
@@ -894,7 +894,7 @@ function fn() {
|
|
|
894
894
|
return l({}, "", {}), l;
|
|
895
895
|
} catch {
|
|
896
896
|
}
|
|
897
|
-
}(),
|
|
897
|
+
}(), Ei = We ? We.isBuffer : void 0, $t = Math.max, Li = Date.now, Pt = lt(O, "Map"), Ae = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
|
|
898
898
|
function l() {
|
|
899
899
|
}
|
|
900
900
|
return function(u) {
|
|
@@ -1025,14 +1025,14 @@ function fn() {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
_e.prototype.clear = Gi, _e.prototype.delete = Zi, _e.prototype.get = qi, _e.prototype.has = Ji, _e.prototype.set = Qi;
|
|
1027
1027
|
function Ki(l, u) {
|
|
1028
|
-
var m = dt(l), A = !m && ht(l), D = !m && !A && Yt(l), H = !m && !A && !D && Xt(l), B = m || A || D || H,
|
|
1028
|
+
var m = dt(l), A = !m && ht(l), D = !m && !A && Yt(l), H = !m && !A && !D && Xt(l), B = m || A || D || H, L = B ? Oe(l.length, String) : [], I = L.length;
|
|
1029
1029
|
for (var q in l)
|
|
1030
1030
|
B && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1031
1031
|
(q == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1032
1032
|
D && (q == "offset" || q == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1033
1033
|
H && (q == "buffer" || q == "byteLength" || q == "byteOffset") || // Skip index properties.
|
|
1034
|
-
Vt(q, I)) ||
|
|
1035
|
-
return
|
|
1034
|
+
Vt(q, I)) || L.push(q);
|
|
1035
|
+
return L;
|
|
1036
1036
|
}
|
|
1037
1037
|
function rt(l, u, m) {
|
|
1038
1038
|
(m !== void 0 && !Ge(l[u], m) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
@@ -1084,23 +1084,23 @@ function fn() {
|
|
|
1084
1084
|
if (D || (D = new _e()), fe(H))
|
|
1085
1085
|
as(l, u, B, m, zt, A, D);
|
|
1086
1086
|
else {
|
|
1087
|
-
var
|
|
1088
|
-
|
|
1087
|
+
var L = A ? A(ct(l, B), H, B + "", l, u, D) : void 0;
|
|
1088
|
+
L === void 0 && (L = H), rt(l, B, L);
|
|
1089
1089
|
}
|
|
1090
1090
|
}, Ut);
|
|
1091
1091
|
}
|
|
1092
1092
|
function as(l, u, m, A, D, H, B) {
|
|
1093
|
-
var
|
|
1093
|
+
var L = ct(l, m), I = ct(u, m), q = B.get(I);
|
|
1094
1094
|
if (q) {
|
|
1095
1095
|
rt(l, m, q);
|
|
1096
1096
|
return;
|
|
1097
1097
|
}
|
|
1098
|
-
var
|
|
1098
|
+
var j = H ? H(L, I, m + "", l, u, B) : void 0, Se = j === void 0;
|
|
1099
1099
|
if (Se) {
|
|
1100
1100
|
var gt = dt(I), mt = !gt && Yt(I), Zt = !gt && !mt && Xt(I);
|
|
1101
|
-
|
|
1101
|
+
j = I, gt || mt || Zt ? dt(L) ? j = L : Ss(L) ? j = ds(L) : mt ? (Se = !1, j = ls(I)) : Zt ? (Se = !1, j = hs(I)) : j = [] : Ts(I) || ht(I) ? (j = L, ht(L) ? j = Ds(L) : (!fe(L) || ft(L)) && (j = ps(I))) : Se = !1;
|
|
1102
1102
|
}
|
|
1103
|
-
Se && (B.set(I,
|
|
1103
|
+
Se && (B.set(I, j), D(j, I, A, H, B), B.delete(I)), rt(l, m, j);
|
|
1104
1104
|
}
|
|
1105
1105
|
function rs(l, u) {
|
|
1106
1106
|
return Cs(xs(l, u, Gt), l + "");
|
|
@@ -1109,7 +1109,7 @@ function fn() {
|
|
|
1109
1109
|
return Ye(l, "toString", {
|
|
1110
1110
|
configurable: !0,
|
|
1111
1111
|
enumerable: !1,
|
|
1112
|
-
value:
|
|
1112
|
+
value: Es(u),
|
|
1113
1113
|
writable: !0
|
|
1114
1114
|
});
|
|
1115
1115
|
} : Gt;
|
|
@@ -1134,8 +1134,8 @@ function fn() {
|
|
|
1134
1134
|
var D = !m;
|
|
1135
1135
|
m || (m = {});
|
|
1136
1136
|
for (var H = -1, B = u.length; ++H < B; ) {
|
|
1137
|
-
var
|
|
1138
|
-
I === void 0 && (I = l[
|
|
1137
|
+
var L = u[H], I = void 0;
|
|
1138
|
+
I === void 0 && (I = l[L]), D ? ot(m, L, I) : es(m, L, I);
|
|
1139
1139
|
}
|
|
1140
1140
|
return m;
|
|
1141
1141
|
}
|
|
@@ -1143,15 +1143,15 @@ function fn() {
|
|
|
1143
1143
|
return rs(function(u, m) {
|
|
1144
1144
|
var A = -1, D = m.length, H = D > 1 ? m[D - 1] : void 0, B = D > 2 ? m[2] : void 0;
|
|
1145
1145
|
for (H = l.length > 3 && typeof H == "function" ? (D--, H) : void 0, B && _s(m[0], m[1], B) && (H = D < 3 ? void 0 : H, D = 1), u = Object(u); ++A < D; ) {
|
|
1146
|
-
var
|
|
1147
|
-
|
|
1146
|
+
var L = m[A];
|
|
1147
|
+
L && l(u, L, A, H);
|
|
1148
1148
|
}
|
|
1149
1149
|
return u;
|
|
1150
1150
|
});
|
|
1151
1151
|
}
|
|
1152
1152
|
function gs(l) {
|
|
1153
1153
|
return function(u, m, A) {
|
|
1154
|
-
for (var D = -1, H = Object(u), B = A(u),
|
|
1154
|
+
for (var D = -1, H = Object(u), B = A(u), L = B.length; L--; ) {
|
|
1155
1155
|
var I = B[++D];
|
|
1156
1156
|
if (m(H[I], I, H) === !1)
|
|
1157
1157
|
break;
|
|
@@ -1216,9 +1216,9 @@ function fn() {
|
|
|
1216
1216
|
for (var A = arguments, D = -1, H = $t(A.length - u, 0), B = Array(H); ++D < H; )
|
|
1217
1217
|
B[D] = A[u + D];
|
|
1218
1218
|
D = -1;
|
|
1219
|
-
for (var
|
|
1220
|
-
|
|
1221
|
-
return
|
|
1219
|
+
for (var L = Array(u + 1); ++D < u; )
|
|
1220
|
+
L[D] = A[D];
|
|
1221
|
+
return L[u] = m(B), Pe(l, this, L);
|
|
1222
1222
|
};
|
|
1223
1223
|
}
|
|
1224
1224
|
function ct(l, u) {
|
|
@@ -1229,7 +1229,7 @@ function fn() {
|
|
|
1229
1229
|
function As(l) {
|
|
1230
1230
|
var u = 0, m = 0;
|
|
1231
1231
|
return function() {
|
|
1232
|
-
var A =
|
|
1232
|
+
var A = Li(), D = a - (A - m);
|
|
1233
1233
|
if (m = A, D > 0) {
|
|
1234
1234
|
if (++u >= n)
|
|
1235
1235
|
return arguments[0];
|
|
@@ -1265,7 +1265,7 @@ function fn() {
|
|
|
1265
1265
|
function Ss(l) {
|
|
1266
1266
|
return Me(l) && ut(l);
|
|
1267
1267
|
}
|
|
1268
|
-
var Yt =
|
|
1268
|
+
var Yt = Ei || Ls;
|
|
1269
1269
|
function ft(l) {
|
|
1270
1270
|
if (!fe(l))
|
|
1271
1271
|
return !1;
|
|
@@ -1301,7 +1301,7 @@ function fn() {
|
|
|
1301
1301
|
var ks = fs(function(l, u, m) {
|
|
1302
1302
|
zt(l, u, m);
|
|
1303
1303
|
});
|
|
1304
|
-
function
|
|
1304
|
+
function Es(l) {
|
|
1305
1305
|
return function() {
|
|
1306
1306
|
return l;
|
|
1307
1307
|
};
|
|
@@ -1309,7 +1309,7 @@ function fn() {
|
|
|
1309
1309
|
function Gt(l) {
|
|
1310
1310
|
return l;
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1312
|
+
function Ls() {
|
|
1313
1313
|
return !1;
|
|
1314
1314
|
}
|
|
1315
1315
|
i.exports = ks;
|
|
@@ -1403,7 +1403,7 @@ class pn {
|
|
|
1403
1403
|
return this._trade;
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
|
-
class
|
|
1406
|
+
class U {
|
|
1407
1407
|
constructor(e) {
|
|
1408
1408
|
f(this, "x");
|
|
1409
1409
|
f(this, "y");
|
|
@@ -1446,32 +1446,32 @@ class j {
|
|
|
1446
1446
|
}
|
|
1447
1447
|
class _n {
|
|
1448
1448
|
constructor(e, t) {
|
|
1449
|
-
f(this, "_chart", new
|
|
1450
|
-
f(this, "_area", new
|
|
1451
|
-
f(this, "_xAxis", new
|
|
1452
|
-
f(this, "_yAxis", new
|
|
1453
|
-
f(this, "_axisIntersection", new
|
|
1449
|
+
f(this, "_chart", new U());
|
|
1450
|
+
f(this, "_area", new U());
|
|
1451
|
+
f(this, "_xAxis", new U());
|
|
1452
|
+
f(this, "_yAxis", new U());
|
|
1453
|
+
f(this, "_axisIntersection", new U());
|
|
1454
1454
|
const { xAxis: s, yAxis: n } = t;
|
|
1455
|
-
this._chart = new
|
|
1455
|
+
this._chart = new U(e), this._calc(s, n);
|
|
1456
1456
|
}
|
|
1457
1457
|
_calc(e, t) {
|
|
1458
1458
|
const s = e.isShow ? e.height : 0, n = t.isShow ? t.width : 0, a = this._chart.height - s, r = this._chart.width - n;
|
|
1459
|
-
this._area = new
|
|
1459
|
+
this._area = new U({
|
|
1460
1460
|
x: t.position === "left" ? n : 0,
|
|
1461
1461
|
y: e.position === "top" ? s : 0,
|
|
1462
1462
|
width: r,
|
|
1463
1463
|
height: a
|
|
1464
|
-
}), this._xAxis = new
|
|
1464
|
+
}), this._xAxis = new U({
|
|
1465
1465
|
y: e.position === "top" ? 0 : a,
|
|
1466
1466
|
x: t.position === "left" ? n : 0,
|
|
1467
1467
|
height: s,
|
|
1468
1468
|
width: r
|
|
1469
|
-
}), this._yAxis = new
|
|
1469
|
+
}), this._yAxis = new U({
|
|
1470
1470
|
y: e.position === "top" ? s : 0,
|
|
1471
1471
|
x: t.position === "left" ? 0 : r,
|
|
1472
1472
|
width: n,
|
|
1473
1473
|
height: a
|
|
1474
|
-
}), this._axisIntersection = new
|
|
1474
|
+
}), this._axisIntersection = new U({
|
|
1475
1475
|
y: e.position === "top" ? 0 : a,
|
|
1476
1476
|
x: t.position === "left" ? 0 : r,
|
|
1477
1477
|
width: n,
|
|
@@ -1484,7 +1484,7 @@ class _n {
|
|
|
1484
1484
|
}
|
|
1485
1485
|
update(e) {
|
|
1486
1486
|
const { xAxis: t, yAxis: s } = e.config;
|
|
1487
|
-
this._chart = new
|
|
1487
|
+
this._chart = new U(e.container), this._calc(t, s);
|
|
1488
1488
|
}
|
|
1489
1489
|
get area() {
|
|
1490
1490
|
return this._area;
|
|
@@ -1650,12 +1650,12 @@ class vi {
|
|
|
1650
1650
|
}
|
|
1651
1651
|
class bi extends vi {
|
|
1652
1652
|
constructor() {
|
|
1653
|
-
super(), this._scale =
|
|
1653
|
+
super(), this._scale = E.scaleTime();
|
|
1654
1654
|
}
|
|
1655
1655
|
}
|
|
1656
1656
|
class wn extends vi {
|
|
1657
1657
|
constructor() {
|
|
1658
|
-
super(), this._scale =
|
|
1658
|
+
super(), this._scale = E.scaleLinear();
|
|
1659
1659
|
}
|
|
1660
1660
|
}
|
|
1661
1661
|
const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
@@ -1672,7 +1672,7 @@ const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
|
1672
1672
|
const [t, s] = e.domain().map((o) => o.getTime()), n = i.filter((o) => {
|
|
1673
1673
|
const c = o.open_time.getTime();
|
|
1674
1674
|
return c >= t && c <= s;
|
|
1675
|
-
}), a =
|
|
1675
|
+
}), a = E.min(n, (o) => o.low), r = E.max(n, (o) => o.high);
|
|
1676
1676
|
if (a == null || r == null) throw new Error("Invalid Y data");
|
|
1677
1677
|
return [a, r];
|
|
1678
1678
|
};
|
|
@@ -1681,7 +1681,7 @@ class Mn {
|
|
|
1681
1681
|
this.model = e;
|
|
1682
1682
|
}
|
|
1683
1683
|
initX(e) {
|
|
1684
|
-
const t = this.model.candles.preparedData, s =
|
|
1684
|
+
const t = this.model.candles.preparedData, s = E.extent(t, (n) => new Date(n.open_time));
|
|
1685
1685
|
if (!s[0] || !s[1]) throw new Error("Invalid x data");
|
|
1686
1686
|
e.setDomain(s), this.setRange(e, this.model.layout.xAxis), this.setDefaultXDomain(e), this.applyOffset(e);
|
|
1687
1687
|
}
|
|
@@ -1999,7 +1999,7 @@ const kn = {
|
|
|
1999
1999
|
}
|
|
2000
2000
|
}
|
|
2001
2001
|
};
|
|
2002
|
-
class
|
|
2002
|
+
class En {
|
|
2003
2003
|
constructor(e) {
|
|
2004
2004
|
f(this, "_scheme");
|
|
2005
2005
|
this._scheme = Qe({}, kn, e), Object.keys(this._scheme).forEach((t) => {
|
|
@@ -2013,7 +2013,7 @@ class Ln {
|
|
|
2013
2013
|
this._scheme = Qe({}, this._scheme, e);
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
|
-
class
|
|
2016
|
+
class Ln {
|
|
2017
2017
|
constructor(e, t) {
|
|
2018
2018
|
f(this, "_data");
|
|
2019
2019
|
f(this, "_callbacks", {
|
|
@@ -2078,7 +2078,7 @@ class Nn {
|
|
|
2078
2078
|
f(this, "trade");
|
|
2079
2079
|
f(this, "userMarkers");
|
|
2080
2080
|
f(this, "comments");
|
|
2081
|
-
this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new
|
|
2081
|
+
this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new En(o), this.layout = new _n(t, this.config), this.scales = new Sn(this), this.trade = new Tn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new Dn(this, r), this.comments = new Ln(c, this);
|
|
2082
2082
|
}
|
|
2083
2083
|
init() {
|
|
2084
2084
|
this.eventBus.emit("init_model");
|
|
@@ -2186,7 +2186,7 @@ function Hn(i, e) {
|
|
|
2186
2186
|
colorScheme: { xAxis: s },
|
|
2187
2187
|
config: { xAxis: n },
|
|
2188
2188
|
scales: a
|
|
2189
|
-
} = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c =
|
|
2189
|
+
} = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = E.timeFormat("%d %b"), h = E.timeFormat("%H:%M");
|
|
2190
2190
|
i.save(), i.fillStyle = s.bg, i.fillRect(t.x, t.y, t.width, t.height), i.restore(), i.fillStyle = s.text, i.font = `${n.text.fontSize} ${n.text.font}`, i.textAlign = "center", i.textBaseline = "middle", r.forEach((d) => {
|
|
2191
2191
|
const g = a.x.convert(d), p = o(d) ? c(d) : h(d);
|
|
2192
2192
|
i.fillText(p, g, t.y + t.height / 2);
|
|
@@ -2861,7 +2861,7 @@ function R(i, e) {
|
|
|
2861
2861
|
function it(i) {
|
|
2862
2862
|
return Math.min(1, Math.max(0, i));
|
|
2863
2863
|
}
|
|
2864
|
-
function
|
|
2864
|
+
function X(i) {
|
|
2865
2865
|
return parseInt(i, 16);
|
|
2866
2866
|
}
|
|
2867
2867
|
function ra(i) {
|
|
@@ -2880,7 +2880,7 @@ function wi(i) {
|
|
|
2880
2880
|
return Math.round(parseFloat(i) * 255).toString(16);
|
|
2881
2881
|
}
|
|
2882
2882
|
function fi(i) {
|
|
2883
|
-
return
|
|
2883
|
+
return X(i) / 255;
|
|
2884
2884
|
}
|
|
2885
2885
|
var J = function() {
|
|
2886
2886
|
var i = "[-\\+]?\\d+%?", e = "[-\\+]?\\d*\\.\\d+%?", t = "(?:" + e + ")|(?:" + i + ")", s = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?", n = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?";
|
|
@@ -2943,26 +2943,26 @@ function la(i) {
|
|
|
2943
2943
|
v: t[3],
|
|
2944
2944
|
a: t[4]
|
|
2945
2945
|
} : (t = J.hex8.exec(i)) ? {
|
|
2946
|
-
r:
|
|
2947
|
-
g:
|
|
2948
|
-
b:
|
|
2946
|
+
r: X(t[1]),
|
|
2947
|
+
g: X(t[2]),
|
|
2948
|
+
b: X(t[3]),
|
|
2949
2949
|
a: fi(t[4]),
|
|
2950
2950
|
format: e ? "name" : "hex8"
|
|
2951
2951
|
} : (t = J.hex6.exec(i)) ? {
|
|
2952
|
-
r:
|
|
2953
|
-
g:
|
|
2954
|
-
b:
|
|
2952
|
+
r: X(t[1]),
|
|
2953
|
+
g: X(t[2]),
|
|
2954
|
+
b: X(t[3]),
|
|
2955
2955
|
format: e ? "name" : "hex"
|
|
2956
2956
|
} : (t = J.hex4.exec(i)) ? {
|
|
2957
|
-
r:
|
|
2958
|
-
g:
|
|
2959
|
-
b:
|
|
2957
|
+
r: X(t[1] + "" + t[1]),
|
|
2958
|
+
g: X(t[2] + "" + t[2]),
|
|
2959
|
+
b: X(t[3] + "" + t[3]),
|
|
2960
2960
|
a: fi(t[4] + "" + t[4]),
|
|
2961
2961
|
format: e ? "name" : "hex8"
|
|
2962
2962
|
} : (t = J.hex3.exec(i)) ? {
|
|
2963
|
-
r:
|
|
2964
|
-
g:
|
|
2965
|
-
b:
|
|
2963
|
+
r: X(t[1] + "" + t[1]),
|
|
2964
|
+
g: X(t[2] + "" + t[2]),
|
|
2965
|
+
b: X(t[3] + "" + t[3]),
|
|
2966
2966
|
format: e ? "name" : "hex"
|
|
2967
2967
|
} : !1;
|
|
2968
2968
|
}
|
|
@@ -3094,7 +3094,7 @@ function ga(i) {
|
|
|
3094
3094
|
return s.length ? s.join(" ") : "0s";
|
|
3095
3095
|
}
|
|
3096
3096
|
const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
3097
|
-
var
|
|
3097
|
+
var W;
|
|
3098
3098
|
const {
|
|
3099
3099
|
scales: { x: t, y: s },
|
|
3100
3100
|
trade: { entries: n, exits: a, holdTime: r },
|
|
@@ -3110,12 +3110,12 @@ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
|
3110
3110
|
if (!p || !_) return;
|
|
3111
3111
|
const v = (P) => P ? P instanceof Date ? P : new Date(P) : null, b = v(d == null ? void 0 : d[0]) || p.candle.open_time, w = v(d == null ? void 0 : d[1]) || _.candle.close_time, x = t.convert(v(d == null ? void 0 : d[0]) || p.candle.open_time), y = t.convert(v(d == null ? void 0 : d[1]) || _.candle.open_time), C = e.candles.allData.filter(
|
|
3112
3112
|
(P) => P.open_time <= w && P.close_time >= b
|
|
3113
|
-
), S = C.length > 0 ? C.reduce((P, oe) => oe.low < P ? oe.low : P, C[0].low) : ((
|
|
3113
|
+
), S = C.length > 0 ? C.reduce((P, oe) => oe.low < P ? oe.low : P, C[0].low) : ((W = n.at(0)) == null ? void 0 : W.price) ?? 0, T = s.convert(g || S);
|
|
3114
3114
|
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(x, T), i.lineTo(y, T), i.stroke(), i.setLineDash([]);
|
|
3115
|
-
const N = (x + y) / 2, $ = h || `Hold: ${ga(r)}`,
|
|
3115
|
+
const N = (x + y) / 2, $ = h || `Hold: ${ga(r)}`, Z = getComputedStyle(
|
|
3116
3116
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3117
3117
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3118
|
-
i.font = `600 ${ma}px ${
|
|
3118
|
+
i.font = `600 ${ma}px ${Z}`;
|
|
3119
3119
|
const K = i.measureText($).width + pa * 2, z = va + _a * 2;
|
|
3120
3120
|
xi(i, {
|
|
3121
3121
|
radius: 4,
|
|
@@ -3240,7 +3240,7 @@ class wa extends ne {
|
|
|
3240
3240
|
}), this.oneBox = new k({
|
|
3241
3241
|
tag: "div",
|
|
3242
3242
|
className: this.clsx("box_one")
|
|
3243
|
-
}), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent:
|
|
3243
|
+
}), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: U.empty() };
|
|
3244
3244
|
}
|
|
3245
3245
|
_createLineNodes(t, s) {
|
|
3246
3246
|
const n = [];
|
|
@@ -3441,7 +3441,7 @@ class ka extends k {
|
|
|
3441
3441
|
}), this.append(s.node, n.node);
|
|
3442
3442
|
}
|
|
3443
3443
|
}
|
|
3444
|
-
function
|
|
3444
|
+
function Et(i, e) {
|
|
3445
3445
|
var n;
|
|
3446
3446
|
const t = (a) => {
|
|
3447
3447
|
if (!document.contains(i.node)) return;
|
|
@@ -3458,7 +3458,7 @@ function Lt(i, e) {
|
|
|
3458
3458
|
document.removeEventListener("mousedown", t), s == null || s();
|
|
3459
3459
|
}, i;
|
|
3460
3460
|
}
|
|
3461
|
-
class
|
|
3461
|
+
class Ea {
|
|
3462
3462
|
constructor() {
|
|
3463
3463
|
f(this, "node");
|
|
3464
3464
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3497,7 +3497,7 @@ class La {
|
|
|
3497
3497
|
}
|
|
3498
3498
|
}
|
|
3499
3499
|
const Te = new re("comment-list");
|
|
3500
|
-
class
|
|
3500
|
+
class La extends k {
|
|
3501
3501
|
constructor({ onDelete: t, onOpenEditor: s, comment: n, layout: a }) {
|
|
3502
3502
|
super({ className: Te.gen("item") });
|
|
3503
3503
|
f(this, "actionTooltip");
|
|
@@ -3514,13 +3514,13 @@ class Ea extends k {
|
|
|
3514
3514
|
onDelete: t,
|
|
3515
3515
|
onUpdate: s
|
|
3516
3516
|
});
|
|
3517
|
-
this.actionTooltip =
|
|
3517
|
+
this.actionTooltip = Et(c, () => {
|
|
3518
3518
|
this.actionTooltip.setVisible(!1);
|
|
3519
3519
|
}), this.actionsTrigger.node.addEventListener("click", () => {
|
|
3520
3520
|
this.actionsTrigger.updateAbsolutePosition(), this.actionTooltip.updateAbsolutePosition(), this.actionTooltip.node.style.top = this.actionsTrigger.absolutePosition.top - a.chart.top + 20 + "px", this.actionTooltip.node.style.left = this.actionsTrigger.absolutePosition.left - a.chart.left - this.actionTooltip.absolutePosition.width + 10 + "px", this.actionTooltip.setVisible(!0);
|
|
3521
3521
|
});
|
|
3522
3522
|
const h = new k({ className: Te.gen("text-wrap") });
|
|
3523
|
-
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new
|
|
3523
|
+
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new Ea().node), this.append(h.node, o.node);
|
|
3524
3524
|
}
|
|
3525
3525
|
}
|
|
3526
3526
|
class Na {
|
|
@@ -3605,7 +3605,7 @@ class Ia extends ne {
|
|
|
3605
3605
|
},
|
|
3606
3606
|
initialValue: t.text
|
|
3607
3607
|
});
|
|
3608
|
-
const s = new
|
|
3608
|
+
const s = new La({
|
|
3609
3609
|
onDelete: () => {
|
|
3610
3610
|
this._model.comments.remove(t.id), s.actionTooltip.setVisible(!1);
|
|
3611
3611
|
},
|
|
@@ -3745,7 +3745,7 @@ class Va extends ne {
|
|
|
3745
3745
|
}, this.pointer.position(r), this.anchor = new za({ x: r.x, className: mi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
|
|
3746
3746
|
const h = !this.state.isActive;
|
|
3747
3747
|
h ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: h });
|
|
3748
|
-
}), this.tooltip =
|
|
3748
|
+
}), this.tooltip = Et(new Pa(a, s, n), (h) => {
|
|
3749
3749
|
this.state.isActive && (this.anchor.node.contains(h.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
|
|
3750
3750
|
}), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
|
|
3751
3751
|
}
|
|
@@ -3777,7 +3777,7 @@ class Ya extends ne {
|
|
|
3777
3777
|
f(this, "_size", null);
|
|
3778
3778
|
f(this, "_model", null);
|
|
3779
3779
|
f(this, "_candle", null);
|
|
3780
|
-
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }),
|
|
3780
|
+
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }), Et(this.menu, () => {
|
|
3781
3781
|
this.setState({ isShow: !1 });
|
|
3782
3782
|
}), this.addField = new Ai({
|
|
3783
3783
|
blockName: "context-add",
|
|
@@ -3888,7 +3888,7 @@ class Ua extends Fe {
|
|
|
3888
3888
|
if (e.config.guides.isShowX) {
|
|
3889
3889
|
const n = e.config.xAxis.position;
|
|
3890
3890
|
this.canvas.drawMarker({
|
|
3891
|
-
text:
|
|
3891
|
+
text: E.timeFormat("%a %d, %b %y %H:%M")(e.scales.x.invert(t)),
|
|
3892
3892
|
startLineCoords: { x: t, y: 0 },
|
|
3893
3893
|
endMarkerCoords: { x: t, y: e.layout.xAxis[n] },
|
|
3894
3894
|
side: n,
|
|
@@ -3903,7 +3903,7 @@ class Ga extends ne {
|
|
|
3903
3903
|
super({ className: t });
|
|
3904
3904
|
f(this, "_isFirstShow", !1);
|
|
3905
3905
|
const s = new k({ tag: "p" });
|
|
3906
|
-
s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent:
|
|
3906
|
+
s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: U.empty() }, this.render();
|
|
3907
3907
|
}
|
|
3908
3908
|
render() {
|
|
3909
3909
|
const { isShow: t, x: s, y: n, parent: a } = this.state;
|
|
@@ -4455,7 +4455,7 @@ function Mt(i, e) {
|
|
|
4455
4455
|
function St(i) {
|
|
4456
4456
|
return i.candles.limiter.absolutePosition.width > 0;
|
|
4457
4457
|
}
|
|
4458
|
-
class
|
|
4458
|
+
class Lt {
|
|
4459
4459
|
constructor(e, t, s) {
|
|
4460
4460
|
f(this, "_model");
|
|
4461
4461
|
f(this, "_hitManager");
|
|
@@ -4463,7 +4463,7 @@ class Et {
|
|
|
4463
4463
|
this._model = e, this._hitManager = t, this._hit = s, t.register(s);
|
|
4464
4464
|
}
|
|
4465
4465
|
}
|
|
4466
|
-
class hr extends
|
|
4466
|
+
class hr extends Lt {
|
|
4467
4467
|
constructor(t, s, n) {
|
|
4468
4468
|
super(t, s, new ar(t));
|
|
4469
4469
|
f(this, "_view");
|
|
@@ -4478,7 +4478,7 @@ class hr extends Et {
|
|
|
4478
4478
|
});
|
|
4479
4479
|
}
|
|
4480
4480
|
}
|
|
4481
|
-
class dr extends
|
|
4481
|
+
class dr extends Lt {
|
|
4482
4482
|
constructor(e, t) {
|
|
4483
4483
|
super(e, t, new or(e));
|
|
4484
4484
|
}
|
|
@@ -4491,7 +4491,7 @@ class dr extends Et {
|
|
|
4491
4491
|
});
|
|
4492
4492
|
}
|
|
4493
4493
|
}
|
|
4494
|
-
class ur extends
|
|
4494
|
+
class ur extends Lt {
|
|
4495
4495
|
constructor(t, s, n) {
|
|
4496
4496
|
super(t, n, new rr(t));
|
|
4497
4497
|
f(this, "_view");
|
|
@@ -4696,7 +4696,11 @@ class _r {
|
|
|
4696
4696
|
const _ = [];
|
|
4697
4697
|
if (t.pair && _.push({ label: "", value: t.pair }), t.net_pnl !== void 0) {
|
|
4698
4698
|
const C = t.net_pnl.startsWith("+");
|
|
4699
|
-
_.push({
|
|
4699
|
+
_.push({
|
|
4700
|
+
label: "Net P&L",
|
|
4701
|
+
value: t.net_pnl,
|
|
4702
|
+
valueColor: C ? "#56B683" : "#F18169"
|
|
4703
|
+
});
|
|
4700
4704
|
}
|
|
4701
4705
|
t.type && _.push({ label: "Type", value: t.type }), t.entry_price && _.push({ label: "Entry", value: t.entry_price }), t.exit_price && _.push({ label: "Exit", value: t.exit_price }), t.open_date && _.push({ label: "Open date", value: t.open_date }), t.close_date && _.push({ label: "Close date", value: t.close_date }), t.holdtime && _.push({ label: "Holdtime", value: t.holdtime }), t.rr && _.push({ label: "RR", value: t.rr }), t.volume && _.push({ label: "Volume", value: t.volume });
|
|
4702
4706
|
const v = p + c / 2, b = 24 * r;
|
|
@@ -4727,71 +4731,86 @@ class _r {
|
|
|
4727
4731
|
return;
|
|
4728
4732
|
}
|
|
4729
4733
|
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, S = w - x - y - C, T = b, N = p / _, $ = T / S;
|
|
4730
|
-
let
|
|
4731
|
-
N > $ ? (
|
|
4732
|
-
const z = window.devicePixelRatio || 1,
|
|
4733
|
-
|
|
4734
|
-
const P =
|
|
4734
|
+
let G, Z, te = 0, K = 0;
|
|
4735
|
+
N > $ ? (Z = S, G = Z * N, te = 0, K = 0) : (G = T, Z = G / N, K = (S - Z) / 2);
|
|
4736
|
+
const z = window.devicePixelRatio || 1, W = document.createElement("canvas");
|
|
4737
|
+
W.width = b * z, W.height = w * z;
|
|
4738
|
+
const P = W.getContext("2d");
|
|
4735
4739
|
if (!P) {
|
|
4736
4740
|
console.error("Failed to get 2D context for merged canvas");
|
|
4737
4741
|
return;
|
|
4738
4742
|
}
|
|
4739
|
-
P.fillStyle = h ? "#101011" : "#ffffff", P.fillRect(0, 0,
|
|
4743
|
+
P.fillStyle = h ? "#101011" : "#ffffff", P.fillRect(0, 0, W.width, W.height);
|
|
4740
4744
|
const oe = x * z, st = y * z, le = S * z, be = T * z, ye = oe + st;
|
|
4741
|
-
await this._drawHeader(P,
|
|
4745
|
+
await this._drawHeader(P, W.width, z, h), this._drawHeaderSecondLine(
|
|
4746
|
+
P,
|
|
4747
|
+
r,
|
|
4748
|
+
o,
|
|
4749
|
+
W.width,
|
|
4750
|
+
oe,
|
|
4751
|
+
z,
|
|
4752
|
+
h
|
|
4753
|
+
);
|
|
4742
4754
|
const He = this._view.mainCanvas;
|
|
4743
|
-
He.background && (P.fillStyle = He.background, P.fillRect(0, ye,
|
|
4744
|
-
const Be =
|
|
4755
|
+
He.background && (P.fillStyle = He.background, P.fillRect(0, ye, W.width, le));
|
|
4756
|
+
const Be = G * z, Ie = Z * z, F = te * z, Re = K * z;
|
|
4745
4757
|
v.forEach((O) => {
|
|
4746
|
-
let ee = 0,
|
|
4758
|
+
let ee = 0, V = 0, Y = O.width, me = O.height, we = Be, xe = Ie, Pe = F, Oe = Re;
|
|
4747
4759
|
if (N > $) {
|
|
4748
4760
|
const ce = Ie / O.height, he = O.width * ce;
|
|
4749
|
-
he > be && (ee = (he - be) / ce,
|
|
4761
|
+
he > be && (ee = (he - be) / ce, Y = O.width - ee, we = be, Pe = 0);
|
|
4750
4762
|
} else {
|
|
4751
4763
|
const ce = Be / O.width, he = O.height * ce;
|
|
4752
4764
|
if (he > le) {
|
|
4753
4765
|
const Ce = (he - le) / ce;
|
|
4754
|
-
|
|
4766
|
+
V = Ce / 2, me = O.height - Ce, xe = le, Oe = 0;
|
|
4755
4767
|
}
|
|
4756
4768
|
}
|
|
4757
4769
|
P.drawImage(
|
|
4758
4770
|
O,
|
|
4759
4771
|
ee,
|
|
4760
|
-
|
|
4761
|
-
|
|
4772
|
+
V,
|
|
4773
|
+
Y,
|
|
4762
4774
|
me,
|
|
4763
4775
|
Pe,
|
|
4764
4776
|
ye + Oe,
|
|
4765
4777
|
we,
|
|
4766
4778
|
xe
|
|
4767
4779
|
);
|
|
4768
|
-
}), c && this._drawFooter(
|
|
4780
|
+
}), c && this._drawFooter(
|
|
4781
|
+
P,
|
|
4782
|
+
c,
|
|
4783
|
+
W.width,
|
|
4784
|
+
ye,
|
|
4785
|
+
le,
|
|
4786
|
+
z,
|
|
4787
|
+
h
|
|
4788
|
+
);
|
|
4769
4789
|
const $e = (O, ee) => {
|
|
4770
|
-
const
|
|
4771
|
-
|
|
4790
|
+
const V = URL.createObjectURL(O), Y = document.createElement("a");
|
|
4791
|
+
Y.href = V, Y.download = ee, document.body.appendChild(Y), Y.click(), document.body.removeChild(Y), URL.revokeObjectURL(V);
|
|
4772
4792
|
};
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
if (d)
|
|
4780
|
-
$e(O, t);
|
|
4781
|
-
else
|
|
4782
|
-
try {
|
|
4783
|
-
await navigator.clipboard.write([
|
|
4784
|
-
new ClipboardItem({
|
|
4785
|
-
"image/png": O
|
|
4786
|
-
})
|
|
4787
|
-
]);
|
|
4788
|
-
} catch (ee) {
|
|
4789
|
-
console.error("Failed to copy to clipboard:", ee), $e(O, t);
|
|
4793
|
+
return new Promise((O, ee) => {
|
|
4794
|
+
W.toBlob(
|
|
4795
|
+
async (V) => {
|
|
4796
|
+
if (!V) {
|
|
4797
|
+
ee(new Error("Failed to create blob from canvas"));
|
|
4798
|
+
return;
|
|
4790
4799
|
}
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4800
|
+
if (d)
|
|
4801
|
+
$e(V, t);
|
|
4802
|
+
else
|
|
4803
|
+
try {
|
|
4804
|
+
await navigator.clipboard.write([new ClipboardItem({ "image/png": V })]);
|
|
4805
|
+
} catch (Y) {
|
|
4806
|
+
console.error("Failed to copy to clipboard:", Y), $e(V, t);
|
|
4807
|
+
}
|
|
4808
|
+
a.returnBlob ? O(V) : O();
|
|
4809
|
+
},
|
|
4810
|
+
"image/png",
|
|
4811
|
+
1
|
|
4812
|
+
);
|
|
4813
|
+
});
|
|
4795
4814
|
}
|
|
4796
4815
|
}
|
|
4797
4816
|
export {
|