charts-core 1.1.28 → 1.1.30
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 +269 -294
- 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,64 +1,39 @@
|
|
|
1
1
|
var Ns = Object.defineProperty;
|
|
2
2
|
var Fs = (i, e, t) => e in i ? Ns(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var f = (i, e, t) => Fs(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import * as
|
|
4
|
+
import * as 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;
|
|
7
7
|
if (!g) return null;
|
|
8
8
|
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((_) => {
|
|
9
|
-
let p =
|
|
10
|
-
o && c ? p = p.tickFormat(c) : p = p.tickFormat((
|
|
11
|
-
const
|
|
12
|
-
return Math.abs(
|
|
9
|
+
let p = L.axisRight(s);
|
|
10
|
+
o && c ? p = p.tickFormat(c) : p = p.tickFormat((v) => {
|
|
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 = [];
|
|
16
|
-
_.selectAll(".tick").each((
|
|
16
|
+
_.selectAll(".tick").each((v) => p.push(v)), i.yTicks = p;
|
|
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
|
|
21
|
-
_.selectAll(".tick").each(function(
|
|
20
|
+
const v = p.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
|
|
21
|
+
_.selectAll(".tick").each(function(w, x) {
|
|
22
22
|
var $;
|
|
23
|
-
const
|
|
24
|
-
C.attr("x",
|
|
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());
|
|
25
25
|
});
|
|
26
26
|
}).attr("font-family", "inherit");
|
|
27
27
|
}, Bs = (i) => {
|
|
28
|
-
const { svg: e, config: t, x: s, height: n
|
|
29
|
-
if (!
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const x = new Date(b);
|
|
38
|
-
return new Intl.DateTimeFormat("en-US", {
|
|
39
|
-
month: "short",
|
|
40
|
-
day: "numeric"
|
|
41
|
-
}).format(x);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
e.append("g").attr("transform", `translate(0,${n - r.bottom})`).call((v) => {
|
|
45
|
-
let b = E.axisBottom(s);
|
|
46
|
-
g ? (y && (b = b.tickFormat(y)), p ? b = b.tickValues(p) : h ? b = b.tickValues(h) : _ && (b = Array.isArray(_) ? b.ticks(..._) : b.ticks(_))) : b.ticks(5), v.call(b);
|
|
47
|
-
}).call((v) => v.select(".domain").remove()).call((v) => {
|
|
48
|
-
let b = [];
|
|
49
|
-
v.selectAll(".tick").each((x) => b.push(x)), i.xTicks = b;
|
|
50
|
-
}).call((v) => v.selectAll(".tick line").remove()).call((v) => v.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).call((v) => {
|
|
51
|
-
requestAnimationFrame(() => {
|
|
52
|
-
const b = v.select(".tick");
|
|
53
|
-
if (!b.empty()) {
|
|
54
|
-
const x = b.attr("transform"), w = x == null ? void 0 : x.match(/translate\(([^,]+)/);
|
|
55
|
-
if (w && parseFloat(w[1]) < r.left) {
|
|
56
|
-
const S = b.select("text");
|
|
57
|
-
b.attr("transform", `translate(${r.left},0)`), S.attr("text-anchor", "start").attr("dx", "0");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}).attr("font-family", "inherit");
|
|
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");
|
|
62
37
|
}, Is = (i) => {
|
|
63
38
|
const { svg: e, config: t, y: s, width: n } = i, {
|
|
64
39
|
margin: a,
|
|
@@ -119,30 +94,30 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
119
94
|
margin: c,
|
|
120
95
|
grid: { verticalStyle: h, tooltipNode: d, hoverCirclesRadius: g, hoverCirclesAdditionalArea: _ }
|
|
121
96
|
} = t;
|
|
122
|
-
if (i.gridHoverTooltip = null, h !== "none" && (h.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((
|
|
123
|
-
const
|
|
124
|
-
h === "every-line-dashed" &&
|
|
97
|
+
if (i.gridHoverTooltip = null, h !== "none" && (h.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((v) => {
|
|
98
|
+
const b = e.append("line").attr("x1", s(v)).attr("x2", s(v)).attr("y1", c.top).attr("y2", a - c.bottom).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
|
|
99
|
+
h === "every-line-dashed" && b.attr("stroke-dasharray", "4 4");
|
|
125
100
|
}), h === "hovered-circles")) {
|
|
126
|
-
const p = n.range()[0],
|
|
127
|
-
qt(e, { x1:
|
|
128
|
-
const { tooltipContainer:
|
|
101
|
+
const p = n.range()[0], v = s(r[0].date), b = s(r[r.length - 1].date);
|
|
102
|
+
qt(e, { x1: v, x2: b, y1: p, y2: p });
|
|
103
|
+
const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Rs(o), C = (S) => {
|
|
129
104
|
if (!d) return;
|
|
130
|
-
_i(x),
|
|
105
|
+
_i(x), w.style.display = "block", x.append(d({ date: S.date, value: S.value }));
|
|
131
106
|
const N = x.getBoundingClientRect(), $ = Os(
|
|
132
107
|
N,
|
|
133
|
-
s(
|
|
108
|
+
s(S.date),
|
|
134
109
|
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
135
110
|
i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
|
|
136
111
|
);
|
|
137
|
-
$ !== null && (x.style.left = $ + "px"),
|
|
138
|
-
},
|
|
139
|
-
|
|
112
|
+
$ !== null && (x.style.left = $ + "px"), y.style.left = s(S.date) + "px";
|
|
113
|
+
}, M = () => {
|
|
114
|
+
w.style.display = "none";
|
|
140
115
|
};
|
|
141
116
|
i.gridHoverTooltip = d ? {
|
|
142
|
-
show: (
|
|
143
|
-
hide:
|
|
144
|
-
} : null, r.forEach((
|
|
145
|
-
const $ = s(
|
|
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;
|
|
146
121
|
Y || qt(e, { x1: $, x2: $, y1: z, y2: p });
|
|
147
122
|
const re = $s(e, Y, {
|
|
148
123
|
x: $,
|
|
@@ -151,9 +126,9 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
151
126
|
hr: _
|
|
152
127
|
});
|
|
153
128
|
d && re.on("mouseover", function() {
|
|
154
|
-
C({ date:
|
|
129
|
+
C({ date: S.date, value: Y ? null : S.value });
|
|
155
130
|
}).on("mouseout", function() {
|
|
156
|
-
|
|
131
|
+
M();
|
|
157
132
|
});
|
|
158
133
|
});
|
|
159
134
|
}
|
|
@@ -162,15 +137,15 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
162
137
|
}, Vs = (i) => {
|
|
163
138
|
const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
|
|
164
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);
|
|
165
|
-
},
|
|
140
|
+
}, Le = (i, e, t) => {
|
|
166
141
|
let s = i.select(`#${e}`);
|
|
167
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 }) => {
|
|
168
143
|
s.append("stop").attr("offset", n).attr("stop-color", a);
|
|
169
144
|
}), s;
|
|
170
145
|
}, _e = (i) => {
|
|
171
|
-
const e =
|
|
172
|
-
return e.empty() ?
|
|
173
|
-
},
|
|
146
|
+
const e = L.select(i).select("defs");
|
|
147
|
+
return e.empty() ? L.select(i).append("defs") : e;
|
|
148
|
+
}, St = (i) => {
|
|
174
149
|
const {
|
|
175
150
|
y: e,
|
|
176
151
|
config: { margin: t }
|
|
@@ -212,7 +187,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
212
187
|
...e == null ? void 0 : e.selection
|
|
213
188
|
}
|
|
214
189
|
}), Qt = (i, e = {}) => {
|
|
215
|
-
const t = i.node(), s = _e(t), n = (o, c) =>
|
|
190
|
+
const t = i.node(), s = _e(t), n = (o, c) => Le(s, o, {
|
|
216
191
|
x1: "0%",
|
|
217
192
|
y1: "0%",
|
|
218
193
|
x2: "0%",
|
|
@@ -252,7 +227,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
252
227
|
};
|
|
253
228
|
}, Ys = (i, e = {}) => {
|
|
254
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);
|
|
255
|
-
return ((o, c) =>
|
|
230
|
+
return ((o, c) => Le(a, o, {
|
|
256
231
|
x1: "0%",
|
|
257
232
|
y1: "0%",
|
|
258
233
|
x2: "0%",
|
|
@@ -274,8 +249,8 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
274
249
|
s.remove();
|
|
275
250
|
}
|
|
276
251
|
};
|
|
277
|
-
}, fe = "sc-charts__range-tooltip", Kt =
|
|
278
|
-
const e =
|
|
252
|
+
}, fe = "sc-charts__range-tooltip", Kt = L.timeFormat("%b %e, %I:%M %p"), Ws = (i) => {
|
|
253
|
+
const e = L.format(",.2f");
|
|
279
254
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
280
255
|
};
|
|
281
256
|
function js(i) {
|
|
@@ -307,18 +282,18 @@ const Xs = (i) => {
|
|
|
307
282
|
},
|
|
308
283
|
update({ leftPoint: n, rightPoint: a, x: r, y: o, hidden: c, closest: h }) {
|
|
309
284
|
if (n && a && h && r !== void 0) {
|
|
310
|
-
const d = a.value - n.value, { sumFormatter: g, timeFormatter: _ } = i.config.selection, p = (i.x(a.date) + i.x(n.date)) / 2,
|
|
311
|
-
let
|
|
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";
|
|
286
|
+
let b = "", w = "";
|
|
312
287
|
if (g)
|
|
313
|
-
|
|
288
|
+
b = g({ left: n.value, right: a.value, direction: v });
|
|
314
289
|
else {
|
|
315
290
|
const x = (d / Math.abs(n.value) * 100).toFixed(2);
|
|
316
|
-
|
|
291
|
+
b = `${Ws(d)} (${x}%)`;
|
|
317
292
|
}
|
|
318
|
-
_ ?
|
|
319
|
-
const x = e.getBoundingClientRect(),
|
|
320
|
-
let N = (C +
|
|
321
|
-
const $ = 0, z =
|
|
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;
|
|
322
297
|
N < $ && (N = $), N > z && (N = z), e.style.left = `${N}px`, e.style.top = `${o}px`;
|
|
323
298
|
});
|
|
324
299
|
}
|
|
@@ -328,8 +303,8 @@ const Xs = (i) => {
|
|
|
328
303
|
e.remove();
|
|
329
304
|
}
|
|
330
305
|
};
|
|
331
|
-
}, ke = "sc-charts__hover-tooltip", _t = 16, Us =
|
|
332
|
-
const e =
|
|
306
|
+
}, ke = "sc-charts__hover-tooltip", _t = 16, Us = L.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
|
|
307
|
+
const e = L.format(",.2f");
|
|
333
308
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
334
309
|
};
|
|
335
310
|
function Zs(i) {
|
|
@@ -427,9 +402,9 @@ const Js = (i) => {
|
|
|
427
402
|
},
|
|
428
403
|
enableBelowZeroLine: !1,
|
|
429
404
|
curveTension: 1
|
|
430
|
-
}, tt = () =>
|
|
405
|
+
}, tt = () => L.curveMonotoneX, Ks = (i) => {
|
|
431
406
|
const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o = _e(r);
|
|
432
|
-
|
|
407
|
+
Le(o, "main-line-area-gradient", {
|
|
433
408
|
x1: "0%",
|
|
434
409
|
y1: "0%",
|
|
435
410
|
x2: "0%",
|
|
@@ -439,7 +414,7 @@ const Js = (i) => {
|
|
|
439
414
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
440
415
|
]
|
|
441
416
|
});
|
|
442
|
-
const h =
|
|
417
|
+
const h = L.area().x((_) => s(_.date)).y0(n.range()[0]).y1((_) => n(_.value)).curve(tt()), d = "sc-charts__main-line-area", g = e.append("path").datum(t).attr("d", h).attr("class", d).classed(`${d}_hidden`, !a.hasMainLineArea);
|
|
443
418
|
return {
|
|
444
419
|
className(_, p) {
|
|
445
420
|
_ === "remove" ? g.classed(`${d}${p}`, !1) : g.classed(`${d}${p}`, !0);
|
|
@@ -456,7 +431,7 @@ const Js = (i) => {
|
|
|
456
431
|
};
|
|
457
432
|
}, en = (i, e = {}) => {
|
|
458
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";
|
|
459
|
-
|
|
434
|
+
Le(g, _ + "_up", {
|
|
460
435
|
x1: "0%",
|
|
461
436
|
y1: "0%",
|
|
462
437
|
x2: "0%",
|
|
@@ -465,7 +440,7 @@ const Js = (i) => {
|
|
|
465
440
|
{ offset: "0%", stopColor: "var(--sc-color-selection-up)" },
|
|
466
441
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
467
442
|
]
|
|
468
|
-
}),
|
|
443
|
+
}), Le(g, _ + "_down", {
|
|
469
444
|
x1: "0%",
|
|
470
445
|
y1: "0%",
|
|
471
446
|
x2: "0%",
|
|
@@ -475,39 +450,39 @@ const Js = (i) => {
|
|
|
475
450
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
476
451
|
]
|
|
477
452
|
});
|
|
478
|
-
const p =
|
|
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})`);
|
|
479
454
|
return {
|
|
480
|
-
className(
|
|
481
|
-
|
|
455
|
+
className(y, C) {
|
|
456
|
+
y === "remove" ? x.classed(`${t}${C}`, !1) : x.classed(`${t}${C}`, !0);
|
|
482
457
|
},
|
|
483
|
-
update({ data:
|
|
484
|
-
|
|
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);
|
|
485
460
|
},
|
|
486
461
|
destroy() {
|
|
487
462
|
x.remove();
|
|
488
463
|
}
|
|
489
464
|
};
|
|
490
465
|
}, vt = (i, e) => {
|
|
491
|
-
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), _ =
|
|
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})`);
|
|
492
467
|
return {
|
|
493
|
-
className(x,
|
|
494
|
-
x === "remove" ?
|
|
468
|
+
className(x, y) {
|
|
469
|
+
x === "remove" ? w.classed(`${o}${y}`, !1) : w.classed(`${o}${y}`, !0);
|
|
495
470
|
},
|
|
496
|
-
update({ data: x, clip:
|
|
497
|
-
x !== void 0 &&
|
|
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);
|
|
498
473
|
},
|
|
499
474
|
destroy() {
|
|
500
|
-
|
|
475
|
+
w.remove();
|
|
501
476
|
}
|
|
502
477
|
};
|
|
503
478
|
}, tn = (i, e) => {
|
|
504
|
-
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 =
|
|
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})`);
|
|
505
480
|
return {
|
|
506
|
-
className(
|
|
507
|
-
|
|
481
|
+
className(y, C) {
|
|
482
|
+
y === "remove" ? x.classed(`${c}${C}`, !1) : x.classed(`${c}${C}`, !0);
|
|
508
483
|
},
|
|
509
|
-
update({ data:
|
|
510
|
-
|
|
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));
|
|
511
486
|
},
|
|
512
487
|
destroy() {
|
|
513
488
|
x.remove();
|
|
@@ -521,10 +496,10 @@ const Js = (i) => {
|
|
|
521
496
|
const { svg: t, data: s, x: n, y: a } = i, { baseClassName: r } = e, o = t.append("g").classed(r, !0), c = o.append("circle").attr("r", 5).classed(`${r}-circle`, !0), h = o.append("text").attr("text-anchor", "middle").attr("dy", "-9px").classed(`${r}-label`, !0);
|
|
522
497
|
return ((g) => {
|
|
523
498
|
if (!g || g.length === 0) return;
|
|
524
|
-
const _ = g[g.length - 1], p = n(_.date),
|
|
525
|
-
c.attr("cx", p).attr("cy",
|
|
526
|
-
const
|
|
527
|
-
h.attr("x", p).attr("y",
|
|
499
|
+
const _ = g[g.length - 1], p = n(_.date), v = a(_.value);
|
|
500
|
+
c.attr("cx", p).attr("cy", v);
|
|
501
|
+
const b = i.config.extremePointFormatter || sn;
|
|
502
|
+
h.attr("x", p).attr("y", v).text(b(_.value));
|
|
528
503
|
})(s), {
|
|
529
504
|
className(g, _) {
|
|
530
505
|
g === "remove" ? o.classed(`${r}${_}`, !1) : o.classed(`${r}${_}`, !0);
|
|
@@ -554,7 +529,7 @@ const Js = (i) => {
|
|
|
554
529
|
i.config.enableBelowZeroLine && (r = vt(i, {
|
|
555
530
|
baseClassName: "sc-charts__below-zero-line",
|
|
556
531
|
id: `${i.chartId}-sc-charts__below-zero-line`,
|
|
557
|
-
clip:
|
|
532
|
+
clip: St(i)
|
|
558
533
|
}));
|
|
559
534
|
const o = pt(i.svg, {
|
|
560
535
|
className: "sc-charts__hover-circle",
|
|
@@ -569,20 +544,20 @@ const Js = (i) => {
|
|
|
569
544
|
}), _ = pt(i.svg, {
|
|
570
545
|
className: "sc-charts__range-circle-right",
|
|
571
546
|
hidden: !0
|
|
572
|
-
}), p = Xs(i),
|
|
547
|
+
}), p = Xs(i), v = Js(i), b = en(i);
|
|
573
548
|
return {
|
|
574
549
|
hoverLine: n,
|
|
575
550
|
hoverCircle: o,
|
|
576
551
|
rangeBorderLeft: c,
|
|
577
552
|
rangeBorderRight: h,
|
|
578
553
|
rangeLine: d,
|
|
579
|
-
rangeLineArea:
|
|
554
|
+
rangeLineArea: b,
|
|
580
555
|
rangeCircleLeft: g,
|
|
581
556
|
rangeCircleRight: _,
|
|
582
557
|
mainLine: e,
|
|
583
558
|
rangeTooltip: p,
|
|
584
559
|
highlightLine: a,
|
|
585
|
-
hoverTooltip:
|
|
560
|
+
hoverTooltip: v,
|
|
586
561
|
mainLineArea: t,
|
|
587
562
|
belowZeroLine: r,
|
|
588
563
|
extremePoint: s
|
|
@@ -706,14 +681,14 @@ const Js = (i) => {
|
|
|
706
681
|
})), n.mainLine.className("add", "_muted");
|
|
707
682
|
} else
|
|
708
683
|
n.highlightLine.update({ hidden: !0 }), n.mainLine.className("remove", "_muted"), (h = n.belowZeroLine) == null || h.update({
|
|
709
|
-
clip:
|
|
684
|
+
clip: St(i)
|
|
710
685
|
});
|
|
711
686
|
(d = i.gridHoverTooltip) == null || d.show({ date: e.date, value: e.value });
|
|
712
687
|
}, ti = (i) => {
|
|
713
688
|
var t, s;
|
|
714
689
|
const { elements: e } = i;
|
|
715
690
|
e.hoverLine.update({ hidden: !0 }), e.hoverCircle.update({ hidden: !0 }), e.highlightLine.update({ hidden: !0 }), e.mainLine.className("remove", "_muted"), e.hoverTooltip.update({ hidden: !0 }), (t = i.gridHoverTooltip) == null || t.hide(), i.action !== "selection" && ((s = e.belowZeroLine) == null || s.update({
|
|
716
|
-
clip:
|
|
691
|
+
clip: St(i)
|
|
717
692
|
}));
|
|
718
693
|
}, on = (i, e) => {
|
|
719
694
|
[
|
|
@@ -728,7 +703,7 @@ const Js = (i) => {
|
|
|
728
703
|
e ? (i[s].className("remove", "_down"), i[s].className("add", "_up")) : (i[s].className("remove", "_up"), i[s].className("add", "_down"));
|
|
729
704
|
});
|
|
730
705
|
}, ln = (i, e, t) => {
|
|
731
|
-
var
|
|
706
|
+
var v;
|
|
732
707
|
const {
|
|
733
708
|
x: s,
|
|
734
709
|
y: n,
|
|
@@ -779,7 +754,7 @@ const Js = (i) => {
|
|
|
779
754
|
x: g + p / 2,
|
|
780
755
|
y: 0,
|
|
781
756
|
hidden: !1
|
|
782
|
-
}), (
|
|
757
|
+
}), (v = o.belowZeroLine) == null || v.update({
|
|
783
758
|
hidden: !0
|
|
784
759
|
}), o.mainLineArea.update({ hidden: !0 }), on(o, d), o.mainLine.className("add", "_selected-muted");
|
|
785
760
|
}, ii = (i) => {
|
|
@@ -789,32 +764,32 @@ const Js = (i) => {
|
|
|
789
764
|
}, cn = (i) => {
|
|
790
765
|
const { svg: e, data: t, x: s, config: n, width: a, height: r } = i, { margin: o, hover: c, selection: h } = n;
|
|
791
766
|
let d = null, g = !1;
|
|
792
|
-
const _ = (
|
|
793
|
-
(
|
|
767
|
+
const _ = (v) => t.reduce(
|
|
768
|
+
(b, w) => Math.abs(s(b.date) - v) < Math.abs(s(w.date) - v) ? b : w
|
|
794
769
|
);
|
|
795
|
-
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(
|
|
796
|
-
const [
|
|
797
|
-
!g && c.enable ? (i.action = "hover", ei(i,
|
|
770
|
+
e.append("rect").attr("width", a - o.left - o.right).attr("height", r - o.top - o.bottom).attr("x", o.left).attr("y", o.top).attr("fill", "transparent").on("mousemove", function(v) {
|
|
771
|
+
const [b] = 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));
|
|
798
773
|
}).on("mouseleave", () => {
|
|
799
774
|
i.action = "none", g = !1, d = null, ti(i), ii(i);
|
|
800
|
-
}).on("mousedown", function(
|
|
775
|
+
}).on("mousedown", function(v) {
|
|
801
776
|
if (h.enable) {
|
|
802
777
|
g = !0, i.action = "selection";
|
|
803
|
-
const [
|
|
804
|
-
d = _(
|
|
778
|
+
const [b] = L.pointer(v, this);
|
|
779
|
+
d = _(b);
|
|
805
780
|
}
|
|
806
|
-
}).on("mouseup", function(
|
|
807
|
-
const [
|
|
808
|
-
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i,
|
|
781
|
+
}).on("mouseup", function(v) {
|
|
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);
|
|
809
784
|
});
|
|
810
785
|
}, hn = (i, e, t) => {
|
|
811
|
-
const { margin: s } = e, n =
|
|
786
|
+
const { margin: s } = e, n = L.scaleTime(), a = L.extent(i, (r) => new Date(r.date));
|
|
812
787
|
return a[0] == null || a[1] == null ? n : n.domain([a[0], a[1]]).range([s.left, t - s.right]);
|
|
813
788
|
}, dn = (i, e, t) => {
|
|
814
|
-
const { margin: s } = e, n =
|
|
815
|
-
return
|
|
789
|
+
const { margin: s } = e, n = L.max(i, (r) => r.value) ?? 0, a = L.min(i, (r) => r.value) ?? 0;
|
|
790
|
+
return L.scaleLinear().domain([a, n]).range([t - s.bottom, s.top]);
|
|
816
791
|
}, pr = (i, e) => {
|
|
817
|
-
const t =
|
|
792
|
+
const t = L.select(i);
|
|
818
793
|
if (t.empty())
|
|
819
794
|
return console.error(`Element with selector ${i} not found!`), null;
|
|
820
795
|
if (!e.chartId || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.chartId))
|
|
@@ -826,16 +801,16 @@ const Js = (i) => {
|
|
|
826
801
|
r = a.getBoundingClientRect(), o = r.width, c = r.height, _({ data: d, config: h });
|
|
827
802
|
};
|
|
828
803
|
window.addEventListener("resize", g);
|
|
829
|
-
const _ = (p,
|
|
830
|
-
|
|
831
|
-
const
|
|
804
|
+
const _ = (p, v = !1) => {
|
|
805
|
+
v && p.config && (h = Jt(h, p.config)), v && p.data && (d = p.data);
|
|
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);
|
|
832
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();
|
|
833
|
-
const
|
|
808
|
+
const y = {
|
|
834
809
|
chartId: e.chartId,
|
|
835
810
|
svg: n,
|
|
836
811
|
wrapperNode: s.node(),
|
|
837
|
-
data:
|
|
838
|
-
x:
|
|
812
|
+
data: b,
|
|
813
|
+
x: w,
|
|
839
814
|
y: x,
|
|
840
815
|
config: h,
|
|
841
816
|
action: "none",
|
|
@@ -843,10 +818,10 @@ const Js = (i) => {
|
|
|
843
818
|
height: c,
|
|
844
819
|
gridHoverTooltip: null
|
|
845
820
|
};
|
|
846
|
-
Vs(
|
|
821
|
+
Vs(y);
|
|
847
822
|
const C = {
|
|
848
|
-
...
|
|
849
|
-
elements: an(
|
|
823
|
+
...y,
|
|
824
|
+
elements: an(y)
|
|
850
825
|
};
|
|
851
826
|
cn(C);
|
|
852
827
|
};
|
|
@@ -861,13 +836,13 @@ var Ze = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
861
836
|
function un(i) {
|
|
862
837
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
863
838
|
}
|
|
864
|
-
var
|
|
865
|
-
|
|
839
|
+
var Se = { exports: {} };
|
|
840
|
+
Se.exports;
|
|
866
841
|
var si;
|
|
867
842
|
function fn() {
|
|
868
843
|
return si || (si = 1, function(i, e) {
|
|
869
|
-
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]",
|
|
870
|
-
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[
|
|
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;
|
|
871
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() {
|
|
872
847
|
try {
|
|
873
848
|
var l = Z && Z.require && Z.require("util").types;
|
|
@@ -909,7 +884,7 @@ function fn() {
|
|
|
909
884
|
var xe = Array.prototype, Ai = Function.prototype, ze = Object.prototype, at = O["__core-js_shared__"], Ve = Ai.toString, ne = ze.hasOwnProperty, Nt = function() {
|
|
910
885
|
var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
|
|
911
886
|
return l ? "Symbol(src)_1." + l : "";
|
|
912
|
-
}(), Ft = ze.toString,
|
|
887
|
+
}(), Ft = ze.toString, Mi = Ve.call(Object), Si = RegExp(
|
|
913
888
|
"^" + Ve.call(ne).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
914
889
|
), Ye = q ? O.Buffer : void 0, Ht = O.Symbol, Bt = O.Uint8Array;
|
|
915
890
|
Ye && Ye.allocUnsafe;
|
|
@@ -919,7 +894,7 @@ function fn() {
|
|
|
919
894
|
return l({}, "", {}), l;
|
|
920
895
|
} catch {
|
|
921
896
|
}
|
|
922
|
-
}(),
|
|
897
|
+
}(), Li = Ye ? Ye.isBuffer : void 0, $t = Math.max, Ei = Date.now, Ot = lt(O, "Map"), Ce = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
|
|
923
898
|
function l() {
|
|
924
899
|
}
|
|
925
900
|
return function(u) {
|
|
@@ -1050,14 +1025,14 @@ function fn() {
|
|
|
1050
1025
|
}
|
|
1051
1026
|
pe.prototype.clear = Gi, pe.prototype.delete = Zi, pe.prototype.get = qi, pe.prototype.has = Ji, pe.prototype.set = Qi;
|
|
1052
1027
|
function Ki(l, u) {
|
|
1053
|
-
var m = dt(l), T = !m && ht(l), D = !m && !T && Wt(l), H = !m && !T && !D && Xt(l), B = m || T || D || H,
|
|
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;
|
|
1054
1029
|
for (var J in l)
|
|
1055
1030
|
B && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1056
1031
|
(J == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1057
1032
|
D && (J == "offset" || J == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1058
1033
|
H && (J == "buffer" || J == "byteLength" || J == "byteOffset") || // Skip index properties.
|
|
1059
|
-
Vt(J, I)) ||
|
|
1060
|
-
return
|
|
1034
|
+
Vt(J, I)) || E.push(J);
|
|
1035
|
+
return E;
|
|
1061
1036
|
}
|
|
1062
1037
|
function rt(l, u, m) {
|
|
1063
1038
|
(m !== void 0 && !Ge(l[u], m) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
@@ -1090,7 +1065,7 @@ function fn() {
|
|
|
1090
1065
|
function is(l) {
|
|
1091
1066
|
if (!ue(l) || bs(l))
|
|
1092
1067
|
return !1;
|
|
1093
|
-
var u = ft(l) ?
|
|
1068
|
+
var u = ft(l) ? Si : Be;
|
|
1094
1069
|
return u.test(As(l));
|
|
1095
1070
|
}
|
|
1096
1071
|
function ss(l) {
|
|
@@ -1109,21 +1084,21 @@ function fn() {
|
|
|
1109
1084
|
if (D || (D = new pe()), ue(H))
|
|
1110
1085
|
as(l, u, B, m, zt, T, D);
|
|
1111
1086
|
else {
|
|
1112
|
-
var
|
|
1113
|
-
|
|
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);
|
|
1114
1089
|
}
|
|
1115
1090
|
}, Ut);
|
|
1116
1091
|
}
|
|
1117
1092
|
function as(l, u, m, T, D, H, B) {
|
|
1118
|
-
var
|
|
1093
|
+
var E = ct(l, m), I = ct(u, m), J = B.get(I);
|
|
1119
1094
|
if (J) {
|
|
1120
1095
|
rt(l, m, J);
|
|
1121
1096
|
return;
|
|
1122
1097
|
}
|
|
1123
|
-
var W = H ? H(
|
|
1098
|
+
var W = H ? H(E, I, m + "", l, u, B) : void 0, Ae = W === void 0;
|
|
1124
1099
|
if (Ae) {
|
|
1125
1100
|
var gt = dt(I), mt = !gt && Wt(I), Zt = !gt && !mt && Xt(I);
|
|
1126
|
-
W = I, gt || mt || Zt ? dt(
|
|
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;
|
|
1127
1102
|
}
|
|
1128
1103
|
Ae && (B.set(I, W), D(W, I, T, H, B), B.delete(I)), rt(l, m, W);
|
|
1129
1104
|
}
|
|
@@ -1134,7 +1109,7 @@ function fn() {
|
|
|
1134
1109
|
return We(l, "toString", {
|
|
1135
1110
|
configurable: !0,
|
|
1136
1111
|
enumerable: !1,
|
|
1137
|
-
value:
|
|
1112
|
+
value: Ls(u),
|
|
1138
1113
|
writable: !0
|
|
1139
1114
|
});
|
|
1140
1115
|
} : Gt;
|
|
@@ -1159,8 +1134,8 @@ function fn() {
|
|
|
1159
1134
|
var D = !m;
|
|
1160
1135
|
m || (m = {});
|
|
1161
1136
|
for (var H = -1, B = u.length; ++H < B; ) {
|
|
1162
|
-
var
|
|
1163
|
-
I === void 0 && (I = l[
|
|
1137
|
+
var E = u[H], I = void 0;
|
|
1138
|
+
I === void 0 && (I = l[E]), D ? ot(m, E, I) : es(m, E, I);
|
|
1164
1139
|
}
|
|
1165
1140
|
return m;
|
|
1166
1141
|
}
|
|
@@ -1168,15 +1143,15 @@ function fn() {
|
|
|
1168
1143
|
return rs(function(u, m) {
|
|
1169
1144
|
var T = -1, D = m.length, H = D > 1 ? m[D - 1] : void 0, B = D > 2 ? m[2] : void 0;
|
|
1170
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; ) {
|
|
1171
|
-
var
|
|
1172
|
-
|
|
1146
|
+
var E = m[T];
|
|
1147
|
+
E && l(u, E, T, H);
|
|
1173
1148
|
}
|
|
1174
1149
|
return u;
|
|
1175
1150
|
});
|
|
1176
1151
|
}
|
|
1177
1152
|
function gs(l) {
|
|
1178
1153
|
return function(u, m, T) {
|
|
1179
|
-
for (var D = -1, H = Object(u), B = T(u),
|
|
1154
|
+
for (var D = -1, H = Object(u), B = T(u), E = B.length; E--; ) {
|
|
1180
1155
|
var I = B[++D];
|
|
1181
1156
|
if (m(H[I], I, H) === !1)
|
|
1182
1157
|
break;
|
|
@@ -1241,9 +1216,9 @@ function fn() {
|
|
|
1241
1216
|
for (var T = arguments, D = -1, H = $t(T.length - u, 0), B = Array(H); ++D < H; )
|
|
1242
1217
|
B[D] = T[u + D];
|
|
1243
1218
|
D = -1;
|
|
1244
|
-
for (var
|
|
1245
|
-
|
|
1246
|
-
return
|
|
1219
|
+
for (var E = Array(u + 1); ++D < u; )
|
|
1220
|
+
E[D] = T[D];
|
|
1221
|
+
return E[u] = m(B), Oe(l, this, E);
|
|
1247
1222
|
};
|
|
1248
1223
|
}
|
|
1249
1224
|
function ct(l, u) {
|
|
@@ -1254,7 +1229,7 @@ function fn() {
|
|
|
1254
1229
|
function Ts(l) {
|
|
1255
1230
|
var u = 0, m = 0;
|
|
1256
1231
|
return function() {
|
|
1257
|
-
var T =
|
|
1232
|
+
var T = Ei(), D = a - (T - m);
|
|
1258
1233
|
if (m = T, D > 0) {
|
|
1259
1234
|
if (++u >= n)
|
|
1260
1235
|
return arguments[0];
|
|
@@ -1287,15 +1262,15 @@ function fn() {
|
|
|
1287
1262
|
function ut(l) {
|
|
1288
1263
|
return l != null && jt(l.length) && !ft(l);
|
|
1289
1264
|
}
|
|
1290
|
-
function
|
|
1265
|
+
function Ms(l) {
|
|
1291
1266
|
return Te(l) && ut(l);
|
|
1292
1267
|
}
|
|
1293
|
-
var Wt =
|
|
1268
|
+
var Wt = Li || Es;
|
|
1294
1269
|
function ft(l) {
|
|
1295
1270
|
if (!ue(l))
|
|
1296
1271
|
return !1;
|
|
1297
1272
|
var u = Xe(l);
|
|
1298
|
-
return u == p || u ==
|
|
1273
|
+
return u == p || u == v || u == h || u == C;
|
|
1299
1274
|
}
|
|
1300
1275
|
function jt(l) {
|
|
1301
1276
|
return typeof l == "number" && l > -1 && l % 1 == 0 && l <= r;
|
|
@@ -1307,14 +1282,14 @@ function fn() {
|
|
|
1307
1282
|
function Te(l) {
|
|
1308
1283
|
return l != null && typeof l == "object";
|
|
1309
1284
|
}
|
|
1310
|
-
function
|
|
1311
|
-
if (!Te(l) || Xe(l) !=
|
|
1285
|
+
function Ss(l) {
|
|
1286
|
+
if (!Te(l) || Xe(l) != y)
|
|
1312
1287
|
return !1;
|
|
1313
1288
|
var u = It(l);
|
|
1314
1289
|
if (u === null)
|
|
1315
1290
|
return !0;
|
|
1316
1291
|
var m = ne.call(u, "constructor") && u.constructor;
|
|
1317
|
-
return typeof m == "function" && m instanceof m && Ve.call(m) ==
|
|
1292
|
+
return typeof m == "function" && m instanceof m && Ve.call(m) == Mi;
|
|
1318
1293
|
}
|
|
1319
1294
|
var Xt = we ? le(we) : ss;
|
|
1320
1295
|
function Ds(l) {
|
|
@@ -1326,7 +1301,7 @@ function fn() {
|
|
|
1326
1301
|
var ks = fs(function(l, u, m) {
|
|
1327
1302
|
zt(l, u, m);
|
|
1328
1303
|
});
|
|
1329
|
-
function
|
|
1304
|
+
function Ls(l) {
|
|
1330
1305
|
return function() {
|
|
1331
1306
|
return l;
|
|
1332
1307
|
};
|
|
@@ -1334,11 +1309,11 @@ function fn() {
|
|
|
1334
1309
|
function Gt(l) {
|
|
1335
1310
|
return l;
|
|
1336
1311
|
}
|
|
1337
|
-
function
|
|
1312
|
+
function Es() {
|
|
1338
1313
|
return !1;
|
|
1339
1314
|
}
|
|
1340
1315
|
i.exports = ks;
|
|
1341
|
-
}(
|
|
1316
|
+
}(Se, Se.exports)), Se.exports;
|
|
1342
1317
|
}
|
|
1343
1318
|
var gn = fn();
|
|
1344
1319
|
const Qe = /* @__PURE__ */ un(gn), ni = 12, mn = {
|
|
@@ -1555,23 +1530,23 @@ function ai(i, e) {
|
|
|
1555
1530
|
let d = c;
|
|
1556
1531
|
a.forEach((g, _) => {
|
|
1557
1532
|
const p = (h - d) / a.length;
|
|
1558
|
-
let
|
|
1559
|
-
const
|
|
1560
|
-
let x = Math.max(
|
|
1533
|
+
let v = d + p * _, b = v + p;
|
|
1534
|
+
const w = Math.abs(v - b);
|
|
1535
|
+
let x = Math.max(v, b) + w / 2, y = Math.min(v, b) - w / 2;
|
|
1561
1536
|
if (e.trade) {
|
|
1562
|
-
const
|
|
1563
|
-
const N =
|
|
1537
|
+
const M = [...e.trade.entries, ...e.trade.exits].find((S) => {
|
|
1538
|
+
const N = S.time.getTime();
|
|
1564
1539
|
return N >= g && N < g + t;
|
|
1565
1540
|
});
|
|
1566
|
-
|
|
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));
|
|
1567
1542
|
}
|
|
1568
1543
|
const C = {
|
|
1569
1544
|
open_time: new Date(g),
|
|
1570
1545
|
close_time: new Date(g + t),
|
|
1571
|
-
open:
|
|
1572
|
-
close:
|
|
1546
|
+
open: v,
|
|
1547
|
+
close: b,
|
|
1573
1548
|
high: x,
|
|
1574
|
-
low:
|
|
1549
|
+
low: y
|
|
1575
1550
|
};
|
|
1576
1551
|
n.push(C);
|
|
1577
1552
|
});
|
|
@@ -1675,12 +1650,12 @@ class vi {
|
|
|
1675
1650
|
}
|
|
1676
1651
|
class bi extends vi {
|
|
1677
1652
|
constructor() {
|
|
1678
|
-
super(), this._scale =
|
|
1653
|
+
super(), this._scale = L.scaleTime();
|
|
1679
1654
|
}
|
|
1680
1655
|
}
|
|
1681
1656
|
class wn extends vi {
|
|
1682
1657
|
constructor() {
|
|
1683
|
-
super(), this._scale =
|
|
1658
|
+
super(), this._scale = L.scaleLinear();
|
|
1684
1659
|
}
|
|
1685
1660
|
}
|
|
1686
1661
|
const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
@@ -1697,7 +1672,7 @@ const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
|
1697
1672
|
const [t, s] = e.domain().map((o) => o.getTime()), n = i.filter((o) => {
|
|
1698
1673
|
const c = o.open_time.getTime();
|
|
1699
1674
|
return c >= t && c <= s;
|
|
1700
|
-
}), a =
|
|
1675
|
+
}), a = L.min(n, (o) => o.low), r = L.max(n, (o) => o.high);
|
|
1701
1676
|
if (a == null || r == null) throw new Error("Invalid Y data");
|
|
1702
1677
|
return [a, r];
|
|
1703
1678
|
};
|
|
@@ -1706,7 +1681,7 @@ class An {
|
|
|
1706
1681
|
this.model = e;
|
|
1707
1682
|
}
|
|
1708
1683
|
initX(e) {
|
|
1709
|
-
const t = this.model.candles.preparedData, s =
|
|
1684
|
+
const t = this.model.candles.preparedData, s = L.extent(t, (n) => new Date(n.open_time));
|
|
1710
1685
|
if (!s[0] || !s[1]) throw new Error("Invalid x data");
|
|
1711
1686
|
e.setDomain(s), this.setRange(e, this.model.layout.xAxis), this.setDefaultXDomain(e), this.applyOffset(e);
|
|
1712
1687
|
}
|
|
@@ -1740,7 +1715,7 @@ class An {
|
|
|
1740
1715
|
e.setDomain([new Date(h.getTime() + c), new Date(d.getTime() + c)]);
|
|
1741
1716
|
}
|
|
1742
1717
|
}
|
|
1743
|
-
class
|
|
1718
|
+
class Mn {
|
|
1744
1719
|
constructor(e) {
|
|
1745
1720
|
f(this, "_model");
|
|
1746
1721
|
f(this, "_scaleX");
|
|
@@ -1824,7 +1799,7 @@ class Sn {
|
|
|
1824
1799
|
this._model.eventBus.emit("scale_event");
|
|
1825
1800
|
}
|
|
1826
1801
|
}
|
|
1827
|
-
class
|
|
1802
|
+
class Sn {
|
|
1828
1803
|
constructor(e, { entry: t = [], exit: s = [] }) {
|
|
1829
1804
|
f(this, "_model");
|
|
1830
1805
|
f(this, "_rawEntry");
|
|
@@ -2024,7 +1999,7 @@ const kn = {
|
|
|
2024
1999
|
}
|
|
2025
2000
|
}
|
|
2026
2001
|
};
|
|
2027
|
-
class
|
|
2002
|
+
class Ln {
|
|
2028
2003
|
constructor(e) {
|
|
2029
2004
|
f(this, "_scheme");
|
|
2030
2005
|
this._scheme = Qe({}, kn, e), Object.keys(this._scheme).forEach((t) => {
|
|
@@ -2038,7 +2013,7 @@ class En {
|
|
|
2038
2013
|
this._scheme = Qe({}, this._scheme, e);
|
|
2039
2014
|
}
|
|
2040
2015
|
}
|
|
2041
|
-
class
|
|
2016
|
+
class En {
|
|
2042
2017
|
constructor(e, t) {
|
|
2043
2018
|
f(this, "_data");
|
|
2044
2019
|
f(this, "_callbacks", {
|
|
@@ -2103,7 +2078,7 @@ class Nn {
|
|
|
2103
2078
|
f(this, "trade");
|
|
2104
2079
|
f(this, "userMarkers");
|
|
2105
2080
|
f(this, "comments");
|
|
2106
|
-
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);
|
|
2107
2082
|
}
|
|
2108
2083
|
init() {
|
|
2109
2084
|
this.eventBus.emit("init_model");
|
|
@@ -2172,7 +2147,7 @@ class k {
|
|
|
2172
2147
|
this.node.style.opacity = e ? "1" : "0", this.node.style.visibility = e ? "visible" : "hidden";
|
|
2173
2148
|
}
|
|
2174
2149
|
}
|
|
2175
|
-
class
|
|
2150
|
+
class Ee extends k {
|
|
2176
2151
|
constructor({ className: t, id: s, width: n, height: a, isMain: r }) {
|
|
2177
2152
|
super({
|
|
2178
2153
|
tag: "canvas",
|
|
@@ -2211,7 +2186,7 @@ function Hn(i, e) {
|
|
|
2211
2186
|
colorScheme: { xAxis: s },
|
|
2212
2187
|
config: { xAxis: n },
|
|
2213
2188
|
scales: a
|
|
2214
|
-
} = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c =
|
|
2189
|
+
} = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = L.timeFormat("%d %b"), h = L.timeFormat("%H:%M");
|
|
2215
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) => {
|
|
2216
2191
|
const g = a.x.convert(d), _ = o(d) ? c(d) : h(d);
|
|
2217
2192
|
i.fillText(_, g, t.y + t.height / 2);
|
|
@@ -2283,15 +2258,15 @@ function Ke(i) {
|
|
|
2283
2258
|
return i * 0.1875;
|
|
2284
2259
|
}
|
|
2285
2260
|
const $n = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2286
|
-
const g = r / 16, _ = 16 * g, p = n - _ / 2,
|
|
2287
|
-
i.save(), i.translate(p,
|
|
2288
|
-
const
|
|
2261
|
+
const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
|
|
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";
|
|
2263
|
+
const b = a + g * 3 + 0.5, w = g * 16, x = b + w / 2;
|
|
2289
2264
|
i.fillStyle = t, i.fillText(s, n, x), i.restore();
|
|
2290
2265
|
}, On = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2291
|
-
const g = r / 16, _ = 16 * g, p = n - _ / 2,
|
|
2292
|
-
i.save(), i.translate(p,
|
|
2293
|
-
const
|
|
2294
|
-
i.fillStyle = t, i.fillText(s, n,
|
|
2266
|
+
const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
|
|
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";
|
|
2268
|
+
const b = g * 16, w = a - g * 19 + b / 2;
|
|
2269
|
+
i.fillStyle = t, i.fillText(s, n, w), i.restore();
|
|
2295
2270
|
};
|
|
2296
2271
|
function et(i) {
|
|
2297
2272
|
"@babel/helpers - typeof";
|
|
@@ -3014,15 +2989,15 @@ function ha(i, e) {
|
|
|
3014
2989
|
const { trade: o } = a, c = 4;
|
|
3015
2990
|
t.forEach(({ isHovered: h, isActive: d, candle: g, trades: _ }) => {
|
|
3016
2991
|
const p = s.convert(g.open_time);
|
|
3017
|
-
_.forEach((
|
|
3018
|
-
const
|
|
3019
|
-
let
|
|
3020
|
-
h && h[1] && h[0] ===
|
|
2992
|
+
_.forEach((v) => {
|
|
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, {
|
|
3021
2996
|
x: p,
|
|
3022
|
-
y
|
|
2997
|
+
y,
|
|
3023
2998
|
symbol: x,
|
|
3024
|
-
mainColor:
|
|
3025
|
-
textColor:
|
|
2999
|
+
mainColor: M,
|
|
3000
|
+
textColor: w,
|
|
3026
3001
|
size: 16,
|
|
3027
3002
|
fontSize: 12
|
|
3028
3003
|
});
|
|
@@ -3065,11 +3040,11 @@ const ua = (i, e) => {
|
|
|
3065
3040
|
(p) => g.getTime() >= p.candle.open_time.getTime() && g.getTime() < p.candle.close_time.getTime()
|
|
3066
3041
|
)) == null ? void 0 : _.candle;
|
|
3067
3042
|
}, d = (g, _) => {
|
|
3068
|
-
const p = h(g.time),
|
|
3069
|
-
if (!p || !
|
|
3070
|
-
const
|
|
3071
|
-
let x,
|
|
3072
|
-
g.type === "buy" ? (x = s.convert(p.low),
|
|
3043
|
+
const p = h(g.time), v = h(_.time);
|
|
3044
|
+
if (!p || !v) return;
|
|
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([]);
|
|
3073
3048
|
};
|
|
3074
3049
|
if (a.length === 1 && r.length > 1)
|
|
3075
3050
|
r.forEach((g) => d(a[0], g));
|
|
@@ -3078,7 +3053,7 @@ const ua = (i, e) => {
|
|
|
3078
3053
|
else if (a.length === 1 && r.length === 1)
|
|
3079
3054
|
d(a[0], r[0]);
|
|
3080
3055
|
else if (a.length > 0 && r.length > 0) {
|
|
3081
|
-
const g = a.reduce((p,
|
|
3056
|
+
const g = a.reduce((p, v) => p.time < v.time ? p : v), _ = r.reduce((p, v) => p.time > v.time ? p : v);
|
|
3082
3057
|
d(g, _);
|
|
3083
3058
|
}
|
|
3084
3059
|
i.restore();
|
|
@@ -3133,27 +3108,27 @@ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
|
3133
3108
|
if (!c) return;
|
|
3134
3109
|
const _ = n.at(0), p = a.at(-1);
|
|
3135
3110
|
if (!_ || !p) return;
|
|
3136
|
-
const
|
|
3137
|
-
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(
|
|
3138
|
-
const
|
|
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(
|
|
3139
3114
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3140
3115
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3141
|
-
i.font = `600 ${ma}px ${
|
|
3116
|
+
i.font = `600 ${ma}px ${S}`;
|
|
3142
3117
|
const $ = i.measureText(C).width + pa * 2, z = va + _a * 2;
|
|
3143
3118
|
xi(i, {
|
|
3144
3119
|
radius: 4,
|
|
3145
3120
|
coords: {
|
|
3146
|
-
x:
|
|
3121
|
+
x: y - $ / 2,
|
|
3147
3122
|
y: x - z / 2
|
|
3148
3123
|
},
|
|
3149
3124
|
width: $,
|
|
3150
3125
|
height: z,
|
|
3151
3126
|
fillColor: o.main
|
|
3152
|
-
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(C,
|
|
3127
|
+
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(C, y, x), i.restore();
|
|
3153
3128
|
};
|
|
3154
3129
|
class Ne {
|
|
3155
3130
|
constructor(e, t, {
|
|
3156
|
-
CanvasClass: s =
|
|
3131
|
+
CanvasClass: s = Ee,
|
|
3157
3132
|
noCanvas: n = !1,
|
|
3158
3133
|
noDOM: a = !1
|
|
3159
3134
|
} = {}) {
|
|
@@ -3182,33 +3157,33 @@ const ya = {
|
|
|
3182
3157
|
prioritySide: s = "right-bottom",
|
|
3183
3158
|
offset: n = 8
|
|
3184
3159
|
}) => {
|
|
3185
|
-
const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (
|
|
3186
|
-
const { dx: C, dy:
|
|
3187
|
-
return { x:
|
|
3188
|
-
}, d = ({ x:
|
|
3189
|
-
const
|
|
3190
|
-
return
|
|
3160
|
+
const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (y) => {
|
|
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;
|
|
3191
3166
|
}, p = [
|
|
3192
3167
|
s,
|
|
3193
3168
|
"right-bottom",
|
|
3194
3169
|
"right-top",
|
|
3195
3170
|
"left-bottom",
|
|
3196
3171
|
"left-top"
|
|
3197
|
-
].filter((
|
|
3198
|
-
let
|
|
3199
|
-
for (const
|
|
3200
|
-
const C = h(
|
|
3172
|
+
].filter((y, C, M) => M.indexOf(y) === C), v = g();
|
|
3173
|
+
let b = null;
|
|
3174
|
+
for (const y of [v, ...p]) {
|
|
3175
|
+
const C = h(y);
|
|
3201
3176
|
if (d(C)) {
|
|
3202
|
-
|
|
3177
|
+
b = C;
|
|
3203
3178
|
break;
|
|
3204
3179
|
}
|
|
3205
3180
|
}
|
|
3206
|
-
|
|
3207
|
-
const
|
|
3181
|
+
b || (b = h(v));
|
|
3182
|
+
const w = Math.min(Math.max(b.x, n), o - a - n), x = Math.min(Math.max(b.y, n), c - r - n);
|
|
3208
3183
|
return {
|
|
3209
|
-
x:
|
|
3184
|
+
x: w,
|
|
3210
3185
|
y: x,
|
|
3211
|
-
side:
|
|
3186
|
+
side: b.side
|
|
3212
3187
|
};
|
|
3213
3188
|
};
|
|
3214
3189
|
class se extends k {
|
|
@@ -3356,15 +3331,15 @@ const Ta = { text: "#FFFFFF", bg: "#000000" }, Aa = (i, e) => {
|
|
|
3356
3331
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3357
3332
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3358
3333
|
i.font = `${a} ${n}px ${p}`;
|
|
3359
|
-
const
|
|
3360
|
-
let x = t.x,
|
|
3361
|
-
d.x === "middle" ? x -=
|
|
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, {
|
|
3362
3337
|
radius: c,
|
|
3363
|
-
coords: { x, y
|
|
3364
|
-
width:
|
|
3365
|
-
height:
|
|
3338
|
+
coords: { x, y },
|
|
3339
|
+
width: b,
|
|
3340
|
+
height: w,
|
|
3366
3341
|
fillColor: g.bg
|
|
3367
|
-
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, x +
|
|
3342
|
+
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, x + b / 2, y + w / 2);
|
|
3368
3343
|
}, gi = {
|
|
3369
3344
|
line: "#000000",
|
|
3370
3345
|
text: "#ffffff",
|
|
@@ -3400,7 +3375,7 @@ const Ta = { text: "#FFFFFF", bg: "#000000" }, Aa = (i, e) => {
|
|
|
3400
3375
|
}
|
|
3401
3376
|
}), i.restore();
|
|
3402
3377
|
};
|
|
3403
|
-
class
|
|
3378
|
+
class Ma extends Ee {
|
|
3404
3379
|
constructor(e) {
|
|
3405
3380
|
super(e);
|
|
3406
3381
|
}
|
|
@@ -3408,9 +3383,9 @@ class Sa extends Le {
|
|
|
3408
3383
|
Ci(this.ctx, e);
|
|
3409
3384
|
}
|
|
3410
3385
|
}
|
|
3411
|
-
class
|
|
3386
|
+
class Sa extends Ne {
|
|
3412
3387
|
constructor(e) {
|
|
3413
|
-
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");
|
|
3414
3389
|
}
|
|
3415
3390
|
render(e) {
|
|
3416
3391
|
this.canvas.clear();
|
|
@@ -3464,7 +3439,7 @@ class ka extends k {
|
|
|
3464
3439
|
}), this.append(s.node, n.node);
|
|
3465
3440
|
}
|
|
3466
3441
|
}
|
|
3467
|
-
function
|
|
3442
|
+
function Lt(i, e) {
|
|
3468
3443
|
var n;
|
|
3469
3444
|
const t = (a) => {
|
|
3470
3445
|
if (!document.contains(i.node)) return;
|
|
@@ -3481,7 +3456,7 @@ function Et(i, e) {
|
|
|
3481
3456
|
document.removeEventListener("mousedown", t), s == null || s();
|
|
3482
3457
|
}, i;
|
|
3483
3458
|
}
|
|
3484
|
-
class
|
|
3459
|
+
class La {
|
|
3485
3460
|
constructor() {
|
|
3486
3461
|
f(this, "node");
|
|
3487
3462
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3519,31 +3494,31 @@ class Ea {
|
|
|
3519
3494
|
this.node = t;
|
|
3520
3495
|
}
|
|
3521
3496
|
}
|
|
3522
|
-
const
|
|
3523
|
-
class
|
|
3497
|
+
const Me = new ae("comment-list");
|
|
3498
|
+
class Ea extends k {
|
|
3524
3499
|
constructor({ onDelete: t, onOpenEditor: s, comment: n, layout: a }) {
|
|
3525
|
-
super({ className:
|
|
3500
|
+
super({ className: Me.gen("item") });
|
|
3526
3501
|
f(this, "actionTooltip");
|
|
3527
3502
|
f(this, "actionsTrigger");
|
|
3528
|
-
const r = new k({ className:
|
|
3529
|
-
className:
|
|
3503
|
+
const r = new k({ className: Me.gen("text"), textContent: n.text }), o = new k({
|
|
3504
|
+
className: Me.gen("created-at"),
|
|
3530
3505
|
textContent: fa(new Date(n.createdAt))
|
|
3531
3506
|
});
|
|
3532
3507
|
this.actionsTrigger = new k({
|
|
3533
3508
|
tag: "button",
|
|
3534
|
-
className:
|
|
3509
|
+
className: Me.gen("action-trigger")
|
|
3535
3510
|
});
|
|
3536
3511
|
const c = new ka({
|
|
3537
3512
|
onDelete: t,
|
|
3538
3513
|
onUpdate: s
|
|
3539
3514
|
});
|
|
3540
|
-
this.actionTooltip =
|
|
3515
|
+
this.actionTooltip = Lt(c, () => {
|
|
3541
3516
|
this.actionTooltip.setVisible(!1);
|
|
3542
3517
|
}), this.actionsTrigger.node.addEventListener("click", () => {
|
|
3543
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);
|
|
3544
3519
|
});
|
|
3545
|
-
const h = new k({ className:
|
|
3546
|
-
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);
|
|
3547
3522
|
}
|
|
3548
3523
|
}
|
|
3549
3524
|
class Na {
|
|
@@ -3628,7 +3603,7 @@ class Ia extends se {
|
|
|
3628
3603
|
},
|
|
3629
3604
|
initialValue: t.text
|
|
3630
3605
|
});
|
|
3631
|
-
const s = new
|
|
3606
|
+
const s = new Ea({
|
|
3632
3607
|
onDelete: () => {
|
|
3633
3608
|
this._model.comments.remove(t.id), s.actionTooltip.setVisible(!1);
|
|
3634
3609
|
},
|
|
@@ -3768,7 +3743,7 @@ class Va extends se {
|
|
|
3768
3743
|
}, this.pointer.position(r), this.anchor = new za({ x: r.x, className: mi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
|
|
3769
3744
|
const h = !this.state.isActive;
|
|
3770
3745
|
h ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: h });
|
|
3771
|
-
}), this.tooltip =
|
|
3746
|
+
}), this.tooltip = Lt(new Oa(a, s, n), (h) => {
|
|
3772
3747
|
this.state.isActive && (this.anchor.node.contains(h.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
|
|
3773
3748
|
}), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
|
|
3774
3749
|
}
|
|
@@ -3780,8 +3755,8 @@ class Va extends se {
|
|
|
3780
3755
|
class Ya {
|
|
3781
3756
|
static animateTo(e, t, s, n) {
|
|
3782
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 = (_) => {
|
|
3783
|
-
const p = _ - c,
|
|
3784
|
-
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();
|
|
3785
3760
|
};
|
|
3786
3761
|
requestAnimationFrame(g);
|
|
3787
3762
|
}
|
|
@@ -3800,7 +3775,7 @@ class Wa extends se {
|
|
|
3800
3775
|
f(this, "_size", null);
|
|
3801
3776
|
f(this, "_model", null);
|
|
3802
3777
|
f(this, "_candle", null);
|
|
3803
|
-
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }),
|
|
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, () => {
|
|
3804
3779
|
this.setState({ isShow: !1 });
|
|
3805
3780
|
}), this.addField = new Ti({
|
|
3806
3781
|
blockName: "context-add",
|
|
@@ -3877,7 +3852,7 @@ class ja extends Ne {
|
|
|
3877
3852
|
});
|
|
3878
3853
|
}
|
|
3879
3854
|
}
|
|
3880
|
-
class Xa extends
|
|
3855
|
+
class Xa extends Ee {
|
|
3881
3856
|
constructor(e) {
|
|
3882
3857
|
super(e);
|
|
3883
3858
|
}
|
|
@@ -3911,7 +3886,7 @@ class Ua extends Ne {
|
|
|
3911
3886
|
if (e.config.guides.isShowX) {
|
|
3912
3887
|
const n = e.config.xAxis.position;
|
|
3913
3888
|
this.canvas.drawMarker({
|
|
3914
|
-
text:
|
|
3889
|
+
text: L.timeFormat("%a %d, %b %y %H:%M")(e.scales.x.invert(t)),
|
|
3915
3890
|
startLineCoords: { x: t, y: 0 },
|
|
3916
3891
|
endMarkerCoords: { x: t, y: e.layout.xAxis[n] },
|
|
3917
3892
|
side: n,
|
|
@@ -3939,7 +3914,7 @@ class Ga extends se {
|
|
|
3939
3914
|
this.position(r.x, r.y);
|
|
3940
3915
|
}
|
|
3941
3916
|
}
|
|
3942
|
-
class Za extends
|
|
3917
|
+
class Za extends Ee {
|
|
3943
3918
|
constructor(t) {
|
|
3944
3919
|
super(t);
|
|
3945
3920
|
f(this, "domain", null);
|
|
@@ -4037,12 +4012,12 @@ class Ja {
|
|
|
4037
4012
|
f(this, "candles");
|
|
4038
4013
|
this.container = e, this.wrapper = new k({ tag: "div", className: "sc-charts-cs" }), e.append(this.wrapper.node);
|
|
4039
4014
|
const { width: t, height: s } = e.getBoundingClientRect();
|
|
4040
|
-
this.width = t, this.height = s, this.mainCanvas = new
|
|
4015
|
+
this.width = t, this.height = s, this.mainCanvas = new Ee({
|
|
4041
4016
|
className: "sc-charts-cs__canvas-main",
|
|
4042
4017
|
width: t,
|
|
4043
4018
|
height: s,
|
|
4044
4019
|
isMain: !0
|
|
4045
|
-
}), 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
|
|
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);
|
|
4046
4021
|
}
|
|
4047
4022
|
renderAll(e) {
|
|
4048
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);
|
|
@@ -4323,8 +4298,8 @@ class tr {
|
|
|
4323
4298
|
}
|
|
4324
4299
|
} = this.model;
|
|
4325
4300
|
for (const o of s) {
|
|
4326
|
-
const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low), g = c - r / 2, _ = c + r / 2, p = Math.min(h, d),
|
|
4327
|
-
if (e >= g && e <= _ && t >= p && t <=
|
|
4301
|
+
const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low), g = c - r / 2, _ = c + r / 2, p = Math.min(h, d), v = Math.max(h, d);
|
|
4302
|
+
if (e >= g && e <= _ && t >= p && t <= v)
|
|
4328
4303
|
return {
|
|
4329
4304
|
target: this,
|
|
4330
4305
|
x: e,
|
|
@@ -4362,19 +4337,19 @@ class sr {
|
|
|
4362
4337
|
const { tradedCandles: s } = this.model.trade, { x: n, y: a } = this.model.scales, r = 16, o = 4;
|
|
4363
4338
|
for (const { candle: c, trades: h } of s) {
|
|
4364
4339
|
const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, _ = r, p = r;
|
|
4365
|
-
for (const
|
|
4366
|
-
const
|
|
4367
|
-
if (!
|
|
4368
|
-
const
|
|
4369
|
-
if (x &&
|
|
4340
|
+
for (const v of ["buy", "sell"]) {
|
|
4341
|
+
const b = h.filter((C) => C.type === v);
|
|
4342
|
+
if (!b.length) continue;
|
|
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)
|
|
4370
4345
|
return {
|
|
4371
4346
|
target: this,
|
|
4372
4347
|
type: "trade-label",
|
|
4373
|
-
tradeType:
|
|
4348
|
+
tradeType: v,
|
|
4374
4349
|
x: e,
|
|
4375
4350
|
y: t,
|
|
4376
4351
|
candle: c,
|
|
4377
|
-
trades:
|
|
4352
|
+
trades: b
|
|
4378
4353
|
};
|
|
4379
4354
|
}
|
|
4380
4355
|
}
|
|
@@ -4475,10 +4450,10 @@ function At(i, e) {
|
|
|
4475
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;
|
|
4476
4451
|
r > 0 && i.scales.pan("x", -r);
|
|
4477
4452
|
}
|
|
4478
|
-
function
|
|
4453
|
+
function Mt(i) {
|
|
4479
4454
|
return i.candles.limiter.absolutePosition.width > 0;
|
|
4480
4455
|
}
|
|
4481
|
-
class
|
|
4456
|
+
class Et {
|
|
4482
4457
|
constructor(e, t, s) {
|
|
4483
4458
|
f(this, "_model");
|
|
4484
4459
|
f(this, "_hitManager");
|
|
@@ -4486,7 +4461,7 @@ class Lt {
|
|
|
4486
4461
|
this._model = e, this._hitManager = t, this._hit = s, t.register(s);
|
|
4487
4462
|
}
|
|
4488
4463
|
}
|
|
4489
|
-
class hr extends
|
|
4464
|
+
class hr extends Et {
|
|
4490
4465
|
constructor(t, s, n) {
|
|
4491
4466
|
super(t, s, new ar(t));
|
|
4492
4467
|
f(this, "_view");
|
|
@@ -4495,13 +4470,13 @@ class hr extends Lt {
|
|
|
4495
4470
|
register() {
|
|
4496
4471
|
this._hitManager.on(this._hit, "drag", (t) => {
|
|
4497
4472
|
const s = t.x - (t.prevX ?? t.x);
|
|
4498
|
-
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);
|
|
4499
4474
|
}), this._hitManager.on(this._hit, "dblclick", () => {
|
|
4500
4475
|
this._model.scales.scale("x", 1, "absolute"), this._model.scales.pan("x", 0, "absolute");
|
|
4501
4476
|
});
|
|
4502
4477
|
}
|
|
4503
4478
|
}
|
|
4504
|
-
class dr extends
|
|
4479
|
+
class dr extends Et {
|
|
4505
4480
|
constructor(e, t) {
|
|
4506
4481
|
super(e, t, new or(e));
|
|
4507
4482
|
}
|
|
@@ -4514,7 +4489,7 @@ class dr extends Lt {
|
|
|
4514
4489
|
});
|
|
4515
4490
|
}
|
|
4516
4491
|
}
|
|
4517
|
-
class ur extends
|
|
4492
|
+
class ur extends Et {
|
|
4518
4493
|
constructor(t, s, n) {
|
|
4519
4494
|
super(t, n, new rr(t));
|
|
4520
4495
|
f(this, "_view");
|
|
@@ -4533,7 +4508,7 @@ class ur extends Lt {
|
|
|
4533
4508
|
this._hit,
|
|
4534
4509
|
"drag",
|
|
4535
4510
|
cr(1, (t) => {
|
|
4536
|
-
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 });
|
|
4537
4512
|
})
|
|
4538
4513
|
), this._hitManager.on(this._hit, "contextmenu", ({ x: t }) => {
|
|
4539
4514
|
const s = this._model.scales.x.invert(t), n = Dt.findByDate(s, this._model.candles.allData);
|
|
@@ -4542,7 +4517,7 @@ class ur extends Lt {
|
|
|
4542
4517
|
var a, r;
|
|
4543
4518
|
if (!t.deltaY) return;
|
|
4544
4519
|
const s = -t.deltaY, n = (r = (a = this._model.config) == null ? void 0 : a.candles) == null ? void 0 : r.zoomOnWheel;
|
|
4545
|
-
["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);
|
|
4546
4521
|
});
|
|
4547
4522
|
}
|
|
4548
4523
|
}
|
|
@@ -4722,16 +4697,16 @@ class _r {
|
|
|
4722
4697
|
p.push({ label: "Net P&L", value: t.net_pnl, valueColor: C ? "#56B683" : "#F18169" });
|
|
4723
4698
|
}
|
|
4724
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 });
|
|
4725
|
-
const
|
|
4700
|
+
const v = _ + c / 2, b = 24 * r;
|
|
4726
4701
|
if (p.length === 0) return;
|
|
4727
4702
|
e.font = `500 ${d}px Geist, Arial, sans-serif`;
|
|
4728
|
-
const
|
|
4729
|
-
let
|
|
4703
|
+
const w = o ? "#878788" : "#8E8E93", x = o ? "#FAFAFA" : "#1C2026";
|
|
4704
|
+
let y = h;
|
|
4730
4705
|
p.forEach((C) => {
|
|
4731
|
-
const
|
|
4732
|
-
e.fillStyle =
|
|
4733
|
-
const $ =
|
|
4734
|
-
e.fillStyle = C.valueColor || x, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.value, $,
|
|
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;
|
|
4735
4710
|
});
|
|
4736
4711
|
}
|
|
4737
4712
|
async captureScreenshot(e = {}) {
|
|
@@ -4742,30 +4717,30 @@ class _r {
|
|
|
4742
4717
|
hour: "2-digit",
|
|
4743
4718
|
minute: "2-digit",
|
|
4744
4719
|
timeZoneName: "short"
|
|
4745
|
-
}), a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1, d = a.download || !1, { canvasesContainer: g, width: _, height: p } = this._view,
|
|
4720
|
+
}), a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1, d = a.download || !1, { canvasesContainer: g, width: _, height: p } = this._view, v = Array.from(
|
|
4746
4721
|
g.node.querySelectorAll("canvas")
|
|
4747
4722
|
);
|
|
4748
|
-
if (
|
|
4723
|
+
if (v.length === 0) {
|
|
4749
4724
|
console.warn("No canvas elements found for screenshot");
|
|
4750
4725
|
return;
|
|
4751
4726
|
}
|
|
4752
|
-
const
|
|
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;
|
|
4753
4728
|
let z, V, Y = 0, re = 0;
|
|
4754
|
-
N > $ ? (V =
|
|
4729
|
+
N > $ ? (V = M, z = V * N, Y = 0, re = 0) : (z = S, V = z / N, re = (M - V) / 2);
|
|
4755
4730
|
const P = window.devicePixelRatio || 1, U = document.createElement("canvas");
|
|
4756
|
-
U.width =
|
|
4731
|
+
U.width = b * P, U.height = w * P;
|
|
4757
4732
|
const G = U.getContext("2d");
|
|
4758
4733
|
if (!G) {
|
|
4759
4734
|
console.error("Failed to get 2D context for merged canvas");
|
|
4760
4735
|
return;
|
|
4761
4736
|
}
|
|
4762
4737
|
G.fillStyle = h ? "#101011" : "#ffffff", G.fillRect(0, 0, U.width, U.height);
|
|
4763
|
-
const Fe = x * P, st =
|
|
4738
|
+
const Fe = x * P, st = y * P, oe = M * P, ve = S * P, be = Fe + st;
|
|
4764
4739
|
await this._drawHeader(G, U.width, P, h), this._drawHeaderSecondLine(G, r, o, U.width, Fe, P, h);
|
|
4765
4740
|
const He = this._view.mainCanvas;
|
|
4766
4741
|
He.background && (G.fillStyle = He.background, G.fillRect(0, be, U.width, oe));
|
|
4767
4742
|
const Be = z * P, Ie = V * P, F = Y * P, Re = re * P;
|
|
4768
|
-
|
|
4743
|
+
v.forEach((O) => {
|
|
4769
4744
|
let ee = 0, Z = 0, q = O.width, ge = O.height, ye = Be, we = Ie, Oe = F, Pe = Re;
|
|
4770
4745
|
if (N > $) {
|
|
4771
4746
|
const le = Ie / O.height, ce = O.width * le;
|