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