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