charts-core 1.1.27 → 1.1.29
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 +368 -445
- 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,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var f = (i, e, t) =>
|
|
1
|
+
var Ns = Object.defineProperty;
|
|
2
|
+
var Fs = (i, e, t) => e in i ? Ns(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var f = (i, e, t) => Fs(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as L 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;
|
|
@@ -8,8 +8,8 @@ const Hs = (i) => {
|
|
|
8
8
|
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((_) => {
|
|
9
9
|
let p = L.axisRight(s);
|
|
10
10
|
o && c ? p = p.tickFormat(c) : p = p.tickFormat((v) => {
|
|
11
|
-
const b = Number(v),
|
|
12
|
-
return Math.abs(b) >= 1e12 ?
|
|
11
|
+
const b = Number(v), w = (x) => x.toString().replace(/\.0+$/, "");
|
|
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);
|
|
13
13
|
}), o && d && (p = Array.isArray(d) ? p.ticks(...d) : p.ticks(d)), o && h && (p = p.tickValues(h)), _.call(p);
|
|
14
14
|
}).call((_) => {
|
|
15
15
|
let p = [];
|
|
@@ -17,101 +17,24 @@ const Hs = (i) => {
|
|
|
17
17
|
}).call((_) => _.select(".domain").remove()).call((_) => _.selectAll(".tick line").remove()).call((_) => {
|
|
18
18
|
const p = _.selectAll(".tick text");
|
|
19
19
|
p.classed("sc-charts__y-axis-tick", !0).attr("text-anchor", "start");
|
|
20
|
-
const v = p.nodes().map((
|
|
21
|
-
_.selectAll(".tick").each(function(
|
|
22
|
-
var
|
|
23
|
-
const y = L.select(this),
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
}).attr("font-family", "inherit");
|
|
27
|
-
}, Is = (i) => {
|
|
28
|
-
const { svg: e, config: t, x: s, height: n, data: a, width: r } = i, { margin: o, xAxis: c } = t, { isShow: h, tickValues: d, tickFormat: g, customTicks: _, ticks: p } = c;
|
|
29
|
-
if (!h) return null;
|
|
30
|
-
let v = null, b = null;
|
|
31
|
-
a.length > 0 && (v = new Date(
|
|
32
|
-
a[0].date.getFullYear(),
|
|
33
|
-
a[0].date.getMonth(),
|
|
34
|
-
a[0].date.getDate()
|
|
35
|
-
), b = new Date(
|
|
36
|
-
a[a.length - 1].date.getFullYear(),
|
|
37
|
-
a[a.length - 1].date.getMonth(),
|
|
38
|
-
a[a.length - 1].date.getDate()
|
|
39
|
-
));
|
|
40
|
-
let x = null, C = g;
|
|
41
|
-
if (a.length > 0 && a.length <= 10 && !d) {
|
|
42
|
-
const y = /* @__PURE__ */ new Set();
|
|
43
|
-
if (a.forEach((w) => {
|
|
44
|
-
const T = new Date(w.date.getFullYear(), w.date.getMonth(), w.date.getDate()).getTime();
|
|
45
|
-
y.add(T.toString());
|
|
46
|
-
}), x = Array.from(y).map((w) => new Date(parseInt(w))).sort((w, T) => w.getTime() - T.getTime()), v && b) {
|
|
47
|
-
const w = x.some(
|
|
48
|
-
(S) => S.getFullYear() === v.getFullYear() && S.getMonth() === v.getMonth() && S.getDate() === v.getDate()
|
|
49
|
-
), T = x.some(
|
|
50
|
-
(S) => S.getFullYear() === b.getFullYear() && S.getMonth() === b.getMonth() && S.getDate() === b.getDate()
|
|
51
|
-
);
|
|
52
|
-
w || (x.unshift(v), x.sort((S, D) => S.getTime() - D.getTime())), T || (x.push(b), x.sort((S, D) => S.getTime() - D.getTime()));
|
|
53
|
-
}
|
|
54
|
-
g || (C = (w) => {
|
|
55
|
-
const T = new Date(w);
|
|
56
|
-
return new Intl.DateTimeFormat("en-US", {
|
|
57
|
-
month: "short",
|
|
58
|
-
day: "numeric"
|
|
59
|
-
}).format(T);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
e.append("g").attr("transform", `translate(0,${n - o.bottom})`).call((y) => {
|
|
63
|
-
let w = L.axisBottom(s);
|
|
64
|
-
if (_)
|
|
65
|
-
if (C && (w = w.tickFormat(C)), x)
|
|
66
|
-
w = w.tickValues(x);
|
|
67
|
-
else if (d) {
|
|
68
|
-
const T = d.map((S) => new Date(S));
|
|
69
|
-
if (v && b) {
|
|
70
|
-
const S = T.some(
|
|
71
|
-
(k) => k.getFullYear() === v.getFullYear() && k.getMonth() === v.getMonth() && k.getDate() === v.getDate()
|
|
72
|
-
), D = T.some(
|
|
73
|
-
(k) => k.getFullYear() === b.getFullYear() && k.getMonth() === b.getMonth() && k.getDate() === b.getDate()
|
|
74
|
-
);
|
|
75
|
-
S || (T.unshift(v), T.sort((k, P) => k.getTime() - P.getTime())), D || (T.push(b), T.sort((k, P) => k.getTime() - P.getTime()));
|
|
76
|
-
}
|
|
77
|
-
w = w.tickValues(T);
|
|
78
|
-
} else p && (w = Array.isArray(p) ? w.ticks(...p) : w.ticks(p));
|
|
79
|
-
else
|
|
80
|
-
w.ticks(5);
|
|
81
|
-
y.call(w);
|
|
82
|
-
}).call((y) => y.select(".domain").remove()).call((y) => {
|
|
83
|
-
let w = [];
|
|
84
|
-
y.selectAll(".tick").each((T) => w.push(T)), i.xTicks = w;
|
|
85
|
-
}).call((y) => y.selectAll(".tick line").remove()).call((y) => y.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).call((y) => {
|
|
86
|
-
v && b && requestAnimationFrame(() => {
|
|
87
|
-
const w = y.selectAll(".tick");
|
|
88
|
-
let T = null, S = null;
|
|
89
|
-
if (w.each(function(D) {
|
|
90
|
-
const k = D, P = new Date(
|
|
91
|
-
k.getFullYear(),
|
|
92
|
-
k.getMonth(),
|
|
93
|
-
k.getDate()
|
|
94
|
-
), z = new Date(
|
|
95
|
-
v.getFullYear(),
|
|
96
|
-
v.getMonth(),
|
|
97
|
-
v.getDate()
|
|
98
|
-
), Y = new Date(
|
|
99
|
-
b.getFullYear(),
|
|
100
|
-
b.getMonth(),
|
|
101
|
-
b.getDate()
|
|
102
|
-
);
|
|
103
|
-
P.getTime() === z.getTime() && (T = L.select(this)), P.getTime() === Y.getTime() && (S = L.select(this));
|
|
104
|
-
}), T) {
|
|
105
|
-
const D = T.select("text");
|
|
106
|
-
T.attr("transform", `translate(${o.left},0)`), D.attr("text-anchor", "start").attr("dx", "0");
|
|
107
|
-
}
|
|
108
|
-
if (S) {
|
|
109
|
-
const D = S.select("text");
|
|
110
|
-
S.attr("transform", `translate(${r - o.right},0)`), D.attr("text-anchor", "end").attr("dx", "0");
|
|
111
|
-
}
|
|
20
|
+
const v = p.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
|
|
21
|
+
_.selectAll(".tick").each(function(w, x) {
|
|
22
|
+
var $;
|
|
23
|
+
const y = L.select(this), C = y.select("text"), M = v[x], S = b - M, N = y.append("g").attr("transform", "translate(10, 0)");
|
|
24
|
+
C.attr("x", S), C.remove(), ($ = N.node()) == null || $.appendChild(C.node());
|
|
112
25
|
});
|
|
113
26
|
}).attr("font-family", "inherit");
|
|
114
27
|
}, Bs = (i) => {
|
|
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
|
+
if (!o) return null;
|
|
30
|
+
e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((_) => {
|
|
31
|
+
let p = L.axisBottom(s);
|
|
32
|
+
d ? (h && (p = p.tickFormat(h)), g && (p = Array.isArray(g) ? p.ticks(...g) : p.ticks(g)), c && (p = p.tickValues(c))) : p.ticks(5), _.call(p);
|
|
33
|
+
}).call((_) => _.select(".domain").remove()).call((_) => {
|
|
34
|
+
let p = [];
|
|
35
|
+
_.selectAll(".tick").each((v) => p.push(v)), i.xTicks = p;
|
|
36
|
+
}).call((_) => _.selectAll(".tick line").remove()).call((_) => _.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
|
|
37
|
+
}, Is = (i) => {
|
|
115
38
|
const { svg: e, config: t, y: s, width: n } = i, {
|
|
116
39
|
margin: a,
|
|
117
40
|
grid: { horizontalStyle: r }
|
|
@@ -177,44 +100,44 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
177
100
|
}), h === "hovered-circles")) {
|
|
178
101
|
const p = n.range()[0], v = s(r[0].date), b = s(r[r.length - 1].date);
|
|
179
102
|
qt(e, { x1: v, x2: b, y1: p, y2: p });
|
|
180
|
-
const { tooltipContainer:
|
|
103
|
+
const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Rs(o), C = (S) => {
|
|
181
104
|
if (!d) return;
|
|
182
|
-
_i(
|
|
183
|
-
const
|
|
184
|
-
|
|
105
|
+
_i(x), w.style.display = "block", x.append(d({ date: S.date, value: S.value }));
|
|
106
|
+
const N = x.getBoundingClientRect(), $ = Os(
|
|
107
|
+
N,
|
|
185
108
|
s(S.date),
|
|
186
109
|
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
187
110
|
i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
|
|
188
111
|
);
|
|
189
|
-
|
|
190
|
-
},
|
|
191
|
-
|
|
112
|
+
$ !== null && (x.style.left = $ + "px"), y.style.left = s(S.date) + "px";
|
|
113
|
+
}, M = () => {
|
|
114
|
+
w.style.display = "none";
|
|
192
115
|
};
|
|
193
116
|
i.gridHoverTooltip = d ? {
|
|
194
|
-
show: (S) =>
|
|
195
|
-
hide:
|
|
196
|
-
} : null, r.forEach((S,
|
|
197
|
-
const
|
|
198
|
-
Y || qt(e, { x1:
|
|
117
|
+
show: (S) => C(S),
|
|
118
|
+
hide: M
|
|
119
|
+
} : null, r.forEach((S, N) => {
|
|
120
|
+
const $ = s(S.date), z = n(S.value), V = r[N - 1], Y = N > 0 && V && S.value === V.value;
|
|
121
|
+
Y || qt(e, { x1: $, x2: $, y1: z, y2: p });
|
|
199
122
|
const re = $s(e, Y, {
|
|
200
|
-
x:
|
|
123
|
+
x: $,
|
|
201
124
|
y: p,
|
|
202
125
|
r: g,
|
|
203
126
|
hr: _
|
|
204
127
|
});
|
|
205
128
|
d && re.on("mouseover", function() {
|
|
206
|
-
|
|
129
|
+
C({ date: S.date, value: Y ? null : S.value });
|
|
207
130
|
}).on("mouseout", function() {
|
|
208
|
-
|
|
131
|
+
M();
|
|
209
132
|
});
|
|
210
133
|
});
|
|
211
134
|
}
|
|
212
135
|
}, zs = (i) => {
|
|
213
|
-
|
|
214
|
-
},
|
|
136
|
+
Is(i), Ps(i);
|
|
137
|
+
}, Vs = (i) => {
|
|
215
138
|
const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
|
|
216
|
-
|
|
217
|
-
},
|
|
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
|
+
}, Le = (i, e, t) => {
|
|
218
141
|
let s = i.select(`#${e}`);
|
|
219
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 }) => {
|
|
220
143
|
s.append("stop").attr("offset", n).attr("stop-color", a);
|
|
@@ -264,7 +187,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
264
187
|
...e == null ? void 0 : e.selection
|
|
265
188
|
}
|
|
266
189
|
}), Qt = (i, e = {}) => {
|
|
267
|
-
const t = i.node(), s = _e(t), n = (o, c) =>
|
|
190
|
+
const t = i.node(), s = _e(t), n = (o, c) => Le(s, o, {
|
|
268
191
|
x1: "0%",
|
|
269
192
|
y1: "0%",
|
|
270
193
|
x2: "0%",
|
|
@@ -302,9 +225,9 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
302
225
|
t.remove();
|
|
303
226
|
}
|
|
304
227
|
};
|
|
305
|
-
},
|
|
228
|
+
}, Ys = (i, e = {}) => {
|
|
306
229
|
const t = "sc-charts__hover-line", s = i.append("line").style("display", e.hidden ? "none" : "block").classed(t, !0), n = i.node(), a = _e(n);
|
|
307
|
-
return ((o, c) =>
|
|
230
|
+
return ((o, c) => Le(a, o, {
|
|
308
231
|
x1: "0%",
|
|
309
232
|
y1: "0%",
|
|
310
233
|
x2: "0%",
|
|
@@ -360,18 +283,18 @@ const Xs = (i) => {
|
|
|
360
283
|
update({ leftPoint: n, rightPoint: a, x: r, y: o, hidden: c, closest: h }) {
|
|
361
284
|
if (n && a && h && r !== void 0) {
|
|
362
285
|
const d = a.value - n.value, { sumFormatter: g, timeFormatter: _ } = i.config.selection, p = (i.x(a.date) + i.x(n.date)) / 2, v = i.x(h.date) < p ? "left" : "right";
|
|
363
|
-
let b = "",
|
|
286
|
+
let b = "", w = "";
|
|
364
287
|
if (g)
|
|
365
288
|
b = g({ left: n.value, right: a.value, direction: v });
|
|
366
289
|
else {
|
|
367
|
-
const
|
|
368
|
-
b = `${Ws(d)} (${
|
|
290
|
+
const x = (d / Math.abs(n.value) * 100).toFixed(2);
|
|
291
|
+
b = `${Ws(d)} (${x}%)`;
|
|
369
292
|
}
|
|
370
|
-
_ ?
|
|
371
|
-
const
|
|
372
|
-
let
|
|
373
|
-
const
|
|
374
|
-
|
|
293
|
+
_ ? w = _({ left: n.date, right: a.date, direction: v }) : w = `${Kt(n.date)} to ${Kt(a.date)}`, t.textContent = b, s.textContent = w, requestAnimationFrame(() => {
|
|
294
|
+
const x = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), M = i.x(a.date);
|
|
295
|
+
let N = (C + M) / 2 - x.width / 2;
|
|
296
|
+
const $ = 0, z = y.width - x.width;
|
|
297
|
+
N < $ && (N = $), N > z && (N = z), e.style.left = `${N}px`, e.style.top = `${o}px`;
|
|
375
298
|
});
|
|
376
299
|
}
|
|
377
300
|
c !== void 0 && (e.style.display = c ? "none" : "block");
|
|
@@ -481,7 +404,7 @@ const Js = (i) => {
|
|
|
481
404
|
curveTension: 1
|
|
482
405
|
}, tt = () => L.curveMonotoneX, Ks = (i) => {
|
|
483
406
|
const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o = _e(r);
|
|
484
|
-
|
|
407
|
+
Le(o, "main-line-area-gradient", {
|
|
485
408
|
x1: "0%",
|
|
486
409
|
y1: "0%",
|
|
487
410
|
x2: "0%",
|
|
@@ -508,7 +431,7 @@ const Js = (i) => {
|
|
|
508
431
|
};
|
|
509
432
|
}, en = (i, e = {}) => {
|
|
510
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 = _e(d), _ = "range-line-area-gradient";
|
|
511
|
-
|
|
434
|
+
Le(g, _ + "_up", {
|
|
512
435
|
x1: "0%",
|
|
513
436
|
y1: "0%",
|
|
514
437
|
x2: "0%",
|
|
@@ -517,7 +440,7 @@ const Js = (i) => {
|
|
|
517
440
|
{ offset: "0%", stopColor: "var(--sc-color-selection-up)" },
|
|
518
441
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
519
442
|
]
|
|
520
|
-
}),
|
|
443
|
+
}), Le(g, _ + "_down", {
|
|
521
444
|
x1: "0%",
|
|
522
445
|
y1: "0%",
|
|
523
446
|
x2: "0%",
|
|
@@ -527,42 +450,42 @@ const Js = (i) => {
|
|
|
527
450
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
528
451
|
]
|
|
529
452
|
});
|
|
530
|
-
const p = L.area().x((y) => n(y.date)).y0(a.range()[0]).y1((y) => a(y.value)).curve(tt()), v = `${c}-clip-${t}`,
|
|
453
|
+
const p = L.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", p).attr("class", t).classed(`${t}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${v})`);
|
|
531
454
|
return {
|
|
532
|
-
className(y,
|
|
533
|
-
y === "remove" ?
|
|
455
|
+
className(y, C) {
|
|
456
|
+
y === "remove" ? x.classed(`${t}${C}`, !1) : x.classed(`${t}${C}`, !0);
|
|
534
457
|
},
|
|
535
|
-
update({ data: y, hidden:
|
|
536
|
-
y !== void 0 &&
|
|
458
|
+
update({ data: y, hidden: C, clip: M }) {
|
|
459
|
+
y !== void 0 && x.datum(y).attr("d", p), C !== void 0 && x.classed(`${t}_hidden`, C), M !== void 0 && w.attr("x", M.x).attr("y", M.y).attr("width", M.width).attr("height", M.height);
|
|
537
460
|
},
|
|
538
461
|
destroy() {
|
|
539
|
-
|
|
462
|
+
x.remove();
|
|
540
463
|
}
|
|
541
464
|
};
|
|
542
465
|
}, vt = (i, e) => {
|
|
543
|
-
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = _e(d), _ = L.line().x((
|
|
466
|
+
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = _e(d), _ = L.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(tt()), p = `${r}-clip-${o}`, b = g.append("clipPath").attr("id", p).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", _).attr("id", c).attr("clip-path", `url(#${p})`);
|
|
544
467
|
return {
|
|
545
|
-
className(
|
|
546
|
-
|
|
468
|
+
className(x, y) {
|
|
469
|
+
x === "remove" ? w.classed(`${o}${y}`, !1) : w.classed(`${o}${y}`, !0);
|
|
547
470
|
},
|
|
548
|
-
update({ data:
|
|
549
|
-
|
|
471
|
+
update({ data: x, clip: y, hidden: C }) {
|
|
472
|
+
x !== void 0 && w.datum(x).attr("d", _), C !== void 0 && w.classed(`${o}_hidden`, C), y !== void 0 && b.attr("x", y.x).attr("y", y.y).attr("width", y.width).attr("height", y.height);
|
|
550
473
|
},
|
|
551
474
|
destroy() {
|
|
552
|
-
|
|
475
|
+
w.remove();
|
|
553
476
|
}
|
|
554
477
|
};
|
|
555
478
|
}, tn = (i, e) => {
|
|
556
|
-
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), _ = _e(g), p = L.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(tt()), v = `${r}-clip-${c}`,
|
|
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(), _ = _e(g), p = L.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(tt()), v = `${r}-clip-${c}`, w = _.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", p).attr("id", h).attr("clip-path", `url(#${v})`);
|
|
557
480
|
return {
|
|
558
|
-
className(y,
|
|
559
|
-
y === "remove" ?
|
|
481
|
+
className(y, C) {
|
|
482
|
+
y === "remove" ? x.classed(`${c}${C}`, !1) : x.classed(`${c}${C}`, !0);
|
|
560
483
|
},
|
|
561
|
-
update({ data: y, clip:
|
|
562
|
-
y !== void 0 &&
|
|
484
|
+
update({ data: y, clip: C, hidden: M }) {
|
|
485
|
+
y !== void 0 && x.datum(y).attr("d", p), M !== void 0 && x.classed(`${c}_hidden`, M), 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(L.easeLinear) : w.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
|
|
563
486
|
},
|
|
564
487
|
destroy() {
|
|
565
|
-
|
|
488
|
+
x.remove();
|
|
566
489
|
}
|
|
567
490
|
};
|
|
568
491
|
}, sn = (i) => {
|
|
@@ -597,7 +520,7 @@ const Js = (i) => {
|
|
|
597
520
|
i.config.hasExtremePoint && (s = nn(i, {
|
|
598
521
|
baseClassName: "sc-charts__extreme-point"
|
|
599
522
|
}));
|
|
600
|
-
const n =
|
|
523
|
+
const n = Ys(i.svg), a = tn(i, {
|
|
601
524
|
baseClassName: "sc-charts__highlight-line",
|
|
602
525
|
id: `${i.chartId}-sc-charts__highlight-line`,
|
|
603
526
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
@@ -842,11 +765,11 @@ const Js = (i) => {
|
|
|
842
765
|
const { svg: e, data: t, x: s, config: n, width: a, height: r } = i, { margin: o, hover: c, selection: h } = n;
|
|
843
766
|
let d = null, g = !1;
|
|
844
767
|
const _ = (v) => t.reduce(
|
|
845
|
-
(b,
|
|
768
|
+
(b, w) => Math.abs(s(b.date) - v) < Math.abs(s(w.date) - v) ? b : w
|
|
846
769
|
);
|
|
847
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) {
|
|
848
|
-
const [b] = L.pointer(v, this),
|
|
849
|
-
!g && c.enable ? (i.action = "hover", ei(i,
|
|
771
|
+
const [b] = L.pointer(v, this), w = _(b);
|
|
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));
|
|
850
773
|
}).on("mouseleave", () => {
|
|
851
774
|
i.action = "none", g = !1, d = null, ti(i), ii(i);
|
|
852
775
|
}).on("mousedown", function(v) {
|
|
@@ -856,8 +779,8 @@ const Js = (i) => {
|
|
|
856
779
|
d = _(b);
|
|
857
780
|
}
|
|
858
781
|
}).on("mouseup", function(v) {
|
|
859
|
-
const [b] = L.pointer(v, this),
|
|
860
|
-
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i,
|
|
782
|
+
const [b] = L.pointer(v, this), w = _(b);
|
|
783
|
+
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i, w);
|
|
861
784
|
});
|
|
862
785
|
}, hn = (i, e, t) => {
|
|
863
786
|
const { margin: s } = e, n = L.scaleTime(), a = L.extent(i, (r) => new Date(r.date));
|
|
@@ -880,27 +803,27 @@ const Js = (i) => {
|
|
|
880
803
|
window.addEventListener("resize", g);
|
|
881
804
|
const _ = (p, v = !1) => {
|
|
882
805
|
v && p.config && (h = Jt(h, p.config)), v && p.data && (d = p.data);
|
|
883
|
-
const b = d.map((
|
|
806
|
+
const b = d.map((M) => ({ date: new Date(M.date), value: M.value })).sort((M, S) => M.date.getTime() - S.date.getTime()), w = hn(b, h, o), x = dn(b, h, c);
|
|
884
807
|
s.attr("class", `sc-charts sc-charts__${h.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${o} ${c}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
|
|
885
808
|
const y = {
|
|
886
809
|
chartId: e.chartId,
|
|
887
810
|
svg: n,
|
|
888
811
|
wrapperNode: s.node(),
|
|
889
812
|
data: b,
|
|
890
|
-
x,
|
|
891
|
-
y:
|
|
813
|
+
x: w,
|
|
814
|
+
y: x,
|
|
892
815
|
config: h,
|
|
893
816
|
action: "none",
|
|
894
817
|
width: o,
|
|
895
818
|
height: c,
|
|
896
819
|
gridHoverTooltip: null
|
|
897
820
|
};
|
|
898
|
-
|
|
899
|
-
const
|
|
821
|
+
Vs(y);
|
|
822
|
+
const C = {
|
|
900
823
|
...y,
|
|
901
824
|
elements: an(y)
|
|
902
825
|
};
|
|
903
|
-
cn(
|
|
826
|
+
cn(C);
|
|
904
827
|
};
|
|
905
828
|
return _(e), {
|
|
906
829
|
update: (p) => _(p, !0),
|
|
@@ -918,8 +841,8 @@ Se.exports;
|
|
|
918
841
|
var si;
|
|
919
842
|
function fn() {
|
|
920
843
|
return si || (si = 1, function(i, e) {
|
|
921
|
-
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]", _ = "[object Error]", p = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]",
|
|
922
|
-
|
|
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]", _ = "[object Error]", p = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", M = "[object RegExp]", S = "[object Set]", N = "[object String]", $ = "[object Undefined]", z = "[object WeakMap]", V = "[object ArrayBuffer]", Y = "[object DataView]", re = "[object Float32Array]", P = "[object Float64Array]", U = "[object Int8Array]", G = "[object Int16Array]", Fe = "[object Int32Array]", st = "[object Uint8Array]", oe = "[object Uint8ClampedArray]", ve = "[object Uint16Array]", be = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Be = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, F = {};
|
|
845
|
+
F[re] = F[P] = F[U] = F[G] = F[Fe] = F[st] = F[oe] = F[ve] = F[be] = !0, F[o] = F[c] = F[V] = F[d] = F[Y] = F[g] = F[_] = F[p] = F[b] = F[w] = F[y] = F[M] = F[S] = F[N] = F[z] = !1;
|
|
923
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, Z = ee && !0 && i && !i.nodeType && i, q = Z && Z.exports === ee, ge = q && Re.process, ye = function() {
|
|
924
847
|
try {
|
|
925
848
|
var l = Z && Z.require && Z.require("util").types;
|
|
@@ -941,9 +864,9 @@ function fn() {
|
|
|
941
864
|
return l.apply(u, m);
|
|
942
865
|
}
|
|
943
866
|
function Pe(l, u) {
|
|
944
|
-
for (var m = -1,
|
|
945
|
-
|
|
946
|
-
return
|
|
867
|
+
for (var m = -1, T = Array(l); ++m < l; )
|
|
868
|
+
T[m] = u(m);
|
|
869
|
+
return T;
|
|
947
870
|
}
|
|
948
871
|
function le(l) {
|
|
949
872
|
return function(u) {
|
|
@@ -958,20 +881,20 @@ function fn() {
|
|
|
958
881
|
return l(u(m));
|
|
959
882
|
};
|
|
960
883
|
}
|
|
961
|
-
var xe = Array.prototype,
|
|
884
|
+
var xe = Array.prototype, Ai = Function.prototype, ze = Object.prototype, at = O["__core-js_shared__"], Ve = Ai.toString, ne = ze.hasOwnProperty, Nt = function() {
|
|
962
885
|
var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
|
|
963
886
|
return l ? "Symbol(src)_1." + l : "";
|
|
964
|
-
}(),
|
|
965
|
-
"^" +
|
|
966
|
-
),
|
|
967
|
-
|
|
968
|
-
var
|
|
887
|
+
}(), Ft = ze.toString, Mi = Ve.call(Object), Si = RegExp(
|
|
888
|
+
"^" + Ve.call(ne).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
889
|
+
), Ye = q ? O.Buffer : void 0, Ht = O.Symbol, Bt = O.Uint8Array;
|
|
890
|
+
Ye && Ye.allocUnsafe;
|
|
891
|
+
var It = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = ze.propertyIsEnumerable, ki = xe.splice, he = Ht ? Ht.toStringTag : void 0, We = function() {
|
|
969
892
|
try {
|
|
970
893
|
var l = lt(Object, "defineProperty");
|
|
971
894
|
return l({}, "", {}), l;
|
|
972
895
|
} catch {
|
|
973
896
|
}
|
|
974
|
-
}(),
|
|
897
|
+
}(), Li = Ye ? Ye.isBuffer : void 0, $t = Math.max, Ei = Date.now, Ot = lt(O, "Map"), Ce = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
|
|
975
898
|
function l() {
|
|
976
899
|
}
|
|
977
900
|
return function(u) {
|
|
@@ -987,18 +910,18 @@ function fn() {
|
|
|
987
910
|
function de(l) {
|
|
988
911
|
var u = -1, m = l == null ? 0 : l.length;
|
|
989
912
|
for (this.clear(); ++u < m; ) {
|
|
990
|
-
var
|
|
991
|
-
this.set(
|
|
913
|
+
var T = l[u];
|
|
914
|
+
this.set(T[0], T[1]);
|
|
992
915
|
}
|
|
993
916
|
}
|
|
994
|
-
function
|
|
917
|
+
function Fi() {
|
|
995
918
|
this.__data__ = Ce ? Ce(null) : {}, this.size = 0;
|
|
996
919
|
}
|
|
997
920
|
function Hi(l) {
|
|
998
921
|
var u = this.has(l) && delete this.__data__[l];
|
|
999
922
|
return this.size -= u ? 1 : 0, u;
|
|
1000
923
|
}
|
|
1001
|
-
function
|
|
924
|
+
function Bi(l) {
|
|
1002
925
|
var u = this.__data__;
|
|
1003
926
|
if (Ce) {
|
|
1004
927
|
var m = u[l];
|
|
@@ -1006,7 +929,7 @@ function fn() {
|
|
|
1006
929
|
}
|
|
1007
930
|
return ne.call(u, l) ? u[l] : void 0;
|
|
1008
931
|
}
|
|
1009
|
-
function
|
|
932
|
+
function Ii(l) {
|
|
1010
933
|
var u = this.__data__;
|
|
1011
934
|
return Ce ? u[l] !== void 0 : ne.call(u, l);
|
|
1012
935
|
}
|
|
@@ -1014,12 +937,12 @@ function fn() {
|
|
|
1014
937
|
var m = this.__data__;
|
|
1015
938
|
return this.size += this.has(l) ? 0 : 1, m[l] = Ce && u === void 0 ? s : u, this;
|
|
1016
939
|
}
|
|
1017
|
-
de.prototype.clear =
|
|
940
|
+
de.prototype.clear = Fi, de.prototype.delete = Hi, de.prototype.get = Bi, de.prototype.has = Ii, de.prototype.set = Ri;
|
|
1018
941
|
function te(l) {
|
|
1019
942
|
var u = -1, m = l == null ? 0 : l.length;
|
|
1020
943
|
for (this.clear(); ++u < m; ) {
|
|
1021
|
-
var
|
|
1022
|
-
this.set(
|
|
944
|
+
var T = l[u];
|
|
945
|
+
this.set(T[0], T[1]);
|
|
1023
946
|
}
|
|
1024
947
|
}
|
|
1025
948
|
function $i() {
|
|
@@ -1029,8 +952,8 @@ function fn() {
|
|
|
1029
952
|
var u = this.__data__, m = je(u, l);
|
|
1030
953
|
if (m < 0)
|
|
1031
954
|
return !1;
|
|
1032
|
-
var
|
|
1033
|
-
return m ==
|
|
955
|
+
var T = u.length - 1;
|
|
956
|
+
return m == T ? u.pop() : ki.call(u, m, 1), --this.size, !0;
|
|
1034
957
|
}
|
|
1035
958
|
function Pi(l) {
|
|
1036
959
|
var u = this.__data__, m = je(u, l);
|
|
@@ -1039,19 +962,19 @@ function fn() {
|
|
|
1039
962
|
function zi(l) {
|
|
1040
963
|
return je(this.__data__, l) > -1;
|
|
1041
964
|
}
|
|
1042
|
-
function
|
|
1043
|
-
var m = this.__data__,
|
|
1044
|
-
return
|
|
965
|
+
function Vi(l, u) {
|
|
966
|
+
var m = this.__data__, T = je(m, l);
|
|
967
|
+
return T < 0 ? (++this.size, m.push([l, u])) : m[T][1] = u, this;
|
|
1045
968
|
}
|
|
1046
|
-
te.prototype.clear = $i, te.prototype.delete = Oi, te.prototype.get = Pi, te.prototype.has = zi, te.prototype.set =
|
|
969
|
+
te.prototype.clear = $i, te.prototype.delete = Oi, te.prototype.get = Pi, te.prototype.has = zi, te.prototype.set = Vi;
|
|
1047
970
|
function me(l) {
|
|
1048
971
|
var u = -1, m = l == null ? 0 : l.length;
|
|
1049
972
|
for (this.clear(); ++u < m; ) {
|
|
1050
|
-
var
|
|
1051
|
-
this.set(
|
|
973
|
+
var T = l[u];
|
|
974
|
+
this.set(T[0], T[1]);
|
|
1052
975
|
}
|
|
1053
976
|
}
|
|
1054
|
-
function
|
|
977
|
+
function Yi() {
|
|
1055
978
|
this.size = 0, this.__data__ = {
|
|
1056
979
|
hash: new de(),
|
|
1057
980
|
map: new (Ot || te)(),
|
|
@@ -1069,10 +992,10 @@ function fn() {
|
|
|
1069
992
|
return Ue(this, l).has(l);
|
|
1070
993
|
}
|
|
1071
994
|
function Ui(l, u) {
|
|
1072
|
-
var m = Ue(this, l),
|
|
1073
|
-
return m.set(l, u), this.size += m.size ==
|
|
995
|
+
var m = Ue(this, l), T = m.size;
|
|
996
|
+
return m.set(l, u), this.size += m.size == T ? 0 : 1, this;
|
|
1074
997
|
}
|
|
1075
|
-
me.prototype.clear =
|
|
998
|
+
me.prototype.clear = Yi, me.prototype.delete = Wi, me.prototype.get = ji, me.prototype.has = Xi, me.prototype.set = Ui;
|
|
1076
999
|
function pe(l) {
|
|
1077
1000
|
var u = this.__data__ = new te(l);
|
|
1078
1001
|
this.size = u.size;
|
|
@@ -1093,30 +1016,30 @@ function fn() {
|
|
|
1093
1016
|
function Qi(l, u) {
|
|
1094
1017
|
var m = this.__data__;
|
|
1095
1018
|
if (m instanceof te) {
|
|
1096
|
-
var
|
|
1097
|
-
if (!Ot ||
|
|
1098
|
-
return
|
|
1099
|
-
m = this.__data__ = new me(
|
|
1019
|
+
var T = m.__data__;
|
|
1020
|
+
if (!Ot || T.length < t - 1)
|
|
1021
|
+
return T.push([l, u]), this.size = ++m.size, this;
|
|
1022
|
+
m = this.__data__ = new me(T);
|
|
1100
1023
|
}
|
|
1101
1024
|
return m.set(l, u), this.size = m.size, this;
|
|
1102
1025
|
}
|
|
1103
1026
|
pe.prototype.clear = Gi, pe.prototype.delete = Zi, pe.prototype.get = qi, pe.prototype.has = Ji, pe.prototype.set = Qi;
|
|
1104
1027
|
function Ki(l, u) {
|
|
1105
|
-
var m = dt(l),
|
|
1028
|
+
var m = dt(l), T = !m && ht(l), D = !m && !T && Wt(l), H = !m && !T && !D && Xt(l), B = m || T || D || H, E = B ? Pe(l.length, String) : [], I = E.length;
|
|
1106
1029
|
for (var J in l)
|
|
1107
1030
|
B && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1108
1031
|
(J == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
return
|
|
1032
|
+
D && (J == "offset" || J == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1033
|
+
H && (J == "buffer" || J == "byteLength" || J == "byteOffset") || // Skip index properties.
|
|
1034
|
+
Vt(J, I)) || E.push(J);
|
|
1035
|
+
return E;
|
|
1113
1036
|
}
|
|
1114
1037
|
function rt(l, u, m) {
|
|
1115
1038
|
(m !== void 0 && !Ge(l[u], m) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1116
1039
|
}
|
|
1117
1040
|
function es(l, u, m) {
|
|
1118
|
-
var
|
|
1119
|
-
(!(ne.call(l, u) && Ge(
|
|
1041
|
+
var T = l[u];
|
|
1042
|
+
(!(ne.call(l, u) && Ge(T, m)) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1120
1043
|
}
|
|
1121
1044
|
function je(l, u) {
|
|
1122
1045
|
for (var m = l.length; m--; )
|
|
@@ -1134,7 +1057,7 @@ function fn() {
|
|
|
1134
1057
|
}
|
|
1135
1058
|
var ts = gs();
|
|
1136
1059
|
function Xe(l) {
|
|
1137
|
-
return l == null ? l === void 0 ?
|
|
1060
|
+
return l == null ? l === void 0 ? $ : x : he && he in Object(l) ? ms(l) : ws(l);
|
|
1138
1061
|
}
|
|
1139
1062
|
function Pt(l) {
|
|
1140
1063
|
return Te(l) && Xe(l) == o;
|
|
@@ -1142,42 +1065,42 @@ function fn() {
|
|
|
1142
1065
|
function is(l) {
|
|
1143
1066
|
if (!ue(l) || bs(l))
|
|
1144
1067
|
return !1;
|
|
1145
|
-
var u = ft(l) ? Si :
|
|
1146
|
-
return u.test(
|
|
1068
|
+
var u = ft(l) ? Si : Be;
|
|
1069
|
+
return u.test(As(l));
|
|
1147
1070
|
}
|
|
1148
1071
|
function ss(l) {
|
|
1149
|
-
return Te(l) && jt(l.length) && !!
|
|
1072
|
+
return Te(l) && jt(l.length) && !!F[Xe(l)];
|
|
1150
1073
|
}
|
|
1151
1074
|
function ns(l) {
|
|
1152
1075
|
if (!ue(l))
|
|
1153
1076
|
return ys(l);
|
|
1154
|
-
var u =
|
|
1155
|
-
for (var
|
|
1156
|
-
|
|
1077
|
+
var u = Yt(l), m = [];
|
|
1078
|
+
for (var T in l)
|
|
1079
|
+
T == "constructor" && (u || !ne.call(l, T)) || m.push(T);
|
|
1157
1080
|
return m;
|
|
1158
1081
|
}
|
|
1159
|
-
function zt(l, u, m,
|
|
1160
|
-
l !== u && ts(u, function(
|
|
1161
|
-
if (
|
|
1162
|
-
as(l, u, B, m, zt,
|
|
1082
|
+
function zt(l, u, m, T, D) {
|
|
1083
|
+
l !== u && ts(u, function(H, B) {
|
|
1084
|
+
if (D || (D = new pe()), ue(H))
|
|
1085
|
+
as(l, u, B, m, zt, T, D);
|
|
1163
1086
|
else {
|
|
1164
|
-
var
|
|
1165
|
-
|
|
1087
|
+
var E = T ? T(ct(l, B), H, B + "", l, u, D) : void 0;
|
|
1088
|
+
E === void 0 && (E = H), rt(l, B, E);
|
|
1166
1089
|
}
|
|
1167
1090
|
}, Ut);
|
|
1168
1091
|
}
|
|
1169
|
-
function as(l, u, m,
|
|
1170
|
-
var
|
|
1092
|
+
function as(l, u, m, T, D, H, B) {
|
|
1093
|
+
var E = ct(l, m), I = ct(u, m), J = B.get(I);
|
|
1171
1094
|
if (J) {
|
|
1172
1095
|
rt(l, m, J);
|
|
1173
1096
|
return;
|
|
1174
1097
|
}
|
|
1175
|
-
var W =
|
|
1176
|
-
if (
|
|
1177
|
-
var gt = dt(
|
|
1178
|
-
W =
|
|
1098
|
+
var W = H ? H(E, I, m + "", l, u, B) : void 0, Ae = W === void 0;
|
|
1099
|
+
if (Ae) {
|
|
1100
|
+
var gt = dt(I), mt = !gt && Wt(I), Zt = !gt && !mt && Xt(I);
|
|
1101
|
+
W = I, gt || mt || Zt ? dt(E) ? W = E : Ms(E) ? W = ds(E) : mt ? (Ae = !1, W = ls(I)) : Zt ? (Ae = !1, W = hs(I)) : W = [] : Ss(I) || ht(I) ? (W = E, ht(E) ? W = Ds(E) : (!ue(E) || ft(E)) && (W = ps(I))) : Ae = !1;
|
|
1179
1102
|
}
|
|
1180
|
-
|
|
1103
|
+
Ae && (B.set(I, W), D(W, I, T, H, B), B.delete(I)), rt(l, m, W);
|
|
1181
1104
|
}
|
|
1182
1105
|
function rs(l, u) {
|
|
1183
1106
|
return Cs(xs(l, u, Gt), l + "");
|
|
@@ -1186,7 +1109,7 @@ function fn() {
|
|
|
1186
1109
|
return We(l, "toString", {
|
|
1187
1110
|
configurable: !0,
|
|
1188
1111
|
enumerable: !1,
|
|
1189
|
-
value:
|
|
1112
|
+
value: Ls(u),
|
|
1190
1113
|
writable: !0
|
|
1191
1114
|
});
|
|
1192
1115
|
} : Gt;
|
|
@@ -1195,42 +1118,42 @@ function fn() {
|
|
|
1195
1118
|
}
|
|
1196
1119
|
function cs(l) {
|
|
1197
1120
|
var u = new l.constructor(l.byteLength);
|
|
1198
|
-
return new
|
|
1121
|
+
return new Bt(u).set(new Bt(l)), u;
|
|
1199
1122
|
}
|
|
1200
1123
|
function hs(l, u) {
|
|
1201
1124
|
var m = cs(l.buffer);
|
|
1202
1125
|
return new l.constructor(m, l.byteOffset, l.length);
|
|
1203
1126
|
}
|
|
1204
1127
|
function ds(l, u) {
|
|
1205
|
-
var m = -1,
|
|
1206
|
-
for (u || (u = Array(
|
|
1128
|
+
var m = -1, T = l.length;
|
|
1129
|
+
for (u || (u = Array(T)); ++m < T; )
|
|
1207
1130
|
u[m] = l[m];
|
|
1208
1131
|
return u;
|
|
1209
1132
|
}
|
|
1210
|
-
function us(l, u, m,
|
|
1211
|
-
var
|
|
1133
|
+
function us(l, u, m, T) {
|
|
1134
|
+
var D = !m;
|
|
1212
1135
|
m || (m = {});
|
|
1213
|
-
for (var
|
|
1214
|
-
var
|
|
1215
|
-
|
|
1136
|
+
for (var H = -1, B = u.length; ++H < B; ) {
|
|
1137
|
+
var E = u[H], I = void 0;
|
|
1138
|
+
I === void 0 && (I = l[E]), D ? ot(m, E, I) : es(m, E, I);
|
|
1216
1139
|
}
|
|
1217
1140
|
return m;
|
|
1218
1141
|
}
|
|
1219
1142
|
function fs(l) {
|
|
1220
1143
|
return rs(function(u, m) {
|
|
1221
|
-
var
|
|
1222
|
-
for (
|
|
1223
|
-
var
|
|
1224
|
-
|
|
1144
|
+
var T = -1, D = m.length, H = D > 1 ? m[D - 1] : void 0, B = D > 2 ? m[2] : void 0;
|
|
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); ++T < D; ) {
|
|
1146
|
+
var E = m[T];
|
|
1147
|
+
E && l(u, E, T, H);
|
|
1225
1148
|
}
|
|
1226
1149
|
return u;
|
|
1227
1150
|
});
|
|
1228
1151
|
}
|
|
1229
1152
|
function gs(l) {
|
|
1230
|
-
return function(u, m,
|
|
1231
|
-
for (var
|
|
1232
|
-
var
|
|
1233
|
-
if (m(I
|
|
1153
|
+
return function(u, m, T) {
|
|
1154
|
+
for (var D = -1, H = Object(u), B = T(u), E = B.length; E--; ) {
|
|
1155
|
+
var I = B[++D];
|
|
1156
|
+
if (m(H[I], I, H) === !1)
|
|
1234
1157
|
break;
|
|
1235
1158
|
}
|
|
1236
1159
|
return u;
|
|
@@ -1248,33 +1171,33 @@ function fn() {
|
|
|
1248
1171
|
var u = ne.call(l, he), m = l[he];
|
|
1249
1172
|
try {
|
|
1250
1173
|
l[he] = void 0;
|
|
1251
|
-
var
|
|
1174
|
+
var T = !0;
|
|
1252
1175
|
} catch {
|
|
1253
1176
|
}
|
|
1254
|
-
var
|
|
1255
|
-
return
|
|
1177
|
+
var D = Ft.call(l);
|
|
1178
|
+
return T && (u ? l[he] = m : delete l[he]), D;
|
|
1256
1179
|
}
|
|
1257
1180
|
function ps(l) {
|
|
1258
|
-
return typeof l.constructor == "function" && !
|
|
1181
|
+
return typeof l.constructor == "function" && !Yt(l) ? Ni(It(l)) : {};
|
|
1259
1182
|
}
|
|
1260
|
-
function
|
|
1183
|
+
function Vt(l, u) {
|
|
1261
1184
|
var m = typeof l;
|
|
1262
|
-
return u = u ?? r, !!u && (m == "number" || m != "symbol" &&
|
|
1185
|
+
return u = u ?? r, !!u && (m == "number" || m != "symbol" && Ie.test(l)) && l > -1 && l % 1 == 0 && l < u;
|
|
1263
1186
|
}
|
|
1264
1187
|
function _s(l, u, m) {
|
|
1265
1188
|
if (!ue(m))
|
|
1266
1189
|
return !1;
|
|
1267
|
-
var
|
|
1268
|
-
return (
|
|
1190
|
+
var T = typeof u;
|
|
1191
|
+
return (T == "number" ? ut(m) && Vt(u, m.length) : T == "string" && u in m) ? Ge(m[u], l) : !1;
|
|
1269
1192
|
}
|
|
1270
1193
|
function vs(l) {
|
|
1271
1194
|
var u = typeof l;
|
|
1272
1195
|
return u == "string" || u == "number" || u == "symbol" || u == "boolean" ? l !== "__proto__" : l === null;
|
|
1273
1196
|
}
|
|
1274
1197
|
function bs(l) {
|
|
1275
|
-
return !!
|
|
1198
|
+
return !!Nt && Nt in l;
|
|
1276
1199
|
}
|
|
1277
|
-
function
|
|
1200
|
+
function Yt(l) {
|
|
1278
1201
|
var u = l && l.constructor, m = typeof u == "function" && u.prototype || ze;
|
|
1279
1202
|
return l === m;
|
|
1280
1203
|
}
|
|
@@ -1286,16 +1209,16 @@ function fn() {
|
|
|
1286
1209
|
return u;
|
|
1287
1210
|
}
|
|
1288
1211
|
function ws(l) {
|
|
1289
|
-
return
|
|
1212
|
+
return Ft.call(l);
|
|
1290
1213
|
}
|
|
1291
1214
|
function xs(l, u, m) {
|
|
1292
1215
|
return u = $t(u === void 0 ? l.length - 1 : u, 0), function() {
|
|
1293
|
-
for (var
|
|
1294
|
-
B[
|
|
1295
|
-
|
|
1296
|
-
for (var
|
|
1297
|
-
|
|
1298
|
-
return
|
|
1216
|
+
for (var T = arguments, D = -1, H = $t(T.length - u, 0), B = Array(H); ++D < H; )
|
|
1217
|
+
B[D] = T[u + D];
|
|
1218
|
+
D = -1;
|
|
1219
|
+
for (var E = Array(u + 1); ++D < u; )
|
|
1220
|
+
E[D] = T[D];
|
|
1221
|
+
return E[u] = m(B), Oe(l, this, E);
|
|
1299
1222
|
};
|
|
1300
1223
|
}
|
|
1301
1224
|
function ct(l, u) {
|
|
@@ -1306,8 +1229,8 @@ function fn() {
|
|
|
1306
1229
|
function Ts(l) {
|
|
1307
1230
|
var u = 0, m = 0;
|
|
1308
1231
|
return function() {
|
|
1309
|
-
var
|
|
1310
|
-
if (m =
|
|
1232
|
+
var T = Ei(), D = a - (T - m);
|
|
1233
|
+
if (m = T, D > 0) {
|
|
1311
1234
|
if (++u >= n)
|
|
1312
1235
|
return arguments[0];
|
|
1313
1236
|
} else
|
|
@@ -1315,10 +1238,10 @@ function fn() {
|
|
|
1315
1238
|
return l.apply(void 0, arguments);
|
|
1316
1239
|
};
|
|
1317
1240
|
}
|
|
1318
|
-
function
|
|
1241
|
+
function As(l) {
|
|
1319
1242
|
if (l != null) {
|
|
1320
1243
|
try {
|
|
1321
|
-
return
|
|
1244
|
+
return Ve.call(l);
|
|
1322
1245
|
} catch {
|
|
1323
1246
|
}
|
|
1324
1247
|
try {
|
|
@@ -1339,15 +1262,15 @@ function fn() {
|
|
|
1339
1262
|
function ut(l) {
|
|
1340
1263
|
return l != null && jt(l.length) && !ft(l);
|
|
1341
1264
|
}
|
|
1342
|
-
function
|
|
1265
|
+
function Ms(l) {
|
|
1343
1266
|
return Te(l) && ut(l);
|
|
1344
1267
|
}
|
|
1345
|
-
var Wt =
|
|
1268
|
+
var Wt = Li || Es;
|
|
1346
1269
|
function ft(l) {
|
|
1347
1270
|
if (!ue(l))
|
|
1348
1271
|
return !1;
|
|
1349
1272
|
var u = Xe(l);
|
|
1350
|
-
return u == p || u == v || u == h || u ==
|
|
1273
|
+
return u == p || u == v || u == h || u == C;
|
|
1351
1274
|
}
|
|
1352
1275
|
function jt(l) {
|
|
1353
1276
|
return typeof l == "number" && l > -1 && l % 1 == 0 && l <= r;
|
|
@@ -1362,11 +1285,11 @@ function fn() {
|
|
|
1362
1285
|
function Ss(l) {
|
|
1363
1286
|
if (!Te(l) || Xe(l) != y)
|
|
1364
1287
|
return !1;
|
|
1365
|
-
var u =
|
|
1288
|
+
var u = It(l);
|
|
1366
1289
|
if (u === null)
|
|
1367
1290
|
return !0;
|
|
1368
1291
|
var m = ne.call(u, "constructor") && u.constructor;
|
|
1369
|
-
return typeof m == "function" && m instanceof m &&
|
|
1292
|
+
return typeof m == "function" && m instanceof m && Ve.call(m) == Mi;
|
|
1370
1293
|
}
|
|
1371
1294
|
var Xt = we ? le(we) : ss;
|
|
1372
1295
|
function Ds(l) {
|
|
@@ -1378,7 +1301,7 @@ function fn() {
|
|
|
1378
1301
|
var ks = fs(function(l, u, m) {
|
|
1379
1302
|
zt(l, u, m);
|
|
1380
1303
|
});
|
|
1381
|
-
function
|
|
1304
|
+
function Ls(l) {
|
|
1382
1305
|
return function() {
|
|
1383
1306
|
return l;
|
|
1384
1307
|
};
|
|
@@ -1386,7 +1309,7 @@ function fn() {
|
|
|
1386
1309
|
function Gt(l) {
|
|
1387
1310
|
return l;
|
|
1388
1311
|
}
|
|
1389
|
-
function
|
|
1312
|
+
function Es() {
|
|
1390
1313
|
return !1;
|
|
1391
1314
|
}
|
|
1392
1315
|
i.exports = ks;
|
|
@@ -1608,24 +1531,24 @@ function ai(i, e) {
|
|
|
1608
1531
|
a.forEach((g, _) => {
|
|
1609
1532
|
const p = (h - d) / a.length;
|
|
1610
1533
|
let v = d + p * _, b = v + p;
|
|
1611
|
-
const
|
|
1612
|
-
let
|
|
1534
|
+
const w = Math.abs(v - b);
|
|
1535
|
+
let x = Math.max(v, b) + w / 2, y = Math.min(v, b) - w / 2;
|
|
1613
1536
|
if (e.trade) {
|
|
1614
|
-
const
|
|
1615
|
-
const
|
|
1616
|
-
return
|
|
1537
|
+
const M = [...e.trade.entries, ...e.trade.exits].find((S) => {
|
|
1538
|
+
const N = S.time.getTime();
|
|
1539
|
+
return N >= g && N < g + t;
|
|
1617
1540
|
});
|
|
1618
|
-
|
|
1541
|
+
M && (M.type === "buy" ? (y = M.price, b = Math.max(y, b), v = b + w, x = Math.max(v, b) + w / 2, d = v) : M.type === "sell" && (x = M.price, b = Math.min(x, b), v = b - w, y = Math.min(v, b) - w / 2, d = v));
|
|
1619
1542
|
}
|
|
1620
|
-
const
|
|
1543
|
+
const C = {
|
|
1621
1544
|
open_time: new Date(g),
|
|
1622
1545
|
close_time: new Date(g + t),
|
|
1623
1546
|
open: v,
|
|
1624
1547
|
close: b,
|
|
1625
|
-
high:
|
|
1548
|
+
high: x,
|
|
1626
1549
|
low: y
|
|
1627
1550
|
};
|
|
1628
|
-
n.push(
|
|
1551
|
+
n.push(C);
|
|
1629
1552
|
});
|
|
1630
1553
|
}), n;
|
|
1631
1554
|
}
|
|
@@ -1753,7 +1676,7 @@ const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
|
1753
1676
|
if (a == null || r == null) throw new Error("Invalid Y data");
|
|
1754
1677
|
return [a, r];
|
|
1755
1678
|
};
|
|
1756
|
-
class
|
|
1679
|
+
class An {
|
|
1757
1680
|
constructor(e) {
|
|
1758
1681
|
this.model = e;
|
|
1759
1682
|
}
|
|
@@ -1792,7 +1715,7 @@ class Mn {
|
|
|
1792
1715
|
e.setDomain([new Date(h.getTime() + c), new Date(d.getTime() + c)]);
|
|
1793
1716
|
}
|
|
1794
1717
|
}
|
|
1795
|
-
class
|
|
1718
|
+
class Mn {
|
|
1796
1719
|
constructor(e) {
|
|
1797
1720
|
f(this, "_model");
|
|
1798
1721
|
f(this, "_scaleX");
|
|
@@ -1804,7 +1727,7 @@ class An {
|
|
|
1804
1727
|
});
|
|
1805
1728
|
f(this, "scaleFactor", { x: 1, y: 1 });
|
|
1806
1729
|
f(this, "panOffset", { x: 0, y: 0 });
|
|
1807
|
-
this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new
|
|
1730
|
+
this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new An(e), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
|
|
1808
1731
|
x: this._scaleX.domain(),
|
|
1809
1732
|
y: this._scaleY.domain()
|
|
1810
1733
|
};
|
|
@@ -2076,7 +1999,7 @@ const kn = {
|
|
|
2076
1999
|
}
|
|
2077
2000
|
}
|
|
2078
2001
|
};
|
|
2079
|
-
class
|
|
2002
|
+
class Ln {
|
|
2080
2003
|
constructor(e) {
|
|
2081
2004
|
f(this, "_scheme");
|
|
2082
2005
|
this._scheme = Qe({}, kn, e), Object.keys(this._scheme).forEach((t) => {
|
|
@@ -2090,7 +2013,7 @@ class En {
|
|
|
2090
2013
|
this._scheme = Qe({}, this._scheme, e);
|
|
2091
2014
|
}
|
|
2092
2015
|
}
|
|
2093
|
-
class
|
|
2016
|
+
class En {
|
|
2094
2017
|
constructor(e, t) {
|
|
2095
2018
|
f(this, "_data");
|
|
2096
2019
|
f(this, "_callbacks", {
|
|
@@ -2133,7 +2056,7 @@ class Ln {
|
|
|
2133
2056
|
this._updateGroups(), this._callbacks.onUpdate(e, t);
|
|
2134
2057
|
}
|
|
2135
2058
|
}
|
|
2136
|
-
class
|
|
2059
|
+
class Nn {
|
|
2137
2060
|
constructor({
|
|
2138
2061
|
chartId: e,
|
|
2139
2062
|
container: t,
|
|
@@ -2155,7 +2078,7 @@ class Fn {
|
|
|
2155
2078
|
f(this, "trade");
|
|
2156
2079
|
f(this, "userMarkers");
|
|
2157
2080
|
f(this, "comments");
|
|
2158
|
-
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 Ln(o), this.layout = new _n(t, this.config), this.scales = new Mn(this), this.trade = new Sn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new Dn(this, r), this.comments = new En(c, this);
|
|
2159
2082
|
}
|
|
2160
2083
|
init() {
|
|
2161
2084
|
this.eventBus.emit("init_model");
|
|
@@ -2186,7 +2109,7 @@ class Fn {
|
|
|
2186
2109
|
}
|
|
2187
2110
|
}
|
|
2188
2111
|
const qe = window.devicePixelRatio || 2;
|
|
2189
|
-
class
|
|
2112
|
+
class k {
|
|
2190
2113
|
constructor({ tag: e, className: t, id: s, textContent: n }) {
|
|
2191
2114
|
f(this, "_tag");
|
|
2192
2115
|
f(this, "_className");
|
|
@@ -2224,7 +2147,7 @@ class F {
|
|
|
2224
2147
|
this.node.style.opacity = e ? "1" : "0", this.node.style.visibility = e ? "visible" : "hidden";
|
|
2225
2148
|
}
|
|
2226
2149
|
}
|
|
2227
|
-
class
|
|
2150
|
+
class Ee extends k {
|
|
2228
2151
|
constructor({ className: t, id: s, width: n, height: a, isMain: r }) {
|
|
2229
2152
|
super({
|
|
2230
2153
|
tag: "canvas",
|
|
@@ -2256,20 +2179,20 @@ class Le extends F {
|
|
|
2256
2179
|
return this._height;
|
|
2257
2180
|
}
|
|
2258
2181
|
}
|
|
2259
|
-
const
|
|
2182
|
+
const Fn = 10;
|
|
2260
2183
|
function Hn(i, e) {
|
|
2261
2184
|
const {
|
|
2262
2185
|
layout: { xAxis: t },
|
|
2263
2186
|
colorScheme: { xAxis: s },
|
|
2264
2187
|
config: { xAxis: n },
|
|
2265
2188
|
scales: a
|
|
2266
|
-
} = e, r = a.x.ticks(
|
|
2189
|
+
} = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = L.timeFormat("%d %b"), h = L.timeFormat("%H:%M");
|
|
2267
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) => {
|
|
2268
2191
|
const g = a.x.convert(d), _ = o(d) ? c(d) : h(d);
|
|
2269
2192
|
i.fillText(_, g, t.y + t.height / 2);
|
|
2270
2193
|
});
|
|
2271
2194
|
}
|
|
2272
|
-
function
|
|
2195
|
+
function Bn(i, e) {
|
|
2273
2196
|
const {
|
|
2274
2197
|
layout: { yAxis: t },
|
|
2275
2198
|
colorScheme: { yAxis: s },
|
|
@@ -2281,7 +2204,7 @@ function In(i, e) {
|
|
|
2281
2204
|
i.fillText(d, t.x + t.width / 2, h);
|
|
2282
2205
|
});
|
|
2283
2206
|
}
|
|
2284
|
-
const
|
|
2207
|
+
const In = (i, e) => {
|
|
2285
2208
|
const {
|
|
2286
2209
|
layout: { axisIntersection: t },
|
|
2287
2210
|
colorScheme: s
|
|
@@ -2298,10 +2221,10 @@ class bt {
|
|
|
2298
2221
|
Hn(e, t);
|
|
2299
2222
|
}
|
|
2300
2223
|
static yAxis(e, t) {
|
|
2301
|
-
|
|
2224
|
+
Bn(e, t);
|
|
2302
2225
|
}
|
|
2303
2226
|
static intersection(e, t) {
|
|
2304
|
-
|
|
2227
|
+
In(e, t);
|
|
2305
2228
|
}
|
|
2306
2229
|
}
|
|
2307
2230
|
class Rn {
|
|
@@ -2337,13 +2260,13 @@ function Ke(i) {
|
|
|
2337
2260
|
const $n = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2338
2261
|
const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
|
|
2339
2262
|
i.save(), i.translate(p, v), i.scale(g, g), i.beginPath(), i.moveTo(7.85696, 0.288512), i.lineTo(4.53377, 3.11938), i.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), i.lineTo(11.2275, 4), i.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), i.lineTo(8.52156, 0.302869), i.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), i.closePath(), i.fillStyle = e, i.fill(), i.beginPath(), i.moveTo(0, 7), i.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), i.lineTo(12, 3), i.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), i.lineTo(16, 15), i.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), i.lineTo(4, 19), i.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), i.lineTo(0, 7), i.closePath(), i.fillStyle = e, i.fill(), i.restore(), i.save(), i.font = `bold ${o}px sans-serif`, i.textAlign = "center", i.textBaseline = "top", i.textAlign = "center", i.textBaseline = "middle";
|
|
2340
|
-
const b = a + g * 3 + 0.5,
|
|
2341
|
-
i.fillStyle = t, i.fillText(s, n,
|
|
2263
|
+
const b = a + g * 3 + 0.5, w = g * 16, x = b + w / 2;
|
|
2264
|
+
i.fillStyle = t, i.fillText(s, n, x), i.restore();
|
|
2342
2265
|
}, On = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2343
2266
|
const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
|
|
2344
2267
|
i.save(), i.translate(p, v), i.scale(g, -g), i.beginPath(), i.moveTo(7.85696, 0.288512), i.lineTo(4.53377, 3.11938), i.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), i.lineTo(11.2275, 4), i.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), i.lineTo(8.52156, 0.302869), i.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), i.closePath(), i.fillStyle = e, i.fill(), i.beginPath(), i.moveTo(0, 7), i.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), i.lineTo(12, 3), i.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), i.lineTo(16, 15), i.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), i.lineTo(4, 19), i.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), i.lineTo(0, 7), i.closePath(), i.fillStyle = e, i.fill(), i.restore(), i.save(), i.font = `bold ${o}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle";
|
|
2345
|
-
const b = g * 16,
|
|
2346
|
-
i.fillStyle = t, i.fillText(s, n,
|
|
2268
|
+
const b = g * 16, w = a - g * 19 + b / 2;
|
|
2269
|
+
i.fillStyle = t, i.fillText(s, n, w), i.restore();
|
|
2347
2270
|
};
|
|
2348
2271
|
function et(i) {
|
|
2349
2272
|
"@babel/helpers - typeof";
|
|
@@ -2359,7 +2282,7 @@ function A(i, e) {
|
|
|
2359
2282
|
return i;
|
|
2360
2283
|
if (!(this instanceof A))
|
|
2361
2284
|
return new A(i, e);
|
|
2362
|
-
var t =
|
|
2285
|
+
var t = Vn(i);
|
|
2363
2286
|
this._originalInput = i, this._r = t.r, this._g = t.g, this._b = t.b, this._a = t.a, this._roundA = Math.round(100 * this._a) / 100, this._format = e.format || t.format, this._gradientType = e.gradientType, this._r < 1 && (this._r = Math.round(this._r)), this._g < 1 && (this._g = Math.round(this._g)), this._b < 1 && (this._b = Math.round(this._b)), this._ok = t.ok;
|
|
2364
2287
|
}
|
|
2365
2288
|
A.prototype = {
|
|
@@ -2443,14 +2366,14 @@ A.prototype = {
|
|
|
2443
2366
|
},
|
|
2444
2367
|
toPercentageRgb: function() {
|
|
2445
2368
|
return {
|
|
2446
|
-
r: Math.round(
|
|
2447
|
-
g: Math.round(
|
|
2448
|
-
b: Math.round(
|
|
2369
|
+
r: Math.round(R(this._r, 255) * 100) + "%",
|
|
2370
|
+
g: Math.round(R(this._g, 255) * 100) + "%",
|
|
2371
|
+
b: Math.round(R(this._b, 255) * 100) + "%",
|
|
2449
2372
|
a: this._a
|
|
2450
2373
|
};
|
|
2451
2374
|
},
|
|
2452
2375
|
toPercentageRgbString: function() {
|
|
2453
|
-
return this._a == 1 ? "rgb(" + Math.round(
|
|
2376
|
+
return this._a == 1 ? "rgb(" + Math.round(R(this._r, 255) * 100) + "%, " + Math.round(R(this._g, 255) * 100) + "%, " + Math.round(R(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(R(this._r, 255) * 100) + "%, " + Math.round(R(this._g, 255) * 100) + "%, " + Math.round(R(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
2454
2377
|
},
|
|
2455
2378
|
toName: function() {
|
|
2456
2379
|
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : na[hi(this._r, this._g, this._b, !0)] || !1;
|
|
@@ -2532,13 +2455,13 @@ A.fromRatio = function(i, e) {
|
|
|
2532
2455
|
}
|
|
2533
2456
|
return A(i, e);
|
|
2534
2457
|
};
|
|
2535
|
-
function
|
|
2458
|
+
function Vn(i) {
|
|
2536
2459
|
var e = {
|
|
2537
2460
|
r: 0,
|
|
2538
2461
|
g: 0,
|
|
2539
2462
|
b: 0
|
|
2540
2463
|
}, t = 1, s = null, n = null, a = null, r = !1, o = !1;
|
|
2541
|
-
return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e =
|
|
2464
|
+
return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e = Yn(i.r, i.g, i.b), r = !0, o = String(i.r).substr(-1) === "%" ? "prgb" : "rgb") : ie(i.h) && ie(i.s) && ie(i.v) ? (s = De(i.s), n = De(i.v), e = jn(i.h, s, n), r = !0, o = "hsv") : ie(i.h) && ie(i.s) && ie(i.l) && (s = De(i.s), a = De(i.l), e = Wn(i.h, s, a), r = !0, o = "hsl"), i.hasOwnProperty("a") && (t = i.a)), t = yi(t), {
|
|
2542
2465
|
ok: r,
|
|
2543
2466
|
format: i.format || o,
|
|
2544
2467
|
r: Math.min(255, Math.max(e.r, 0)),
|
|
@@ -2547,15 +2470,15 @@ function Yn(i) {
|
|
|
2547
2470
|
a: t
|
|
2548
2471
|
};
|
|
2549
2472
|
}
|
|
2550
|
-
function
|
|
2473
|
+
function Yn(i, e, t) {
|
|
2551
2474
|
return {
|
|
2552
|
-
r:
|
|
2553
|
-
g:
|
|
2554
|
-
b:
|
|
2475
|
+
r: R(i, 255) * 255,
|
|
2476
|
+
g: R(e, 255) * 255,
|
|
2477
|
+
b: R(t, 255) * 255
|
|
2555
2478
|
};
|
|
2556
2479
|
}
|
|
2557
2480
|
function li(i, e, t) {
|
|
2558
|
-
i =
|
|
2481
|
+
i = R(i, 255), e = R(e, 255), t = R(t, 255);
|
|
2559
2482
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = (s + n) / 2;
|
|
2560
2483
|
if (s == n)
|
|
2561
2484
|
a = r = 0;
|
|
@@ -2582,7 +2505,7 @@ function li(i, e, t) {
|
|
|
2582
2505
|
}
|
|
2583
2506
|
function Wn(i, e, t) {
|
|
2584
2507
|
var s, n, a;
|
|
2585
|
-
i =
|
|
2508
|
+
i = R(i, 360), e = R(e, 100), t = R(t, 100);
|
|
2586
2509
|
function r(h, d, g) {
|
|
2587
2510
|
return g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ? h + (d - h) * 6 * g : g < 1 / 2 ? d : g < 2 / 3 ? h + (d - h) * (2 / 3 - g) * 6 : h;
|
|
2588
2511
|
}
|
|
@@ -2599,7 +2522,7 @@ function Wn(i, e, t) {
|
|
|
2599
2522
|
};
|
|
2600
2523
|
}
|
|
2601
2524
|
function ci(i, e, t) {
|
|
2602
|
-
i =
|
|
2525
|
+
i = R(i, 255), e = R(e, 255), t = R(t, 255);
|
|
2603
2526
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = s, c = s - n;
|
|
2604
2527
|
if (r = s === 0 ? 0 : c / s, s == n)
|
|
2605
2528
|
a = 0;
|
|
@@ -2624,7 +2547,7 @@ function ci(i, e, t) {
|
|
|
2624
2547
|
};
|
|
2625
2548
|
}
|
|
2626
2549
|
function jn(i, e, t) {
|
|
2627
|
-
i =
|
|
2550
|
+
i = R(i, 360) * 6, e = R(e, 100), t = R(t, 100);
|
|
2628
2551
|
var s = Math.floor(i), n = i - s, a = t * (1 - e), r = t * (1 - n * e), o = t * (1 - (1 - n) * e), c = s % 6, h = [t, r, a, a, o, t][c], d = [o, t, t, r, a, a][c], g = [a, a, o, t, t, r][c];
|
|
2629
2552
|
return {
|
|
2630
2553
|
r: h * 255,
|
|
@@ -2930,7 +2853,7 @@ function aa(i) {
|
|
|
2930
2853
|
function yi(i) {
|
|
2931
2854
|
return i = parseFloat(i), (isNaN(i) || i < 0 || i > 1) && (i = 1), i;
|
|
2932
2855
|
}
|
|
2933
|
-
function
|
|
2856
|
+
function R(i, e) {
|
|
2934
2857
|
ra(i) && (i = "100%");
|
|
2935
2858
|
var t = oa(i);
|
|
2936
2859
|
return i = Math.min(e, Math.max(0, parseFloat(i))), t && (i = parseInt(i * e, 10) / 100), Math.abs(i - e) < 1e-6 ? 1 : i % e / parseFloat(e);
|
|
@@ -3067,14 +2990,14 @@ function ha(i, e) {
|
|
|
3067
2990
|
t.forEach(({ isHovered: h, isActive: d, candle: g, trades: _ }) => {
|
|
3068
2991
|
const p = s.convert(g.open_time);
|
|
3069
2992
|
_.forEach((v) => {
|
|
3070
|
-
const b = v.type === "buy",
|
|
3071
|
-
let
|
|
3072
|
-
h && h[1] && h[0] === v.type && (
|
|
2993
|
+
const b = v.type === "buy", w = b ? o.buyLabel.text : o.sellLabel.text, x = b ? "B" : "S", y = b ? n.convert(g.low) + c : n.convert(g.high) - c, C = b ? $n : On;
|
|
2994
|
+
let M = b ? o.buyLabel.main : o.sellLabel.main;
|
|
2995
|
+
h && h[1] && h[0] === v.type && (M = A.mix(M, a.bg, 20).toString()), d && d[1] && d[0] === v.type && (M = o.activeLabel), C(i, {
|
|
3073
2996
|
x: p,
|
|
3074
2997
|
y,
|
|
3075
|
-
symbol:
|
|
3076
|
-
mainColor:
|
|
3077
|
-
textColor:
|
|
2998
|
+
symbol: x,
|
|
2999
|
+
mainColor: M,
|
|
3000
|
+
textColor: w,
|
|
3078
3001
|
size: 16,
|
|
3079
3002
|
fontSize: 12
|
|
3080
3003
|
});
|
|
@@ -3119,9 +3042,9 @@ const ua = (i, e) => {
|
|
|
3119
3042
|
}, d = (g, _) => {
|
|
3120
3043
|
const p = h(g.time), v = h(_.time);
|
|
3121
3044
|
if (!p || !v) return;
|
|
3122
|
-
const b = t.convert(p.open_time),
|
|
3123
|
-
let
|
|
3124
|
-
g.type === "buy" ? (
|
|
3045
|
+
const b = t.convert(p.open_time), w = t.convert(v.open_time);
|
|
3046
|
+
let x, y;
|
|
3047
|
+
g.type === "buy" ? (x = s.convert(p.low), y = s.convert(v.high)) : (x = s.convert(p.high), y = s.convert(v.low)), i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.connectionLine, i.moveTo(b, x), i.lineTo(w, y), i.stroke(), i.setLineDash([]);
|
|
3125
3048
|
};
|
|
3126
3049
|
if (a.length === 1 && r.length > 1)
|
|
3127
3050
|
r.forEach((g) => d(a[0], g));
|
|
@@ -3171,7 +3094,7 @@ function ga(i) {
|
|
|
3171
3094
|
return s.length ? s.join(" ") : "0s";
|
|
3172
3095
|
}
|
|
3173
3096
|
const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
3174
|
-
var
|
|
3097
|
+
var V;
|
|
3175
3098
|
const {
|
|
3176
3099
|
scales: { x: t, y: s },
|
|
3177
3100
|
trade: { entries: n, exits: a, holdTime: r },
|
|
@@ -3185,27 +3108,27 @@ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
|
3185
3108
|
if (!c) return;
|
|
3186
3109
|
const _ = n.at(0), p = a.at(-1);
|
|
3187
3110
|
if (!_ || !p) return;
|
|
3188
|
-
const v = (Y) => Y ? Y instanceof Date ? Y : new Date(Y) : null, b = t.convert(v(d == null ? void 0 : d[0]) || _.candle.open_time),
|
|
3189
|
-
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(b,
|
|
3190
|
-
const y = (b +
|
|
3111
|
+
const v = (Y) => Y ? Y instanceof Date ? Y : new Date(Y) : null, b = t.convert(v(d == null ? void 0 : d[0]) || _.candle.open_time), w = t.convert(v(d == null ? void 0 : d[1]) || p.candle.open_time), x = s.convert(g || (((V = n.at(0)) == null ? void 0 : V.price) ?? 0));
|
|
3112
|
+
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(b, x), i.lineTo(w, x), i.stroke(), i.setLineDash([]);
|
|
3113
|
+
const y = (b + w) / 2, C = h || `Hold: ${ga(r)}`, S = getComputedStyle(
|
|
3191
3114
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3192
3115
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3193
3116
|
i.font = `600 ${ma}px ${S}`;
|
|
3194
|
-
const
|
|
3117
|
+
const $ = i.measureText(C).width + pa * 2, z = va + _a * 2;
|
|
3195
3118
|
xi(i, {
|
|
3196
3119
|
radius: 4,
|
|
3197
3120
|
coords: {
|
|
3198
|
-
x: y -
|
|
3199
|
-
y:
|
|
3121
|
+
x: y - $ / 2,
|
|
3122
|
+
y: x - z / 2
|
|
3200
3123
|
},
|
|
3201
|
-
width:
|
|
3202
|
-
height:
|
|
3124
|
+
width: $,
|
|
3125
|
+
height: z,
|
|
3203
3126
|
fillColor: o.main
|
|
3204
|
-
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(
|
|
3127
|
+
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(C, y, x), i.restore();
|
|
3205
3128
|
};
|
|
3206
|
-
class
|
|
3129
|
+
class Ne {
|
|
3207
3130
|
constructor(e, t, {
|
|
3208
|
-
CanvasClass: s =
|
|
3131
|
+
CanvasClass: s = Ee,
|
|
3209
3132
|
noCanvas: n = !1,
|
|
3210
3133
|
noDOM: a = !1
|
|
3211
3134
|
} = {}) {
|
|
@@ -3213,7 +3136,7 @@ class Fe {
|
|
|
3213
3136
|
f(this, "dom", null);
|
|
3214
3137
|
f(this, "prefix");
|
|
3215
3138
|
const { width: r, height: o, canvasesContainer: c, domElements: h } = t;
|
|
3216
|
-
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${e}`, width: r, height: o }), c.append(this.canvas.node)), a || (this.dom = new
|
|
3139
|
+
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${e}`, width: r, height: o }), c.append(this.canvas.node)), a || (this.dom = new k({ className: `sc-charts-cs__dom-${e}` }), h.append(this.dom.node)), this.prefix = `sc-charts-cs__${e}`;
|
|
3217
3140
|
}
|
|
3218
3141
|
cx(...e) {
|
|
3219
3142
|
return e.map((t) => `${this.prefix}-${t}`).join(" ");
|
|
@@ -3235,35 +3158,35 @@ const ya = {
|
|
|
3235
3158
|
offset: n = 8
|
|
3236
3159
|
}) => {
|
|
3237
3160
|
const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (y) => {
|
|
3238
|
-
const { dx:
|
|
3239
|
-
return { x: S, y:
|
|
3240
|
-
}, d = ({ x: y, y:
|
|
3241
|
-
const y = t.y < 0,
|
|
3242
|
-
return
|
|
3161
|
+
const { dx: C, dy: M } = ya[y], S = t.x + (C === 1 ? n : -a - n), N = t.y + (M === 1 ? n : -r - n);
|
|
3162
|
+
return { x: S, y: N, side: y };
|
|
3163
|
+
}, d = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + a <= o && C + r <= c, g = () => {
|
|
3164
|
+
const y = t.y < 0, C = t.y + r > c, M = t.x < 0, S = t.x + a > o;
|
|
3165
|
+
return M && y ? "right-bottom" : M && C ? "right-top" : S && y ? "left-bottom" : S && C ? "left-top" : M ? "right-bottom" : S ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
|
|
3243
3166
|
}, p = [
|
|
3244
3167
|
s,
|
|
3245
3168
|
"right-bottom",
|
|
3246
3169
|
"right-top",
|
|
3247
3170
|
"left-bottom",
|
|
3248
3171
|
"left-top"
|
|
3249
|
-
].filter((y,
|
|
3172
|
+
].filter((y, C, M) => M.indexOf(y) === C), v = g();
|
|
3250
3173
|
let b = null;
|
|
3251
3174
|
for (const y of [v, ...p]) {
|
|
3252
|
-
const
|
|
3253
|
-
if (d(
|
|
3254
|
-
b =
|
|
3175
|
+
const C = h(y);
|
|
3176
|
+
if (d(C)) {
|
|
3177
|
+
b = C;
|
|
3255
3178
|
break;
|
|
3256
3179
|
}
|
|
3257
3180
|
}
|
|
3258
3181
|
b || (b = h(v));
|
|
3259
|
-
const
|
|
3182
|
+
const w = Math.min(Math.max(b.x, n), o - a - n), x = Math.min(Math.max(b.y, n), c - r - n);
|
|
3260
3183
|
return {
|
|
3261
|
-
x,
|
|
3262
|
-
y:
|
|
3184
|
+
x: w,
|
|
3185
|
+
y: x,
|
|
3263
3186
|
side: b.side
|
|
3264
3187
|
};
|
|
3265
3188
|
};
|
|
3266
|
-
class se extends
|
|
3189
|
+
class se extends k {
|
|
3267
3190
|
constructor(t) {
|
|
3268
3191
|
super(t);
|
|
3269
3192
|
f(this, "_state", {});
|
|
@@ -3306,13 +3229,13 @@ class wa extends se {
|
|
|
3306
3229
|
f(this, "manyBox");
|
|
3307
3230
|
f(this, "oneBox");
|
|
3308
3231
|
f(this, "clsx");
|
|
3309
|
-
this.clsx = t.cxFabric(s), this.title = new
|
|
3232
|
+
this.clsx = t.cxFabric(s), this.title = new k({
|
|
3310
3233
|
tag: "div",
|
|
3311
3234
|
className: this.clsx("title")
|
|
3312
|
-
}), this.manyBox = new
|
|
3235
|
+
}), this.manyBox = new k({
|
|
3313
3236
|
tag: "div",
|
|
3314
3237
|
className: this.clsx("box_many")
|
|
3315
|
-
}), this.oneBox = new
|
|
3238
|
+
}), this.oneBox = new k({
|
|
3316
3239
|
tag: "div",
|
|
3317
3240
|
className: this.clsx("box_one")
|
|
3318
3241
|
}), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() };
|
|
@@ -3321,13 +3244,13 @@ class wa extends se {
|
|
|
3321
3244
|
const n = [];
|
|
3322
3245
|
for (const a of Object.keys(s))
|
|
3323
3246
|
if (a in t) {
|
|
3324
|
-
const r = new
|
|
3247
|
+
const r = new k({
|
|
3325
3248
|
tag: "div",
|
|
3326
3249
|
className: this.clsx("line")
|
|
3327
3250
|
});
|
|
3328
3251
|
let o = t[a].toString();
|
|
3329
3252
|
a === "kind" && (o = this._formatDate(t.time));
|
|
3330
|
-
const c = new
|
|
3253
|
+
const c = new k({ tag: "strong", textContent: s[a] }), h = new k({ tag: "span", textContent: o });
|
|
3331
3254
|
r.append(c.node, h.node), n.push(r.node);
|
|
3332
3255
|
}
|
|
3333
3256
|
return n;
|
|
@@ -3357,7 +3280,7 @@ class wa extends se {
|
|
|
3357
3280
|
} else if (t.length > 1) {
|
|
3358
3281
|
this.manyBox.node.style.display = "flex";
|
|
3359
3282
|
const s = t.map((n) => {
|
|
3360
|
-
const a = new
|
|
3283
|
+
const a = new k({ tag: "div" }), r = this._createLineNodes(n, {
|
|
3361
3284
|
kind: n.kind === "entry" ? "Entry:" : "Exit:",
|
|
3362
3285
|
price: "Price:"
|
|
3363
3286
|
});
|
|
@@ -3378,7 +3301,7 @@ class wa extends se {
|
|
|
3378
3301
|
this.position(r.x, r.y);
|
|
3379
3302
|
}
|
|
3380
3303
|
}
|
|
3381
|
-
class xa extends
|
|
3304
|
+
class xa extends Ne {
|
|
3382
3305
|
constructor(t) {
|
|
3383
3306
|
super("trade", t);
|
|
3384
3307
|
f(this, "labelTooltip");
|
|
@@ -3393,7 +3316,7 @@ class xa extends Fe {
|
|
|
3393
3316
|
function Ca(i, { color: e = "#000000", lineWidth: t = 1, dashed: s, coords: n }) {
|
|
3394
3317
|
i.strokeStyle = e, i.lineWidth = t, s && i.setLineDash(s), i.beginPath(), i.moveTo(n.x1, n.y1), i.lineTo(n.x2, n.y2), i.stroke();
|
|
3395
3318
|
}
|
|
3396
|
-
const Ta = { text: "#FFFFFF", bg: "#000000" },
|
|
3319
|
+
const Ta = { text: "#FFFFFF", bg: "#000000" }, Aa = (i, e) => {
|
|
3397
3320
|
const {
|
|
3398
3321
|
coords: t,
|
|
3399
3322
|
text: s,
|
|
@@ -3408,15 +3331,15 @@ const Ta = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3408
3331
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3409
3332
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3410
3333
|
i.font = `${a} ${n}px ${p}`;
|
|
3411
|
-
const b = i.measureText(s).width + o.x * 2,
|
|
3412
|
-
let
|
|
3413
|
-
d.x === "middle" ?
|
|
3334
|
+
const b = i.measureText(s).width + o.x * 2, w = r + o.y * 2;
|
|
3335
|
+
let x = t.x, y = t.y;
|
|
3336
|
+
d.x === "middle" ? x -= b / 2 : d.x === "right" && (x -= b), d.y === "middle" ? y -= w / 2 : d.y === "bottom" && (y -= w), xi(i, {
|
|
3414
3337
|
radius: c,
|
|
3415
|
-
coords: { x
|
|
3338
|
+
coords: { x, y },
|
|
3416
3339
|
width: b,
|
|
3417
|
-
height:
|
|
3340
|
+
height: w,
|
|
3418
3341
|
fillColor: g.bg
|
|
3419
|
-
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s,
|
|
3342
|
+
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, x + b / 2, y + w / 2);
|
|
3420
3343
|
}, gi = {
|
|
3421
3344
|
line: "#000000",
|
|
3422
3345
|
text: "#ffffff",
|
|
@@ -3435,7 +3358,7 @@ const Ta = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3435
3358
|
x2: r.x,
|
|
3436
3359
|
y2: r.y
|
|
3437
3360
|
}
|
|
3438
|
-
}),
|
|
3361
|
+
}), Aa(i, {
|
|
3439
3362
|
text: e,
|
|
3440
3363
|
coords: r,
|
|
3441
3364
|
padding: { x: 6, y: 4 },
|
|
@@ -3452,7 +3375,7 @@ const Ta = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3452
3375
|
}
|
|
3453
3376
|
}), i.restore();
|
|
3454
3377
|
};
|
|
3455
|
-
class
|
|
3378
|
+
class Ma extends Ee {
|
|
3456
3379
|
constructor(e) {
|
|
3457
3380
|
super(e);
|
|
3458
3381
|
}
|
|
@@ -3460,9 +3383,9 @@ class Aa extends Le {
|
|
|
3460
3383
|
Ci(this.ctx, e);
|
|
3461
3384
|
}
|
|
3462
3385
|
}
|
|
3463
|
-
class Sa extends
|
|
3386
|
+
class Sa extends Ne {
|
|
3464
3387
|
constructor(e) {
|
|
3465
|
-
if (super("user-markers", e, { CanvasClass:
|
|
3388
|
+
if (super("user-markers", e, { CanvasClass: Ma, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_UserMarkers] this.canvas must be defined");
|
|
3466
3389
|
}
|
|
3467
3390
|
render(e) {
|
|
3468
3391
|
this.canvas.clear();
|
|
@@ -3501,10 +3424,10 @@ class ae {
|
|
|
3501
3424
|
}
|
|
3502
3425
|
}
|
|
3503
3426
|
const yt = new ae("comment-actions");
|
|
3504
|
-
class ka extends
|
|
3427
|
+
class ka extends k {
|
|
3505
3428
|
constructor({ onDelete: e, onUpdate: t }) {
|
|
3506
3429
|
super({ className: yt.gen() });
|
|
3507
|
-
const s = new
|
|
3430
|
+
const s = new k({ tag: "button", className: yt.gen("edit"), textContent: "Edit" }), n = new k({
|
|
3508
3431
|
tag: "button",
|
|
3509
3432
|
className: yt.gen("delete"),
|
|
3510
3433
|
textContent: "Delete"
|
|
@@ -3516,7 +3439,7 @@ class ka extends F {
|
|
|
3516
3439
|
}), this.append(s.node, n.node);
|
|
3517
3440
|
}
|
|
3518
3441
|
}
|
|
3519
|
-
function
|
|
3442
|
+
function Lt(i, e) {
|
|
3520
3443
|
var n;
|
|
3521
3444
|
const t = (a) => {
|
|
3522
3445
|
if (!document.contains(i.node)) return;
|
|
@@ -3533,7 +3456,7 @@ function Et(i, e) {
|
|
|
3533
3456
|
document.removeEventListener("mousedown", t), s == null || s();
|
|
3534
3457
|
}, i;
|
|
3535
3458
|
}
|
|
3536
|
-
class
|
|
3459
|
+
class La {
|
|
3537
3460
|
constructor() {
|
|
3538
3461
|
f(this, "node");
|
|
3539
3462
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3571,34 +3494,34 @@ class Ea {
|
|
|
3571
3494
|
this.node = t;
|
|
3572
3495
|
}
|
|
3573
3496
|
}
|
|
3574
|
-
const
|
|
3575
|
-
class
|
|
3497
|
+
const Me = new ae("comment-list");
|
|
3498
|
+
class Ea extends k {
|
|
3576
3499
|
constructor({ onDelete: t, onOpenEditor: s, comment: n, layout: a }) {
|
|
3577
|
-
super({ className:
|
|
3500
|
+
super({ className: Me.gen("item") });
|
|
3578
3501
|
f(this, "actionTooltip");
|
|
3579
3502
|
f(this, "actionsTrigger");
|
|
3580
|
-
const r = new
|
|
3581
|
-
className:
|
|
3503
|
+
const r = new k({ className: Me.gen("text"), textContent: n.text }), o = new k({
|
|
3504
|
+
className: Me.gen("created-at"),
|
|
3582
3505
|
textContent: fa(new Date(n.createdAt))
|
|
3583
3506
|
});
|
|
3584
|
-
this.actionsTrigger = new
|
|
3507
|
+
this.actionsTrigger = new k({
|
|
3585
3508
|
tag: "button",
|
|
3586
|
-
className:
|
|
3509
|
+
className: Me.gen("action-trigger")
|
|
3587
3510
|
});
|
|
3588
3511
|
const c = new ka({
|
|
3589
3512
|
onDelete: t,
|
|
3590
3513
|
onUpdate: s
|
|
3591
3514
|
});
|
|
3592
|
-
this.actionTooltip =
|
|
3515
|
+
this.actionTooltip = Lt(c, () => {
|
|
3593
3516
|
this.actionTooltip.setVisible(!1);
|
|
3594
3517
|
}), this.actionsTrigger.node.addEventListener("click", () => {
|
|
3595
3518
|
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);
|
|
3596
3519
|
});
|
|
3597
|
-
const h = new
|
|
3598
|
-
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new
|
|
3520
|
+
const h = new k({ className: Me.gen("text-wrap") });
|
|
3521
|
+
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new La().node), this.append(h.node, o.node);
|
|
3599
3522
|
}
|
|
3600
3523
|
}
|
|
3601
|
-
class
|
|
3524
|
+
class Na {
|
|
3602
3525
|
constructor() {
|
|
3603
3526
|
f(this, "node");
|
|
3604
3527
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3610,7 +3533,7 @@ class Fa {
|
|
|
3610
3533
|
), s.setAttribute("fill", "currentColor"), t.appendChild(s), this.node = t;
|
|
3611
3534
|
}
|
|
3612
3535
|
}
|
|
3613
|
-
class
|
|
3536
|
+
class Fa {
|
|
3614
3537
|
constructor() {
|
|
3615
3538
|
f(this, "node");
|
|
3616
3539
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3630,14 +3553,14 @@ class Ha extends se {
|
|
|
3630
3553
|
f(this, "cancelBtn");
|
|
3631
3554
|
f(this, "_onSave");
|
|
3632
3555
|
f(this, "_onCancel");
|
|
3633
|
-
this._onSave = t.onSave, this._onCancel = t.onCancel, this.input = new
|
|
3556
|
+
this._onSave = t.onSave, this._onCancel = t.onCancel, this.input = new k({ tag: "textarea", className: "sc-charts-cs__comments-edit-input" }), this.saveBtn = new k({
|
|
3634
3557
|
tag: "button",
|
|
3635
3558
|
className: "sc-charts-cs__comments-edit-save-btn"
|
|
3636
|
-
}), this.saveBtn.append(new
|
|
3559
|
+
}), this.saveBtn.append(new Na().node), this.cancelBtn = new k({
|
|
3637
3560
|
tag: "button",
|
|
3638
3561
|
className: "sc-charts-cs__comments-edit-cancel-btn"
|
|
3639
|
-
}), this.cancelBtn.append(new
|
|
3640
|
-
const s = new
|
|
3562
|
+
}), this.cancelBtn.append(new Fa().node);
|
|
3563
|
+
const s = new k({ className: "sc-charts-cs__comments-edit-btn-container" });
|
|
3641
3564
|
s.append(this.cancelBtn.node, this.saveBtn.node), this.append(this.input.node, s.node), this.state = { inputValue: t.initialValue || "", hasInitFocused: !1 }, this._setupListeners(), this.render();
|
|
3642
3565
|
}
|
|
3643
3566
|
_setupListeners() {
|
|
@@ -3652,10 +3575,10 @@ class Ha extends se {
|
|
|
3652
3575
|
this.input.node.value = this.state.inputValue, this.saveBtn.node.disabled = !this.state.inputValue.trim(), this.state.hasInitFocused || (requestAnimationFrame(() => this.input.node.focus()), this.setState({ hasInitFocused: !0 }));
|
|
3653
3576
|
}
|
|
3654
3577
|
}
|
|
3655
|
-
const
|
|
3656
|
-
class
|
|
3578
|
+
const Ba = new ae("comment-list");
|
|
3579
|
+
class Ia extends se {
|
|
3657
3580
|
constructor(t, s, n, a = {}) {
|
|
3658
|
-
super({ tag: "ul", className:
|
|
3581
|
+
super({ tag: "ul", className: Ba.gen(), ...a });
|
|
3659
3582
|
f(this, "_elements", {});
|
|
3660
3583
|
f(this, "_model");
|
|
3661
3584
|
f(this, "_view");
|
|
@@ -3680,7 +3603,7 @@ class Ba extends se {
|
|
|
3680
3603
|
},
|
|
3681
3604
|
initialValue: t.text
|
|
3682
3605
|
});
|
|
3683
|
-
const s = new
|
|
3606
|
+
const s = new Ea({
|
|
3684
3607
|
onDelete: () => {
|
|
3685
3608
|
this._model.comments.remove(t.id), s.actionTooltip.setVisible(!1);
|
|
3686
3609
|
},
|
|
@@ -3716,10 +3639,10 @@ class Ti extends se {
|
|
|
3716
3639
|
f(this, "btn");
|
|
3717
3640
|
f(this, "input");
|
|
3718
3641
|
f(this, "_onAdd");
|
|
3719
|
-
this._onAdd = t, this.state = { inputValue: "" }, this.input = new
|
|
3642
|
+
this._onAdd = t, this.state = { inputValue: "" }, this.input = new k({
|
|
3720
3643
|
tag: "input",
|
|
3721
3644
|
className: Je.gen("input") + " " + wt.gen("input")
|
|
3722
|
-
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new
|
|
3645
|
+
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new k({
|
|
3723
3646
|
tag: "button",
|
|
3724
3647
|
className: Je.gen("btn") + " " + wt.gen("btn")
|
|
3725
3648
|
}), this.btn.append(new Ra().node), this.append(this.input.node, this.btn.node), this._setupListeners(), this.render();
|
|
@@ -3750,7 +3673,7 @@ class Oa extends se {
|
|
|
3750
3673
|
f(this, "_size", null);
|
|
3751
3674
|
f(this, "_model");
|
|
3752
3675
|
f(this, "_prevIsShow", !1);
|
|
3753
|
-
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new
|
|
3676
|
+
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ia(t, s, n), this._addField = new Ti({
|
|
3754
3677
|
blockName: "list-tooltip-add",
|
|
3755
3678
|
onAdd: (a) => {
|
|
3756
3679
|
const r = t[0].date, o = t[0].price, c = {
|
|
@@ -3804,10 +3727,10 @@ class za extends se {
|
|
|
3804
3727
|
}
|
|
3805
3728
|
}
|
|
3806
3729
|
const mi = new ae("comment-box");
|
|
3807
|
-
class
|
|
3730
|
+
class Va extends se {
|
|
3808
3731
|
constructor({ boxId: t, model: s, view: n, comments: a, coords: r, onBoxActivate: o, onBoxDeactivate: c }) {
|
|
3809
3732
|
super({ className: mi.gen() });
|
|
3810
|
-
f(this, "pointer", new
|
|
3733
|
+
f(this, "pointer", new k({ className: "sc-charts-cs__comments-pointer" }));
|
|
3811
3734
|
f(this, "tooltip");
|
|
3812
3735
|
f(this, "anchor");
|
|
3813
3736
|
f(this, "_onBoxActivate");
|
|
@@ -3820,7 +3743,7 @@ class Ya extends se {
|
|
|
3820
3743
|
}, this.pointer.position(r), this.anchor = new za({ x: r.x, className: mi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
|
|
3821
3744
|
const h = !this.state.isActive;
|
|
3822
3745
|
h ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: h });
|
|
3823
|
-
}), this.tooltip =
|
|
3746
|
+
}), this.tooltip = Lt(new Oa(a, s, n), (h) => {
|
|
3824
3747
|
this.state.isActive && (this.anchor.node.contains(h.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
|
|
3825
3748
|
}), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
|
|
3826
3749
|
}
|
|
@@ -3829,11 +3752,11 @@ class Ya extends se {
|
|
|
3829
3752
|
this.pointer.position(n), this.pointer.setVisible(t), this.anchor.setState({ x: n.x, isActive: t }), this.tooltip.setState({ comments: s, isShow: t });
|
|
3830
3753
|
}
|
|
3831
3754
|
}
|
|
3832
|
-
class
|
|
3755
|
+
class Ya {
|
|
3833
3756
|
static animateTo(e, t, s, n) {
|
|
3834
3757
|
const a = e.scales.panOffsetX + (e.layout.area.width / 2 - t), r = e.scales.panOffsetY + (e.layout.area.height / 2 - s), o = 300, c = performance.now(), h = e.scales.panOffsetX, d = e.scales.panOffsetY, g = (_) => {
|
|
3835
|
-
const p = _ - c, v = Math.min(p / o, 1), b = v * v * (3 - 2 * v),
|
|
3836
|
-
e.scales.pan("x",
|
|
3758
|
+
const p = _ - c, v = Math.min(p / o, 1), b = v * v * (3 - 2 * v), w = h + (a - h) * b, x = d + (r - d) * b;
|
|
3759
|
+
e.scales.pan("x", w, "absolute"), e.scales.pan("y", x, "absolute"), v < 1 ? requestAnimationFrame(g) : n == null || n();
|
|
3837
3760
|
};
|
|
3838
3761
|
requestAnimationFrame(g);
|
|
3839
3762
|
}
|
|
@@ -3852,7 +3775,7 @@ class Wa extends se {
|
|
|
3852
3775
|
f(this, "_size", null);
|
|
3853
3776
|
f(this, "_model", null);
|
|
3854
3777
|
f(this, "_candle", null);
|
|
3855
|
-
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new
|
|
3778
|
+
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }), Lt(this.menu, () => {
|
|
3856
3779
|
this.setState({ isShow: !1 });
|
|
3857
3780
|
}), this.addField = new Ti({
|
|
3858
3781
|
blockName: "context-add",
|
|
@@ -3888,7 +3811,7 @@ class Wa extends se {
|
|
|
3888
3811
|
this._changeInputCorner(r.side), this.menu.position(r.x, r.y);
|
|
3889
3812
|
}
|
|
3890
3813
|
}
|
|
3891
|
-
class ja extends
|
|
3814
|
+
class ja extends Ne {
|
|
3892
3815
|
constructor(t) {
|
|
3893
3816
|
super("comments", t, { noCanvas: !0 });
|
|
3894
3817
|
f(this, "boxes", {});
|
|
@@ -3904,7 +3827,7 @@ class ja extends Fe {
|
|
|
3904
3827
|
};
|
|
3905
3828
|
}
|
|
3906
3829
|
createBox({ boxId: t, coords: s, model: n, comments: a }) {
|
|
3907
|
-
const r = new
|
|
3830
|
+
const r = new Va({
|
|
3908
3831
|
boxId: t,
|
|
3909
3832
|
model: n,
|
|
3910
3833
|
comments: a,
|
|
@@ -3912,7 +3835,7 @@ class ja extends Fe {
|
|
|
3912
3835
|
view: this._view,
|
|
3913
3836
|
onBoxActivate: (o) => {
|
|
3914
3837
|
const c = a[0].candle;
|
|
3915
|
-
|
|
3838
|
+
Ya.animateToDataCoords(n, c.open_time, (c.open + c.close) / 2), this.boxes[o].setState({ isActive: !0 });
|
|
3916
3839
|
},
|
|
3917
3840
|
onBoxDeactivate: (o) => this.boxes[o].setState({ isActive: !1 })
|
|
3918
3841
|
});
|
|
@@ -3929,7 +3852,7 @@ class ja extends Fe {
|
|
|
3929
3852
|
});
|
|
3930
3853
|
}
|
|
3931
3854
|
}
|
|
3932
|
-
class Xa extends
|
|
3855
|
+
class Xa extends Ee {
|
|
3933
3856
|
constructor(e) {
|
|
3934
3857
|
super(e);
|
|
3935
3858
|
}
|
|
@@ -3944,7 +3867,7 @@ class Xa extends Le {
|
|
|
3944
3867
|
});
|
|
3945
3868
|
}
|
|
3946
3869
|
}
|
|
3947
|
-
class Ua extends
|
|
3870
|
+
class Ua extends Ne {
|
|
3948
3871
|
constructor(e) {
|
|
3949
3872
|
if (super("guides", e, { CanvasClass: Xa, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_Guides] Canvas must be defined");
|
|
3950
3873
|
}
|
|
@@ -3977,7 +3900,7 @@ class Ga extends se {
|
|
|
3977
3900
|
constructor(t) {
|
|
3978
3901
|
super({ className: t });
|
|
3979
3902
|
f(this, "_isFirstShow", !1);
|
|
3980
|
-
const s = new
|
|
3903
|
+
const s = new k({ tag: "p" });
|
|
3981
3904
|
s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() }, this.render();
|
|
3982
3905
|
}
|
|
3983
3906
|
render() {
|
|
@@ -3991,7 +3914,7 @@ class Ga extends se {
|
|
|
3991
3914
|
this.position(r.x, r.y);
|
|
3992
3915
|
}
|
|
3993
3916
|
}
|
|
3994
|
-
class Za extends
|
|
3917
|
+
class Za extends Ee {
|
|
3995
3918
|
constructor(t) {
|
|
3996
3919
|
super(t);
|
|
3997
3920
|
f(this, "domain", null);
|
|
@@ -4047,14 +3970,14 @@ class Za extends Le {
|
|
|
4047
3970
|
};
|
|
4048
3971
|
}
|
|
4049
3972
|
}
|
|
4050
|
-
class qa extends
|
|
3973
|
+
class qa extends Ne {
|
|
4051
3974
|
constructor(t) {
|
|
4052
3975
|
super("candles", t, { CanvasClass: Za });
|
|
4053
3976
|
f(this, "_noDataTooltip", null);
|
|
4054
3977
|
f(this, "limiter");
|
|
4055
3978
|
if (!this.dom) throw new Error("[CS_V_Candles] this.dom must be defined");
|
|
4056
3979
|
if (!this.canvas) throw new Error("[CS_V_Candles] this.canvas must be defined");
|
|
4057
|
-
this._noDataTooltip = new Ga(this.cx("no-data")), this.limiter = new
|
|
3980
|
+
this._noDataTooltip = new Ga(this.cx("no-data")), this.limiter = new k({ className: this.cx("limiter") }), this.limiter.setVisible(!1), this.dom.append(this._noDataTooltip.node, this.limiter.node);
|
|
4058
3981
|
}
|
|
4059
3982
|
get noDataTooltip() {
|
|
4060
3983
|
return this._noDataTooltip;
|
|
@@ -4087,14 +4010,14 @@ class Ja {
|
|
|
4087
4010
|
f(this, "trade");
|
|
4088
4011
|
f(this, "comments");
|
|
4089
4012
|
f(this, "candles");
|
|
4090
|
-
this.container = e, this.wrapper = new
|
|
4013
|
+
this.container = e, this.wrapper = new k({ tag: "div", className: "sc-charts-cs" }), e.append(this.wrapper.node);
|
|
4091
4014
|
const { width: t, height: s } = e.getBoundingClientRect();
|
|
4092
|
-
this.width = t, this.height = s, this.mainCanvas = new
|
|
4015
|
+
this.width = t, this.height = s, this.mainCanvas = new Ee({
|
|
4093
4016
|
className: "sc-charts-cs__canvas-main",
|
|
4094
4017
|
width: t,
|
|
4095
4018
|
height: s,
|
|
4096
4019
|
isMain: !0
|
|
4097
|
-
}), this.domElements = new
|
|
4020
|
+
}), this.domElements = new k({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new k({ tag: "div", className: "sc-charts-cs__canvases" }), this.canvasesContainer.append(this.mainCanvas.node), this.wrapper.append(this.canvasesContainer.node, this.domElements.node), this.mainCanvas.updateAbsolutePosition(), this.binding = new Rn(this.mainCanvas.node), this.comments = new ja(this), this.candles = new qa(this), this.trade = new xa(this), this.guideMarkers = new Ua(this), this.userMarkers = new Sa(this);
|
|
4098
4021
|
}
|
|
4099
4022
|
renderAll(e) {
|
|
4100
4023
|
this.mainCanvas.clear(), this.candles.render(e), bt.xAxis(this.mainCanvas.ctx, e), bt.yAxis(this.mainCanvas.ctx, e), bt.intersection(this.mainCanvas.ctx, e), this.trade.renderAll(e), this.userMarkers.render(e), this.comments.render(e);
|
|
@@ -4415,10 +4338,10 @@ class sr {
|
|
|
4415
4338
|
for (const { candle: c, trades: h } of s) {
|
|
4416
4339
|
const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, _ = r, p = r;
|
|
4417
4340
|
for (const v of ["buy", "sell"]) {
|
|
4418
|
-
const b = h.filter((
|
|
4341
|
+
const b = h.filter((C) => C.type === v);
|
|
4419
4342
|
if (!b.length) continue;
|
|
4420
|
-
const
|
|
4421
|
-
if (
|
|
4343
|
+
const w = v === "buy" ? a.convert(c.low) + o + Ke(r) : a.convert(c.high) - o - r - Ke(r), x = e >= g - _ / 2 && e <= g + _ / 2, y = t >= w && t <= w + p;
|
|
4344
|
+
if (x && y)
|
|
4422
4345
|
return {
|
|
4423
4346
|
target: this,
|
|
4424
4347
|
type: "trade-label",
|
|
@@ -4523,14 +4446,14 @@ function cr(i, e) {
|
|
|
4523
4446
|
}));
|
|
4524
4447
|
};
|
|
4525
4448
|
}
|
|
4526
|
-
function
|
|
4449
|
+
function At(i, e) {
|
|
4527
4450
|
const { width: t } = e.candles.limiter.absolutePosition, s = i.config.candles.baseWidth, n = i.config.candles.limiterOffset.left + i.config.candles.limiterOffset.right, r = i.scales.x.convert(i.candles.allData[0].open_time) - t - s / 2 - n;
|
|
4528
4451
|
r > 0 && i.scales.pan("x", -r);
|
|
4529
4452
|
}
|
|
4530
|
-
function
|
|
4453
|
+
function Mt(i) {
|
|
4531
4454
|
return i.candles.limiter.absolutePosition.width > 0;
|
|
4532
4455
|
}
|
|
4533
|
-
class
|
|
4456
|
+
class Et {
|
|
4534
4457
|
constructor(e, t, s) {
|
|
4535
4458
|
f(this, "_model");
|
|
4536
4459
|
f(this, "_hitManager");
|
|
@@ -4538,7 +4461,7 @@ class Lt {
|
|
|
4538
4461
|
this._model = e, this._hitManager = t, this._hit = s, t.register(s);
|
|
4539
4462
|
}
|
|
4540
4463
|
}
|
|
4541
|
-
class hr extends
|
|
4464
|
+
class hr extends Et {
|
|
4542
4465
|
constructor(t, s, n) {
|
|
4543
4466
|
super(t, s, new ar(t));
|
|
4544
4467
|
f(this, "_view");
|
|
@@ -4547,13 +4470,13 @@ class hr extends Lt {
|
|
|
4547
4470
|
register() {
|
|
4548
4471
|
this._hitManager.on(this._hit, "drag", (t) => {
|
|
4549
4472
|
const s = t.x - (t.prevX ?? t.x);
|
|
4550
|
-
this._model.scales.scale("x", -s), this._view &&
|
|
4473
|
+
this._model.scales.scale("x", -s), this._view && Mt(this._view) && At(this._model, this._view);
|
|
4551
4474
|
}), this._hitManager.on(this._hit, "dblclick", () => {
|
|
4552
4475
|
this._model.scales.scale("x", 1, "absolute"), this._model.scales.pan("x", 0, "absolute");
|
|
4553
4476
|
});
|
|
4554
4477
|
}
|
|
4555
4478
|
}
|
|
4556
|
-
class dr extends
|
|
4479
|
+
class dr extends Et {
|
|
4557
4480
|
constructor(e, t) {
|
|
4558
4481
|
super(e, t, new or(e));
|
|
4559
4482
|
}
|
|
@@ -4566,7 +4489,7 @@ class dr extends Lt {
|
|
|
4566
4489
|
});
|
|
4567
4490
|
}
|
|
4568
4491
|
}
|
|
4569
|
-
class ur extends
|
|
4492
|
+
class ur extends Et {
|
|
4570
4493
|
constructor(t, s, n) {
|
|
4571
4494
|
super(t, n, new rr(t));
|
|
4572
4495
|
f(this, "_view");
|
|
@@ -4585,7 +4508,7 @@ class ur extends Lt {
|
|
|
4585
4508
|
this._hit,
|
|
4586
4509
|
"drag",
|
|
4587
4510
|
cr(1, (t) => {
|
|
4588
|
-
this._model.scales.pan("x", t.x - (t.prevX ?? t.x)),
|
|
4511
|
+
this._model.scales.pan("x", t.x - (t.prevX ?? t.x)), Mt(this._view) && At(this._model, this._view), this._model.scales.pan("y", t.y - (t.prevY ?? t.y)), this._view.guideMarkers.render(this._model, { x: t.x, y: t.y });
|
|
4589
4512
|
})
|
|
4590
4513
|
), this._hitManager.on(this._hit, "contextmenu", ({ x: t }) => {
|
|
4591
4514
|
const s = this._model.scales.x.invert(t), n = Dt.findByDate(s, this._model.candles.allData);
|
|
@@ -4594,7 +4517,7 @@ class ur extends Lt {
|
|
|
4594
4517
|
var a, r;
|
|
4595
4518
|
if (!t.deltaY) return;
|
|
4596
4519
|
const s = -t.deltaY, n = (r = (a = this._model.config) == null ? void 0 : a.candles) == null ? void 0 : r.zoomOnWheel;
|
|
4597
|
-
["x", "both"].includes(n) && (this._model.scales.scale("x", s),
|
|
4520
|
+
["x", "both"].includes(n) && (this._model.scales.scale("x", s), Mt(this._view) && At(this._model, this._view)), ["y", "both"].includes(n) && this._model.scales.scale("y", s);
|
|
4598
4521
|
});
|
|
4599
4522
|
}
|
|
4600
4523
|
}
|
|
@@ -4691,7 +4614,7 @@ class _r {
|
|
|
4691
4614
|
throw new Error(
|
|
4692
4615
|
"chartId is required and must be a valid id (only letters, numbers or underscores. The first character must be a letter)"
|
|
4693
4616
|
);
|
|
4694
|
-
if (this._model = new
|
|
4617
|
+
if (this._model = new Nn({
|
|
4695
4618
|
chartId: t,
|
|
4696
4619
|
candles: s,
|
|
4697
4620
|
config: n,
|
|
@@ -4770,20 +4693,20 @@ class _r {
|
|
|
4770
4693
|
e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, _, s, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, _), e.lineTo(s, _), e.stroke(), e.textBaseline = "middle", e.textAlign = "left";
|
|
4771
4694
|
const p = [];
|
|
4772
4695
|
if (t.pair && p.push({ label: "", value: t.pair }), t.net_pnl !== void 0) {
|
|
4773
|
-
const
|
|
4774
|
-
p.push({ label: "Net P&L", value: t.net_pnl, valueColor:
|
|
4696
|
+
const C = t.net_pnl.startsWith("+");
|
|
4697
|
+
p.push({ label: "Net P&L", value: t.net_pnl, valueColor: C ? "#56B683" : "#F18169" });
|
|
4775
4698
|
}
|
|
4776
4699
|
t.type && p.push({ label: "Type", value: t.type }), t.entry_price && p.push({ label: "Entry", value: t.entry_price }), t.exit_price && p.push({ label: "Exit", value: t.exit_price }), t.open_date && p.push({ label: "Open date", value: t.open_date }), t.close_date && p.push({ label: "Close date", value: t.close_date }), t.holdtime && p.push({ label: "Holdtime", value: t.holdtime }), t.rr && p.push({ label: "RR", value: t.rr }), t.volume && p.push({ label: "Volume", value: t.volume });
|
|
4777
4700
|
const v = _ + c / 2, b = 24 * r;
|
|
4778
4701
|
if (p.length === 0) return;
|
|
4779
4702
|
e.font = `500 ${d}px Geist, Arial, sans-serif`;
|
|
4780
|
-
const
|
|
4703
|
+
const w = o ? "#878788" : "#8E8E93", x = o ? "#FAFAFA" : "#1C2026";
|
|
4781
4704
|
let y = h;
|
|
4782
|
-
p.forEach((
|
|
4783
|
-
const
|
|
4784
|
-
e.fillStyle =
|
|
4785
|
-
const
|
|
4786
|
-
e.fillStyle =
|
|
4705
|
+
p.forEach((C) => {
|
|
4706
|
+
const M = e.measureText(C.label).width, S = e.measureText(C.value).width, N = M + g + S;
|
|
4707
|
+
e.fillStyle = w, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.label, y, v);
|
|
4708
|
+
const $ = y + M + g;
|
|
4709
|
+
e.fillStyle = C.valueColor || x, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.value, $, v), y += N + b;
|
|
4787
4710
|
});
|
|
4788
4711
|
}
|
|
4789
4712
|
async captureScreenshot(e = {}) {
|
|
@@ -4801,29 +4724,29 @@ class _r {
|
|
|
4801
4724
|
console.warn("No canvas elements found for screenshot");
|
|
4802
4725
|
return;
|
|
4803
4726
|
}
|
|
4804
|
-
const b = 1440,
|
|
4805
|
-
let
|
|
4806
|
-
|
|
4807
|
-
const
|
|
4808
|
-
U.width = b *
|
|
4727
|
+
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, M = w - x - y - C, S = b, N = _ / p, $ = S / M;
|
|
4728
|
+
let z, V, Y = 0, re = 0;
|
|
4729
|
+
N > $ ? (V = M, z = V * N, Y = 0, re = 0) : (z = S, V = z / N, re = (M - V) / 2);
|
|
4730
|
+
const P = window.devicePixelRatio || 1, U = document.createElement("canvas");
|
|
4731
|
+
U.width = b * P, U.height = w * P;
|
|
4809
4732
|
const G = U.getContext("2d");
|
|
4810
4733
|
if (!G) {
|
|
4811
4734
|
console.error("Failed to get 2D context for merged canvas");
|
|
4812
4735
|
return;
|
|
4813
4736
|
}
|
|
4814
4737
|
G.fillStyle = h ? "#101011" : "#ffffff", G.fillRect(0, 0, U.width, U.height);
|
|
4815
|
-
const
|
|
4816
|
-
await this._drawHeader(G, U.width,
|
|
4738
|
+
const Fe = x * P, st = y * P, oe = M * P, ve = S * P, be = Fe + st;
|
|
4739
|
+
await this._drawHeader(G, U.width, P, h), this._drawHeaderSecondLine(G, r, o, U.width, Fe, P, h);
|
|
4817
4740
|
const He = this._view.mainCanvas;
|
|
4818
4741
|
He.background && (G.fillStyle = He.background, G.fillRect(0, be, U.width, oe));
|
|
4819
|
-
const
|
|
4742
|
+
const Be = z * P, Ie = V * P, F = Y * P, Re = re * P;
|
|
4820
4743
|
v.forEach((O) => {
|
|
4821
|
-
let ee = 0, Z = 0, q = O.width, ge = O.height, ye =
|
|
4822
|
-
if (
|
|
4823
|
-
const le =
|
|
4744
|
+
let ee = 0, Z = 0, q = O.width, ge = O.height, ye = Be, we = Ie, Oe = F, Pe = Re;
|
|
4745
|
+
if (N > $) {
|
|
4746
|
+
const le = Ie / O.height, ce = O.width * le;
|
|
4824
4747
|
ce > ve && (ee = (ce - ve) / le, q = O.width - ee, ye = ve, Oe = 0);
|
|
4825
4748
|
} else {
|
|
4826
|
-
const le =
|
|
4749
|
+
const le = Be / O.width, ce = O.height * le;
|
|
4827
4750
|
if (ce > oe) {
|
|
4828
4751
|
const xe = (ce - oe) / le;
|
|
4829
4752
|
Z = xe / 2, ge = O.height - xe, we = oe, Pe = 0;
|
|
@@ -4840,7 +4763,7 @@ class _r {
|
|
|
4840
4763
|
ye,
|
|
4841
4764
|
we
|
|
4842
4765
|
);
|
|
4843
|
-
}), c && this._drawFooter(G, c, U.width, be, oe,
|
|
4766
|
+
}), c && this._drawFooter(G, c, U.width, be, oe, P, h);
|
|
4844
4767
|
const $e = (O, ee) => {
|
|
4845
4768
|
const Z = URL.createObjectURL(O), q = document.createElement("a");
|
|
4846
4769
|
q.href = Z, q.download = ee, document.body.appendChild(q), q.click(), document.body.removeChild(q), URL.revokeObjectURL(Z);
|