charts-core 1.1.31 → 1.1.32
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 +248 -248
- 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
|
@@ -5,20 +5,20 @@ 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
|
-
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((
|
|
9
|
-
let
|
|
10
|
-
o && c ?
|
|
8
|
+
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((p) => {
|
|
9
|
+
let _ = L.axisRight(s);
|
|
10
|
+
o && c ? _ = _.tickFormat(c) : _ = _.tickFormat((v) => {
|
|
11
11
|
const b = Number(v), w = (x) => x.toString().replace(/\.0+$/, "");
|
|
12
12
|
return Math.abs(b) >= 1e12 ? w(b / 1e12) + "T" : Math.abs(b) >= 1e9 ? w(b / 1e9) + "B" : Math.abs(b) >= 1e6 ? w(b / 1e6) + "M" : Math.abs(b) >= 1e3 ? w(b / 1e3) + "K" : w(b);
|
|
13
|
-
}), o && d && (
|
|
14
|
-
}).call((
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
}).call((
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const v =
|
|
21
|
-
|
|
13
|
+
}), o && d && (_ = Array.isArray(d) ? _.ticks(...d) : _.ticks(d)), o && h && (_ = _.tickValues(h)), p.call(_);
|
|
14
|
+
}).call((p) => {
|
|
15
|
+
let _ = [];
|
|
16
|
+
p.selectAll(".tick").each((v) => _.push(v)), i.yTicks = _;
|
|
17
|
+
}).call((p) => p.select(".domain").remove()).call((p) => p.selectAll(".tick line").remove()).call((p) => {
|
|
18
|
+
const _ = p.selectAll(".tick text");
|
|
19
|
+
_.classed("sc-charts__y-axis-tick", !0).attr("text-anchor", "start");
|
|
20
|
+
const v = _.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
|
|
21
|
+
p.selectAll(".tick").each(function(w, x) {
|
|
22
22
|
var $;
|
|
23
23
|
const y = L.select(this), C = y.select("text"), S = v[x], T = b - S, N = y.append("g").attr("transform", "translate(10, 0)");
|
|
24
24
|
C.attr("x", T), C.remove(), ($ = N.node()) == null || $.appendChild(C.node());
|
|
@@ -27,13 +27,13 @@ const Hs = (i) => {
|
|
|
27
27
|
}, Bs = (i) => {
|
|
28
28
|
const { svg: e, config: t, x: s, height: n } = i, { margin: a, xAxis: r } = t, { isShow: o, tickValues: c, tickFormat: h, customTicks: d, ticks: g } = r;
|
|
29
29
|
if (!o) return null;
|
|
30
|
-
e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((
|
|
31
|
-
let
|
|
32
|
-
d ? (h && (
|
|
33
|
-
}).call((
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
}).call((
|
|
30
|
+
e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((p) => {
|
|
31
|
+
let _ = L.axisBottom(s);
|
|
32
|
+
d ? (h && (_ = _.tickFormat(h)), g && (_ = Array.isArray(g) ? _.ticks(...g) : _.ticks(g)), c && (_ = _.tickValues(c))) : _.ticks(5), p.call(_);
|
|
33
|
+
}).call((p) => p.select(".domain").remove()).call((p) => {
|
|
34
|
+
let _ = [];
|
|
35
|
+
p.selectAll(".tick").each((v) => _.push(v)), i.xTicks = _;
|
|
36
|
+
}).call((p) => p.selectAll(".tick line").remove()).call((p) => p.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
|
|
37
37
|
}, Is = (i) => {
|
|
38
38
|
const { svg: e, config: t, y: s, width: n } = i, {
|
|
39
39
|
margin: a,
|
|
@@ -84,26 +84,26 @@ const Hs = (i) => {
|
|
|
84
84
|
return r.append("circle").attr("cx", t).attr("cy", s).attr("r", n).classed("sc-charts__hovered-circles", !0), r.append("circle").attr("cx", t).attr("cy", s).attr("r", n + a).classed("sc-charts__hovered-circles_add", !0), r;
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
function
|
|
87
|
+
function Ps(i, e, t, s) {
|
|
88
88
|
if (!i) return null;
|
|
89
89
|
const n = i.width / 2, a = e - n, r = e + n;
|
|
90
90
|
return a < t ? t : r > s ? s - i.width : e - n;
|
|
91
91
|
}
|
|
92
|
-
const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e).attr("x2", t).attr("y1", s).attr("y2", n).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1),
|
|
92
|
+
const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e).attr("x2", t).attr("y1", s).attr("y2", n).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1), Os = (i) => {
|
|
93
93
|
const { svg: e, config: t, x: s, y: n, height: a, data: r, wrapperNode: o } = i, {
|
|
94
94
|
margin: c,
|
|
95
|
-
grid: { verticalStyle: h, tooltipNode: d, hoverCirclesRadius: g, hoverCirclesAdditionalArea:
|
|
95
|
+
grid: { verticalStyle: h, tooltipNode: d, hoverCirclesRadius: g, hoverCirclesAdditionalArea: p }
|
|
96
96
|
} = t;
|
|
97
97
|
if (i.gridHoverTooltip = null, h !== "none" && (h.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((v) => {
|
|
98
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
99
|
h === "every-line-dashed" && b.attr("stroke-dasharray", "4 4");
|
|
100
100
|
}), h === "hovered-circles")) {
|
|
101
|
-
const
|
|
102
|
-
qt(e, { x1: v, x2: b, y1:
|
|
101
|
+
const _ = n.range()[0], v = s(r[0].date), b = s(r[r.length - 1].date);
|
|
102
|
+
qt(e, { x1: v, x2: b, y1: _, y2: _ });
|
|
103
103
|
const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Rs(o), C = (T) => {
|
|
104
104
|
if (!d) return;
|
|
105
105
|
_i(x), w.style.display = "block", x.append(d({ date: T.date, value: T.value }));
|
|
106
|
-
const N = x.getBoundingClientRect(), $ =
|
|
106
|
+
const N = x.getBoundingClientRect(), $ = Ps(
|
|
107
107
|
N,
|
|
108
108
|
s(T.date),
|
|
109
109
|
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
@@ -118,12 +118,12 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
118
118
|
hide: S
|
|
119
119
|
} : null, r.forEach((T, N) => {
|
|
120
120
|
const $ = s(T.date), X = n(T.value), U = r[N - 1], te = N > 0 && U && T.value === U.value;
|
|
121
|
-
te || qt(e, { x1: $, x2: $, y1: X, y2:
|
|
121
|
+
te || qt(e, { x1: $, x2: $, y1: X, y2: _ });
|
|
122
122
|
const K = $s(e, te, {
|
|
123
123
|
x: $,
|
|
124
|
-
y:
|
|
124
|
+
y: _,
|
|
125
125
|
r: g,
|
|
126
|
-
hr:
|
|
126
|
+
hr: p
|
|
127
127
|
});
|
|
128
128
|
d && K.on("mouseover", function() {
|
|
129
129
|
C({ date: T.date, value: te ? null : T.value });
|
|
@@ -133,7 +133,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
}, zs = (i) => {
|
|
136
|
-
Is(i),
|
|
136
|
+
Is(i), Os(i);
|
|
137
137
|
}, Vs = (i) => {
|
|
138
138
|
const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
|
|
139
139
|
Bs(i), Hs(i), r && e.append("image").attr("xlink:href", t.theme === "dark" ? r.picDarkTheme : r.picLightTheme).attr("width", r.width).attr("height", r.height).attr("x", r.x ?? (s - a.left - a.right) / 2 - r.width / 2 + a.left).attr("y", r.y ?? (n - a.top - a.bottom) / 2 - r.height / 2 + a.top), zs(i);
|
|
@@ -225,7 +225,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
225
225
|
t.remove();
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
|
-
},
|
|
228
|
+
}, Ws = (i, e = {}) => {
|
|
229
229
|
const t = "sc-charts__hover-line", s = i.append("line").style("display", e.hidden ? "none" : "block").classed(t, !0), n = i.node(), a = ve(n);
|
|
230
230
|
return ((o, c) => Ee(a, o, {
|
|
231
231
|
x1: "0%",
|
|
@@ -249,7 +249,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
249
249
|
s.remove();
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
-
}, ge = "sc-charts__range-tooltip", Kt = L.timeFormat("%b %e, %I:%M %p"),
|
|
252
|
+
}, ge = "sc-charts__range-tooltip", Kt = L.timeFormat("%b %e, %I:%M %p"), Ys = (i) => {
|
|
253
253
|
const e = L.format(",.2f");
|
|
254
254
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
255
255
|
};
|
|
@@ -282,15 +282,15 @@ const Xs = (i) => {
|
|
|
282
282
|
},
|
|
283
283
|
update({ leftPoint: n, rightPoint: a, x: r, y: o, hidden: c, closest: h }) {
|
|
284
284
|
if (n && a && h && r !== void 0) {
|
|
285
|
-
const d = a.value - n.value, { sumFormatter: g, timeFormatter:
|
|
285
|
+
const d = a.value - n.value, { sumFormatter: g, timeFormatter: p } = i.config.selection, _ = (i.x(a.date) + i.x(n.date)) / 2, v = i.x(h.date) < _ ? "left" : "right";
|
|
286
286
|
let b = "", w = "";
|
|
287
287
|
if (g)
|
|
288
288
|
b = g({ left: n.value, right: a.value, direction: v });
|
|
289
289
|
else {
|
|
290
290
|
const x = (d / Math.abs(n.value) * 100).toFixed(2);
|
|
291
|
-
b = `${
|
|
291
|
+
b = `${Ys(d)} (${x}%)`;
|
|
292
292
|
}
|
|
293
|
-
|
|
293
|
+
p ? w = p({ left: n.date, right: a.date, direction: v }) : w = `${Kt(n.date)} to ${Kt(a.date)}`, t.textContent = b, s.textContent = w, requestAnimationFrame(() => {
|
|
294
294
|
const x = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), S = i.x(a.date);
|
|
295
295
|
let N = (C + S) / 2 - x.width / 2;
|
|
296
296
|
const $ = 0, X = y.width - x.width;
|
|
@@ -414,15 +414,15 @@ const Js = (i) => {
|
|
|
414
414
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
415
415
|
]
|
|
416
416
|
});
|
|
417
|
-
const h = L.area().x((
|
|
417
|
+
const h = L.area().x((p) => s(p.date)).y0(n.range()[0]).y1((p) => n(p.value)).curve(tt()), d = "sc-charts__main-line-area", g = e.append("path").datum(t).attr("d", h).attr("class", d).classed(`${d}_hidden`, !a.hasMainLineArea);
|
|
418
418
|
return {
|
|
419
|
-
className(
|
|
420
|
-
|
|
419
|
+
className(p, _) {
|
|
420
|
+
p === "remove" ? g.classed(`${d}${_}`, !1) : g.classed(`${d}${_}`, !0);
|
|
421
421
|
},
|
|
422
|
-
update({ data:
|
|
423
|
-
if (
|
|
422
|
+
update({ data: p, hidden: _ }) {
|
|
423
|
+
if (p !== void 0 && g.datum(p).attr("d", h), _ !== void 0) {
|
|
424
424
|
if (!a.hasMainLineArea) return null;
|
|
425
|
-
g.classed(`${d}_hidden`,
|
|
425
|
+
g.classed(`${d}_hidden`, _);
|
|
426
426
|
}
|
|
427
427
|
},
|
|
428
428
|
destroy() {
|
|
@@ -430,8 +430,8 @@ const Js = (i) => {
|
|
|
430
430
|
}
|
|
431
431
|
};
|
|
432
432
|
}, en = (i, e = {}) => {
|
|
433
|
-
const t = "sc-charts__range-line-area", { svg: s, x: n, y: a, config: r, data: o, chartId: c } = i, { clip: h } = e, d = s.node(), g = ve(d),
|
|
434
|
-
Ee(g,
|
|
433
|
+
const t = "sc-charts__range-line-area", { svg: s, x: n, y: a, config: r, data: o, chartId: c } = i, { clip: h } = e, d = s.node(), g = ve(d), p = "range-line-area-gradient";
|
|
434
|
+
Ee(g, p + "_up", {
|
|
435
435
|
x1: "0%",
|
|
436
436
|
y1: "0%",
|
|
437
437
|
x2: "0%",
|
|
@@ -440,7 +440,7 @@ const Js = (i) => {
|
|
|
440
440
|
{ offset: "0%", stopColor: "var(--sc-color-selection-up)" },
|
|
441
441
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
442
442
|
]
|
|
443
|
-
}), Ee(g,
|
|
443
|
+
}), Ee(g, p + "_down", {
|
|
444
444
|
x1: "0%",
|
|
445
445
|
y1: "0%",
|
|
446
446
|
x2: "0%",
|
|
@@ -450,39 +450,39 @@ const Js = (i) => {
|
|
|
450
450
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
451
451
|
]
|
|
452
452
|
});
|
|
453
|
-
const
|
|
453
|
+
const _ = 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", _).attr("class", t).classed(`${t}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${v})`);
|
|
454
454
|
return {
|
|
455
455
|
className(y, C) {
|
|
456
456
|
y === "remove" ? x.classed(`${t}${C}`, !1) : x.classed(`${t}${C}`, !0);
|
|
457
457
|
},
|
|
458
458
|
update({ data: y, hidden: C, clip: S }) {
|
|
459
|
-
y !== void 0 && x.datum(y).attr("d",
|
|
459
|
+
y !== void 0 && x.datum(y).attr("d", _), C !== void 0 && x.classed(`${t}_hidden`, C), S !== void 0 && w.attr("x", S.x).attr("y", S.y).attr("width", S.width).attr("height", S.height);
|
|
460
460
|
},
|
|
461
461
|
destroy() {
|
|
462
462
|
x.remove();
|
|
463
463
|
}
|
|
464
464
|
};
|
|
465
465
|
}, vt = (i, e) => {
|
|
466
|
-
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = ve(d),
|
|
466
|
+
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = ve(d), p = L.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(tt()), _ = `${r}-clip-${o}`, b = g.append("clipPath").attr("id", _).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), w = t.append("path").classed(o, !0).datum(s).attr("d", p).attr("id", c).attr("clip-path", `url(#${_})`);
|
|
467
467
|
return {
|
|
468
468
|
className(x, y) {
|
|
469
469
|
x === "remove" ? w.classed(`${o}${y}`, !1) : w.classed(`${o}${y}`, !0);
|
|
470
470
|
},
|
|
471
471
|
update({ data: x, clip: y, hidden: C }) {
|
|
472
|
-
x !== void 0 && w.datum(x).attr("d",
|
|
472
|
+
x !== void 0 && w.datum(x).attr("d", p), 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);
|
|
473
473
|
},
|
|
474
474
|
destroy() {
|
|
475
475
|
w.remove();
|
|
476
476
|
}
|
|
477
477
|
};
|
|
478
478
|
}, tn = (i, e) => {
|
|
479
|
-
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(),
|
|
479
|
+
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), p = ve(g), _ = L.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(tt()), v = `${r}-clip-${c}`, w = p.append("clipPath").attr("id", v).append("rect").attr("x", (d == null ? void 0 : d.x) || 0).attr("y", (d == null ? void 0 : d.y) || 0).attr("width", (d == null ? void 0 : d.width) || "100%").attr("height", (d == null ? void 0 : d.height) || "100%"), x = t.append("path").classed(c, !0).datum(s).attr("d", _).attr("id", h).attr("clip-path", `url(#${v})`);
|
|
480
480
|
return {
|
|
481
481
|
className(y, C) {
|
|
482
482
|
y === "remove" ? x.classed(`${c}${C}`, !1) : x.classed(`${c}${C}`, !0);
|
|
483
483
|
},
|
|
484
484
|
update({ data: y, clip: C, hidden: S }) {
|
|
485
|
-
y !== void 0 && x.datum(y).attr("d",
|
|
485
|
+
y !== void 0 && x.datum(y).attr("d", _), S !== void 0 && x.classed(`${c}_hidden`, S), C !== void 0 && (o.hover.transitionName === "default" ? w.transition().duration(o.hover.transitionDuration).attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height).ease(L.easeLinear) : w.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
|
|
486
486
|
},
|
|
487
487
|
destroy() {
|
|
488
488
|
x.remove();
|
|
@@ -496,13 +496,13 @@ const Js = (i) => {
|
|
|
496
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);
|
|
497
497
|
return ((g) => {
|
|
498
498
|
if (!g || g.length === 0) return;
|
|
499
|
-
const
|
|
500
|
-
c.attr("cx",
|
|
499
|
+
const p = g[g.length - 1], _ = n(p.date), v = a(p.value);
|
|
500
|
+
c.attr("cx", _).attr("cy", v);
|
|
501
501
|
const b = i.config.extremePointFormatter || sn;
|
|
502
|
-
h.attr("x",
|
|
502
|
+
h.attr("x", _).attr("y", v).text(b(p.value));
|
|
503
503
|
})(s), {
|
|
504
|
-
className(g,
|
|
505
|
-
g === "remove" ? o.classed(`${r}${
|
|
504
|
+
className(g, p) {
|
|
505
|
+
g === "remove" ? o.classed(`${r}${p}`, !1) : o.classed(`${r}${p}`, !0);
|
|
506
506
|
},
|
|
507
507
|
update({ hidden: g }) {
|
|
508
508
|
g !== void 0 && o.classed(`${r}_hidden`, g);
|
|
@@ -520,7 +520,7 @@ const Js = (i) => {
|
|
|
520
520
|
i.config.hasExtremePoint && (s = nn(i, {
|
|
521
521
|
baseClassName: "sc-charts__extreme-point"
|
|
522
522
|
}));
|
|
523
|
-
const n =
|
|
523
|
+
const n = Ws(i.svg), a = tn(i, {
|
|
524
524
|
baseClassName: "sc-charts__highlight-line",
|
|
525
525
|
id: `${i.chartId}-sc-charts__highlight-line`,
|
|
526
526
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
@@ -541,10 +541,10 @@ const Js = (i) => {
|
|
|
541
541
|
}), g = pt(i.svg, {
|
|
542
542
|
className: "sc-charts__range-circle-left",
|
|
543
543
|
hidden: !0
|
|
544
|
-
}),
|
|
544
|
+
}), p = pt(i.svg, {
|
|
545
545
|
className: "sc-charts__range-circle-right",
|
|
546
546
|
hidden: !0
|
|
547
|
-
}),
|
|
547
|
+
}), _ = Xs(i), v = Js(i), b = en(i);
|
|
548
548
|
return {
|
|
549
549
|
hoverLine: n,
|
|
550
550
|
hoverCircle: o,
|
|
@@ -553,9 +553,9 @@ const Js = (i) => {
|
|
|
553
553
|
rangeLine: d,
|
|
554
554
|
rangeLineArea: b,
|
|
555
555
|
rangeCircleLeft: g,
|
|
556
|
-
rangeCircleRight:
|
|
556
|
+
rangeCircleRight: p,
|
|
557
557
|
mainLine: e,
|
|
558
|
-
rangeTooltip:
|
|
558
|
+
rangeTooltip: _,
|
|
559
559
|
highlightLine: a,
|
|
560
560
|
hoverTooltip: v,
|
|
561
561
|
mainLineArea: t,
|
|
@@ -600,11 +600,11 @@ const Js = (i) => {
|
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
602
|
if (e >= h && e < d) {
|
|
603
|
-
const g = t(h),
|
|
603
|
+
const g = t(h), p = t(d);
|
|
604
604
|
return {
|
|
605
605
|
x: g,
|
|
606
606
|
y: 0,
|
|
607
|
-
width:
|
|
607
|
+
width: p - g,
|
|
608
608
|
height: "100%"
|
|
609
609
|
};
|
|
610
610
|
}
|
|
@@ -629,11 +629,11 @@ const Js = (i) => {
|
|
|
629
629
|
d = new Date(c.getFullYear(), c.getMonth() - r, 1);
|
|
630
630
|
break;
|
|
631
631
|
}
|
|
632
|
-
const g = t(d),
|
|
632
|
+
const g = t(d), p = t(c);
|
|
633
633
|
return {
|
|
634
634
|
x: g,
|
|
635
635
|
y: 0,
|
|
636
|
-
width:
|
|
636
|
+
width: p - g,
|
|
637
637
|
height: "100%"
|
|
638
638
|
};
|
|
639
639
|
}
|
|
@@ -671,12 +671,12 @@ const Js = (i) => {
|
|
|
671
671
|
clip: g,
|
|
672
672
|
hidden: !1
|
|
673
673
|
});
|
|
674
|
-
const
|
|
675
|
-
|
|
674
|
+
const p = s.range()[0] - s(0) + a.bottom;
|
|
675
|
+
p >= 0 && ((c = n.belowZeroLine) == null || c.update({
|
|
676
676
|
clip: {
|
|
677
677
|
...g,
|
|
678
678
|
y: s(0),
|
|
679
|
-
height:
|
|
679
|
+
height: p
|
|
680
680
|
}
|
|
681
681
|
})), n.mainLine.className("add", "_muted");
|
|
682
682
|
} else
|
|
@@ -710,7 +710,7 @@ const Js = (i) => {
|
|
|
710
710
|
config: { margin: a },
|
|
711
711
|
height: r,
|
|
712
712
|
elements: o
|
|
713
|
-
} = i, c = s(e.date) < s(t.date) ? e : t, h = s(e.date) >= s(t.date) ? e : t, d = h.value - c.value >= 0, g = s(c.date),
|
|
713
|
+
} = i, c = s(e.date) < s(t.date) ? e : t, h = s(e.date) >= s(t.date) ? e : t, d = h.value - c.value >= 0, g = s(c.date), p = s(h.date), _ = p - g;
|
|
714
714
|
o.rangeBorderLeft.update({
|
|
715
715
|
x1: g,
|
|
716
716
|
x2: g,
|
|
@@ -718,8 +718,8 @@ const Js = (i) => {
|
|
|
718
718
|
y2: r - a.bottom,
|
|
719
719
|
hidden: !1
|
|
720
720
|
}), o.rangeBorderRight.update({
|
|
721
|
-
x1:
|
|
722
|
-
x2:
|
|
721
|
+
x1: p,
|
|
722
|
+
x2: p,
|
|
723
723
|
y1: a.top,
|
|
724
724
|
y2: r - a.bottom,
|
|
725
725
|
hidden: !1
|
|
@@ -728,14 +728,14 @@ const Js = (i) => {
|
|
|
728
728
|
cy: n(c.value),
|
|
729
729
|
hidden: !1
|
|
730
730
|
}), o.rangeCircleRight.update({
|
|
731
|
-
cx:
|
|
731
|
+
cx: p,
|
|
732
732
|
cy: n(h.value),
|
|
733
733
|
hidden: !1
|
|
734
734
|
}), o.rangeLine.update({
|
|
735
735
|
clip: {
|
|
736
736
|
x: g,
|
|
737
737
|
y: 0,
|
|
738
|
-
width:
|
|
738
|
+
width: _,
|
|
739
739
|
height: n.range()[0]
|
|
740
740
|
},
|
|
741
741
|
hidden: !1
|
|
@@ -743,7 +743,7 @@ const Js = (i) => {
|
|
|
743
743
|
clip: {
|
|
744
744
|
x: g,
|
|
745
745
|
y: 0,
|
|
746
|
-
width:
|
|
746
|
+
width: _,
|
|
747
747
|
height: n.range()[0]
|
|
748
748
|
},
|
|
749
749
|
hidden: !1
|
|
@@ -751,7 +751,7 @@ const Js = (i) => {
|
|
|
751
751
|
rightPoint: h,
|
|
752
752
|
leftPoint: c,
|
|
753
753
|
closest: t,
|
|
754
|
-
x: g +
|
|
754
|
+
x: g + _ / 2,
|
|
755
755
|
y: 0,
|
|
756
756
|
hidden: !1
|
|
757
757
|
}), (v = o.belowZeroLine) == null || v.update({
|
|
@@ -764,11 +764,11 @@ const Js = (i) => {
|
|
|
764
764
|
}, cn = (i) => {
|
|
765
765
|
const { svg: e, data: t, x: s, config: n, width: a, height: r } = i, { margin: o, hover: c, selection: h } = n;
|
|
766
766
|
let d = null, g = !1;
|
|
767
|
-
const
|
|
767
|
+
const p = (v) => t.reduce(
|
|
768
768
|
(b, w) => Math.abs(s(b.date) - v) < Math.abs(s(w.date) - v) ? b : w
|
|
769
769
|
);
|
|
770
770
|
e.append("rect").attr("width", a - o.left - o.right).attr("height", r - o.top - o.bottom).attr("x", o.left).attr("y", o.top).attr("fill", "transparent").on("mousemove", function(v) {
|
|
771
|
-
const [b] = L.pointer(v, this), w =
|
|
771
|
+
const [b] = L.pointer(v, this), w = p(b);
|
|
772
772
|
!g && c.enable ? (i.action = "hover", ei(i, w)) : (i.action = g ? "selection" : "none", ti(i)), d && h.enable && (i.action = "selection", ln(i, d, w));
|
|
773
773
|
}).on("mouseleave", () => {
|
|
774
774
|
i.action = "none", g = !1, d = null, ti(i), ii(i);
|
|
@@ -776,10 +776,10 @@ const Js = (i) => {
|
|
|
776
776
|
if (h.enable) {
|
|
777
777
|
g = !0, i.action = "selection";
|
|
778
778
|
const [b] = L.pointer(v, this);
|
|
779
|
-
d =
|
|
779
|
+
d = p(b);
|
|
780
780
|
}
|
|
781
781
|
}).on("mouseup", function(v) {
|
|
782
|
-
const [b] = L.pointer(v, this), w =
|
|
782
|
+
const [b] = L.pointer(v, this), w = p(b);
|
|
783
783
|
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i, w);
|
|
784
784
|
});
|
|
785
785
|
}, hn = (i, e, t) => {
|
|
@@ -796,39 +796,39 @@ const Js = (i) => {
|
|
|
796
796
|
return console.error(`chartId is required and must be a valid id
|
|
797
797
|
(only letters, numbers or underscores. The first character must be a letter)`), null;
|
|
798
798
|
const s = t.append("div"), n = s.append("svg"), a = t.node();
|
|
799
|
-
let r = a.
|
|
800
|
-
const
|
|
801
|
-
r = a.
|
|
799
|
+
let r = a.clientWidth, o = a.clientHeight, c = Jt({ ...Qs }, e.config), h = e.data;
|
|
800
|
+
const d = () => {
|
|
801
|
+
r = a.clientWidth, o = a.clientHeight, g({ data: h, config: c });
|
|
802
802
|
};
|
|
803
|
-
window.addEventListener("resize",
|
|
804
|
-
const
|
|
805
|
-
|
|
806
|
-
const
|
|
807
|
-
s.attr("class", `sc-charts sc-charts__${
|
|
808
|
-
const
|
|
803
|
+
e.disabledResize || window.addEventListener("resize", d);
|
|
804
|
+
const g = (p, _ = !1) => {
|
|
805
|
+
_ && p.config && (c = Jt(c, p.config)), _ && p.data && (h = p.data);
|
|
806
|
+
const v = h.map((C) => ({ date: new Date(C.date), value: C.value })).sort((C, S) => C.date.getTime() - S.date.getTime()), b = hn(v, c, r), w = dn(v, c, o);
|
|
807
|
+
s.attr("class", `sc-charts sc-charts__${c.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${r} ${o}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
|
|
808
|
+
const x = {
|
|
809
809
|
chartId: e.chartId,
|
|
810
810
|
svg: n,
|
|
811
811
|
wrapperNode: s.node(),
|
|
812
|
-
data:
|
|
813
|
-
x:
|
|
814
|
-
y:
|
|
815
|
-
config:
|
|
812
|
+
data: v,
|
|
813
|
+
x: b,
|
|
814
|
+
y: w,
|
|
815
|
+
config: c,
|
|
816
816
|
action: "none",
|
|
817
|
-
width:
|
|
818
|
-
height:
|
|
817
|
+
width: r,
|
|
818
|
+
height: o,
|
|
819
819
|
gridHoverTooltip: null
|
|
820
820
|
};
|
|
821
|
-
Vs(
|
|
822
|
-
const
|
|
823
|
-
...
|
|
824
|
-
elements: an(
|
|
821
|
+
Vs(x);
|
|
822
|
+
const y = {
|
|
823
|
+
...x,
|
|
824
|
+
elements: an(x)
|
|
825
825
|
};
|
|
826
|
-
cn(
|
|
826
|
+
cn(y);
|
|
827
827
|
};
|
|
828
|
-
return
|
|
829
|
-
update: (p) =>
|
|
828
|
+
return g(e), {
|
|
829
|
+
update: (p) => g(p, !0),
|
|
830
830
|
destroy: () => {
|
|
831
|
-
window.removeEventListener("resize",
|
|
831
|
+
e.disabledResize || window.removeEventListener("resize", d), n.remove();
|
|
832
832
|
}
|
|
833
833
|
};
|
|
834
834
|
};
|
|
@@ -841,16 +841,16 @@ De.exports;
|
|
|
841
841
|
var si;
|
|
842
842
|
function fn() {
|
|
843
843
|
return si || (si = 1, function(i, e) {
|
|
844
|
-
var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]",
|
|
845
|
-
F[K] = F[z] = F[V] = F[
|
|
846
|
-
var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self,
|
|
844
|
+
var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", p = "[object Error]", _ = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", S = "[object RegExp]", T = "[object Set]", N = "[object String]", $ = "[object Undefined]", X = "[object WeakMap]", U = "[object ArrayBuffer]", te = "[object DataView]", K = "[object Float32Array]", z = "[object Float64Array]", V = "[object Int8Array]", P = "[object Int16Array]", oe = "[object Int32Array]", st = "[object Uint8Array]", le = "[object Uint8ClampedArray]", be = "[object Uint16Array]", ye = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Be = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, F = {};
|
|
845
|
+
F[K] = F[z] = F[V] = F[P] = F[oe] = F[st] = F[le] = F[be] = F[ye] = !0, F[o] = F[c] = F[U] = F[d] = F[te] = F[g] = F[p] = F[_] = F[b] = F[w] = F[y] = F[S] = F[T] = F[N] = F[X] = !1;
|
|
846
|
+
var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self, O = Re || $e || Function("return this")(), ee = e && !e.nodeType && e, G = ee && !0 && i && !i.nodeType && i, Z = G && G.exports === ee, me = Z && Re.process, we = function() {
|
|
847
847
|
try {
|
|
848
848
|
var l = G && G.require && G.require("util").types;
|
|
849
849
|
return l || me && me.binding && me.binding("util");
|
|
850
850
|
} catch {
|
|
851
851
|
}
|
|
852
852
|
}(), xe = we && we.isTypedArray;
|
|
853
|
-
function
|
|
853
|
+
function Pe(l, u, m) {
|
|
854
854
|
switch (m.length) {
|
|
855
855
|
case 0:
|
|
856
856
|
return l.call(u);
|
|
@@ -863,7 +863,7 @@ function fn() {
|
|
|
863
863
|
}
|
|
864
864
|
return l.apply(u, m);
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function Oe(l, u) {
|
|
867
867
|
for (var m = -1, A = Array(l); ++m < l; )
|
|
868
868
|
A[m] = u(m);
|
|
869
869
|
return A;
|
|
@@ -881,20 +881,20 @@ function fn() {
|
|
|
881
881
|
return l(u(m));
|
|
882
882
|
};
|
|
883
883
|
}
|
|
884
|
-
var Ce = Array.prototype, Mi = Function.prototype, ze = Object.prototype, at =
|
|
884
|
+
var Ce = Array.prototype, Mi = Function.prototype, ze = Object.prototype, at = O["__core-js_shared__"], Ve = Mi.toString, ae = ze.hasOwnProperty, Nt = function() {
|
|
885
885
|
var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
|
|
886
886
|
return l ? "Symbol(src)_1." + l : "";
|
|
887
887
|
}(), Ft = ze.toString, Si = Ve.call(Object), Ti = RegExp(
|
|
888
888
|
"^" + Ve.call(ae).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
889
|
-
),
|
|
890
|
-
|
|
891
|
-
var It = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = ze.propertyIsEnumerable, ki = Ce.splice, de = Ht ? Ht.toStringTag : void 0,
|
|
889
|
+
), We = Z ? O.Buffer : void 0, Ht = O.Symbol, Bt = O.Uint8Array;
|
|
890
|
+
We && We.allocUnsafe;
|
|
891
|
+
var It = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = ze.propertyIsEnumerable, ki = Ce.splice, de = Ht ? Ht.toStringTag : void 0, Ye = function() {
|
|
892
892
|
try {
|
|
893
893
|
var l = lt(Object, "defineProperty");
|
|
894
894
|
return l({}, "", {}), l;
|
|
895
895
|
} catch {
|
|
896
896
|
}
|
|
897
|
-
}(), Li =
|
|
897
|
+
}(), Li = We ? We.isBuffer : void 0, $t = Math.max, Ei = Date.now, Pt = lt(O, "Map"), Ae = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
|
|
898
898
|
function l() {
|
|
899
899
|
}
|
|
900
900
|
return function(u) {
|
|
@@ -948,14 +948,14 @@ function fn() {
|
|
|
948
948
|
function $i() {
|
|
949
949
|
this.__data__ = [], this.size = 0;
|
|
950
950
|
}
|
|
951
|
-
function
|
|
951
|
+
function Pi(l) {
|
|
952
952
|
var u = this.__data__, m = je(u, l);
|
|
953
953
|
if (m < 0)
|
|
954
954
|
return !1;
|
|
955
955
|
var A = u.length - 1;
|
|
956
956
|
return m == A ? u.pop() : ki.call(u, m, 1), --this.size, !0;
|
|
957
957
|
}
|
|
958
|
-
function
|
|
958
|
+
function Oi(l) {
|
|
959
959
|
var u = this.__data__, m = je(u, l);
|
|
960
960
|
return m < 0 ? void 0 : u[m][1];
|
|
961
961
|
}
|
|
@@ -966,7 +966,7 @@ function fn() {
|
|
|
966
966
|
var m = this.__data__, A = je(m, l);
|
|
967
967
|
return A < 0 ? (++this.size, m.push([l, u])) : m[A][1] = u, this;
|
|
968
968
|
}
|
|
969
|
-
ie.prototype.clear = $i, ie.prototype.delete =
|
|
969
|
+
ie.prototype.clear = $i, ie.prototype.delete = Pi, ie.prototype.get = Oi, ie.prototype.has = zi, ie.prototype.set = Vi;
|
|
970
970
|
function pe(l) {
|
|
971
971
|
var u = -1, m = l == null ? 0 : l.length;
|
|
972
972
|
for (this.clear(); ++u < m; ) {
|
|
@@ -974,14 +974,14 @@ function fn() {
|
|
|
974
974
|
this.set(A[0], A[1]);
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
|
-
function
|
|
977
|
+
function Wi() {
|
|
978
978
|
this.size = 0, this.__data__ = {
|
|
979
979
|
hash: new ue(),
|
|
980
|
-
map: new (
|
|
980
|
+
map: new (Pt || ie)(),
|
|
981
981
|
string: new ue()
|
|
982
982
|
};
|
|
983
983
|
}
|
|
984
|
-
function
|
|
984
|
+
function Yi(l) {
|
|
985
985
|
var u = Ue(this, l).delete(l);
|
|
986
986
|
return this.size -= u ? 1 : 0, u;
|
|
987
987
|
}
|
|
@@ -995,7 +995,7 @@ function fn() {
|
|
|
995
995
|
var m = Ue(this, l), A = m.size;
|
|
996
996
|
return m.set(l, u), this.size += m.size == A ? 0 : 1, this;
|
|
997
997
|
}
|
|
998
|
-
pe.prototype.clear =
|
|
998
|
+
pe.prototype.clear = Wi, pe.prototype.delete = Yi, pe.prototype.get = ji, pe.prototype.has = Xi, pe.prototype.set = Ui;
|
|
999
999
|
function _e(l) {
|
|
1000
1000
|
var u = this.__data__ = new ie(l);
|
|
1001
1001
|
this.size = u.size;
|
|
@@ -1017,7 +1017,7 @@ function fn() {
|
|
|
1017
1017
|
var m = this.__data__;
|
|
1018
1018
|
if (m instanceof ie) {
|
|
1019
1019
|
var A = m.__data__;
|
|
1020
|
-
if (!
|
|
1020
|
+
if (!Pt || A.length < t - 1)
|
|
1021
1021
|
return A.push([l, u]), this.size = ++m.size, this;
|
|
1022
1022
|
m = this.__data__ = new pe(A);
|
|
1023
1023
|
}
|
|
@@ -1025,7 +1025,7 @@ function fn() {
|
|
|
1025
1025
|
}
|
|
1026
1026
|
_e.prototype.clear = Gi, _e.prototype.delete = Zi, _e.prototype.get = qi, _e.prototype.has = Ji, _e.prototype.set = Qi;
|
|
1027
1027
|
function Ki(l, u) {
|
|
1028
|
-
var m = dt(l), A = !m && ht(l), D = !m && !A &&
|
|
1028
|
+
var m = dt(l), A = !m && ht(l), D = !m && !A && Yt(l), H = !m && !A && !D && Xt(l), B = m || A || D || H, E = B ? Oe(l.length, String) : [], I = E.length;
|
|
1029
1029
|
for (var q in l)
|
|
1030
1030
|
B && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1031
1031
|
(q == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
@@ -1048,7 +1048,7 @@ function fn() {
|
|
|
1048
1048
|
return -1;
|
|
1049
1049
|
}
|
|
1050
1050
|
function ot(l, u, m) {
|
|
1051
|
-
u == "__proto__" &&
|
|
1051
|
+
u == "__proto__" && Ye ? Ye(l, u, {
|
|
1052
1052
|
configurable: !0,
|
|
1053
1053
|
enumerable: !0,
|
|
1054
1054
|
value: m,
|
|
@@ -1059,7 +1059,7 @@ function fn() {
|
|
|
1059
1059
|
function Xe(l) {
|
|
1060
1060
|
return l == null ? l === void 0 ? $ : x : de && de in Object(l) ? ms(l) : ws(l);
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1062
|
+
function Ot(l) {
|
|
1063
1063
|
return Me(l) && Xe(l) == o;
|
|
1064
1064
|
}
|
|
1065
1065
|
function is(l) {
|
|
@@ -1074,7 +1074,7 @@ function fn() {
|
|
|
1074
1074
|
function ns(l) {
|
|
1075
1075
|
if (!fe(l))
|
|
1076
1076
|
return ys(l);
|
|
1077
|
-
var u =
|
|
1077
|
+
var u = Wt(l), m = [];
|
|
1078
1078
|
for (var A in l)
|
|
1079
1079
|
A == "constructor" && (u || !ae.call(l, A)) || m.push(A);
|
|
1080
1080
|
return m;
|
|
@@ -1095,18 +1095,18 @@ function fn() {
|
|
|
1095
1095
|
rt(l, m, q);
|
|
1096
1096
|
return;
|
|
1097
1097
|
}
|
|
1098
|
-
var
|
|
1098
|
+
var W = H ? H(E, I, m + "", l, u, B) : void 0, Se = W === void 0;
|
|
1099
1099
|
if (Se) {
|
|
1100
|
-
var gt = dt(I), mt = !gt &&
|
|
1101
|
-
|
|
1100
|
+
var gt = dt(I), mt = !gt && Yt(I), Zt = !gt && !mt && Xt(I);
|
|
1101
|
+
W = I, gt || mt || Zt ? dt(E) ? W = E : Ss(E) ? W = ds(E) : mt ? (Se = !1, W = ls(I)) : Zt ? (Se = !1, W = hs(I)) : W = [] : Ts(I) || ht(I) ? (W = E, ht(E) ? W = Ds(E) : (!fe(E) || ft(E)) && (W = ps(I))) : Se = !1;
|
|
1102
1102
|
}
|
|
1103
|
-
Se && (B.set(I,
|
|
1103
|
+
Se && (B.set(I, W), D(W, I, A, H, B), B.delete(I)), rt(l, m, W);
|
|
1104
1104
|
}
|
|
1105
1105
|
function rs(l, u) {
|
|
1106
1106
|
return Cs(xs(l, u, Gt), l + "");
|
|
1107
1107
|
}
|
|
1108
|
-
var os =
|
|
1109
|
-
return
|
|
1108
|
+
var os = Ye ? function(l, u) {
|
|
1109
|
+
return Ye(l, "toString", {
|
|
1110
1110
|
configurable: !0,
|
|
1111
1111
|
enumerable: !1,
|
|
1112
1112
|
value: Ls(u),
|
|
@@ -1178,7 +1178,7 @@ function fn() {
|
|
|
1178
1178
|
return A && (u ? l[de] = m : delete l[de]), D;
|
|
1179
1179
|
}
|
|
1180
1180
|
function ps(l) {
|
|
1181
|
-
return typeof l.constructor == "function" && !
|
|
1181
|
+
return typeof l.constructor == "function" && !Wt(l) ? Ni(It(l)) : {};
|
|
1182
1182
|
}
|
|
1183
1183
|
function Vt(l, u) {
|
|
1184
1184
|
var m = typeof l;
|
|
@@ -1197,7 +1197,7 @@ function fn() {
|
|
|
1197
1197
|
function bs(l) {
|
|
1198
1198
|
return !!Nt && Nt in l;
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1200
|
+
function Wt(l) {
|
|
1201
1201
|
var u = l && l.constructor, m = typeof u == "function" && u.prototype || ze;
|
|
1202
1202
|
return l === m;
|
|
1203
1203
|
}
|
|
@@ -1218,7 +1218,7 @@ function fn() {
|
|
|
1218
1218
|
D = -1;
|
|
1219
1219
|
for (var E = Array(u + 1); ++D < u; )
|
|
1220
1220
|
E[D] = A[D];
|
|
1221
|
-
return E[u] = m(B),
|
|
1221
|
+
return E[u] = m(B), Pe(l, this, E);
|
|
1222
1222
|
};
|
|
1223
1223
|
}
|
|
1224
1224
|
function ct(l, u) {
|
|
@@ -1254,9 +1254,9 @@ function fn() {
|
|
|
1254
1254
|
function Ge(l, u) {
|
|
1255
1255
|
return l === u || l !== l && u !== u;
|
|
1256
1256
|
}
|
|
1257
|
-
var ht =
|
|
1257
|
+
var ht = Ot(/* @__PURE__ */ function() {
|
|
1258
1258
|
return arguments;
|
|
1259
|
-
}()) ?
|
|
1259
|
+
}()) ? Ot : function(l) {
|
|
1260
1260
|
return Me(l) && ae.call(l, "callee") && !Di.call(l, "callee");
|
|
1261
1261
|
}, dt = Array.isArray;
|
|
1262
1262
|
function ut(l) {
|
|
@@ -1265,12 +1265,12 @@ function fn() {
|
|
|
1265
1265
|
function Ss(l) {
|
|
1266
1266
|
return Me(l) && ut(l);
|
|
1267
1267
|
}
|
|
1268
|
-
var
|
|
1268
|
+
var Yt = Li || Es;
|
|
1269
1269
|
function ft(l) {
|
|
1270
1270
|
if (!fe(l))
|
|
1271
1271
|
return !1;
|
|
1272
1272
|
var u = Xe(l);
|
|
1273
|
-
return u ==
|
|
1273
|
+
return u == _ || u == v || u == h || u == C;
|
|
1274
1274
|
}
|
|
1275
1275
|
function jt(l) {
|
|
1276
1276
|
return typeof l == "number" && l > -1 && l % 1 == 0 && l <= r;
|
|
@@ -1528,9 +1528,9 @@ function ai(i, e) {
|
|
|
1528
1528
|
throw new Error("[CS_Data] error while creating missing data");
|
|
1529
1529
|
const c = r.close, h = o.open;
|
|
1530
1530
|
let d = c;
|
|
1531
|
-
a.forEach((g,
|
|
1532
|
-
const
|
|
1533
|
-
let v = d +
|
|
1531
|
+
a.forEach((g, p) => {
|
|
1532
|
+
const _ = (h - d) / a.length;
|
|
1533
|
+
let v = d + _ * p, b = v + _;
|
|
1534
1534
|
const w = Math.abs(v - b);
|
|
1535
1535
|
let x = Math.max(v, b) + w / 2, y = Math.min(v, b) - w / 2;
|
|
1536
1536
|
if (e.trade) {
|
|
@@ -1702,8 +1702,8 @@ class Mn {
|
|
|
1702
1702
|
config: {
|
|
1703
1703
|
candles: { baseWidth: n, bodyRatio: a, direction: r }
|
|
1704
1704
|
}
|
|
1705
|
-
} = this.model, [o, c] = e.domain().map((
|
|
1706
|
-
e.setDomain(
|
|
1705
|
+
} = this.model, [o, c] = e.domain().map((_) => _.getTime()), h = c - o, d = n / a * t, g = h * (s.width / d), p = r === "left" ? [new Date(o), new Date(o + g)] : [new Date(c - g), new Date(c)];
|
|
1706
|
+
e.setDomain(p);
|
|
1707
1707
|
}
|
|
1708
1708
|
applyOffset(e) {
|
|
1709
1709
|
const {
|
|
@@ -2188,8 +2188,8 @@ function Hn(i, e) {
|
|
|
2188
2188
|
scales: a
|
|
2189
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");
|
|
2190
2190
|
i.save(), i.fillStyle = s.bg, i.fillRect(t.x, t.y, t.width, t.height), i.restore(), i.fillStyle = s.text, i.font = `${n.text.fontSize} ${n.text.font}`, i.textAlign = "center", i.textBaseline = "middle", r.forEach((d) => {
|
|
2191
|
-
const g = a.x.convert(d),
|
|
2192
|
-
i.fillText(
|
|
2191
|
+
const g = a.x.convert(d), p = o(d) ? c(d) : h(d);
|
|
2192
|
+
i.fillText(p, g, t.y + t.height / 2);
|
|
2193
2193
|
});
|
|
2194
2194
|
}
|
|
2195
2195
|
function Bn(i, e) {
|
|
@@ -2258,13 +2258,13 @@ function Ke(i) {
|
|
|
2258
2258
|
return i * 0.1875;
|
|
2259
2259
|
}
|
|
2260
2260
|
const $n = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2261
|
-
const g = r / 16,
|
|
2262
|
-
i.save(), i.translate(
|
|
2261
|
+
const g = r / 16, p = 16 * g, _ = n - p / 2, v = a;
|
|
2262
|
+
i.save(), i.translate(_, 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
2263
|
const b = a + g * 3 + 0.5, w = g * 16, x = b + w / 2;
|
|
2264
2264
|
i.fillStyle = t, i.fillText(s, n, x), i.restore();
|
|
2265
|
-
},
|
|
2266
|
-
const g = r / 16,
|
|
2267
|
-
i.save(), i.translate(
|
|
2265
|
+
}, Pn = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2266
|
+
const g = r / 16, p = 16 * g, _ = n - p / 2, v = a;
|
|
2267
|
+
i.save(), i.translate(_, 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
2268
|
const b = g * 16, w = a - g * 19 + b / 2;
|
|
2269
2269
|
i.fillStyle = t, i.fillText(s, n, w), i.restore();
|
|
2270
2270
|
};
|
|
@@ -2276,7 +2276,7 @@ function et(i) {
|
|
|
2276
2276
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
2277
2277
|
}, et(i);
|
|
2278
2278
|
}
|
|
2279
|
-
var
|
|
2279
|
+
var On = /^\s+/, zn = /\s+$/;
|
|
2280
2280
|
function M(i, e) {
|
|
2281
2281
|
if (i = i || "", e = e || {}, i instanceof M)
|
|
2282
2282
|
return i;
|
|
@@ -2461,7 +2461,7 @@ function Vn(i) {
|
|
|
2461
2461
|
g: 0,
|
|
2462
2462
|
b: 0
|
|
2463
2463
|
}, t = 1, s = null, n = null, a = null, r = !1, o = !1;
|
|
2464
|
-
return typeof i == "string" && (i = la(i)), et(i) == "object" && (se(i.r) && se(i.g) && se(i.b) ? (e =
|
|
2464
|
+
return typeof i == "string" && (i = la(i)), et(i) == "object" && (se(i.r) && se(i.g) && se(i.b) ? (e = Wn(i.r, i.g, i.b), r = !0, o = String(i.r).substr(-1) === "%" ? "prgb" : "rgb") : se(i.h) && se(i.s) && se(i.v) ? (s = ke(i.s), n = ke(i.v), e = jn(i.h, s, n), r = !0, o = "hsv") : se(i.h) && se(i.s) && se(i.l) && (s = ke(i.s), a = ke(i.l), e = Yn(i.h, s, a), r = !0, o = "hsl"), i.hasOwnProperty("a") && (t = i.a)), t = yi(t), {
|
|
2465
2465
|
ok: r,
|
|
2466
2466
|
format: i.format || o,
|
|
2467
2467
|
r: Math.min(255, Math.max(e.r, 0)),
|
|
@@ -2470,7 +2470,7 @@ function Vn(i) {
|
|
|
2470
2470
|
a: t
|
|
2471
2471
|
};
|
|
2472
2472
|
}
|
|
2473
|
-
function
|
|
2473
|
+
function Wn(i, e, t) {
|
|
2474
2474
|
return {
|
|
2475
2475
|
r: R(i, 255) * 255,
|
|
2476
2476
|
g: R(e, 255) * 255,
|
|
@@ -2503,7 +2503,7 @@ function li(i, e, t) {
|
|
|
2503
2503
|
l: o
|
|
2504
2504
|
};
|
|
2505
2505
|
}
|
|
2506
|
-
function
|
|
2506
|
+
function Yn(i, e, t) {
|
|
2507
2507
|
var s, n, a;
|
|
2508
2508
|
i = R(i, 360), e = R(e, 100), t = R(t, 100);
|
|
2509
2509
|
function r(h, d, g) {
|
|
@@ -2861,7 +2861,7 @@ function R(i, e) {
|
|
|
2861
2861
|
function it(i) {
|
|
2862
2862
|
return Math.min(1, Math.max(0, i));
|
|
2863
2863
|
}
|
|
2864
|
-
function
|
|
2864
|
+
function Y(i) {
|
|
2865
2865
|
return parseInt(i, 16);
|
|
2866
2866
|
}
|
|
2867
2867
|
function ra(i) {
|
|
@@ -2880,7 +2880,7 @@ function wi(i) {
|
|
|
2880
2880
|
return Math.round(parseFloat(i) * 255).toString(16);
|
|
2881
2881
|
}
|
|
2882
2882
|
function fi(i) {
|
|
2883
|
-
return
|
|
2883
|
+
return Y(i) / 255;
|
|
2884
2884
|
}
|
|
2885
2885
|
var J = function() {
|
|
2886
2886
|
var i = "[-\\+]?\\d+%?", e = "[-\\+]?\\d*\\.\\d+%?", t = "(?:" + e + ")|(?:" + i + ")", s = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?", n = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?";
|
|
@@ -2902,7 +2902,7 @@ function se(i) {
|
|
|
2902
2902
|
return !!J.CSS_UNIT.exec(i);
|
|
2903
2903
|
}
|
|
2904
2904
|
function la(i) {
|
|
2905
|
-
i = i.replace(
|
|
2905
|
+
i = i.replace(On, "").replace(zn, "").toLowerCase();
|
|
2906
2906
|
var e = !1;
|
|
2907
2907
|
if (At[i])
|
|
2908
2908
|
i = At[i], e = !0;
|
|
@@ -2943,26 +2943,26 @@ function la(i) {
|
|
|
2943
2943
|
v: t[3],
|
|
2944
2944
|
a: t[4]
|
|
2945
2945
|
} : (t = J.hex8.exec(i)) ? {
|
|
2946
|
-
r:
|
|
2947
|
-
g:
|
|
2948
|
-
b:
|
|
2946
|
+
r: Y(t[1]),
|
|
2947
|
+
g: Y(t[2]),
|
|
2948
|
+
b: Y(t[3]),
|
|
2949
2949
|
a: fi(t[4]),
|
|
2950
2950
|
format: e ? "name" : "hex8"
|
|
2951
2951
|
} : (t = J.hex6.exec(i)) ? {
|
|
2952
|
-
r:
|
|
2953
|
-
g:
|
|
2954
|
-
b:
|
|
2952
|
+
r: Y(t[1]),
|
|
2953
|
+
g: Y(t[2]),
|
|
2954
|
+
b: Y(t[3]),
|
|
2955
2955
|
format: e ? "name" : "hex"
|
|
2956
2956
|
} : (t = J.hex4.exec(i)) ? {
|
|
2957
|
-
r:
|
|
2958
|
-
g:
|
|
2959
|
-
b:
|
|
2957
|
+
r: Y(t[1] + "" + t[1]),
|
|
2958
|
+
g: Y(t[2] + "" + t[2]),
|
|
2959
|
+
b: Y(t[3] + "" + t[3]),
|
|
2960
2960
|
a: fi(t[4] + "" + t[4]),
|
|
2961
2961
|
format: e ? "name" : "hex8"
|
|
2962
2962
|
} : (t = J.hex3.exec(i)) ? {
|
|
2963
|
-
r:
|
|
2964
|
-
g:
|
|
2965
|
-
b:
|
|
2963
|
+
r: Y(t[1] + "" + t[1]),
|
|
2964
|
+
g: Y(t[2] + "" + t[2]),
|
|
2965
|
+
b: Y(t[3] + "" + t[3]),
|
|
2966
2966
|
format: e ? "name" : "hex"
|
|
2967
2967
|
} : !1;
|
|
2968
2968
|
}
|
|
@@ -2987,13 +2987,13 @@ function ha(i, e) {
|
|
|
2987
2987
|
} = e;
|
|
2988
2988
|
if (!r) return;
|
|
2989
2989
|
const { trade: o } = a, c = 4;
|
|
2990
|
-
t.forEach(({ isHovered: h, isActive: d, candle: g, trades:
|
|
2991
|
-
const
|
|
2992
|
-
|
|
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 :
|
|
2990
|
+
t.forEach(({ isHovered: h, isActive: d, candle: g, trades: p }) => {
|
|
2991
|
+
const _ = s.convert(g.open_time);
|
|
2992
|
+
p.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 : Pn;
|
|
2994
2994
|
let S = b ? o.buyLabel.main : o.sellLabel.main;
|
|
2995
2995
|
h && h[1] && h[0] === v.type && (S = M.mix(S, a.bg, 20).toString()), d && d[1] && d[0] === v.type && (S = o.activeLabel), C(i, {
|
|
2996
|
-
x:
|
|
2996
|
+
x: _,
|
|
2997
2997
|
y,
|
|
2998
2998
|
symbol: x,
|
|
2999
2999
|
mainColor: S,
|
|
@@ -3013,14 +3013,14 @@ function da(i, e) {
|
|
|
3013
3013
|
colorScheme: { trade: h }
|
|
3014
3014
|
} = e;
|
|
3015
3015
|
if (a.length === 0) return;
|
|
3016
|
-
const d = a.map((
|
|
3016
|
+
const d = a.map((p) => p.candle).sort((p, _) => p.open_time.getTime() - _.open_time.getTime()), g = c.baseWidth / 2 * s + c.strokeWidth / 2;
|
|
3017
3017
|
if (i.save(), i.lineWidth = 1, i.strokeStyle = h.tradeBorders, o.length) {
|
|
3018
|
-
const
|
|
3019
|
-
i.beginPath(), i.moveTo(
|
|
3018
|
+
const p = t.convert(d[0].open_time) - g;
|
|
3019
|
+
i.beginPath(), i.moveTo(p, n.y), i.lineTo(p, n.y + n.height), i.stroke();
|
|
3020
3020
|
}
|
|
3021
3021
|
if (r.length) {
|
|
3022
|
-
const
|
|
3023
|
-
i.beginPath(), i.moveTo(
|
|
3022
|
+
const p = t.convert(d[d.length - 1].open_time) + g;
|
|
3023
|
+
i.beginPath(), i.moveTo(p, n.y), i.lineTo(p, n.y + n.height), i.stroke();
|
|
3024
3024
|
}
|
|
3025
3025
|
i.restore();
|
|
3026
3026
|
}
|
|
@@ -3035,16 +3035,16 @@ const ua = (i, e) => {
|
|
|
3035
3035
|
} = e;
|
|
3036
3036
|
if (i.save(), !c) return;
|
|
3037
3037
|
const h = (g) => {
|
|
3038
|
-
var
|
|
3039
|
-
return (
|
|
3040
|
-
(
|
|
3041
|
-
)) == null ? void 0 :
|
|
3042
|
-
}, d = (g,
|
|
3043
|
-
const
|
|
3044
|
-
if (!
|
|
3045
|
-
const b = t.convert(
|
|
3038
|
+
var p;
|
|
3039
|
+
return (p = n.find(
|
|
3040
|
+
(_) => g.getTime() >= _.candle.open_time.getTime() && g.getTime() < _.candle.close_time.getTime()
|
|
3041
|
+
)) == null ? void 0 : p.candle;
|
|
3042
|
+
}, d = (g, p) => {
|
|
3043
|
+
const _ = h(g.time), v = h(p.time);
|
|
3044
|
+
if (!_ || !v) return;
|
|
3045
|
+
const b = t.convert(_.open_time), w = t.convert(v.open_time);
|
|
3046
3046
|
let x, y;
|
|
3047
|
-
g.type === "buy" ? (x = s.convert(
|
|
3047
|
+
g.type === "buy" ? (x = s.convert(_.low), y = s.convert(v.high)) : (x = s.convert(_.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([]);
|
|
3048
3048
|
};
|
|
3049
3049
|
if (a.length === 1 && r.length > 1)
|
|
3050
3050
|
r.forEach((g) => d(a[0], g));
|
|
@@ -3053,8 +3053,8 @@ const ua = (i, e) => {
|
|
|
3053
3053
|
else if (a.length === 1 && r.length === 1)
|
|
3054
3054
|
d(a[0], r[0]);
|
|
3055
3055
|
else if (a.length > 0 && r.length > 0) {
|
|
3056
|
-
const g = a.reduce((
|
|
3057
|
-
d(g,
|
|
3056
|
+
const g = a.reduce((_, v) => _.time < v.time ? _ : v), p = r.reduce((_, v) => _.time > v.time ? _ : v);
|
|
3057
|
+
d(g, p);
|
|
3058
3058
|
}
|
|
3059
3059
|
i.restore();
|
|
3060
3060
|
}, xi = (i, e) => {
|
|
@@ -3106,11 +3106,11 @@ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
|
3106
3106
|
}
|
|
3107
3107
|
} = e;
|
|
3108
3108
|
if (!c) return;
|
|
3109
|
-
const
|
|
3110
|
-
if (!
|
|
3111
|
-
const v = (
|
|
3112
|
-
(
|
|
3113
|
-
), S = C.length > 0 ? C.reduce((
|
|
3109
|
+
const p = n.at(0), _ = a.at(-1);
|
|
3110
|
+
if (!p || !_) return;
|
|
3111
|
+
const v = (P) => P ? P instanceof Date ? P : new Date(P) : null, b = v(d == null ? void 0 : d[0]) || p.candle.open_time, w = v(d == null ? void 0 : d[1]) || _.candle.close_time, x = t.convert(v(d == null ? void 0 : d[0]) || p.candle.open_time), y = t.convert(v(d == null ? void 0 : d[1]) || _.candle.open_time), C = e.candles.allData.filter(
|
|
3112
|
+
(P) => P.open_time <= w && P.close_time >= b
|
|
3113
|
+
), S = C.length > 0 ? C.reduce((P, oe) => oe.low < P ? oe.low : P, C[0].low) : ((V = n.at(0)) == null ? void 0 : V.price) ?? 0, T = s.convert(g || S);
|
|
3114
3114
|
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(x, T), i.lineTo(y, T), i.stroke(), i.setLineDash([]);
|
|
3115
3115
|
const N = (x + y) / 2, $ = h || `Hold: ${ga(r)}`, U = getComputedStyle(
|
|
3116
3116
|
document.querySelector(".sc-charts-cs") || document.body
|
|
@@ -3165,7 +3165,7 @@ const ya = {
|
|
|
3165
3165
|
}, d = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + a <= o && C + r <= c, g = () => {
|
|
3166
3166
|
const y = t.y < 0, C = t.y + r > c, S = t.x < 0, T = t.x + a > o;
|
|
3167
3167
|
return S && y ? "right-bottom" : S && C ? "right-top" : T && y ? "left-bottom" : T && C ? "left-top" : S ? "right-bottom" : T ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
|
|
3168
|
-
},
|
|
3168
|
+
}, _ = [
|
|
3169
3169
|
s,
|
|
3170
3170
|
"right-bottom",
|
|
3171
3171
|
"right-top",
|
|
@@ -3173,7 +3173,7 @@ const ya = {
|
|
|
3173
3173
|
"left-top"
|
|
3174
3174
|
].filter((y, C, S) => S.indexOf(y) === C), v = g();
|
|
3175
3175
|
let b = null;
|
|
3176
|
-
for (const y of [v, ...
|
|
3176
|
+
for (const y of [v, ..._]) {
|
|
3177
3177
|
const C = h(y);
|
|
3178
3178
|
if (d(C)) {
|
|
3179
3179
|
b = C;
|
|
@@ -3329,10 +3329,10 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3329
3329
|
borderRadius: c = 0,
|
|
3330
3330
|
colors: h,
|
|
3331
3331
|
align: d = { x: "left", y: "top" }
|
|
3332
|
-
} = e, g = { ...Aa, ...h },
|
|
3332
|
+
} = e, g = { ...Aa, ...h }, _ = getComputedStyle(
|
|
3333
3333
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3334
3334
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3335
|
-
i.font = `${a} ${n}px ${
|
|
3335
|
+
i.font = `${a} ${n}px ${_}`;
|
|
3336
3336
|
const b = i.measureText(s).width + o.x * 2, w = r + o.y * 2;
|
|
3337
3337
|
let x = t.x, y = t.y;
|
|
3338
3338
|
d.x === "middle" ? x -= b / 2 : d.x === "right" && (x -= b), d.y === "middle" ? y -= w / 2 : d.y === "bottom" && (y -= w), xi(i, {
|
|
@@ -3667,7 +3667,7 @@ class Ai extends ne {
|
|
|
3667
3667
|
}
|
|
3668
3668
|
}
|
|
3669
3669
|
const $a = new re("list-tooltip"), xt = 8;
|
|
3670
|
-
class
|
|
3670
|
+
class Pa extends ne {
|
|
3671
3671
|
constructor(t, s, n) {
|
|
3672
3672
|
super({ className: $a.gen() });
|
|
3673
3673
|
f(this, "_list");
|
|
@@ -3699,7 +3699,7 @@ class Oa extends ne {
|
|
|
3699
3699
|
return this._list;
|
|
3700
3700
|
}
|
|
3701
3701
|
}
|
|
3702
|
-
class
|
|
3702
|
+
class Oa {
|
|
3703
3703
|
constructor() {
|
|
3704
3704
|
f(this, "node");
|
|
3705
3705
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3719,7 +3719,7 @@ class za extends ne {
|
|
|
3719
3719
|
x: t,
|
|
3720
3720
|
y: n.layout.xAxis.top,
|
|
3721
3721
|
isActive: !1
|
|
3722
|
-
}, this.node.append(new
|
|
3722
|
+
}, this.node.append(new Oa().node), this.render();
|
|
3723
3723
|
}
|
|
3724
3724
|
render() {
|
|
3725
3725
|
const { x: t, y: s, isActive: n } = this.state;
|
|
@@ -3745,7 +3745,7 @@ class Va extends ne {
|
|
|
3745
3745
|
}, this.pointer.position(r), this.anchor = new za({ x: r.x, className: mi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
|
|
3746
3746
|
const h = !this.state.isActive;
|
|
3747
3747
|
h ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: h });
|
|
3748
|
-
}), this.tooltip = Lt(new
|
|
3748
|
+
}), this.tooltip = Lt(new Pa(a, s, n), (h) => {
|
|
3749
3749
|
this.state.isActive && (this.anchor.node.contains(h.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
|
|
3750
3750
|
}), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
|
|
3751
3751
|
}
|
|
@@ -3754,10 +3754,10 @@ class Va extends ne {
|
|
|
3754
3754
|
this.pointer.position(n), this.pointer.setVisible(t), this.anchor.setState({ x: n.x, isActive: t }), this.tooltip.setState({ comments: s, isShow: t });
|
|
3755
3755
|
}
|
|
3756
3756
|
}
|
|
3757
|
-
class
|
|
3757
|
+
class Wa {
|
|
3758
3758
|
static animateTo(e, t, s, n) {
|
|
3759
|
-
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 = (
|
|
3760
|
-
const
|
|
3759
|
+
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 = (p) => {
|
|
3760
|
+
const _ = p - c, v = Math.min(_ / o, 1), b = v * v * (3 - 2 * v), w = h + (a - h) * b, x = d + (r - d) * b;
|
|
3761
3761
|
e.scales.pan("x", w, "absolute"), e.scales.pan("y", x, "absolute"), v < 1 ? requestAnimationFrame(g) : n == null || n();
|
|
3762
3762
|
};
|
|
3763
3763
|
requestAnimationFrame(g);
|
|
@@ -3768,7 +3768,7 @@ class Ya {
|
|
|
3768
3768
|
}
|
|
3769
3769
|
}
|
|
3770
3770
|
const Ct = new re("comments-context");
|
|
3771
|
-
class
|
|
3771
|
+
class Ya extends ne {
|
|
3772
3772
|
constructor() {
|
|
3773
3773
|
super({ className: Ct.gen() });
|
|
3774
3774
|
f(this, "pointer");
|
|
@@ -3820,7 +3820,7 @@ class ja extends Fe {
|
|
|
3820
3820
|
f(this, "contextMenu");
|
|
3821
3821
|
f(this, "_view");
|
|
3822
3822
|
if (!this.dom) throw new Error("[CS_V_Comments] this.dom must be defined");
|
|
3823
|
-
this.contextMenu = new
|
|
3823
|
+
this.contextMenu = new Ya(), this._view = t, t.domElements.append(this.contextMenu.node);
|
|
3824
3824
|
}
|
|
3825
3825
|
_getCandleCoords(t, s) {
|
|
3826
3826
|
return {
|
|
@@ -3837,7 +3837,7 @@ class ja extends Fe {
|
|
|
3837
3837
|
view: this._view,
|
|
3838
3838
|
onBoxActivate: (o) => {
|
|
3839
3839
|
const c = a[0].candle;
|
|
3840
|
-
|
|
3840
|
+
Wa.animateToDataCoords(n, c.open_time, (c.open + c.close) / 2), this.boxes[o].setState({ isActive: !0 });
|
|
3841
3841
|
},
|
|
3842
3842
|
onBoxDeactivate: (o) => this.boxes[o].setState({ isActive: !1 })
|
|
3843
3843
|
});
|
|
@@ -3941,16 +3941,16 @@ class Za extends Ne {
|
|
|
3941
3941
|
}
|
|
3942
3942
|
} = t, h = t.config.candles.style === "filled";
|
|
3943
3943
|
this.domain = t.scales.x.domain(), c || this._getVisible(r).forEach((d, g) => {
|
|
3944
|
-
const
|
|
3944
|
+
const p = s.noDataFill[g % s.noDataFill.length], _ = h ? p : s.noDataStroke;
|
|
3945
3945
|
this.drawSingleCandle({
|
|
3946
3946
|
...this._getBasicCandleProps(t, d),
|
|
3947
|
-
colors: { fill:
|
|
3947
|
+
colors: { fill: p, stroke: _, bg: n }
|
|
3948
3948
|
});
|
|
3949
3949
|
}), this._getVisible(o).forEach((d) => {
|
|
3950
|
-
const g = d.close >= d.open ? "rising" : "falling",
|
|
3950
|
+
const g = d.close >= d.open ? "rising" : "falling", p = s[`${g}Fill`], _ = s[`${g}${h ? "Fill" : "Stroke"}`];
|
|
3951
3951
|
this.drawSingleCandle({
|
|
3952
3952
|
...this._getBasicCandleProps(t, d),
|
|
3953
|
-
colors: { fill:
|
|
3953
|
+
colors: { fill: p, stroke: _, bg: n },
|
|
3954
3954
|
isDim: !!(a.length && !a.includes(d.open_time.getTime()))
|
|
3955
3955
|
});
|
|
3956
3956
|
});
|
|
@@ -4300,8 +4300,8 @@ class tr {
|
|
|
4300
4300
|
}
|
|
4301
4301
|
} = this.model;
|
|
4302
4302
|
for (const o of s) {
|
|
4303
|
-
const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low), g = c - r / 2,
|
|
4304
|
-
if (e >= g && e <=
|
|
4303
|
+
const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low), g = c - r / 2, p = c + r / 2, _ = Math.min(h, d), v = Math.max(h, d);
|
|
4304
|
+
if (e >= g && e <= p && t >= _ && t <= v)
|
|
4305
4305
|
return {
|
|
4306
4306
|
target: this,
|
|
4307
4307
|
x: e,
|
|
@@ -4338,11 +4338,11 @@ class sr {
|
|
|
4338
4338
|
hitTest(e, t) {
|
|
4339
4339
|
const { tradedCandles: s } = this.model.trade, { x: n, y: a } = this.model.scales, r = 16, o = 4;
|
|
4340
4340
|
for (const { candle: c, trades: h } of s) {
|
|
4341
|
-
const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2,
|
|
4341
|
+
const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, p = r, _ = r;
|
|
4342
4342
|
for (const v of ["buy", "sell"]) {
|
|
4343
4343
|
const b = h.filter((C) => C.type === v);
|
|
4344
4344
|
if (!b.length) continue;
|
|
4345
|
-
const w = v === "buy" ? a.convert(c.low) + o + Ke(r) : a.convert(c.high) - o - r - Ke(r), x = e >= g -
|
|
4345
|
+
const w = v === "buy" ? a.convert(c.low) + o + Ke(r) : a.convert(c.high) - o - r - Ke(r), x = e >= g - p / 2 && e <= g + p / 2, y = t >= w && t <= w + _;
|
|
4346
4346
|
if (x && y)
|
|
4347
4347
|
return {
|
|
4348
4348
|
target: this,
|
|
@@ -4691,20 +4691,20 @@ class _r {
|
|
|
4691
4691
|
});
|
|
4692
4692
|
}
|
|
4693
4693
|
_drawFooter(e, t, s, n, a, r, o = !1) {
|
|
4694
|
-
const c = 32 * r, h = 12 * r, d = 12 * r, g = 4 * r,
|
|
4695
|
-
e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0,
|
|
4696
|
-
const
|
|
4697
|
-
if (t.pair &&
|
|
4694
|
+
const c = 32 * r, h = 12 * r, d = 12 * r, g = 4 * r, p = n + a;
|
|
4695
|
+
e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, p, s, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, p), e.lineTo(s, p), e.stroke(), e.textBaseline = "middle", e.textAlign = "left";
|
|
4696
|
+
const _ = [];
|
|
4697
|
+
if (t.pair && _.push({ label: "", value: t.pair }), t.net_pnl !== void 0) {
|
|
4698
4698
|
const C = t.net_pnl.startsWith("+");
|
|
4699
|
-
|
|
4699
|
+
_.push({ label: "Net P&L", value: t.net_pnl, valueColor: C ? "#56B683" : "#F18169" });
|
|
4700
4700
|
}
|
|
4701
|
-
t.type &&
|
|
4702
|
-
const v =
|
|
4703
|
-
if (
|
|
4701
|
+
t.type && _.push({ label: "Type", value: t.type }), t.entry_price && _.push({ label: "Entry", value: t.entry_price }), t.exit_price && _.push({ label: "Exit", value: t.exit_price }), t.open_date && _.push({ label: "Open date", value: t.open_date }), t.close_date && _.push({ label: "Close date", value: t.close_date }), t.holdtime && _.push({ label: "Holdtime", value: t.holdtime }), t.rr && _.push({ label: "RR", value: t.rr }), t.volume && _.push({ label: "Volume", value: t.volume });
|
|
4702
|
+
const v = p + c / 2, b = 24 * r;
|
|
4703
|
+
if (_.length === 0) return;
|
|
4704
4704
|
e.font = `500 ${d}px Geist, Arial, sans-serif`;
|
|
4705
4705
|
const w = o ? "#878788" : "#8E8E93", x = o ? "#FAFAFA" : "#1C2026";
|
|
4706
4706
|
let y = h;
|
|
4707
|
-
|
|
4707
|
+
_.forEach((C) => {
|
|
4708
4708
|
const S = e.measureText(C.label).width, T = e.measureText(C.value).width, N = S + g + T;
|
|
4709
4709
|
e.fillStyle = w, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.label, y, v);
|
|
4710
4710
|
const $ = y + S + g;
|
|
@@ -4719,74 +4719,74 @@ class _r {
|
|
|
4719
4719
|
hour: "2-digit",
|
|
4720
4720
|
minute: "2-digit",
|
|
4721
4721
|
timeZoneName: "short"
|
|
4722
|
-
}), 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:
|
|
4722
|
+
}), 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: p, height: _ } = this._view, v = Array.from(
|
|
4723
4723
|
g.node.querySelectorAll("canvas")
|
|
4724
4724
|
);
|
|
4725
4725
|
if (v.length === 0) {
|
|
4726
4726
|
console.warn("No canvas elements found for screenshot");
|
|
4727
4727
|
return;
|
|
4728
4728
|
}
|
|
4729
|
-
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, S = w - x - y - C, T = b, N =
|
|
4729
|
+
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, S = w - x - y - C, T = b, N = p / _, $ = T / S;
|
|
4730
4730
|
let X, U, te = 0, K = 0;
|
|
4731
4731
|
N > $ ? (U = S, X = U * N, te = 0, K = 0) : (X = T, U = X / N, K = (S - U) / 2);
|
|
4732
4732
|
const z = window.devicePixelRatio || 1, V = document.createElement("canvas");
|
|
4733
4733
|
V.width = b * z, V.height = w * z;
|
|
4734
|
-
const
|
|
4735
|
-
if (!
|
|
4734
|
+
const P = V.getContext("2d");
|
|
4735
|
+
if (!P) {
|
|
4736
4736
|
console.error("Failed to get 2D context for merged canvas");
|
|
4737
4737
|
return;
|
|
4738
4738
|
}
|
|
4739
|
-
|
|
4739
|
+
P.fillStyle = h ? "#101011" : "#ffffff", P.fillRect(0, 0, V.width, V.height);
|
|
4740
4740
|
const oe = x * z, st = y * z, le = S * z, be = T * z, ye = oe + st;
|
|
4741
|
-
await this._drawHeader(
|
|
4741
|
+
await this._drawHeader(P, V.width, z, h), this._drawHeaderSecondLine(P, r, o, V.width, oe, z, h);
|
|
4742
4742
|
const He = this._view.mainCanvas;
|
|
4743
|
-
He.background && (
|
|
4743
|
+
He.background && (P.fillStyle = He.background, P.fillRect(0, ye, V.width, le));
|
|
4744
4744
|
const Be = X * z, Ie = U * z, F = te * z, Re = K * z;
|
|
4745
|
-
v.forEach((
|
|
4746
|
-
let ee = 0, G = 0, Z =
|
|
4745
|
+
v.forEach((O) => {
|
|
4746
|
+
let ee = 0, G = 0, Z = O.width, me = O.height, we = Be, xe = Ie, Pe = F, Oe = Re;
|
|
4747
4747
|
if (N > $) {
|
|
4748
|
-
const ce = Ie /
|
|
4749
|
-
he > be && (ee = (he - be) / ce, Z =
|
|
4748
|
+
const ce = Ie / O.height, he = O.width * ce;
|
|
4749
|
+
he > be && (ee = (he - be) / ce, Z = O.width - ee, we = be, Pe = 0);
|
|
4750
4750
|
} else {
|
|
4751
|
-
const ce = Be /
|
|
4751
|
+
const ce = Be / O.width, he = O.height * ce;
|
|
4752
4752
|
if (he > le) {
|
|
4753
4753
|
const Ce = (he - le) / ce;
|
|
4754
|
-
G = Ce / 2, me =
|
|
4754
|
+
G = Ce / 2, me = O.height - Ce, xe = le, Oe = 0;
|
|
4755
4755
|
}
|
|
4756
4756
|
}
|
|
4757
|
-
|
|
4758
|
-
|
|
4757
|
+
P.drawImage(
|
|
4758
|
+
O,
|
|
4759
4759
|
ee,
|
|
4760
4760
|
G,
|
|
4761
4761
|
Z,
|
|
4762
4762
|
me,
|
|
4763
|
-
|
|
4764
|
-
ye +
|
|
4763
|
+
Pe,
|
|
4764
|
+
ye + Oe,
|
|
4765
4765
|
we,
|
|
4766
4766
|
xe
|
|
4767
4767
|
);
|
|
4768
|
-
}), c && this._drawFooter(
|
|
4769
|
-
const $e = (
|
|
4770
|
-
const G = URL.createObjectURL(
|
|
4768
|
+
}), c && this._drawFooter(P, c, V.width, ye, le, z, h);
|
|
4769
|
+
const $e = (O, ee) => {
|
|
4770
|
+
const G = URL.createObjectURL(O), Z = document.createElement("a");
|
|
4771
4771
|
Z.href = G, Z.download = ee, document.body.appendChild(Z), Z.click(), document.body.removeChild(Z), URL.revokeObjectURL(G);
|
|
4772
4772
|
};
|
|
4773
4773
|
V.toBlob(
|
|
4774
|
-
async (
|
|
4775
|
-
if (!
|
|
4774
|
+
async (O) => {
|
|
4775
|
+
if (!O) {
|
|
4776
4776
|
console.error("Failed to create blob from canvas");
|
|
4777
4777
|
return;
|
|
4778
4778
|
}
|
|
4779
4779
|
if (d)
|
|
4780
|
-
$e(
|
|
4780
|
+
$e(O, t);
|
|
4781
4781
|
else
|
|
4782
4782
|
try {
|
|
4783
4783
|
await navigator.clipboard.write([
|
|
4784
4784
|
new ClipboardItem({
|
|
4785
|
-
"image/png":
|
|
4785
|
+
"image/png": O
|
|
4786
4786
|
})
|
|
4787
4787
|
]);
|
|
4788
4788
|
} catch (ee) {
|
|
4789
|
-
console.error("Failed to copy to clipboard:", ee), $e(
|
|
4789
|
+
console.error("Failed to copy to clipboard:", ee), $e(O, t);
|
|
4790
4790
|
}
|
|
4791
4791
|
},
|
|
4792
4792
|
"image/png",
|