charts-core 1.1.35 → 1.1.38
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 +631 -609
- 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,10 +1,10 @@
|
|
|
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
|
-
var
|
|
3
|
+
var g = (i, e, t) => Fs(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
import * as E from "d3";
|
|
5
5
|
const Hs = (i) => {
|
|
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:
|
|
7
|
-
if (!
|
|
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: f } = r;
|
|
7
|
+
if (!f) return null;
|
|
8
8
|
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((p) => {
|
|
9
9
|
let _ = E.axisRight(s);
|
|
10
10
|
o && c ? _ = _.tickFormat(c) : _ = _.tickFormat((v) => {
|
|
@@ -19,22 +19,22 @@ const Hs = (i) => {
|
|
|
19
19
|
_.classed("sc-charts__y-axis-tick", !0).attr("text-anchor", "start");
|
|
20
20
|
const v = _.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
|
|
21
21
|
p.selectAll(".tick").each(function(w, x) {
|
|
22
|
-
var
|
|
23
|
-
const y = E.select(this), C = y.select("text"), M = v[x], T = b - M,
|
|
24
|
-
C.attr("x", T), C.remove(), (
|
|
22
|
+
var I;
|
|
23
|
+
const y = E.select(this), C = y.select("text"), M = v[x], T = b - M, k = y.append("g").attr("transform", "translate(10, 0)");
|
|
24
|
+
C.attr("x", T), C.remove(), (I = k.node()) == null || I.appendChild(C.node());
|
|
25
25
|
});
|
|
26
26
|
}).attr("font-family", "inherit");
|
|
27
|
-
},
|
|
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:
|
|
27
|
+
}, Is = (i) => {
|
|
28
|
+
const { svg: e, config: t, x: s, height: n } = i, { margin: a, xAxis: r } = t, { isShow: o, tickValues: c, tickFormat: h, customTicks: d, ticks: f } = r;
|
|
29
29
|
if (!o) return null;
|
|
30
30
|
e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((p) => {
|
|
31
31
|
let _ = E.axisBottom(s);
|
|
32
|
-
d ? (h && (_ = _.tickFormat(h)),
|
|
32
|
+
d ? (h && (_ = _.tickFormat(h)), f && (_ = Array.isArray(f) ? _.ticks(...f) : _.ticks(f)), c && (_ = _.tickValues(c))) : _.ticks(5), p.call(_);
|
|
33
33
|
}).call((p) => p.select(".domain").remove()).call((p) => {
|
|
34
34
|
let _ = [];
|
|
35
35
|
p.selectAll(".tick").each((v) => _.push(v)), i.xTicks = _;
|
|
36
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
|
+
}, Bs = (i) => {
|
|
38
38
|
const { svg: e, config: t, y: s, width: n } = i, {
|
|
39
39
|
margin: a,
|
|
40
40
|
grid: { horizontalStyle: r }
|
|
@@ -92,7 +92,7 @@ function Os(i, e, t, s) {
|
|
|
92
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), Ps = (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:
|
|
95
|
+
grid: { verticalStyle: h, tooltipNode: d, hoverCirclesRadius: f, 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);
|
|
@@ -103,26 +103,26 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
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
|
|
107
|
-
|
|
106
|
+
const k = x.getBoundingClientRect(), I = Os(
|
|
107
|
+
k,
|
|
108
108
|
s(T.date),
|
|
109
109
|
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
110
110
|
i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
|
|
111
111
|
);
|
|
112
|
-
|
|
112
|
+
I !== null && (x.style.left = I + "px"), y.style.left = s(T.date) + "px";
|
|
113
113
|
}, M = () => {
|
|
114
114
|
w.style.display = "none";
|
|
115
115
|
};
|
|
116
116
|
i.gridHoverTooltip = d ? {
|
|
117
117
|
show: (T) => C(T),
|
|
118
118
|
hide: M
|
|
119
|
-
} : null, r.forEach((T,
|
|
120
|
-
const
|
|
121
|
-
te || qt(e, { x1:
|
|
119
|
+
} : null, r.forEach((T, k) => {
|
|
120
|
+
const I = s(T.date), V = n(T.value), Z = r[k - 1], te = k > 0 && Z && T.value === Z.value;
|
|
121
|
+
te || qt(e, { x1: I, x2: I, y1: V, y2: _ });
|
|
122
122
|
const K = $s(e, te, {
|
|
123
|
-
x:
|
|
123
|
+
x: I,
|
|
124
124
|
y: _,
|
|
125
|
-
r:
|
|
125
|
+
r: f,
|
|
126
126
|
hr: p
|
|
127
127
|
});
|
|
128
128
|
d && K.on("mouseover", function() {
|
|
@@ -133,11 +133,11 @@ 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
|
-
|
|
136
|
+
Bs(i), Ps(i);
|
|
137
137
|
}, Vs = (i) => {
|
|
138
138
|
const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
|
|
139
|
-
|
|
140
|
-
},
|
|
139
|
+
Is(i), Hs(i), r && e.append("image").attr("xlink:href", t.theme === "dark" ? r.picDarkTheme : r.picLightTheme).attr("width", r.width).attr("height", r.height).attr("x", r.x ?? (s - a.left - a.right) / 2 - r.width / 2 + a.left).attr("y", r.y ?? (n - a.top - a.bottom) / 2 - r.height / 2 + a.top), zs(i);
|
|
140
|
+
}, Ee = (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);
|
|
@@ -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) => Ee(s, o, {
|
|
191
191
|
x1: "0%",
|
|
192
192
|
y1: "0%",
|
|
193
193
|
x2: "0%",
|
|
@@ -205,8 +205,8 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
205
205
|
className(o, c) {
|
|
206
206
|
o === "remove" ? r.classed(`${a}${c}`, !1) : r.classed(`${a}${c}`, !0);
|
|
207
207
|
},
|
|
208
|
-
update({ x1: o, x2: c, y1: h, y2: d, hidden:
|
|
209
|
-
o !== void 0 && r.attr("x1", o), c !== void 0 && r.attr("x2", c), h !== void 0 && r.attr("y1", h), d !== void 0 && r.attr("y2", d),
|
|
208
|
+
update({ x1: o, x2: c, y1: h, y2: d, hidden: f }) {
|
|
209
|
+
o !== void 0 && r.attr("x1", o), c !== void 0 && r.attr("x2", c), h !== void 0 && r.attr("y1", h), d !== void 0 && r.attr("y2", d), f !== void 0 && r.style("display", f ? "none" : "block");
|
|
210
210
|
},
|
|
211
211
|
destroy() {
|
|
212
212
|
r.remove();
|
|
@@ -227,7 +227,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
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) => Ee(a, o, {
|
|
231
231
|
x1: "0%",
|
|
232
232
|
y1: "0%",
|
|
233
233
|
x2: "0%",
|
|
@@ -242,26 +242,26 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
242
242
|
className(o, c) {
|
|
243
243
|
o === "remove" ? s.classed(`${t}${c}`, !1) : s.classed(`${t}${c}`, !0);
|
|
244
244
|
},
|
|
245
|
-
update({ x1: o, x2: c, y1: h, y2: d, hidden:
|
|
246
|
-
o !== void 0 && s.attr("x1", o), c !== void 0 && s.attr("x2", c), h !== void 0 && s.attr("y1", h), d !== void 0 && s.attr("y2", d),
|
|
245
|
+
update({ x1: o, x2: c, y1: h, y2: d, hidden: f }) {
|
|
246
|
+
o !== void 0 && s.attr("x1", o), c !== void 0 && s.attr("x2", c), h !== void 0 && s.attr("y1", h), d !== void 0 && s.attr("y2", d), f !== void 0 && s.style("display", f ? "none" : "block");
|
|
247
247
|
},
|
|
248
248
|
destroy() {
|
|
249
249
|
s.remove();
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
-
},
|
|
252
|
+
}, fe = "sc-charts__range-tooltip", Kt = E.timeFormat("%b %e, %I:%M %p"), Ys = (i) => {
|
|
253
253
|
const e = E.format(",.2f");
|
|
254
254
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
255
255
|
};
|
|
256
256
|
function js(i) {
|
|
257
257
|
const e = "http://www.w3.org/2000/svg", t = document.createElement("div");
|
|
258
|
-
t.className =
|
|
258
|
+
t.className = fe, t.style.position = "absolute", t.style.top = "0", t.style.pointerEvents = "none", t.style.display = "none", i.append(t);
|
|
259
259
|
const s = document.createElement("div");
|
|
260
|
-
s.className = `${
|
|
260
|
+
s.className = `${fe}-container`, t.append(s);
|
|
261
261
|
const n = document.createElement("div");
|
|
262
|
-
n.className = `${
|
|
262
|
+
n.className = `${fe}-sum`, s.append(n);
|
|
263
263
|
const a = document.createElement("div");
|
|
264
|
-
a.className = `${
|
|
264
|
+
a.className = `${fe}-sum-icon`;
|
|
265
265
|
const r = document.createElementNS(e, "svg");
|
|
266
266
|
r.setAttribute("width", "14"), r.setAttribute("height", "14"), r.setAttribute("viewBox", "0 0 14 14"), r.setAttribute("fill", "none"), r.setAttribute("xmlns", e);
|
|
267
267
|
const o = document.createElementNS(e, "path");
|
|
@@ -272,29 +272,29 @@ function js(i) {
|
|
|
272
272
|
const c = document.createElement("div");
|
|
273
273
|
n.append(c);
|
|
274
274
|
const h = document.createElement("div");
|
|
275
|
-
return h.className = `${
|
|
275
|
+
return h.className = `${fe}-time`, s.append(h), { wrapper: t, sumNode: c, timeNode: h };
|
|
276
276
|
}
|
|
277
277
|
const Xs = (i) => {
|
|
278
278
|
const { wrapper: e, sumNode: t, timeNode: s } = js(i.wrapperNode);
|
|
279
279
|
return {
|
|
280
280
|
className(n, a) {
|
|
281
|
-
n === "remove" ? e.classList.remove(`${
|
|
281
|
+
n === "remove" ? e.classList.remove(`${fe}${a}`) : e.classList.add(`${fe}${a}`);
|
|
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:
|
|
285
|
+
const d = a.value - n.value, { sumFormatter: f, 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
|
-
if (
|
|
288
|
-
b =
|
|
287
|
+
if (f)
|
|
288
|
+
b = f({ left: n.value, right: a.value, direction: v });
|
|
289
289
|
else {
|
|
290
290
|
const x = (d / Math.abs(n.value) * 100).toFixed(2);
|
|
291
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), M = i.x(a.date);
|
|
295
|
-
let
|
|
296
|
-
const
|
|
297
|
-
|
|
295
|
+
let k = (C + M) / 2 - x.width / 2;
|
|
296
|
+
const I = 0, V = y.width - x.width;
|
|
297
|
+
k < I && (k = I), k > V && (k = V), e.style.left = `${k}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
|
-
},
|
|
306
|
+
}, Le = "sc-charts__hover-tooltip", _t = 16, Us = E.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
|
|
307
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 = `${Le}-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 = `${Le}-sum`;
|
|
315
315
|
const s = document.createElement("div");
|
|
316
|
-
return s.className = `${
|
|
316
|
+
return s.className = `${Le}-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(`${Le}${r}`) : e.classList.add(`${Le}${r}`);
|
|
328
328
|
},
|
|
329
329
|
update({ hidden: a, dataItem: r }) {
|
|
330
330
|
if (!i.config.hover.showDefaultTooltip) {
|
|
@@ -334,12 +334,12 @@ const Js = (i) => {
|
|
|
334
334
|
if (r) {
|
|
335
335
|
const { sumFormatter: o, timeFormatter: c, tooltipNode: h } = i.config.hover;
|
|
336
336
|
h ? (_i(e), e.appendChild(h({ date: r.date, value: r.value }))) : (n(), t.textContent = o ? o(r.value) : Gs(r.value), s.textContent = c ? c(r.date) : Us(r.date)), requestAnimationFrame(() => {
|
|
337
|
-
const d = e.getBoundingClientRect(),
|
|
337
|
+
const d = e.getBoundingClientRect(), f = qs(
|
|
338
338
|
d,
|
|
339
339
|
i.x(r.date),
|
|
340
340
|
i.width - i.config.margin.right
|
|
341
341
|
);
|
|
342
|
-
|
|
342
|
+
f && (e.style.left = f + "px");
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
345
|
a !== void 0 && (e.style.display = a ? "none" : "block");
|
|
@@ -402,9 +402,9 @@ const Js = (i) => {
|
|
|
402
402
|
},
|
|
403
403
|
enableBelowZeroLine: !1,
|
|
404
404
|
curveTension: 1
|
|
405
|
-
},
|
|
405
|
+
}, et = () => 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
|
+
Ee(o, "main-line-area-gradient", {
|
|
408
408
|
x1: "0%",
|
|
409
409
|
y1: "0%",
|
|
410
410
|
x2: "0%",
|
|
@@ -414,24 +414,24 @@ const Js = (i) => {
|
|
|
414
414
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
415
415
|
]
|
|
416
416
|
});
|
|
417
|
-
const h = E.area().x((p) => s(p.date)).y0(n.range()[0]).y1((p) => n(p.value)).curve(
|
|
417
|
+
const h = E.area().x((p) => s(p.date)).y0(n.range()[0]).y1((p) => n(p.value)).curve(et()), d = "sc-charts__main-line-area", f = e.append("path").datum(t).attr("d", h).attr("class", d).classed(`${d}_hidden`, !a.hasMainLineArea);
|
|
418
418
|
return {
|
|
419
419
|
className(p, _) {
|
|
420
|
-
p === "remove" ?
|
|
420
|
+
p === "remove" ? f.classed(`${d}${_}`, !1) : f.classed(`${d}${_}`, !0);
|
|
421
421
|
},
|
|
422
422
|
update({ data: p, hidden: _ }) {
|
|
423
|
-
if (p !== void 0 &&
|
|
423
|
+
if (p !== void 0 && f.datum(p).attr("d", h), _ !== void 0) {
|
|
424
424
|
if (!a.hasMainLineArea) return null;
|
|
425
|
-
|
|
425
|
+
f.classed(`${d}_hidden`, _);
|
|
426
426
|
}
|
|
427
427
|
},
|
|
428
428
|
destroy() {
|
|
429
|
-
|
|
429
|
+
f.remove();
|
|
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(),
|
|
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(), f = ve(d), p = "range-line-area-gradient";
|
|
434
|
+
Ee(f, 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
|
+
}), Ee(f, p + "_down", {
|
|
444
444
|
x1: "0%",
|
|
445
445
|
y1: "0%",
|
|
446
446
|
x2: "0%",
|
|
@@ -450,7 +450,7 @@ const Js = (i) => {
|
|
|
450
450
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
451
451
|
]
|
|
452
452
|
});
|
|
453
|
-
const _ = E.area().x((y) => n(y.date)).y0(a.range()[0]).y1((y) => a(y.value)).curve(
|
|
453
|
+
const _ = E.area().x((y) => n(y.date)).y0(a.range()[0]).y1((y) => a(y.value)).curve(et()), v = `${c}-clip-${t}`, w = f.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);
|
|
@@ -463,7 +463,7 @@ const Js = (i) => {
|
|
|
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(),
|
|
466
|
+
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), f = ve(d), p = E.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(et()), _ = `${r}-clip-${o}`, b = f.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);
|
|
@@ -476,7 +476,7 @@ const Js = (i) => {
|
|
|
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,
|
|
479
|
+
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, f = t.node(), p = ve(f), _ = E.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(et()), 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);
|
|
@@ -494,18 +494,18 @@ const Js = (i) => {
|
|
|
494
494
|
return e >= 1e9 ? t = (i / 1e9).toFixed(1) + "B" : e >= 1e6 ? t = (i / 1e6).toFixed(1) + "M" : e >= 1e3 ? t = (i / 1e3).toFixed(1) + "K" : t = i.toFixed(1), t;
|
|
495
495
|
}, nn = (i, e) => {
|
|
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
|
-
return ((
|
|
498
|
-
if (!
|
|
499
|
-
const p =
|
|
497
|
+
return ((f) => {
|
|
498
|
+
if (!f || f.length === 0) return;
|
|
499
|
+
const p = f[f.length - 1], _ = n(p.date), v = a(p.value);
|
|
500
500
|
c.attr("cx", _).attr("cy", v);
|
|
501
501
|
const b = i.config.extremePointFormatter || sn;
|
|
502
502
|
h.attr("x", _).attr("y", v).text(b(p.value));
|
|
503
503
|
})(s), {
|
|
504
|
-
className(
|
|
505
|
-
|
|
504
|
+
className(f, p) {
|
|
505
|
+
f === "remove" ? o.classed(`${r}${p}`, !1) : o.classed(`${r}${p}`, !0);
|
|
506
506
|
},
|
|
507
|
-
update({ hidden:
|
|
508
|
-
|
|
507
|
+
update({ hidden: f }) {
|
|
508
|
+
f !== void 0 && o.classed(`${r}_hidden`, f);
|
|
509
509
|
},
|
|
510
510
|
destroy() {
|
|
511
511
|
o.remove();
|
|
@@ -538,7 +538,7 @@ const Js = (i) => {
|
|
|
538
538
|
baseClassName: "sc-charts__range-line",
|
|
539
539
|
id: `${i.chartId}-sc-charts__range-line`,
|
|
540
540
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
541
|
-
}),
|
|
541
|
+
}), f = pt(i.svg, {
|
|
542
542
|
className: "sc-charts__range-circle-left",
|
|
543
543
|
hidden: !0
|
|
544
544
|
}), p = pt(i.svg, {
|
|
@@ -552,7 +552,7 @@ const Js = (i) => {
|
|
|
552
552
|
rangeBorderRight: h,
|
|
553
553
|
rangeLine: d,
|
|
554
554
|
rangeLineArea: b,
|
|
555
|
-
rangeCircleLeft:
|
|
555
|
+
rangeCircleLeft: f,
|
|
556
556
|
rangeCircleRight: p,
|
|
557
557
|
mainLine: e,
|
|
558
558
|
rangeTooltip: _,
|
|
@@ -600,11 +600,11 @@ const Js = (i) => {
|
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
602
|
if (e >= h && e < d) {
|
|
603
|
-
const
|
|
603
|
+
const f = t(h), p = t(d);
|
|
604
604
|
return {
|
|
605
|
-
x:
|
|
605
|
+
x: f,
|
|
606
606
|
y: 0,
|
|
607
|
-
width: p -
|
|
607
|
+
width: p - f,
|
|
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
|
|
632
|
+
const f = t(d), p = t(c);
|
|
633
633
|
return {
|
|
634
|
-
x:
|
|
634
|
+
x: f,
|
|
635
635
|
y: 0,
|
|
636
|
-
width: p -
|
|
636
|
+
width: p - f,
|
|
637
637
|
height: "100%"
|
|
638
638
|
};
|
|
639
639
|
}
|
|
@@ -666,15 +666,15 @@ const Js = (i) => {
|
|
|
666
666
|
dataItem: e,
|
|
667
667
|
hidden: !1
|
|
668
668
|
}), r.highlightRange) {
|
|
669
|
-
const
|
|
669
|
+
const f = rn(r.range, e.date, t);
|
|
670
670
|
n.highlightLine.update({
|
|
671
|
-
clip:
|
|
671
|
+
clip: f,
|
|
672
672
|
hidden: !1
|
|
673
673
|
});
|
|
674
674
|
const p = s.range()[0] - s(0) + a.bottom;
|
|
675
675
|
p >= 0 && ((c = n.belowZeroLine) == null || c.update({
|
|
676
676
|
clip: {
|
|
677
|
-
...
|
|
677
|
+
...f,
|
|
678
678
|
y: s(0),
|
|
679
679
|
height: p
|
|
680
680
|
}
|
|
@@ -710,10 +710,10 @@ 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,
|
|
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, f = s(c.date), p = s(h.date), _ = p - f;
|
|
714
714
|
o.rangeBorderLeft.update({
|
|
715
|
-
x1:
|
|
716
|
-
x2:
|
|
715
|
+
x1: f,
|
|
716
|
+
x2: f,
|
|
717
717
|
y1: a.top,
|
|
718
718
|
y2: r - a.bottom,
|
|
719
719
|
hidden: !1
|
|
@@ -724,7 +724,7 @@ const Js = (i) => {
|
|
|
724
724
|
y2: r - a.bottom,
|
|
725
725
|
hidden: !1
|
|
726
726
|
}), o.rangeCircleLeft.update({
|
|
727
|
-
cx:
|
|
727
|
+
cx: f,
|
|
728
728
|
cy: n(c.value),
|
|
729
729
|
hidden: !1
|
|
730
730
|
}), o.rangeCircleRight.update({
|
|
@@ -733,7 +733,7 @@ const Js = (i) => {
|
|
|
733
733
|
hidden: !1
|
|
734
734
|
}), o.rangeLine.update({
|
|
735
735
|
clip: {
|
|
736
|
-
x:
|
|
736
|
+
x: f,
|
|
737
737
|
y: 0,
|
|
738
738
|
width: _,
|
|
739
739
|
height: n.range()[0]
|
|
@@ -741,7 +741,7 @@ const Js = (i) => {
|
|
|
741
741
|
hidden: !1
|
|
742
742
|
}), o.rangeLineArea.update({
|
|
743
743
|
clip: {
|
|
744
|
-
x:
|
|
744
|
+
x: f,
|
|
745
745
|
y: 0,
|
|
746
746
|
width: _,
|
|
747
747
|
height: n.range()[0]
|
|
@@ -751,7 +751,7 @@ const Js = (i) => {
|
|
|
751
751
|
rightPoint: h,
|
|
752
752
|
leftPoint: c,
|
|
753
753
|
closest: t,
|
|
754
|
-
x:
|
|
754
|
+
x: f + _ / 2,
|
|
755
755
|
y: 0,
|
|
756
756
|
hidden: !1
|
|
757
757
|
}), (v = o.belowZeroLine) == null || v.update({
|
|
@@ -763,24 +763,24 @@ const Js = (i) => {
|
|
|
763
763
|
e.rangeLine.update({ hidden: !0 }), e.rangeLineArea.update({ hidden: !0 }), e.rangeBorderLeft.update({ hidden: !0 }), e.rangeBorderRight.update({ hidden: !0 }), e.rangeCircleLeft.update({ hidden: !0 }), e.rangeCircleRight.update({ hidden: !0 }), e.rangeTooltip.update({ hidden: !0 }), e.mainLine.className("remove", "_selected-muted"), e.mainLineArea.update({ hidden: !1 }), (t = e.belowZeroLine) == null || t.update({ hidden: !1 });
|
|
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
|
-
let d = null,
|
|
766
|
+
let d = null, f = !1;
|
|
767
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
771
|
const [b] = E.pointer(v, this), w = p(b);
|
|
772
|
-
!
|
|
772
|
+
!f && c.enable ? (i.action = "hover", ei(i, w)) : (i.action = f ? "selection" : "none", ti(i)), d && h.enable && (i.action = "selection", ln(i, d, w));
|
|
773
773
|
}).on("mouseleave", () => {
|
|
774
|
-
i.action = "none",
|
|
774
|
+
i.action = "none", f = !1, d = null, ti(i), ii(i);
|
|
775
775
|
}).on("mousedown", function(v) {
|
|
776
776
|
if (h.enable) {
|
|
777
|
-
|
|
777
|
+
f = !0, i.action = "selection";
|
|
778
778
|
const [b] = E.pointer(v, this);
|
|
779
779
|
d = p(b);
|
|
780
780
|
}
|
|
781
781
|
}).on("mouseup", function(v) {
|
|
782
782
|
const [b] = E.pointer(v, this), w = p(b);
|
|
783
|
-
|
|
783
|
+
f = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i, w);
|
|
784
784
|
});
|
|
785
785
|
}, hn = (i, e, t) => {
|
|
786
786
|
const { margin: s } = e, n = E.scaleTime(), a = E.extent(i, (r) => new Date(r.date));
|
|
@@ -798,10 +798,10 @@ const Js = (i) => {
|
|
|
798
798
|
const s = t.append("div"), n = s.append("svg"), a = t.node();
|
|
799
799
|
let r = a.clientWidth, o = a.clientHeight, c = Jt({ ...Qs }, e.config), h = e.data;
|
|
800
800
|
const d = () => {
|
|
801
|
-
r = a.clientWidth, o = a.clientHeight,
|
|
801
|
+
r = a.clientWidth, o = a.clientHeight, f({ data: h, config: c });
|
|
802
802
|
};
|
|
803
803
|
e.disabledResize || window.addEventListener("resize", d);
|
|
804
|
-
const
|
|
804
|
+
const f = (p, _ = !1) => {
|
|
805
805
|
_ && p.config && (c = Jt(c, p.config)), _ && p.data && (h = p.data);
|
|
806
806
|
const v = h.map((C) => ({ date: new Date(C.date), value: C.value })).sort((C, M) => C.date.getTime() - M.date.getTime()), b = hn(v, c, r), w = dn(v, c, o);
|
|
807
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();
|
|
@@ -825,32 +825,32 @@ const Js = (i) => {
|
|
|
825
825
|
};
|
|
826
826
|
cn(y);
|
|
827
827
|
};
|
|
828
|
-
return
|
|
829
|
-
update: (p) =>
|
|
828
|
+
return f(e), {
|
|
829
|
+
update: (p) => f(p, !0),
|
|
830
830
|
destroy: () => {
|
|
831
831
|
e.disabledResize || window.removeEventListener("resize", d), n.remove();
|
|
832
832
|
}
|
|
833
833
|
};
|
|
834
834
|
};
|
|
835
|
-
var
|
|
835
|
+
var Ge = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
836
836
|
function un(i) {
|
|
837
837
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
838
838
|
}
|
|
839
839
|
var De = { exports: {} };
|
|
840
840
|
De.exports;
|
|
841
841
|
var si;
|
|
842
|
-
function
|
|
842
|
+
function gn() {
|
|
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]",
|
|
845
|
-
F[K] = F[z] = F[
|
|
846
|
-
var Re = typeof
|
|
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]", f = "[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]", M = "[object RegExp]", T = "[object Set]", k = "[object String]", I = "[object Undefined]", V = "[object WeakMap]", Z = "[object ArrayBuffer]", te = "[object DataView]", K = "[object Float32Array]", z = "[object Float64Array]", Y = "[object Int8Array]", O = "[object Int16Array]", oe = "[object Int32Array]", it = "[object Uint8Array]", le = "[object Uint8ClampedArray]", be = "[object Uint16Array]", ye = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Ie = /^\[object .+?Constructor\]$/, Be = /^(?:0|[1-9]\d*)$/, F = {};
|
|
845
|
+
F[K] = F[z] = F[Y] = F[O] = F[oe] = F[it] = F[le] = F[be] = F[ye] = !0, F[o] = F[c] = F[Z] = F[d] = F[te] = F[f] = F[p] = F[_] = F[b] = F[w] = F[y] = F[M] = F[T] = F[k] = F[V] = !1;
|
|
846
|
+
var Re = typeof Ge == "object" && Ge && Ge.Object === Object && Ge, st = typeof self == "object" && self && self.Object === Object && self, P = Re || st || Function("return this")(), ee = e && !e.nodeType && e, W = ee && !0 && i && !i.nodeType && i, j = W && W.exports === ee, me = j && Re.process, we = function() {
|
|
847
847
|
try {
|
|
848
|
-
var l =
|
|
848
|
+
var l = W && W.require && W.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 $e(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, S = Array(l); ++m < l; )
|
|
868
868
|
S[m] = u(m);
|
|
869
869
|
return S;
|
|
@@ -881,24 +881,24 @@ function fn() {
|
|
|
881
881
|
return l(u(m));
|
|
882
882
|
};
|
|
883
883
|
}
|
|
884
|
-
var Ce = Array.prototype, Ai = Function.prototype,
|
|
884
|
+
var Ce = Array.prototype, Ai = Function.prototype, Pe = Object.prototype, at = P["__core-js_shared__"], ze = Ai.toString, ae = Pe.hasOwnProperty, Nt = function() {
|
|
885
885
|
var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
|
|
886
886
|
return l ? "Symbol(src)_1." + l : "";
|
|
887
|
-
}(), Ft =
|
|
888
|
-
"^" +
|
|
889
|
-
),
|
|
890
|
-
|
|
891
|
-
var
|
|
887
|
+
}(), Ft = Pe.toString, Mi = ze.call(Object), Ti = RegExp(
|
|
888
|
+
"^" + ze.call(ae).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
889
|
+
), Ve = j ? P.Buffer : void 0, Ht = P.Symbol, It = P.Uint8Array;
|
|
890
|
+
Ve && Ve.allocUnsafe;
|
|
891
|
+
var Bt = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = Pe.propertyIsEnumerable, ki = Ce.splice, de = Ht ? Ht.toStringTag : void 0, We = function() {
|
|
892
892
|
try {
|
|
893
893
|
var l = lt(Object, "defineProperty");
|
|
894
894
|
return l({}, "", {}), l;
|
|
895
895
|
} catch {
|
|
896
896
|
}
|
|
897
|
-
}(),
|
|
897
|
+
}(), Li = Ve ? Ve.isBuffer : void 0, $t = Math.max, Ei = Date.now, Ot = lt(P, "Map"), Se = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
|
|
898
898
|
function l() {
|
|
899
899
|
}
|
|
900
900
|
return function(u) {
|
|
901
|
-
if (!
|
|
901
|
+
if (!ge(u))
|
|
902
902
|
return {};
|
|
903
903
|
if (Rt)
|
|
904
904
|
return Rt(u);
|
|
@@ -921,7 +921,7 @@ function fn() {
|
|
|
921
921
|
var u = this.has(l) && delete this.__data__[l];
|
|
922
922
|
return this.size -= u ? 1 : 0, u;
|
|
923
923
|
}
|
|
924
|
-
function
|
|
924
|
+
function Ii(l) {
|
|
925
925
|
var u = this.__data__;
|
|
926
926
|
if (Se) {
|
|
927
927
|
var m = u[l];
|
|
@@ -929,7 +929,7 @@ function fn() {
|
|
|
929
929
|
}
|
|
930
930
|
return ae.call(u, l) ? u[l] : void 0;
|
|
931
931
|
}
|
|
932
|
-
function
|
|
932
|
+
function Bi(l) {
|
|
933
933
|
var u = this.__data__;
|
|
934
934
|
return Se ? u[l] !== void 0 : ae.call(u, l);
|
|
935
935
|
}
|
|
@@ -937,7 +937,7 @@ function fn() {
|
|
|
937
937
|
var m = this.__data__;
|
|
938
938
|
return this.size += this.has(l) ? 0 : 1, m[l] = Se && u === void 0 ? s : u, this;
|
|
939
939
|
}
|
|
940
|
-
ue.prototype.clear = Fi, ue.prototype.delete = Hi, ue.prototype.get =
|
|
940
|
+
ue.prototype.clear = Fi, ue.prototype.delete = Hi, ue.prototype.get = Ii, ue.prototype.has = Bi, ue.prototype.set = Ri;
|
|
941
941
|
function ie(l) {
|
|
942
942
|
var u = -1, m = l == null ? 0 : l.length;
|
|
943
943
|
for (this.clear(); ++u < m; ) {
|
|
@@ -949,21 +949,21 @@ function fn() {
|
|
|
949
949
|
this.__data__ = [], this.size = 0;
|
|
950
950
|
}
|
|
951
951
|
function Oi(l) {
|
|
952
|
-
var u = this.__data__, m =
|
|
952
|
+
var u = this.__data__, m = Ye(u, l);
|
|
953
953
|
if (m < 0)
|
|
954
954
|
return !1;
|
|
955
955
|
var S = u.length - 1;
|
|
956
956
|
return m == S ? u.pop() : ki.call(u, m, 1), --this.size, !0;
|
|
957
957
|
}
|
|
958
958
|
function Pi(l) {
|
|
959
|
-
var u = this.__data__, m =
|
|
959
|
+
var u = this.__data__, m = Ye(u, l);
|
|
960
960
|
return m < 0 ? void 0 : u[m][1];
|
|
961
961
|
}
|
|
962
962
|
function zi(l) {
|
|
963
|
-
return
|
|
963
|
+
return Ye(this.__data__, l) > -1;
|
|
964
964
|
}
|
|
965
965
|
function Vi(l, u) {
|
|
966
|
-
var m = this.__data__, S =
|
|
966
|
+
var m = this.__data__, S = Ye(m, l);
|
|
967
967
|
return S < 0 ? (++this.size, m.push([l, u])) : m[S][1] = u, this;
|
|
968
968
|
}
|
|
969
969
|
ie.prototype.clear = $i, ie.prototype.delete = Oi, ie.prototype.get = Pi, ie.prototype.has = zi, ie.prototype.set = Vi;
|
|
@@ -982,17 +982,17 @@ function fn() {
|
|
|
982
982
|
};
|
|
983
983
|
}
|
|
984
984
|
function Yi(l) {
|
|
985
|
-
var u =
|
|
985
|
+
var u = Xe(this, l).delete(l);
|
|
986
986
|
return this.size -= u ? 1 : 0, u;
|
|
987
987
|
}
|
|
988
988
|
function ji(l) {
|
|
989
|
-
return
|
|
989
|
+
return Xe(this, l).get(l);
|
|
990
990
|
}
|
|
991
991
|
function Xi(l) {
|
|
992
|
-
return
|
|
992
|
+
return Xe(this, l).has(l);
|
|
993
993
|
}
|
|
994
994
|
function Ui(l, u) {
|
|
995
|
-
var m =
|
|
995
|
+
var m = Xe(this, l), S = m.size;
|
|
996
996
|
return m.set(l, u), this.size += m.size == S ? 0 : 1, this;
|
|
997
997
|
}
|
|
998
998
|
pe.prototype.clear = Wi, pe.prototype.delete = Yi, pe.prototype.get = ji, pe.prototype.has = Xi, pe.prototype.set = Ui;
|
|
@@ -1025,54 +1025,54 @@ 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), S = !m && ht(l), D = !m && !S && Yt(l), H = !m && !S && !D && Xt(l), B = m || S || D || H,
|
|
1028
|
+
var m = dt(l), S = !m && ht(l), D = !m && !S && Yt(l), H = !m && !S && !D && Xt(l), B = m || S || D || H, N = B ? Oe(l.length, String) : [], R = N.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,
|
|
1035
|
-
return
|
|
1034
|
+
Vt(q, R)) || N.push(q);
|
|
1035
|
+
return N;
|
|
1036
1036
|
}
|
|
1037
1037
|
function rt(l, u, m) {
|
|
1038
|
-
(m !== void 0 && !
|
|
1038
|
+
(m !== void 0 && !Ue(l[u], m) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1039
1039
|
}
|
|
1040
1040
|
function es(l, u, m) {
|
|
1041
1041
|
var S = l[u];
|
|
1042
|
-
(!(ae.call(l, u) &&
|
|
1042
|
+
(!(ae.call(l, u) && Ue(S, m)) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1044
|
+
function Ye(l, u) {
|
|
1045
1045
|
for (var m = l.length; m--; )
|
|
1046
|
-
if (
|
|
1046
|
+
if (Ue(l[m][0], u))
|
|
1047
1047
|
return m;
|
|
1048
1048
|
return -1;
|
|
1049
1049
|
}
|
|
1050
1050
|
function ot(l, u, m) {
|
|
1051
|
-
u == "__proto__" &&
|
|
1051
|
+
u == "__proto__" && We ? We(l, u, {
|
|
1052
1052
|
configurable: !0,
|
|
1053
1053
|
enumerable: !0,
|
|
1054
1054
|
value: m,
|
|
1055
1055
|
writable: !0
|
|
1056
1056
|
}) : l[u] = m;
|
|
1057
1057
|
}
|
|
1058
|
-
var ts =
|
|
1059
|
-
function
|
|
1060
|
-
return l == null ? l === void 0 ?
|
|
1058
|
+
var ts = fs();
|
|
1059
|
+
function je(l) {
|
|
1060
|
+
return l == null ? l === void 0 ? I : x : de && de in Object(l) ? ms(l) : ws(l);
|
|
1061
1061
|
}
|
|
1062
1062
|
function Pt(l) {
|
|
1063
|
-
return Ae(l) &&
|
|
1063
|
+
return Ae(l) && je(l) == o;
|
|
1064
1064
|
}
|
|
1065
1065
|
function is(l) {
|
|
1066
|
-
if (!
|
|
1066
|
+
if (!ge(l) || bs(l))
|
|
1067
1067
|
return !1;
|
|
1068
|
-
var u =
|
|
1068
|
+
var u = gt(l) ? Ti : Ie;
|
|
1069
1069
|
return u.test(As(l));
|
|
1070
1070
|
}
|
|
1071
1071
|
function ss(l) {
|
|
1072
|
-
return Ae(l) && jt(l.length) && !!F[
|
|
1072
|
+
return Ae(l) && jt(l.length) && !!F[je(l)];
|
|
1073
1073
|
}
|
|
1074
1074
|
function ns(l) {
|
|
1075
|
-
if (!
|
|
1075
|
+
if (!ge(l))
|
|
1076
1076
|
return ys(l);
|
|
1077
1077
|
var u = Wt(l), m = [];
|
|
1078
1078
|
for (var S in l)
|
|
@@ -1081,35 +1081,35 @@ function fn() {
|
|
|
1081
1081
|
}
|
|
1082
1082
|
function zt(l, u, m, S, D) {
|
|
1083
1083
|
l !== u && ts(u, function(H, B) {
|
|
1084
|
-
if (D || (D = new _e()),
|
|
1084
|
+
if (D || (D = new _e()), ge(H))
|
|
1085
1085
|
as(l, u, B, m, zt, S, D);
|
|
1086
1086
|
else {
|
|
1087
|
-
var
|
|
1088
|
-
|
|
1087
|
+
var N = S ? S(ct(l, B), H, B + "", l, u, D) : void 0;
|
|
1088
|
+
N === void 0 && (N = H), rt(l, B, N);
|
|
1089
1089
|
}
|
|
1090
1090
|
}, Ut);
|
|
1091
1091
|
}
|
|
1092
1092
|
function as(l, u, m, S, D, H, B) {
|
|
1093
|
-
var
|
|
1093
|
+
var N = ct(l, m), R = ct(u, m), q = B.get(R);
|
|
1094
1094
|
if (q) {
|
|
1095
1095
|
rt(l, m, q);
|
|
1096
1096
|
return;
|
|
1097
1097
|
}
|
|
1098
|
-
var
|
|
1098
|
+
var X = H ? H(N, R, m + "", l, u, B) : void 0, Me = X === void 0;
|
|
1099
1099
|
if (Me) {
|
|
1100
|
-
var
|
|
1101
|
-
|
|
1100
|
+
var ft = dt(R), mt = !ft && Yt(R), Zt = !ft && !mt && Xt(R);
|
|
1101
|
+
X = R, ft || mt || Zt ? dt(N) ? X = N : Ms(N) ? X = ds(N) : mt ? (Me = !1, X = ls(R)) : Zt ? (Me = !1, X = hs(R)) : X = [] : Ts(R) || ht(R) ? (X = N, ht(N) ? X = Ds(N) : (!ge(N) || gt(N)) && (X = ps(R))) : Me = !1;
|
|
1102
1102
|
}
|
|
1103
|
-
Me && (B.set(
|
|
1103
|
+
Me && (B.set(R, X), D(X, R, S, H, B), B.delete(R)), rt(l, m, X);
|
|
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 = We ? function(l, u) {
|
|
1109
|
+
return We(l, "toString", {
|
|
1110
1110
|
configurable: !0,
|
|
1111
1111
|
enumerable: !1,
|
|
1112
|
-
value:
|
|
1112
|
+
value: Ls(u),
|
|
1113
1113
|
writable: !0
|
|
1114
1114
|
});
|
|
1115
1115
|
} : Gt;
|
|
@@ -1118,7 +1118,7 @@ function fn() {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
function cs(l) {
|
|
1120
1120
|
var u = new l.constructor(l.byteLength);
|
|
1121
|
-
return new
|
|
1121
|
+
return new It(u).set(new It(l)), u;
|
|
1122
1122
|
}
|
|
1123
1123
|
function hs(l, u) {
|
|
1124
1124
|
var m = cs(l.buffer);
|
|
@@ -1134,32 +1134,32 @@ 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
|
-
|
|
1137
|
+
var N = u[H], R = void 0;
|
|
1138
|
+
R === void 0 && (R = l[N]), D ? ot(m, N, R) : es(m, N, R);
|
|
1139
1139
|
}
|
|
1140
1140
|
return m;
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function gs(l) {
|
|
1143
1143
|
return rs(function(u, m) {
|
|
1144
1144
|
var S = -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); ++S < D; ) {
|
|
1146
|
-
var
|
|
1147
|
-
|
|
1146
|
+
var N = m[S];
|
|
1147
|
+
N && l(u, N, S, H);
|
|
1148
1148
|
}
|
|
1149
1149
|
return u;
|
|
1150
1150
|
});
|
|
1151
1151
|
}
|
|
1152
|
-
function
|
|
1152
|
+
function fs(l) {
|
|
1153
1153
|
return function(u, m, S) {
|
|
1154
|
-
for (var D = -1, H = Object(u), B = S(u),
|
|
1155
|
-
var
|
|
1156
|
-
if (m(H[
|
|
1154
|
+
for (var D = -1, H = Object(u), B = S(u), N = B.length; N--; ) {
|
|
1155
|
+
var R = B[++D];
|
|
1156
|
+
if (m(H[R], R, H) === !1)
|
|
1157
1157
|
break;
|
|
1158
1158
|
}
|
|
1159
1159
|
return u;
|
|
1160
1160
|
};
|
|
1161
1161
|
}
|
|
1162
|
-
function
|
|
1162
|
+
function Xe(l, u) {
|
|
1163
1163
|
var m = l.__data__;
|
|
1164
1164
|
return vs(u) ? m[typeof u == "string" ? "string" : "hash"] : m.map;
|
|
1165
1165
|
}
|
|
@@ -1178,17 +1178,17 @@ function fn() {
|
|
|
1178
1178
|
return S && (u ? l[de] = m : delete l[de]), D;
|
|
1179
1179
|
}
|
|
1180
1180
|
function ps(l) {
|
|
1181
|
-
return typeof l.constructor == "function" && !Wt(l) ? Ni(
|
|
1181
|
+
return typeof l.constructor == "function" && !Wt(l) ? Ni(Bt(l)) : {};
|
|
1182
1182
|
}
|
|
1183
1183
|
function Vt(l, u) {
|
|
1184
1184
|
var m = typeof l;
|
|
1185
|
-
return u = u ?? r, !!u && (m == "number" || m != "symbol" &&
|
|
1185
|
+
return u = u ?? r, !!u && (m == "number" || m != "symbol" && Be.test(l)) && l > -1 && l % 1 == 0 && l < u;
|
|
1186
1186
|
}
|
|
1187
1187
|
function _s(l, u, m) {
|
|
1188
|
-
if (!
|
|
1188
|
+
if (!ge(m))
|
|
1189
1189
|
return !1;
|
|
1190
1190
|
var S = typeof u;
|
|
1191
|
-
return (S == "number" ? ut(m) && Vt(u, m.length) : S == "string" && u in m) ?
|
|
1191
|
+
return (S == "number" ? ut(m) && Vt(u, m.length) : S == "string" && u in m) ? Ue(m[u], l) : !1;
|
|
1192
1192
|
}
|
|
1193
1193
|
function vs(l) {
|
|
1194
1194
|
var u = typeof l;
|
|
@@ -1198,7 +1198,7 @@ function fn() {
|
|
|
1198
1198
|
return !!Nt && Nt in l;
|
|
1199
1199
|
}
|
|
1200
1200
|
function Wt(l) {
|
|
1201
|
-
var u = l && l.constructor, m = typeof u == "function" && u.prototype ||
|
|
1201
|
+
var u = l && l.constructor, m = typeof u == "function" && u.prototype || Pe;
|
|
1202
1202
|
return l === m;
|
|
1203
1203
|
}
|
|
1204
1204
|
function ys(l) {
|
|
@@ -1216,9 +1216,9 @@ function fn() {
|
|
|
1216
1216
|
for (var S = arguments, D = -1, H = $t(S.length - u, 0), B = Array(H); ++D < H; )
|
|
1217
1217
|
B[D] = S[u + D];
|
|
1218
1218
|
D = -1;
|
|
1219
|
-
for (var
|
|
1220
|
-
|
|
1221
|
-
return
|
|
1219
|
+
for (var N = Array(u + 1); ++D < u; )
|
|
1220
|
+
N[D] = S[D];
|
|
1221
|
+
return N[u] = m(B), $e(l, this, N);
|
|
1222
1222
|
};
|
|
1223
1223
|
}
|
|
1224
1224
|
function ct(l, u) {
|
|
@@ -1229,7 +1229,7 @@ function fn() {
|
|
|
1229
1229
|
function Ss(l) {
|
|
1230
1230
|
var u = 0, m = 0;
|
|
1231
1231
|
return function() {
|
|
1232
|
-
var S =
|
|
1232
|
+
var S = Ei(), D = a - (S - m);
|
|
1233
1233
|
if (m = S, D > 0) {
|
|
1234
1234
|
if (++u >= n)
|
|
1235
1235
|
return arguments[0];
|
|
@@ -1241,7 +1241,7 @@ function fn() {
|
|
|
1241
1241
|
function As(l) {
|
|
1242
1242
|
if (l != null) {
|
|
1243
1243
|
try {
|
|
1244
|
-
return
|
|
1244
|
+
return ze.call(l);
|
|
1245
1245
|
} catch {
|
|
1246
1246
|
}
|
|
1247
1247
|
try {
|
|
@@ -1251,7 +1251,7 @@ function fn() {
|
|
|
1251
1251
|
}
|
|
1252
1252
|
return "";
|
|
1253
1253
|
}
|
|
1254
|
-
function
|
|
1254
|
+
function Ue(l, u) {
|
|
1255
1255
|
return l === u || l !== l && u !== u;
|
|
1256
1256
|
}
|
|
1257
1257
|
var ht = Pt(/* @__PURE__ */ function() {
|
|
@@ -1260,22 +1260,22 @@ function fn() {
|
|
|
1260
1260
|
return Ae(l) && ae.call(l, "callee") && !Di.call(l, "callee");
|
|
1261
1261
|
}, dt = Array.isArray;
|
|
1262
1262
|
function ut(l) {
|
|
1263
|
-
return l != null && jt(l.length) && !
|
|
1263
|
+
return l != null && jt(l.length) && !gt(l);
|
|
1264
1264
|
}
|
|
1265
1265
|
function Ms(l) {
|
|
1266
1266
|
return Ae(l) && ut(l);
|
|
1267
1267
|
}
|
|
1268
|
-
var Yt =
|
|
1269
|
-
function
|
|
1270
|
-
if (!
|
|
1268
|
+
var Yt = Li || Es;
|
|
1269
|
+
function gt(l) {
|
|
1270
|
+
if (!ge(l))
|
|
1271
1271
|
return !1;
|
|
1272
|
-
var u =
|
|
1272
|
+
var u = je(l);
|
|
1273
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;
|
|
1277
1277
|
}
|
|
1278
|
-
function
|
|
1278
|
+
function ge(l) {
|
|
1279
1279
|
var u = typeof l;
|
|
1280
1280
|
return l != null && (u == "object" || u == "function");
|
|
1281
1281
|
}
|
|
@@ -1283,13 +1283,13 @@ function fn() {
|
|
|
1283
1283
|
return l != null && typeof l == "object";
|
|
1284
1284
|
}
|
|
1285
1285
|
function Ts(l) {
|
|
1286
|
-
if (!Ae(l) ||
|
|
1286
|
+
if (!Ae(l) || je(l) != y)
|
|
1287
1287
|
return !1;
|
|
1288
|
-
var u =
|
|
1288
|
+
var u = Bt(l);
|
|
1289
1289
|
if (u === null)
|
|
1290
1290
|
return !0;
|
|
1291
1291
|
var m = ae.call(u, "constructor") && u.constructor;
|
|
1292
|
-
return typeof m == "function" && m instanceof m &&
|
|
1292
|
+
return typeof m == "function" && m instanceof m && ze.call(m) == Mi;
|
|
1293
1293
|
}
|
|
1294
1294
|
var Xt = xe ? ce(xe) : ss;
|
|
1295
1295
|
function Ds(l) {
|
|
@@ -1298,10 +1298,10 @@ function fn() {
|
|
|
1298
1298
|
function Ut(l) {
|
|
1299
1299
|
return ut(l) ? Ki(l) : ns(l);
|
|
1300
1300
|
}
|
|
1301
|
-
var ks =
|
|
1301
|
+
var ks = gs(function(l, u, m) {
|
|
1302
1302
|
zt(l, u, m);
|
|
1303
1303
|
});
|
|
1304
|
-
function
|
|
1304
|
+
function Ls(l) {
|
|
1305
1305
|
return function() {
|
|
1306
1306
|
return l;
|
|
1307
1307
|
};
|
|
@@ -1309,14 +1309,14 @@ function fn() {
|
|
|
1309
1309
|
function Gt(l) {
|
|
1310
1310
|
return l;
|
|
1311
1311
|
}
|
|
1312
|
-
function
|
|
1312
|
+
function Es() {
|
|
1313
1313
|
return !1;
|
|
1314
1314
|
}
|
|
1315
1315
|
i.exports = ks;
|
|
1316
1316
|
}(De, De.exports)), De.exports;
|
|
1317
1317
|
}
|
|
1318
|
-
var
|
|
1319
|
-
const
|
|
1318
|
+
var fn = gn();
|
|
1319
|
+
const Je = /* @__PURE__ */ un(fn), ni = 12, mn = {
|
|
1320
1320
|
candles: {
|
|
1321
1321
|
direction: "right",
|
|
1322
1322
|
offset: `${Math.round(ni / 2)}px`,
|
|
@@ -1365,16 +1365,17 @@ const Qe = /* @__PURE__ */ un(gn), ni = 12, mn = {
|
|
|
1365
1365
|
};
|
|
1366
1366
|
class pn {
|
|
1367
1367
|
constructor(e) {
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1368
|
+
g(this, "_candles");
|
|
1369
|
+
g(this, "_xAxis");
|
|
1370
|
+
g(this, "_yAxis");
|
|
1371
|
+
g(this, "_guides");
|
|
1372
|
+
g(this, "_trade");
|
|
1373
|
+
g(this, "_logo");
|
|
1374
|
+
const t = Je({}, mn, e);
|
|
1375
|
+
this._candles = t.candles, this._xAxis = t.xAxis, this._yAxis = t.yAxis, this._guides = t.guides, this._trade = t.trade, this._logo = t.logo;
|
|
1375
1376
|
}
|
|
1376
1377
|
update(e) {
|
|
1377
|
-
const t =
|
|
1378
|
+
const t = Je(
|
|
1378
1379
|
{},
|
|
1379
1380
|
{
|
|
1380
1381
|
candles: this._candles,
|
|
@@ -1385,7 +1386,7 @@ class pn {
|
|
|
1385
1386
|
},
|
|
1386
1387
|
e
|
|
1387
1388
|
);
|
|
1388
|
-
this._candles = t.candles, this._xAxis = t.xAxis, this._yAxis = t.yAxis, this._guides = t.guides, this._trade = t.trade;
|
|
1389
|
+
this._candles = t.candles, this._xAxis = t.xAxis, this._yAxis = t.yAxis, this._guides = t.guides, this._trade = t.trade, this._logo = e.hasOwnProperty("logo") ? e.logo : this._logo;
|
|
1389
1390
|
}
|
|
1390
1391
|
getSnapshot() {
|
|
1391
1392
|
return {
|
|
@@ -1393,7 +1394,8 @@ class pn {
|
|
|
1393
1394
|
xAxis: this._xAxis,
|
|
1394
1395
|
yAxis: this._yAxis,
|
|
1395
1396
|
guides: this._guides,
|
|
1396
|
-
trade: this._trade
|
|
1397
|
+
trade: this._trade,
|
|
1398
|
+
logo: this._logo
|
|
1397
1399
|
};
|
|
1398
1400
|
}
|
|
1399
1401
|
get candles() {
|
|
@@ -1411,13 +1413,16 @@ class pn {
|
|
|
1411
1413
|
get trade() {
|
|
1412
1414
|
return this._trade;
|
|
1413
1415
|
}
|
|
1416
|
+
get logo() {
|
|
1417
|
+
return this._logo;
|
|
1418
|
+
}
|
|
1414
1419
|
}
|
|
1415
|
-
class
|
|
1420
|
+
class G {
|
|
1416
1421
|
constructor(e) {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1422
|
+
g(this, "x");
|
|
1423
|
+
g(this, "y");
|
|
1424
|
+
g(this, "width");
|
|
1425
|
+
g(this, "height");
|
|
1421
1426
|
let t;
|
|
1422
1427
|
if (!e)
|
|
1423
1428
|
t = { x: 0, y: 0, width: 0, height: 0 };
|
|
@@ -1455,32 +1460,32 @@ class U {
|
|
|
1455
1460
|
}
|
|
1456
1461
|
class _n {
|
|
1457
1462
|
constructor(e, t) {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
+
g(this, "_chart", new G());
|
|
1464
|
+
g(this, "_area", new G());
|
|
1465
|
+
g(this, "_xAxis", new G());
|
|
1466
|
+
g(this, "_yAxis", new G());
|
|
1467
|
+
g(this, "_axisIntersection", new G());
|
|
1463
1468
|
const { xAxis: s, yAxis: n } = t;
|
|
1464
|
-
this._chart = new
|
|
1469
|
+
this._chart = new G(e), this._calc(s, n);
|
|
1465
1470
|
}
|
|
1466
1471
|
_calc(e, t) {
|
|
1467
1472
|
const s = e.isShow ? e.height : 0, n = t.isShow ? t.width : 0, a = this._chart.height - s, r = this._chart.width - n;
|
|
1468
|
-
this._area = new
|
|
1473
|
+
this._area = new G({
|
|
1469
1474
|
x: t.position === "left" ? n : 0,
|
|
1470
1475
|
y: e.position === "top" ? s : 0,
|
|
1471
1476
|
width: r,
|
|
1472
1477
|
height: a
|
|
1473
|
-
}), this._xAxis = new
|
|
1478
|
+
}), this._xAxis = new G({
|
|
1474
1479
|
y: e.position === "top" ? 0 : a,
|
|
1475
1480
|
x: t.position === "left" ? n : 0,
|
|
1476
1481
|
height: s,
|
|
1477
1482
|
width: r
|
|
1478
|
-
}), this._yAxis = new
|
|
1483
|
+
}), this._yAxis = new G({
|
|
1479
1484
|
y: e.position === "top" ? s : 0,
|
|
1480
1485
|
x: t.position === "left" ? 0 : r,
|
|
1481
1486
|
width: n,
|
|
1482
1487
|
height: a
|
|
1483
|
-
}), this._axisIntersection = new
|
|
1488
|
+
}), this._axisIntersection = new G({
|
|
1484
1489
|
y: e.position === "top" ? 0 : a,
|
|
1485
1490
|
x: t.position === "left" ? 0 : r,
|
|
1486
1491
|
width: n,
|
|
@@ -1493,7 +1498,7 @@ class _n {
|
|
|
1493
1498
|
}
|
|
1494
1499
|
update(e) {
|
|
1495
1500
|
const { xAxis: t, yAxis: s } = e.config;
|
|
1496
|
-
this._chart = new
|
|
1501
|
+
this._chart = new G(e.container), this._calc(t, s);
|
|
1497
1502
|
}
|
|
1498
1503
|
get area() {
|
|
1499
1504
|
return this._area;
|
|
@@ -1530,28 +1535,28 @@ function ai(i, e) {
|
|
|
1530
1535
|
const t = vn(i[0]), s = bn(i, t), n = [];
|
|
1531
1536
|
return s.forEach((a) => {
|
|
1532
1537
|
if (a.length === 0) return;
|
|
1533
|
-
const r = i.find((
|
|
1534
|
-
(
|
|
1538
|
+
const r = i.find((f) => f.close_time.getTime() === a[0]), o = i.find(
|
|
1539
|
+
(f) => f.open_time.getTime() === a[a.length - 1] + t
|
|
1535
1540
|
);
|
|
1536
1541
|
if (!r || !o)
|
|
1537
1542
|
throw new Error("[CS_Data] error while creating missing data");
|
|
1538
1543
|
const c = r.close, h = o.open;
|
|
1539
1544
|
let d = c;
|
|
1540
|
-
a.forEach((
|
|
1545
|
+
a.forEach((f, p) => {
|
|
1541
1546
|
const _ = (h - d) / a.length;
|
|
1542
1547
|
let v = d + _ * p, b = v + _;
|
|
1543
1548
|
const w = Math.abs(v - b);
|
|
1544
1549
|
let x = Math.max(v, b) + w / 2, y = Math.min(v, b) - w / 2;
|
|
1545
1550
|
if (e.trade) {
|
|
1546
1551
|
const M = [...e.trade.entries, ...e.trade.exits].find((T) => {
|
|
1547
|
-
const
|
|
1548
|
-
return
|
|
1552
|
+
const k = T.time.getTime();
|
|
1553
|
+
return k >= f && k < f + t;
|
|
1549
1554
|
});
|
|
1550
1555
|
M && (M.type === "buy" ? (y = M.price, b = Math.max(y, b), v = b + w, x = Math.max(v, b) + w / 2, d = v) : M.type === "sell" && (x = M.price, b = Math.min(x, b), v = b - w, y = Math.min(v, b) - w / 2, d = v));
|
|
1551
1556
|
}
|
|
1552
1557
|
const C = {
|
|
1553
|
-
open_time: new Date(
|
|
1554
|
-
close_time: new Date(
|
|
1558
|
+
open_time: new Date(f),
|
|
1559
|
+
close_time: new Date(f + t),
|
|
1555
1560
|
open: v,
|
|
1556
1561
|
close: b,
|
|
1557
1562
|
high: x,
|
|
@@ -1563,12 +1568,12 @@ function ai(i, e) {
|
|
|
1563
1568
|
}
|
|
1564
1569
|
class Dt {
|
|
1565
1570
|
constructor(e, t) {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1571
|
+
g(this, "_initialData", []);
|
|
1572
|
+
g(this, "_preparedData", []);
|
|
1573
|
+
g(this, "_missingData", []);
|
|
1574
|
+
g(this, "_count", 0);
|
|
1575
|
+
g(this, "_model");
|
|
1576
|
+
g(this, "_interval", 0);
|
|
1572
1577
|
this._model = t, this.update(e);
|
|
1573
1578
|
}
|
|
1574
1579
|
_prepare(e) {
|
|
@@ -1604,7 +1609,7 @@ class Dt {
|
|
|
1604
1609
|
}
|
|
1605
1610
|
class yn {
|
|
1606
1611
|
constructor() {
|
|
1607
|
-
|
|
1612
|
+
g(this, "listeners", {});
|
|
1608
1613
|
}
|
|
1609
1614
|
subscribe(e, t) {
|
|
1610
1615
|
return this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t), () => this.unsubscribe(e, t);
|
|
@@ -1623,7 +1628,7 @@ class yn {
|
|
|
1623
1628
|
}
|
|
1624
1629
|
class vi {
|
|
1625
1630
|
constructor() {
|
|
1626
|
-
|
|
1631
|
+
g(this, "_scale");
|
|
1627
1632
|
}
|
|
1628
1633
|
domain() {
|
|
1629
1634
|
const e = this._scale.domain();
|
|
@@ -1711,7 +1716,7 @@ class An {
|
|
|
1711
1716
|
config: {
|
|
1712
1717
|
candles: { baseWidth: n, bodyRatio: a, direction: r }
|
|
1713
1718
|
}
|
|
1714
|
-
} = this.model, [o, c] = e.domain().map((_) => _.getTime()), h = c - o, d = n / a * t,
|
|
1719
|
+
} = this.model, [o, c] = e.domain().map((_) => _.getTime()), h = c - o, d = n / a * t, f = h * (s.width / d), p = r === "left" ? [new Date(o), new Date(o + f)] : [new Date(c - f), new Date(c)];
|
|
1715
1720
|
e.setDomain(p);
|
|
1716
1721
|
}
|
|
1717
1722
|
applyOffset(e) {
|
|
@@ -1726,16 +1731,16 @@ class An {
|
|
|
1726
1731
|
}
|
|
1727
1732
|
class Mn {
|
|
1728
1733
|
constructor(e) {
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
+
g(this, "_model");
|
|
1735
|
+
g(this, "_scaleX");
|
|
1736
|
+
g(this, "_scaleY");
|
|
1737
|
+
g(this, "_initializer");
|
|
1738
|
+
g(this, "_baseDomain", {
|
|
1734
1739
|
x: [/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date()],
|
|
1735
1740
|
y: [0, 0]
|
|
1736
1741
|
});
|
|
1737
|
-
|
|
1738
|
-
|
|
1742
|
+
g(this, "scaleFactor", { x: 1, y: 1 });
|
|
1743
|
+
g(this, "panOffset", { x: 0, y: 0 });
|
|
1739
1744
|
this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new An(e), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
|
|
1740
1745
|
x: this._scaleX.domain(),
|
|
1741
1746
|
y: this._scaleY.domain()
|
|
@@ -1782,9 +1787,9 @@ class Mn {
|
|
|
1782
1787
|
return this.panOffset.y;
|
|
1783
1788
|
}
|
|
1784
1789
|
fitYToVisibleCandles() {
|
|
1785
|
-
const e = this._model.candles.allData, [t, s] = this._scaleX.domain(), n = e.filter((
|
|
1790
|
+
const e = this._model.candles.allData, [t, s] = this._scaleX.domain(), n = e.filter((f) => f.open_time >= t && f.open_time <= s);
|
|
1786
1791
|
if (!n.length) return;
|
|
1787
|
-
const a = Math.min(...n.map((
|
|
1792
|
+
const a = Math.min(...n.map((f) => f.low)), r = Math.max(...n.map((f) => f.high)), o = r - a;
|
|
1788
1793
|
if (o === 0) return;
|
|
1789
1794
|
const c = this._baseDomain.y;
|
|
1790
1795
|
this.scale("y", (c[1] - c[0]) / o, "absolute");
|
|
@@ -1826,14 +1831,14 @@ class Mn {
|
|
|
1826
1831
|
}
|
|
1827
1832
|
class Tn {
|
|
1828
1833
|
constructor(e, { entry: t = [], exit: s = [] }) {
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1834
|
+
g(this, "_model");
|
|
1835
|
+
g(this, "_rawEntry");
|
|
1836
|
+
g(this, "_rawExit");
|
|
1837
|
+
g(this, "_mapped", []);
|
|
1838
|
+
g(this, "_entries", []);
|
|
1839
|
+
g(this, "_exits", []);
|
|
1840
|
+
g(this, "_activeTradeTime", null);
|
|
1841
|
+
g(this, "_hoveredTradeTime", null);
|
|
1837
1842
|
this._model = e, this._rawEntry = t, this._rawExit = s, this.recalculate();
|
|
1838
1843
|
}
|
|
1839
1844
|
_findTradeCandle(e) {
|
|
@@ -1914,10 +1919,10 @@ class Tn {
|
|
|
1914
1919
|
}
|
|
1915
1920
|
class Dn {
|
|
1916
1921
|
constructor(e, t) {
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1922
|
+
g(this, "_rawMarkers");
|
|
1923
|
+
g(this, "_markers", []);
|
|
1924
|
+
g(this, "_model");
|
|
1925
|
+
g(this, "_defaults", {
|
|
1921
1926
|
mainColor: "#000000",
|
|
1922
1927
|
textColor: "#ffffff",
|
|
1923
1928
|
lineColor: "#000000",
|
|
@@ -2024,10 +2029,10 @@ const kn = {
|
|
|
2024
2029
|
}
|
|
2025
2030
|
}
|
|
2026
2031
|
};
|
|
2027
|
-
class
|
|
2032
|
+
class Ln {
|
|
2028
2033
|
constructor(e) {
|
|
2029
|
-
|
|
2030
|
-
this._scheme =
|
|
2034
|
+
g(this, "_scheme");
|
|
2035
|
+
this._scheme = Je({}, kn, e), Object.keys(this._scheme).forEach((t) => {
|
|
2031
2036
|
Object.defineProperty(this, t, {
|
|
2032
2037
|
get: () => this._scheme[t],
|
|
2033
2038
|
enumerable: !0
|
|
@@ -2035,13 +2040,13 @@ class En {
|
|
|
2035
2040
|
});
|
|
2036
2041
|
}
|
|
2037
2042
|
update(e) {
|
|
2038
|
-
this._scheme =
|
|
2043
|
+
this._scheme = Je({}, this._scheme, e);
|
|
2039
2044
|
}
|
|
2040
2045
|
}
|
|
2041
|
-
class
|
|
2046
|
+
class En {
|
|
2042
2047
|
constructor(e, t) {
|
|
2043
|
-
|
|
2044
|
-
|
|
2048
|
+
g(this, "_data");
|
|
2049
|
+
g(this, "_callbacks", {
|
|
2045
2050
|
onAdd: () => {
|
|
2046
2051
|
},
|
|
2047
2052
|
onUpdate: () => {
|
|
@@ -2049,8 +2054,8 @@ class Ln {
|
|
|
2049
2054
|
onDelete: () => {
|
|
2050
2055
|
}
|
|
2051
2056
|
});
|
|
2052
|
-
|
|
2053
|
-
|
|
2057
|
+
g(this, "_model");
|
|
2058
|
+
g(this, "_grouped", {});
|
|
2054
2059
|
this._data = (e == null ? void 0 : e.data) || [], this._model = t, this._updateGroups(), e != null && e.onAdd && (this._callbacks.onAdd = e.onAdd), e != null && e.onUpdate && (this._callbacks.onUpdate = e.onUpdate), e != null && e.onDelete && (this._callbacks.onDelete = e.onDelete);
|
|
2055
2060
|
}
|
|
2056
2061
|
_updateGroups() {
|
|
@@ -2092,18 +2097,18 @@ class Nn {
|
|
|
2092
2097
|
colorScheme: o,
|
|
2093
2098
|
comments: c
|
|
2094
2099
|
}) {
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new
|
|
2100
|
+
g(this, "chartId");
|
|
2101
|
+
g(this, "container");
|
|
2102
|
+
g(this, "eventBus", new yn());
|
|
2103
|
+
g(this, "candles");
|
|
2104
|
+
g(this, "config");
|
|
2105
|
+
g(this, "colorScheme");
|
|
2106
|
+
g(this, "layout");
|
|
2107
|
+
g(this, "scales");
|
|
2108
|
+
g(this, "trade");
|
|
2109
|
+
g(this, "userMarkers");
|
|
2110
|
+
g(this, "comments");
|
|
2111
|
+
this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new Ln(o), this.layout = new _n(t, this.config), this.scales = new Mn(this), this.trade = new Tn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new Dn(this, r), this.comments = new En(c, this);
|
|
2107
2112
|
}
|
|
2108
2113
|
init() {
|
|
2109
2114
|
this.eventBus.emit("init_model");
|
|
@@ -2142,15 +2147,15 @@ class Nn {
|
|
|
2142
2147
|
this.eventBus.emit("update_comments", e);
|
|
2143
2148
|
}
|
|
2144
2149
|
}
|
|
2145
|
-
const
|
|
2146
|
-
class
|
|
2150
|
+
const Ze = window.devicePixelRatio || 2;
|
|
2151
|
+
class L {
|
|
2147
2152
|
constructor({ tag: e, className: t, id: s, textContent: n }) {
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2153
|
+
g(this, "_tag");
|
|
2154
|
+
g(this, "_className");
|
|
2155
|
+
g(this, "_id");
|
|
2156
|
+
g(this, "_textContent");
|
|
2157
|
+
g(this, "_node");
|
|
2158
|
+
g(this, "_absolutePosition", new DOMRect());
|
|
2154
2159
|
this._tag = e || "div", this._className = t || "", this._id = s || "", this._textContent = n || "";
|
|
2155
2160
|
const a = document.createElement(this._tag);
|
|
2156
2161
|
this._className && (a.className = this._className), this._id && (a.id = this._id), this._textContent && (a.textContent = this._textContent), this._node = a;
|
|
@@ -2181,24 +2186,24 @@ class k {
|
|
|
2181
2186
|
this.node.style.opacity = e ? "1" : "0", this.node.style.visibility = e ? "visible" : "hidden";
|
|
2182
2187
|
}
|
|
2183
2188
|
}
|
|
2184
|
-
class Ne extends
|
|
2189
|
+
class Ne extends L {
|
|
2185
2190
|
constructor({ className: t, id: s, width: n, height: a, isMain: r }) {
|
|
2186
2191
|
super({
|
|
2187
2192
|
tag: "canvas",
|
|
2188
2193
|
className: `${t} sc-charts-cs__canvas ${r ? "" : "sc-charts-cs__canvas-additional"}`,
|
|
2189
2194
|
id: s
|
|
2190
2195
|
});
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2196
|
+
g(this, "_ctx");
|
|
2197
|
+
g(this, "_width");
|
|
2198
|
+
g(this, "_height");
|
|
2199
|
+
g(this, "background", null);
|
|
2195
2200
|
this._width = n, this._height = a, this.updateSize({ width: n, height: a });
|
|
2196
2201
|
const o = this._node.getContext("2d");
|
|
2197
2202
|
if (!o) throw new Error("Failed to get 2D context");
|
|
2198
|
-
o.scale(
|
|
2203
|
+
o.scale(Ze, Ze), this._ctx = o;
|
|
2199
2204
|
}
|
|
2200
2205
|
updateSize({ width: t, height: s }) {
|
|
2201
|
-
t && (this._node.width = t *
|
|
2206
|
+
t && (this._node.width = t * Ze, this._node.style.width = `${t}px`, this._width = t), s && (this._node.height = s * Ze, this._node.style.height = `${s}px`, this._height = s);
|
|
2202
2207
|
}
|
|
2203
2208
|
clear() {
|
|
2204
2209
|
this.background ? (this._ctx.save(), this._ctx.fillStyle = this.background, this._ctx.fillRect(0, 0, this._width, this._height), this._ctx.restore()) : this._ctx.clearRect(0, 0, this._width, this._height);
|
|
@@ -2222,11 +2227,11 @@ function Hn(i, e) {
|
|
|
2222
2227
|
scales: a
|
|
2223
2228
|
} = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = E.timeFormat("%d %b"), h = E.timeFormat("%H:%M");
|
|
2224
2229
|
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) => {
|
|
2225
|
-
const
|
|
2226
|
-
i.fillText(p,
|
|
2230
|
+
const f = a.x.convert(d), p = o(d) ? c(d) : h(d);
|
|
2231
|
+
i.fillText(p, f, t.y + t.height / 2);
|
|
2227
2232
|
});
|
|
2228
2233
|
}
|
|
2229
|
-
function
|
|
2234
|
+
function In(i, e) {
|
|
2230
2235
|
const {
|
|
2231
2236
|
layout: { yAxis: t },
|
|
2232
2237
|
colorScheme: { yAxis: s },
|
|
@@ -2238,7 +2243,7 @@ function Bn(i, e) {
|
|
|
2238
2243
|
i.fillText(d, t.x + t.width / 2, h);
|
|
2239
2244
|
});
|
|
2240
2245
|
}
|
|
2241
|
-
const
|
|
2246
|
+
const Bn = (i, e) => {
|
|
2242
2247
|
const {
|
|
2243
2248
|
layout: { axisIntersection: t },
|
|
2244
2249
|
colorScheme: s
|
|
@@ -2255,15 +2260,15 @@ class bt {
|
|
|
2255
2260
|
Hn(e, t);
|
|
2256
2261
|
}
|
|
2257
2262
|
static yAxis(e, t) {
|
|
2258
|
-
|
|
2263
|
+
In(e, t);
|
|
2259
2264
|
}
|
|
2260
2265
|
static intersection(e, t) {
|
|
2261
|
-
|
|
2266
|
+
Bn(e, t);
|
|
2262
2267
|
}
|
|
2263
2268
|
}
|
|
2264
2269
|
class Rn {
|
|
2265
2270
|
constructor(e) {
|
|
2266
|
-
|
|
2271
|
+
g(this, "_target");
|
|
2267
2272
|
this._target = e;
|
|
2268
2273
|
}
|
|
2269
2274
|
mousemove(e) {
|
|
@@ -2288,27 +2293,27 @@ class Rn {
|
|
|
2288
2293
|
this._target.addEventListener("contextmenu", e);
|
|
2289
2294
|
}
|
|
2290
2295
|
}
|
|
2291
|
-
function
|
|
2296
|
+
function Qe(i) {
|
|
2292
2297
|
return i * 0.1875;
|
|
2293
2298
|
}
|
|
2294
2299
|
const $n = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2295
|
-
const
|
|
2296
|
-
i.save(), i.translate(_, v), i.scale(
|
|
2297
|
-
const b = a +
|
|
2300
|
+
const f = r / 16, p = 16 * f, _ = n - p / 2, v = a;
|
|
2301
|
+
i.save(), i.translate(_, v), i.scale(f, f), 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";
|
|
2302
|
+
const b = a + f * 3 + 0.5, w = f * 16, x = b + w / 2;
|
|
2298
2303
|
i.fillStyle = t, i.fillText(s, n, x), i.restore();
|
|
2299
2304
|
}, On = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2300
|
-
const
|
|
2301
|
-
i.save(), i.translate(_, v), i.scale(
|
|
2302
|
-
const b =
|
|
2305
|
+
const f = r / 16, p = 16 * f, _ = n - p / 2, v = a;
|
|
2306
|
+
i.save(), i.translate(_, v), i.scale(f, -f), 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";
|
|
2307
|
+
const b = f * 16, w = a - f * 19 + b / 2;
|
|
2303
2308
|
i.fillStyle = t, i.fillText(s, n, w), i.restore();
|
|
2304
2309
|
};
|
|
2305
|
-
function
|
|
2310
|
+
function Ke(i) {
|
|
2306
2311
|
"@babel/helpers - typeof";
|
|
2307
|
-
return
|
|
2312
|
+
return Ke = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
2308
2313
|
return typeof e;
|
|
2309
2314
|
} : function(e) {
|
|
2310
2315
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
2311
|
-
},
|
|
2316
|
+
}, Ke(i);
|
|
2312
2317
|
}
|
|
2313
2318
|
var Pn = /^\s+/, zn = /\s+$/;
|
|
2314
2319
|
function A(i, e) {
|
|
@@ -2400,14 +2405,14 @@ A.prototype = {
|
|
|
2400
2405
|
},
|
|
2401
2406
|
toPercentageRgb: function() {
|
|
2402
2407
|
return {
|
|
2403
|
-
r: Math.round(
|
|
2404
|
-
g: Math.round(
|
|
2405
|
-
b: Math.round(
|
|
2408
|
+
r: Math.round($(this._r, 255) * 100) + "%",
|
|
2409
|
+
g: Math.round($(this._g, 255) * 100) + "%",
|
|
2410
|
+
b: Math.round($(this._b, 255) * 100) + "%",
|
|
2406
2411
|
a: this._a
|
|
2407
2412
|
};
|
|
2408
2413
|
},
|
|
2409
2414
|
toPercentageRgbString: function() {
|
|
2410
|
-
return this._a == 1 ? "rgb(" + Math.round(
|
|
2415
|
+
return this._a == 1 ? "rgb(" + Math.round($(this._r, 255) * 100) + "%, " + Math.round($(this._g, 255) * 100) + "%, " + Math.round($(this._b, 255) * 100) + "%)" : "rgba(" + Math.round($(this._r, 255) * 100) + "%, " + Math.round($(this._g, 255) * 100) + "%, " + Math.round($(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
2411
2416
|
},
|
|
2412
2417
|
toName: function() {
|
|
2413
2418
|
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : na[hi(this._r, this._g, this._b, !0)] || !1;
|
|
@@ -2481,7 +2486,7 @@ A.prototype = {
|
|
|
2481
2486
|
}
|
|
2482
2487
|
};
|
|
2483
2488
|
A.fromRatio = function(i, e) {
|
|
2484
|
-
if (
|
|
2489
|
+
if (Ke(i) == "object") {
|
|
2485
2490
|
var t = {};
|
|
2486
2491
|
for (var s in i)
|
|
2487
2492
|
i.hasOwnProperty(s) && (s === "a" ? t[s] = i[s] : t[s] = ke(i[s]));
|
|
@@ -2495,7 +2500,7 @@ function Vn(i) {
|
|
|
2495
2500
|
g: 0,
|
|
2496
2501
|
b: 0
|
|
2497
2502
|
}, t = 1, s = null, n = null, a = null, r = !1, o = !1;
|
|
2498
|
-
return typeof i == "string" && (i = la(i)),
|
|
2503
|
+
return typeof i == "string" && (i = la(i)), Ke(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), {
|
|
2499
2504
|
ok: r,
|
|
2500
2505
|
format: i.format || o,
|
|
2501
2506
|
r: Math.min(255, Math.max(e.r, 0)),
|
|
@@ -2506,13 +2511,13 @@ function Vn(i) {
|
|
|
2506
2511
|
}
|
|
2507
2512
|
function Wn(i, e, t) {
|
|
2508
2513
|
return {
|
|
2509
|
-
r:
|
|
2510
|
-
g:
|
|
2511
|
-
b:
|
|
2514
|
+
r: $(i, 255) * 255,
|
|
2515
|
+
g: $(e, 255) * 255,
|
|
2516
|
+
b: $(t, 255) * 255
|
|
2512
2517
|
};
|
|
2513
2518
|
}
|
|
2514
2519
|
function li(i, e, t) {
|
|
2515
|
-
i =
|
|
2520
|
+
i = $(i, 255), e = $(e, 255), t = $(t, 255);
|
|
2516
2521
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = (s + n) / 2;
|
|
2517
2522
|
if (s == n)
|
|
2518
2523
|
a = r = 0;
|
|
@@ -2539,9 +2544,9 @@ function li(i, e, t) {
|
|
|
2539
2544
|
}
|
|
2540
2545
|
function Yn(i, e, t) {
|
|
2541
2546
|
var s, n, a;
|
|
2542
|
-
i =
|
|
2543
|
-
function r(h, d,
|
|
2544
|
-
return
|
|
2547
|
+
i = $(i, 360), e = $(e, 100), t = $(t, 100);
|
|
2548
|
+
function r(h, d, f) {
|
|
2549
|
+
return f < 0 && (f += 1), f > 1 && (f -= 1), f < 1 / 6 ? h + (d - h) * 6 * f : f < 1 / 2 ? d : f < 2 / 3 ? h + (d - h) * (2 / 3 - f) * 6 : h;
|
|
2545
2550
|
}
|
|
2546
2551
|
if (e === 0)
|
|
2547
2552
|
s = n = a = t;
|
|
@@ -2556,7 +2561,7 @@ function Yn(i, e, t) {
|
|
|
2556
2561
|
};
|
|
2557
2562
|
}
|
|
2558
2563
|
function ci(i, e, t) {
|
|
2559
|
-
i =
|
|
2564
|
+
i = $(i, 255), e = $(e, 255), t = $(t, 255);
|
|
2560
2565
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = s, c = s - n;
|
|
2561
2566
|
if (r = s === 0 ? 0 : c / s, s == n)
|
|
2562
2567
|
a = 0;
|
|
@@ -2581,12 +2586,12 @@ function ci(i, e, t) {
|
|
|
2581
2586
|
};
|
|
2582
2587
|
}
|
|
2583
2588
|
function jn(i, e, t) {
|
|
2584
|
-
i =
|
|
2585
|
-
var s = Math.floor(i), n = i - s, a = t * (1 - e), r = t * (1 - n * e), o = t * (1 - (1 - n) * e), c = s % 6, h = [t, r, a, a, o, t][c], d = [o, t, t, r, a, a][c],
|
|
2589
|
+
i = $(i, 360) * 6, e = $(e, 100), t = $(t, 100);
|
|
2590
|
+
var s = Math.floor(i), n = i - s, a = t * (1 - e), r = t * (1 - n * e), o = t * (1 - (1 - n) * e), c = s % 6, h = [t, r, a, a, o, t][c], d = [o, t, t, r, a, a][c], f = [a, a, o, t, t, r][c];
|
|
2586
2591
|
return {
|
|
2587
2592
|
r: h * 255,
|
|
2588
2593
|
g: d * 255,
|
|
2589
|
-
b:
|
|
2594
|
+
b: f * 255
|
|
2590
2595
|
};
|
|
2591
2596
|
}
|
|
2592
2597
|
function hi(i, e, t, s) {
|
|
@@ -2614,12 +2619,12 @@ A.random = function() {
|
|
|
2614
2619
|
function Un(i, e) {
|
|
2615
2620
|
e = e === 0 ? 0 : e || 10;
|
|
2616
2621
|
var t = A(i).toHsl();
|
|
2617
|
-
return t.s -= e / 100, t.s =
|
|
2622
|
+
return t.s -= e / 100, t.s = tt(t.s), A(t);
|
|
2618
2623
|
}
|
|
2619
2624
|
function Gn(i, e) {
|
|
2620
2625
|
e = e === 0 ? 0 : e || 10;
|
|
2621
2626
|
var t = A(i).toHsl();
|
|
2622
|
-
return t.s += e / 100, t.s =
|
|
2627
|
+
return t.s += e / 100, t.s = tt(t.s), A(t);
|
|
2623
2628
|
}
|
|
2624
2629
|
function Zn(i) {
|
|
2625
2630
|
return A(i).desaturate(100);
|
|
@@ -2627,7 +2632,7 @@ function Zn(i) {
|
|
|
2627
2632
|
function qn(i, e) {
|
|
2628
2633
|
e = e === 0 ? 0 : e || 10;
|
|
2629
2634
|
var t = A(i).toHsl();
|
|
2630
|
-
return t.l += e / 100, t.l =
|
|
2635
|
+
return t.l += e / 100, t.l = tt(t.l), A(t);
|
|
2631
2636
|
}
|
|
2632
2637
|
function Jn(i, e) {
|
|
2633
2638
|
e = e === 0 ? 0 : e || 10;
|
|
@@ -2637,7 +2642,7 @@ function Jn(i, e) {
|
|
|
2637
2642
|
function Qn(i, e) {
|
|
2638
2643
|
e = e === 0 ? 0 : e || 10;
|
|
2639
2644
|
var t = A(i).toHsl();
|
|
2640
|
-
return t.l -= e / 100, t.l =
|
|
2645
|
+
return t.l -= e / 100, t.l = tt(t.l), A(t);
|
|
2641
2646
|
}
|
|
2642
2647
|
function Kn(i, e) {
|
|
2643
2648
|
var t = A(i).toHsl(), s = (t.h + e) % 360;
|
|
@@ -2887,15 +2892,15 @@ function aa(i) {
|
|
|
2887
2892
|
function yi(i) {
|
|
2888
2893
|
return i = parseFloat(i), (isNaN(i) || i < 0 || i > 1) && (i = 1), i;
|
|
2889
2894
|
}
|
|
2890
|
-
function
|
|
2895
|
+
function $(i, e) {
|
|
2891
2896
|
ra(i) && (i = "100%");
|
|
2892
2897
|
var t = oa(i);
|
|
2893
2898
|
return i = Math.min(e, Math.max(0, parseFloat(i))), t && (i = parseInt(i * e, 10) / 100), Math.abs(i - e) < 1e-6 ? 1 : i % e / parseFloat(e);
|
|
2894
2899
|
}
|
|
2895
|
-
function
|
|
2900
|
+
function tt(i) {
|
|
2896
2901
|
return Math.min(1, Math.max(0, i));
|
|
2897
2902
|
}
|
|
2898
|
-
function
|
|
2903
|
+
function U(i) {
|
|
2899
2904
|
return parseInt(i, 16);
|
|
2900
2905
|
}
|
|
2901
2906
|
function ra(i) {
|
|
@@ -2913,8 +2918,8 @@ function ke(i) {
|
|
|
2913
2918
|
function wi(i) {
|
|
2914
2919
|
return Math.round(parseFloat(i) * 255).toString(16);
|
|
2915
2920
|
}
|
|
2916
|
-
function
|
|
2917
|
-
return
|
|
2921
|
+
function gi(i) {
|
|
2922
|
+
return U(i) / 255;
|
|
2918
2923
|
}
|
|
2919
2924
|
var J = function() {
|
|
2920
2925
|
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*\\)?";
|
|
@@ -2977,26 +2982,26 @@ function la(i) {
|
|
|
2977
2982
|
v: t[3],
|
|
2978
2983
|
a: t[4]
|
|
2979
2984
|
} : (t = J.hex8.exec(i)) ? {
|
|
2980
|
-
r:
|
|
2981
|
-
g:
|
|
2982
|
-
b:
|
|
2983
|
-
a:
|
|
2985
|
+
r: U(t[1]),
|
|
2986
|
+
g: U(t[2]),
|
|
2987
|
+
b: U(t[3]),
|
|
2988
|
+
a: gi(t[4]),
|
|
2984
2989
|
format: e ? "name" : "hex8"
|
|
2985
2990
|
} : (t = J.hex6.exec(i)) ? {
|
|
2986
|
-
r:
|
|
2987
|
-
g:
|
|
2988
|
-
b:
|
|
2991
|
+
r: U(t[1]),
|
|
2992
|
+
g: U(t[2]),
|
|
2993
|
+
b: U(t[3]),
|
|
2989
2994
|
format: e ? "name" : "hex"
|
|
2990
2995
|
} : (t = J.hex4.exec(i)) ? {
|
|
2991
|
-
r:
|
|
2992
|
-
g:
|
|
2993
|
-
b:
|
|
2994
|
-
a:
|
|
2996
|
+
r: U(t[1] + "" + t[1]),
|
|
2997
|
+
g: U(t[2] + "" + t[2]),
|
|
2998
|
+
b: U(t[3] + "" + t[3]),
|
|
2999
|
+
a: gi(t[4] + "" + t[4]),
|
|
2995
3000
|
format: e ? "name" : "hex8"
|
|
2996
3001
|
} : (t = J.hex3.exec(i)) ? {
|
|
2997
|
-
r:
|
|
2998
|
-
g:
|
|
2999
|
-
b:
|
|
3002
|
+
r: U(t[1] + "" + t[1]),
|
|
3003
|
+
g: U(t[2] + "" + t[2]),
|
|
3004
|
+
b: U(t[3] + "" + t[3]),
|
|
3000
3005
|
format: e ? "name" : "hex"
|
|
3001
3006
|
} : !1;
|
|
3002
3007
|
}
|
|
@@ -3021,10 +3026,10 @@ function ha(i, e) {
|
|
|
3021
3026
|
} = e;
|
|
3022
3027
|
if (!r) return;
|
|
3023
3028
|
const { trade: o } = a, c = 4;
|
|
3024
|
-
t.forEach(({ isHovered: h, isActive: d, candle:
|
|
3025
|
-
const _ = s.convert(
|
|
3029
|
+
t.forEach(({ isHovered: h, isActive: d, candle: f, trades: p }) => {
|
|
3030
|
+
const _ = s.convert(f.open_time);
|
|
3026
3031
|
p.forEach((v) => {
|
|
3027
|
-
const b = v.type === "buy", w = b ? o.buyLabel.text : o.sellLabel.text, x = b ? "B" : "S", y = b ? n.convert(
|
|
3032
|
+
const b = v.type === "buy", w = b ? o.buyLabel.text : o.sellLabel.text, x = b ? "B" : "S", y = b ? n.convert(f.low) + c : n.convert(f.high) - c, C = b ? $n : On;
|
|
3028
3033
|
let M = b ? o.buyLabel.main : o.sellLabel.main;
|
|
3029
3034
|
h && h[1] && h[0] === v.type && (M = A.mix(M, a.bg, 20).toString()), d && d[1] && d[0] === v.type && (M = o.activeLabel), C(i, {
|
|
3030
3035
|
x: _,
|
|
@@ -3047,13 +3052,13 @@ function da(i, e) {
|
|
|
3047
3052
|
colorScheme: { trade: h }
|
|
3048
3053
|
} = e;
|
|
3049
3054
|
if (a.length === 0) return;
|
|
3050
|
-
const d = a.map((p) => p.candle).sort((p, _) => p.open_time.getTime() - _.open_time.getTime()),
|
|
3055
|
+
const d = a.map((p) => p.candle).sort((p, _) => p.open_time.getTime() - _.open_time.getTime()), f = c.baseWidth / 2 * s + c.strokeWidth / 2;
|
|
3051
3056
|
if (i.save(), i.lineWidth = 1, i.strokeStyle = h.tradeBorders, o.length) {
|
|
3052
|
-
const p = t.convert(d[0].open_time) -
|
|
3057
|
+
const p = t.convert(d[0].open_time) - f;
|
|
3053
3058
|
i.beginPath(), i.moveTo(p, n.y), i.lineTo(p, n.y + n.height), i.stroke();
|
|
3054
3059
|
}
|
|
3055
3060
|
if (r.length) {
|
|
3056
|
-
const p = t.convert(d[d.length - 1].open_time) +
|
|
3061
|
+
const p = t.convert(d[d.length - 1].open_time) + f;
|
|
3057
3062
|
i.beginPath(), i.moveTo(p, n.y), i.lineTo(p, n.y + n.height), i.stroke();
|
|
3058
3063
|
}
|
|
3059
3064
|
i.restore();
|
|
@@ -3068,27 +3073,27 @@ const ua = (i, e) => {
|
|
|
3068
3073
|
}
|
|
3069
3074
|
} = e;
|
|
3070
3075
|
if (i.save(), !c) return;
|
|
3071
|
-
const h = (
|
|
3076
|
+
const h = (f) => {
|
|
3072
3077
|
var p;
|
|
3073
3078
|
return (p = n.find(
|
|
3074
|
-
(_) =>
|
|
3079
|
+
(_) => f.getTime() >= _.candle.open_time.getTime() && f.getTime() < _.candle.close_time.getTime()
|
|
3075
3080
|
)) == null ? void 0 : p.candle;
|
|
3076
|
-
}, d = (
|
|
3077
|
-
const _ = h(
|
|
3081
|
+
}, d = (f, p) => {
|
|
3082
|
+
const _ = h(f.time), v = h(p.time);
|
|
3078
3083
|
if (!_ || !v) return;
|
|
3079
3084
|
const b = t.convert(_.open_time), w = t.convert(v.open_time);
|
|
3080
3085
|
let x, y;
|
|
3081
|
-
|
|
3086
|
+
f.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([]);
|
|
3082
3087
|
};
|
|
3083
3088
|
if (a.length === 1 && r.length > 1)
|
|
3084
|
-
r.forEach((
|
|
3089
|
+
r.forEach((f) => d(a[0], f));
|
|
3085
3090
|
else if (r.length === 1 && a.length > 1)
|
|
3086
|
-
a.forEach((
|
|
3091
|
+
a.forEach((f) => d(f, r[0]));
|
|
3087
3092
|
else if (a.length === 1 && r.length === 1)
|
|
3088
3093
|
d(a[0], r[0]);
|
|
3089
3094
|
else if (a.length > 0 && r.length > 0) {
|
|
3090
|
-
const
|
|
3091
|
-
d(
|
|
3095
|
+
const f = a.reduce((_, v) => _.time < v.time ? _ : v), p = r.reduce((_, v) => _.time > v.time ? _ : v);
|
|
3096
|
+
d(f, p);
|
|
3092
3097
|
}
|
|
3093
3098
|
i.restore();
|
|
3094
3099
|
}, xi = (i, e) => {
|
|
@@ -3100,7 +3105,7 @@ const ua = (i, e) => {
|
|
|
3100
3105
|
height: o
|
|
3101
3106
|
} = e;
|
|
3102
3107
|
i.beginPath(), i.fillStyle = a, i.lineWidth = 1, i.moveTo(s + t, n), i.lineTo(s + r - t, n), i.quadraticCurveTo(s + r, n, s + r, n + t), i.lineTo(s + r, n + o - t), i.quadraticCurveTo(s + r, n + o, s + r - t, n + o), i.lineTo(s + t, n + o), i.quadraticCurveTo(s, n + o, s, n + o - t), i.lineTo(s, n + t), i.quadraticCurveTo(s, n, s + t, n), i.closePath(), i.fill();
|
|
3103
|
-
},
|
|
3108
|
+
}, ga = (i) => {
|
|
3104
3109
|
const e = Math.floor((Date.now() - +i) / 1e3), t = [
|
|
3105
3110
|
[60, 1, "s"],
|
|
3106
3111
|
[3600, 60, "m"],
|
|
@@ -3112,7 +3117,7 @@ const ua = (i, e) => {
|
|
|
3112
3117
|
], [, s, n] = t.find(([r]) => e < r);
|
|
3113
3118
|
return `${Math.floor(e / s)}${n} ago`;
|
|
3114
3119
|
};
|
|
3115
|
-
function
|
|
3120
|
+
function fa(i) {
|
|
3116
3121
|
const e = Math.floor(i / 1e3), t = [
|
|
3117
3122
|
{ label: "d", value: 86400 },
|
|
3118
3123
|
{ label: "h", value: 3600 },
|
|
@@ -3128,7 +3133,7 @@ function ga(i) {
|
|
|
3128
3133
|
return s.length ? s.join(" ") : "0s";
|
|
3129
3134
|
}
|
|
3130
3135
|
const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
3131
|
-
var
|
|
3136
|
+
var Y;
|
|
3132
3137
|
const {
|
|
3133
3138
|
scales: { x: t, y: s },
|
|
3134
3139
|
trade: { entries: n, exits: a, holdTime: r },
|
|
@@ -3136,7 +3141,7 @@ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
|
3136
3141
|
trade: { hold: o }
|
|
3137
3142
|
},
|
|
3138
3143
|
config: {
|
|
3139
|
-
trade: { showHoldTime: c, holdTimeContent: h, holdTimeDates: d, holdTimePrice:
|
|
3144
|
+
trade: { showHoldTime: c, holdTimeContent: h, holdTimeDates: d, holdTimePrice: f }
|
|
3140
3145
|
}
|
|
3141
3146
|
} = e;
|
|
3142
3147
|
if (!c) return;
|
|
@@ -3144,23 +3149,23 @@ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
|
3144
3149
|
if (!p || !_) return;
|
|
3145
3150
|
const v = (O) => O ? O instanceof Date ? O : new Date(O) : 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(
|
|
3146
3151
|
(O) => O.open_time <= w && O.close_time >= b
|
|
3147
|
-
), M = C.length > 0 ? C.reduce((O, oe) => oe.low < O ? oe.low : O, C[0].low) : ((
|
|
3152
|
+
), M = C.length > 0 ? C.reduce((O, oe) => oe.low < O ? oe.low : O, C[0].low) : ((Y = n.at(0)) == null ? void 0 : Y.price) ?? 0, T = s.convert(f || M);
|
|
3148
3153
|
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(x, T), i.lineTo(y, T), i.stroke(), i.setLineDash([]);
|
|
3149
|
-
const
|
|
3154
|
+
const k = (x + y) / 2, I = h || `Hold: ${fa(r)}`, Z = getComputedStyle(
|
|
3150
3155
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3151
3156
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3152
3157
|
i.font = `600 ${ma}px ${Z}`;
|
|
3153
|
-
const K = i.measureText(
|
|
3158
|
+
const K = i.measureText(I).width + pa * 2, z = va + _a * 2;
|
|
3154
3159
|
xi(i, {
|
|
3155
3160
|
radius: 4,
|
|
3156
3161
|
coords: {
|
|
3157
|
-
x:
|
|
3162
|
+
x: k - K / 2,
|
|
3158
3163
|
y: T - z / 2
|
|
3159
3164
|
},
|
|
3160
3165
|
width: K,
|
|
3161
3166
|
height: z,
|
|
3162
3167
|
fillColor: o.main
|
|
3163
|
-
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(
|
|
3168
|
+
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(I, k, T), i.restore();
|
|
3164
3169
|
};
|
|
3165
3170
|
class Fe {
|
|
3166
3171
|
constructor(e, t, {
|
|
@@ -3168,11 +3173,11 @@ class Fe {
|
|
|
3168
3173
|
noCanvas: n = !1,
|
|
3169
3174
|
noDOM: a = !1
|
|
3170
3175
|
} = {}) {
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3176
|
+
g(this, "canvas", null);
|
|
3177
|
+
g(this, "dom", null);
|
|
3178
|
+
g(this, "prefix");
|
|
3174
3179
|
const { width: r, height: o, canvasesContainer: c, domElements: h } = t;
|
|
3175
|
-
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${e}`, width: r, height: o }), c.append(this.canvas.node)), a || (this.dom = new
|
|
3180
|
+
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${e}`, width: r, height: o }), c.append(this.canvas.node)), a || (this.dom = new L({ className: `sc-charts-cs__dom-${e}` }), h.append(this.dom.node)), this.prefix = `sc-charts-cs__${e}`;
|
|
3176
3181
|
}
|
|
3177
3182
|
cx(...e) {
|
|
3178
3183
|
return e.map((t) => `${this.prefix}-${t}`).join(" ");
|
|
@@ -3194,9 +3199,9 @@ const ya = {
|
|
|
3194
3199
|
offset: n = 8
|
|
3195
3200
|
}) => {
|
|
3196
3201
|
const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (y) => {
|
|
3197
|
-
const { dx: C, dy: M } = ya[y], T = t.x + (C === 1 ? n : -a - n),
|
|
3198
|
-
return { x: T, y:
|
|
3199
|
-
}, d = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + a <= o && C + r <= c,
|
|
3202
|
+
const { dx: C, dy: M } = ya[y], T = t.x + (C === 1 ? n : -a - n), k = t.y + (M === 1 ? n : -r - n);
|
|
3203
|
+
return { x: T, y: k, side: y };
|
|
3204
|
+
}, d = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + a <= o && C + r <= c, f = () => {
|
|
3200
3205
|
const y = t.y < 0, C = t.y + r > c, M = t.x < 0, T = t.x + a > o;
|
|
3201
3206
|
return M && y ? "right-bottom" : M && C ? "right-top" : T && y ? "left-bottom" : T && C ? "left-top" : M ? "right-bottom" : T ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
|
|
3202
3207
|
}, _ = [
|
|
@@ -3205,7 +3210,7 @@ const ya = {
|
|
|
3205
3210
|
"right-top",
|
|
3206
3211
|
"left-bottom",
|
|
3207
3212
|
"left-top"
|
|
3208
|
-
].filter((y, C, M) => M.indexOf(y) === C), v =
|
|
3213
|
+
].filter((y, C, M) => M.indexOf(y) === C), v = f();
|
|
3209
3214
|
let b = null;
|
|
3210
3215
|
for (const y of [v, ..._]) {
|
|
3211
3216
|
const C = h(y);
|
|
@@ -3222,11 +3227,11 @@ const ya = {
|
|
|
3222
3227
|
side: b.side
|
|
3223
3228
|
};
|
|
3224
3229
|
};
|
|
3225
|
-
class ne extends
|
|
3230
|
+
class ne extends L {
|
|
3226
3231
|
constructor(t) {
|
|
3227
3232
|
super(t);
|
|
3228
|
-
|
|
3229
|
-
|
|
3233
|
+
g(this, "_state", {});
|
|
3234
|
+
g(this, "_updateScheduled", !1);
|
|
3230
3235
|
}
|
|
3231
3236
|
get state() {
|
|
3232
3237
|
return this._state;
|
|
@@ -3261,32 +3266,32 @@ class wa extends ne {
|
|
|
3261
3266
|
constructor(t) {
|
|
3262
3267
|
const s = "label-tooltip";
|
|
3263
3268
|
super({ className: t.cx(s) });
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
this.clsx = t.cxFabric(s), this.title = new
|
|
3269
|
+
g(this, "title");
|
|
3270
|
+
g(this, "manyBox");
|
|
3271
|
+
g(this, "oneBox");
|
|
3272
|
+
g(this, "clsx");
|
|
3273
|
+
this.clsx = t.cxFabric(s), this.title = new L({
|
|
3269
3274
|
tag: "div",
|
|
3270
3275
|
className: this.clsx("title")
|
|
3271
|
-
}), this.manyBox = new
|
|
3276
|
+
}), this.manyBox = new L({
|
|
3272
3277
|
tag: "div",
|
|
3273
3278
|
className: this.clsx("box_many")
|
|
3274
|
-
}), this.oneBox = new
|
|
3279
|
+
}), this.oneBox = new L({
|
|
3275
3280
|
tag: "div",
|
|
3276
3281
|
className: this.clsx("box_one")
|
|
3277
|
-
}), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent:
|
|
3282
|
+
}), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: G.empty() };
|
|
3278
3283
|
}
|
|
3279
3284
|
_createLineNodes(t, s) {
|
|
3280
3285
|
const n = [];
|
|
3281
3286
|
for (const a of Object.keys(s))
|
|
3282
3287
|
if (a in t) {
|
|
3283
|
-
const r = new
|
|
3288
|
+
const r = new L({
|
|
3284
3289
|
tag: "div",
|
|
3285
3290
|
className: this.clsx("line")
|
|
3286
3291
|
});
|
|
3287
3292
|
let o = t[a].toString();
|
|
3288
3293
|
a === "kind" && (o = this._formatDate(t.time));
|
|
3289
|
-
const c = new
|
|
3294
|
+
const c = new L({ tag: "strong", textContent: s[a] }), h = new L({ tag: "span", textContent: o });
|
|
3290
3295
|
r.append(c.node, h.node), n.push(r.node);
|
|
3291
3296
|
}
|
|
3292
3297
|
return n;
|
|
@@ -3316,7 +3321,7 @@ class wa extends ne {
|
|
|
3316
3321
|
} else if (t.length > 1) {
|
|
3317
3322
|
this.manyBox.node.style.display = "flex";
|
|
3318
3323
|
const s = t.map((n) => {
|
|
3319
|
-
const a = new
|
|
3324
|
+
const a = new L({ tag: "div" }), r = this._createLineNodes(n, {
|
|
3320
3325
|
kind: n.kind === "entry" ? "Entry:" : "Exit:",
|
|
3321
3326
|
price: "Price:"
|
|
3322
3327
|
});
|
|
@@ -3340,7 +3345,7 @@ class wa extends ne {
|
|
|
3340
3345
|
class xa extends Fe {
|
|
3341
3346
|
constructor(t) {
|
|
3342
3347
|
super("trade", t);
|
|
3343
|
-
|
|
3348
|
+
g(this, "labelTooltip");
|
|
3344
3349
|
if (!this.dom) throw new Error("[CS_V_Trade] this.dom must be defined");
|
|
3345
3350
|
if (!this.canvas) throw new Error("[CS_V_Trade] this.canvas must be defined");
|
|
3346
3351
|
this.labelTooltip = new wa(this), this.dom.append(this.labelTooltip.node);
|
|
@@ -3363,7 +3368,7 @@ const Sa = { text: "#FFFFFF", bg: "#000000" }, Aa = (i, e) => {
|
|
|
3363
3368
|
borderRadius: c = 0,
|
|
3364
3369
|
colors: h,
|
|
3365
3370
|
align: d = { x: "left", y: "top" }
|
|
3366
|
-
} = e,
|
|
3371
|
+
} = e, f = { ...Sa, ...h }, _ = getComputedStyle(
|
|
3367
3372
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3368
3373
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3369
3374
|
i.font = `${a} ${n}px ${_}`;
|
|
@@ -3374,16 +3379,16 @@ const Sa = { text: "#FFFFFF", bg: "#000000" }, Aa = (i, e) => {
|
|
|
3374
3379
|
coords: { x, y },
|
|
3375
3380
|
width: b,
|
|
3376
3381
|
height: w,
|
|
3377
|
-
fillColor:
|
|
3378
|
-
}), i.fillStyle =
|
|
3379
|
-
},
|
|
3382
|
+
fillColor: f.bg
|
|
3383
|
+
}), i.fillStyle = f.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, x + b / 2, y + w / 2);
|
|
3384
|
+
}, fi = {
|
|
3380
3385
|
line: "#000000",
|
|
3381
3386
|
text: "#ffffff",
|
|
3382
3387
|
main: "#000000"
|
|
3383
|
-
}, Ci = (i, { text: e, startLineCoords: t, side: s, colors: n =
|
|
3388
|
+
}, Ci = (i, { text: e, startLineCoords: t, side: s, colors: n = fi, dir: a = "h", endMarkerCoords: r }) => {
|
|
3384
3389
|
if (a === "h" && (s === "bottom" || s === "top"))
|
|
3385
3390
|
throw new Error("[drawMarker util]: Incorrect side or dir for this marker");
|
|
3386
|
-
const o = { ...
|
|
3391
|
+
const o = { ...fi, ...n };
|
|
3387
3392
|
i.save(), Ca(i, {
|
|
3388
3393
|
color: o.line,
|
|
3389
3394
|
lineWidth: 1,
|
|
@@ -3452,7 +3457,7 @@ class Ta extends Fe {
|
|
|
3452
3457
|
const Da = "sc-charts-cs";
|
|
3453
3458
|
class re {
|
|
3454
3459
|
constructor(e) {
|
|
3455
|
-
|
|
3460
|
+
g(this, "block");
|
|
3456
3461
|
this.block = e;
|
|
3457
3462
|
}
|
|
3458
3463
|
gen(e) {
|
|
@@ -3460,10 +3465,10 @@ class re {
|
|
|
3460
3465
|
}
|
|
3461
3466
|
}
|
|
3462
3467
|
const yt = new re("comment-actions");
|
|
3463
|
-
class ka extends
|
|
3468
|
+
class ka extends L {
|
|
3464
3469
|
constructor({ onDelete: e, onUpdate: t }) {
|
|
3465
3470
|
super({ className: yt.gen() });
|
|
3466
|
-
const s = new
|
|
3471
|
+
const s = new L({ tag: "button", className: yt.gen("edit"), textContent: "Edit" }), n = new L({
|
|
3467
3472
|
tag: "button",
|
|
3468
3473
|
className: yt.gen("delete"),
|
|
3469
3474
|
textContent: "Delete"
|
|
@@ -3475,7 +3480,7 @@ class ka extends k {
|
|
|
3475
3480
|
}), this.append(s.node, n.node);
|
|
3476
3481
|
}
|
|
3477
3482
|
}
|
|
3478
|
-
function
|
|
3483
|
+
function Lt(i, e) {
|
|
3479
3484
|
var n;
|
|
3480
3485
|
const t = (a) => {
|
|
3481
3486
|
if (!document.contains(i.node)) return;
|
|
@@ -3492,9 +3497,9 @@ function Et(i, e) {
|
|
|
3492
3497
|
document.removeEventListener("mousedown", t), s == null || s();
|
|
3493
3498
|
}, i;
|
|
3494
3499
|
}
|
|
3495
|
-
class
|
|
3500
|
+
class La {
|
|
3496
3501
|
constructor() {
|
|
3497
|
-
|
|
3502
|
+
g(this, "node");
|
|
3498
3503
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
3499
3504
|
t.setAttribute("width", "18"), t.setAttribute("height", "4"), t.setAttribute("viewBox", "0 0 18 4"), t.setAttribute("fill", "none"), t.setAttribute("xmlns", e);
|
|
3500
3505
|
const s = [
|
|
@@ -3531,16 +3536,16 @@ class Ea {
|
|
|
3531
3536
|
}
|
|
3532
3537
|
}
|
|
3533
3538
|
const Te = new re("comment-list");
|
|
3534
|
-
class
|
|
3539
|
+
class Ea extends L {
|
|
3535
3540
|
constructor({ onDelete: t, onOpenEditor: s, comment: n, layout: a }) {
|
|
3536
3541
|
super({ className: Te.gen("item") });
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
const r = new
|
|
3542
|
+
g(this, "actionTooltip");
|
|
3543
|
+
g(this, "actionsTrigger");
|
|
3544
|
+
const r = new L({ className: Te.gen("text"), textContent: n.text }), o = new L({
|
|
3540
3545
|
className: Te.gen("created-at"),
|
|
3541
|
-
textContent:
|
|
3546
|
+
textContent: ga(new Date(n.createdAt))
|
|
3542
3547
|
});
|
|
3543
|
-
this.actionsTrigger = new
|
|
3548
|
+
this.actionsTrigger = new L({
|
|
3544
3549
|
tag: "button",
|
|
3545
3550
|
className: Te.gen("action-trigger")
|
|
3546
3551
|
});
|
|
@@ -3548,18 +3553,18 @@ class La extends k {
|
|
|
3548
3553
|
onDelete: t,
|
|
3549
3554
|
onUpdate: s
|
|
3550
3555
|
});
|
|
3551
|
-
this.actionTooltip =
|
|
3556
|
+
this.actionTooltip = Lt(c, () => {
|
|
3552
3557
|
this.actionTooltip.setVisible(!1);
|
|
3553
3558
|
}), this.actionsTrigger.node.addEventListener("click", () => {
|
|
3554
3559
|
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);
|
|
3555
3560
|
});
|
|
3556
|
-
const h = new
|
|
3557
|
-
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new
|
|
3561
|
+
const h = new L({ className: Te.gen("text-wrap") });
|
|
3562
|
+
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new La().node), this.append(h.node, o.node);
|
|
3558
3563
|
}
|
|
3559
3564
|
}
|
|
3560
3565
|
class Na {
|
|
3561
3566
|
constructor() {
|
|
3562
|
-
|
|
3567
|
+
g(this, "node");
|
|
3563
3568
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
3564
3569
|
t.setAttribute("width", "14"), t.setAttribute("height", "12"), t.setAttribute("viewBox", "0 0 14 12"), t.setAttribute("fill", "none"), t.setAttribute("xmlns", e);
|
|
3565
3570
|
const s = document.createElementNS(e, "path");
|
|
@@ -3571,7 +3576,7 @@ class Na {
|
|
|
3571
3576
|
}
|
|
3572
3577
|
class Fa {
|
|
3573
3578
|
constructor() {
|
|
3574
|
-
|
|
3579
|
+
g(this, "node");
|
|
3575
3580
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
3576
3581
|
t.setAttribute("width", "10"), t.setAttribute("height", "10"), t.setAttribute("viewBox", "0 0 10 10"), t.setAttribute("fill", "none"), t.setAttribute("xmlns", e);
|
|
3577
3582
|
const s = document.createElementNS(e, "path");
|
|
@@ -3584,19 +3589,19 @@ class Fa {
|
|
|
3584
3589
|
class Ha extends ne {
|
|
3585
3590
|
constructor(t) {
|
|
3586
3591
|
super({ className: "sc-charts-cs__comments-edit" });
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
this._onSave = t.onSave, this._onCancel = t.onCancel, this.input = new
|
|
3592
|
+
g(this, "input");
|
|
3593
|
+
g(this, "saveBtn");
|
|
3594
|
+
g(this, "cancelBtn");
|
|
3595
|
+
g(this, "_onSave");
|
|
3596
|
+
g(this, "_onCancel");
|
|
3597
|
+
this._onSave = t.onSave, this._onCancel = t.onCancel, this.input = new L({ tag: "textarea", className: "sc-charts-cs__comments-edit-input" }), this.saveBtn = new L({
|
|
3593
3598
|
tag: "button",
|
|
3594
3599
|
className: "sc-charts-cs__comments-edit-save-btn"
|
|
3595
|
-
}), this.saveBtn.append(new Na().node), this.cancelBtn = new
|
|
3600
|
+
}), this.saveBtn.append(new Na().node), this.cancelBtn = new L({
|
|
3596
3601
|
tag: "button",
|
|
3597
3602
|
className: "sc-charts-cs__comments-edit-cancel-btn"
|
|
3598
3603
|
}), this.cancelBtn.append(new Fa().node);
|
|
3599
|
-
const s = new
|
|
3604
|
+
const s = new L({ className: "sc-charts-cs__comments-edit-btn-container" });
|
|
3600
3605
|
s.append(this.cancelBtn.node, this.saveBtn.node), this.append(this.input.node, s.node), this.state = { inputValue: t.initialValue || "", hasInitFocused: !1 }, this._setupListeners(), this.render();
|
|
3601
3606
|
}
|
|
3602
3607
|
_setupListeners() {
|
|
@@ -3611,13 +3616,13 @@ class Ha extends ne {
|
|
|
3611
3616
|
this.input.node.value = this.state.inputValue, this.saveBtn.node.disabled = !this.state.inputValue.trim(), this.state.hasInitFocused || (requestAnimationFrame(() => this.input.node.focus()), this.setState({ hasInitFocused: !0 }));
|
|
3612
3617
|
}
|
|
3613
3618
|
}
|
|
3614
|
-
const
|
|
3615
|
-
class
|
|
3619
|
+
const Ia = new re("comment-list");
|
|
3620
|
+
class Ba extends ne {
|
|
3616
3621
|
constructor(t, s, n, a = {}) {
|
|
3617
|
-
super({ tag: "ul", className:
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3622
|
+
super({ tag: "ul", className: Ia.gen(), ...a });
|
|
3623
|
+
g(this, "_elements", {});
|
|
3624
|
+
g(this, "_model");
|
|
3625
|
+
g(this, "_view");
|
|
3621
3626
|
this._model = s, this._view = n, this.state = { items: t, editId: null }, this.render();
|
|
3622
3627
|
}
|
|
3623
3628
|
render() {
|
|
@@ -3639,7 +3644,7 @@ class Ia extends ne {
|
|
|
3639
3644
|
},
|
|
3640
3645
|
initialValue: t.text
|
|
3641
3646
|
});
|
|
3642
|
-
const s = new
|
|
3647
|
+
const s = new Ea({
|
|
3643
3648
|
onDelete: () => {
|
|
3644
3649
|
this._model.comments.remove(t.id), s.actionTooltip.setVisible(!1);
|
|
3645
3650
|
},
|
|
@@ -3657,7 +3662,7 @@ class Ia extends ne {
|
|
|
3657
3662
|
}
|
|
3658
3663
|
class Ra {
|
|
3659
3664
|
constructor() {
|
|
3660
|
-
|
|
3665
|
+
g(this, "node");
|
|
3661
3666
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
3662
3667
|
t.setAttribute("width", "14"), t.setAttribute("height", "14"), t.setAttribute("viewBox", "0 0 14 14"), t.setAttribute("fill", "none"), t.setAttribute("xmlns", e);
|
|
3663
3668
|
const s = document.createElementNS(e, "path");
|
|
@@ -3667,20 +3672,20 @@ class Ra {
|
|
|
3667
3672
|
), s.setAttribute("stroke", "currentColor"), s.setAttribute("stroke-linecap", "round"), s.setAttribute("stroke-linejoin", "round"), t.appendChild(s), this.node = t;
|
|
3668
3673
|
}
|
|
3669
3674
|
}
|
|
3670
|
-
const
|
|
3675
|
+
const qe = new re(""), wt = new re("add-field");
|
|
3671
3676
|
class Si extends ne {
|
|
3672
3677
|
constructor({ onAdd: t, blockName: s }) {
|
|
3673
|
-
|
|
3674
|
-
super({ className:
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
this._onAdd = t, this.state = { inputValue: "" }, this.input = new
|
|
3678
|
+
qe.block = s;
|
|
3679
|
+
super({ className: qe.gen() + " " + wt.gen() });
|
|
3680
|
+
g(this, "btn");
|
|
3681
|
+
g(this, "input");
|
|
3682
|
+
g(this, "_onAdd");
|
|
3683
|
+
this._onAdd = t, this.state = { inputValue: "" }, this.input = new L({
|
|
3679
3684
|
tag: "input",
|
|
3680
|
-
className:
|
|
3681
|
-
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new
|
|
3685
|
+
className: qe.gen("input") + " " + wt.gen("input")
|
|
3686
|
+
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new L({
|
|
3682
3687
|
tag: "button",
|
|
3683
|
-
className:
|
|
3688
|
+
className: qe.gen("btn") + " " + wt.gen("btn")
|
|
3684
3689
|
}), this.btn.append(new Ra().node), this.append(this.input.node, this.btn.node), this._setupListeners(), this.render();
|
|
3685
3690
|
}
|
|
3686
3691
|
_addComment() {
|
|
@@ -3704,12 +3709,12 @@ const $a = new re("list-tooltip"), xt = 8;
|
|
|
3704
3709
|
class Oa extends ne {
|
|
3705
3710
|
constructor(t, s, n) {
|
|
3706
3711
|
super({ className: $a.gen() });
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new
|
|
3712
|
+
g(this, "_list");
|
|
3713
|
+
g(this, "_addField");
|
|
3714
|
+
g(this, "_size", null);
|
|
3715
|
+
g(this, "_model");
|
|
3716
|
+
g(this, "_prevIsShow", !1);
|
|
3717
|
+
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ba(t, s, n), this._addField = new Si({
|
|
3713
3718
|
blockName: "list-tooltip-add",
|
|
3714
3719
|
onAdd: (a) => {
|
|
3715
3720
|
const r = t[0].date, o = t[0].price, c = {
|
|
@@ -3735,7 +3740,7 @@ class Oa extends ne {
|
|
|
3735
3740
|
}
|
|
3736
3741
|
class Pa {
|
|
3737
3742
|
constructor() {
|
|
3738
|
-
|
|
3743
|
+
g(this, "node");
|
|
3739
3744
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
3740
3745
|
t.setAttribute("width", "16"), t.setAttribute("height", "16"), t.setAttribute("viewBox", "0 0 16 16"), t.setAttribute("fill", "none"), t.setAttribute("xmlns", e);
|
|
3741
3746
|
const s = document.createElementNS(e, "path");
|
|
@@ -3748,7 +3753,7 @@ class Pa {
|
|
|
3748
3753
|
class za extends ne {
|
|
3749
3754
|
constructor({ x: t, ...s }, n) {
|
|
3750
3755
|
super(s);
|
|
3751
|
-
|
|
3756
|
+
g(this, "_colors");
|
|
3752
3757
|
this._colors = n.colorScheme.comments.scaleAnchor, this.state = {
|
|
3753
3758
|
x: t,
|
|
3754
3759
|
y: n.layout.xAxis.top,
|
|
@@ -3766,12 +3771,12 @@ const mi = new re("comment-box");
|
|
|
3766
3771
|
class Va extends ne {
|
|
3767
3772
|
constructor({ boxId: t, model: s, view: n, comments: a, coords: r, onBoxActivate: o, onBoxDeactivate: c }) {
|
|
3768
3773
|
super({ className: mi.gen() });
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3774
|
+
g(this, "pointer", new L({ className: "sc-charts-cs__comments-pointer" }));
|
|
3775
|
+
g(this, "tooltip");
|
|
3776
|
+
g(this, "anchor");
|
|
3777
|
+
g(this, "_onBoxActivate");
|
|
3778
|
+
g(this, "_onBoxDeactivate");
|
|
3779
|
+
g(this, "_boxId");
|
|
3775
3780
|
this._boxId = t, this._onBoxActivate = o, this._onBoxDeactivate = c, this.state = {
|
|
3776
3781
|
isActive: !1,
|
|
3777
3782
|
comments: a,
|
|
@@ -3779,7 +3784,7 @@ class Va extends ne {
|
|
|
3779
3784
|
}, this.pointer.position(r), this.anchor = new za({ x: r.x, className: mi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
|
|
3780
3785
|
const h = !this.state.isActive;
|
|
3781
3786
|
h ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: h });
|
|
3782
|
-
}), this.tooltip =
|
|
3787
|
+
}), this.tooltip = Lt(new Oa(a, s, n), (h) => {
|
|
3783
3788
|
this.state.isActive && (this.anchor.node.contains(h.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
|
|
3784
3789
|
}), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
|
|
3785
3790
|
}
|
|
@@ -3790,11 +3795,11 @@ class Va extends ne {
|
|
|
3790
3795
|
}
|
|
3791
3796
|
class Wa {
|
|
3792
3797
|
static animateTo(e, t, s, n) {
|
|
3793
|
-
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,
|
|
3798
|
+
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, f = (p) => {
|
|
3794
3799
|
const _ = p - c, v = Math.min(_ / o, 1), b = v * v * (3 - 2 * v), w = h + (a - h) * b, x = d + (r - d) * b;
|
|
3795
|
-
e.scales.pan("x", w, "absolute"), e.scales.pan("y", x, "absolute"), v < 1 ? requestAnimationFrame(
|
|
3800
|
+
e.scales.pan("x", w, "absolute"), e.scales.pan("y", x, "absolute"), v < 1 ? requestAnimationFrame(f) : n == null || n();
|
|
3796
3801
|
};
|
|
3797
|
-
requestAnimationFrame(
|
|
3802
|
+
requestAnimationFrame(f);
|
|
3798
3803
|
}
|
|
3799
3804
|
static animateToDataCoords(e, t, s, n) {
|
|
3800
3805
|
const a = typeof t == "number" ? e.scales.x.convert(new Date(t)) : e.scales.x.convert(t), r = e.scales.y.convert(s);
|
|
@@ -3805,13 +3810,13 @@ const Ct = new re("comments-context");
|
|
|
3805
3810
|
class Ya extends ne {
|
|
3806
3811
|
constructor() {
|
|
3807
3812
|
super({ className: Ct.gen() });
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new
|
|
3813
|
+
g(this, "pointer");
|
|
3814
|
+
g(this, "addField");
|
|
3815
|
+
g(this, "menu");
|
|
3816
|
+
g(this, "_size", null);
|
|
3817
|
+
g(this, "_model", null);
|
|
3818
|
+
g(this, "_candle", null);
|
|
3819
|
+
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new L({ className: Ct.gen("pointer") }), this.menu = new L({ className: Ct.gen("menu") }), Lt(this.menu, () => {
|
|
3815
3820
|
this.setState({ isShow: !1 });
|
|
3816
3821
|
}), this.addField = new Si({
|
|
3817
3822
|
blockName: "context-add",
|
|
@@ -3850,9 +3855,9 @@ class Ya extends ne {
|
|
|
3850
3855
|
class ja extends Fe {
|
|
3851
3856
|
constructor(t) {
|
|
3852
3857
|
super("comments", t, { noCanvas: !0 });
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3858
|
+
g(this, "boxes", {});
|
|
3859
|
+
g(this, "contextMenu");
|
|
3860
|
+
g(this, "_view");
|
|
3856
3861
|
if (!this.dom) throw new Error("[CS_V_Comments] this.dom must be defined");
|
|
3857
3862
|
this.contextMenu = new Ya(), this._view = t, t.domElements.append(this.contextMenu.node);
|
|
3858
3863
|
}
|
|
@@ -3935,9 +3940,9 @@ class Ua extends Fe {
|
|
|
3935
3940
|
class Ga extends ne {
|
|
3936
3941
|
constructor(t) {
|
|
3937
3942
|
super({ className: t });
|
|
3938
|
-
|
|
3939
|
-
const s = new
|
|
3940
|
-
s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent:
|
|
3943
|
+
g(this, "_isFirstShow", !1);
|
|
3944
|
+
const s = new L({ tag: "p" });
|
|
3945
|
+
s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: G.empty() }, this.render();
|
|
3941
3946
|
}
|
|
3942
3947
|
render() {
|
|
3943
3948
|
const { isShow: t, x: s, y: n, parent: a } = this.state;
|
|
@@ -3953,8 +3958,8 @@ class Ga extends ne {
|
|
|
3953
3958
|
class Za extends Ne {
|
|
3954
3959
|
constructor(t) {
|
|
3955
3960
|
super(t);
|
|
3956
|
-
|
|
3957
|
-
|
|
3961
|
+
g(this, "domain", null);
|
|
3962
|
+
g(this, "_getVisible", (t) => {
|
|
3958
3963
|
if (!this.domain) return [];
|
|
3959
3964
|
const [s, n] = this.domain;
|
|
3960
3965
|
return t.filter((a) => a.open_time >= s && a.open_time <= n);
|
|
@@ -3974,14 +3979,14 @@ class Za extends Ne {
|
|
|
3974
3979
|
candles: { hideMissingData: c }
|
|
3975
3980
|
}
|
|
3976
3981
|
} = t, h = t.config.candles.style === "filled";
|
|
3977
|
-
this.domain = t.scales.x.domain(), c || this._getVisible(r).forEach((d,
|
|
3978
|
-
const p = s.noDataFill[
|
|
3982
|
+
this.domain = t.scales.x.domain(), c || this._getVisible(r).forEach((d, f) => {
|
|
3983
|
+
const p = s.noDataFill[f % s.noDataFill.length], _ = h ? p : s.noDataStroke;
|
|
3979
3984
|
this.drawSingleCandle({
|
|
3980
3985
|
...this._getBasicCandleProps(t, d),
|
|
3981
3986
|
colors: { fill: p, stroke: _, bg: n }
|
|
3982
3987
|
});
|
|
3983
3988
|
}), this._getVisible(o).forEach((d) => {
|
|
3984
|
-
const
|
|
3989
|
+
const f = d.close >= d.open ? "rising" : "falling", p = s[`${f}Fill`], _ = s[`${f}${h ? "Fill" : "Stroke"}`];
|
|
3985
3990
|
this.drawSingleCandle({
|
|
3986
3991
|
...this._getBasicCandleProps(t, d),
|
|
3987
3992
|
colors: { fill: p, stroke: _, bg: n },
|
|
@@ -4009,11 +4014,11 @@ class Za extends Ne {
|
|
|
4009
4014
|
class qa extends Fe {
|
|
4010
4015
|
constructor(t) {
|
|
4011
4016
|
super("candles", t, { CanvasClass: Za });
|
|
4012
|
-
|
|
4013
|
-
|
|
4017
|
+
g(this, "_noDataTooltip", null);
|
|
4018
|
+
g(this, "limiter");
|
|
4014
4019
|
if (!this.dom) throw new Error("[CS_V_Candles] this.dom must be defined");
|
|
4015
4020
|
if (!this.canvas) throw new Error("[CS_V_Candles] this.canvas must be defined");
|
|
4016
|
-
this._noDataTooltip = new Ga(this.cx("no-data")), this.limiter = new
|
|
4021
|
+
this._noDataTooltip = new Ga(this.cx("no-data")), this.limiter = new L({ className: this.cx("limiter") }), this.limiter.setVisible(!1), this.dom.append(this._noDataTooltip.node, this.limiter.node);
|
|
4017
4022
|
}
|
|
4018
4023
|
get noDataTooltip() {
|
|
4019
4024
|
return this._noDataTooltip;
|
|
@@ -4033,35 +4038,55 @@ class qa extends Fe {
|
|
|
4033
4038
|
}
|
|
4034
4039
|
class Ja {
|
|
4035
4040
|
constructor(e) {
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
this
|
|
4041
|
+
g(this, "container");
|
|
4042
|
+
g(this, "width");
|
|
4043
|
+
g(this, "height");
|
|
4044
|
+
g(this, "wrapper");
|
|
4045
|
+
g(this, "domElements");
|
|
4046
|
+
g(this, "canvasesContainer");
|
|
4047
|
+
g(this, "mainCanvas");
|
|
4048
|
+
g(this, "binding");
|
|
4049
|
+
g(this, "userMarkers");
|
|
4050
|
+
g(this, "guideMarkers");
|
|
4051
|
+
g(this, "trade");
|
|
4052
|
+
g(this, "comments");
|
|
4053
|
+
g(this, "candles");
|
|
4054
|
+
g(this, "_logoImage");
|
|
4055
|
+
g(this, "_logoSrc");
|
|
4056
|
+
this.container = e, this.wrapper = new L({ tag: "div", className: "sc-charts-cs" }), e.append(this.wrapper.node);
|
|
4050
4057
|
const { width: t, height: s } = e.getBoundingClientRect();
|
|
4051
4058
|
this.width = t, this.height = s, this.mainCanvas = new Ne({
|
|
4052
4059
|
className: "sc-charts-cs__canvas-main",
|
|
4053
4060
|
width: t,
|
|
4054
4061
|
height: s,
|
|
4055
4062
|
isMain: !0
|
|
4056
|
-
}), this.domElements = new
|
|
4063
|
+
}), this.domElements = new L({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new L({ tag: "div", className: "sc-charts-cs__canvases" }), this.canvasesContainer.append(this.mainCanvas.node), this.wrapper.append(this.canvasesContainer.node, this.domElements.node), this.mainCanvas.updateAbsolutePosition(), this.binding = new Rn(this.mainCanvas.node), this.comments = new ja(this), this.candles = new qa(this), this.trade = new xa(this), this.guideMarkers = new Ua(this), this.userMarkers = new Ta(this);
|
|
4064
|
+
}
|
|
4065
|
+
_prepareLogo(e) {
|
|
4066
|
+
const t = e.config.logo;
|
|
4067
|
+
if (!(t != null && t.src)) {
|
|
4068
|
+
this._logoImage = void 0, this._logoSrc = void 0;
|
|
4069
|
+
return;
|
|
4070
|
+
}
|
|
4071
|
+
if (t.src === this._logoSrc) return;
|
|
4072
|
+
const s = new Image();
|
|
4073
|
+
s.crossOrigin = "anonymous", s.src = t.src, s.onload = () => {
|
|
4074
|
+
this._logoImage = s, this._logoSrc = t.src, this.renderAll(e);
|
|
4075
|
+
};
|
|
4076
|
+
}
|
|
4077
|
+
_drawLogo(e) {
|
|
4078
|
+
const t = e.config.logo, s = this._logoImage;
|
|
4079
|
+
if (!t || !s) return;
|
|
4080
|
+
const n = this.mainCanvas.ctx, a = this.mainCanvas, r = t.margin ?? 24, o = t.width ?? 120, c = o / s.width, h = s.height * c, d = a.width - o - r, f = a.height - h - r;
|
|
4081
|
+
n.save(), n.globalAlpha = t.opacity ?? 0.2, n.drawImage(s, d, f, o, h), n.restore();
|
|
4057
4082
|
}
|
|
4058
4083
|
renderAll(e) {
|
|
4059
|
-
this.mainCanvas.clear(), this.candles.render(e), bt.xAxis(this.mainCanvas.ctx, e), bt.yAxis(this.mainCanvas.ctx, e), bt.intersection(this.mainCanvas.ctx, e), this.trade.renderAll(e), this.userMarkers.render(e), this.comments.render(e);
|
|
4084
|
+
this._prepareLogo(e), this.mainCanvas.clear(), this.candles.render(e), bt.xAxis(this.mainCanvas.ctx, e), bt.yAxis(this.mainCanvas.ctx, e), bt.intersection(this.mainCanvas.ctx, e), this.trade.renderAll(e), this.userMarkers.render(e), this.comments.render(e), this._drawLogo(e);
|
|
4060
4085
|
}
|
|
4061
4086
|
}
|
|
4062
4087
|
class Qa {
|
|
4063
4088
|
constructor(e) {
|
|
4064
|
-
|
|
4089
|
+
g(this, "logColors", {
|
|
4065
4090
|
init_model: "color: green",
|
|
4066
4091
|
scale_event: "color: orange",
|
|
4067
4092
|
update_config: "color: blue",
|
|
@@ -4070,7 +4095,7 @@ class Qa {
|
|
|
4070
4095
|
update_user_markers: "color: brown",
|
|
4071
4096
|
update_color_scheme: "color: teal"
|
|
4072
4097
|
});
|
|
4073
|
-
|
|
4098
|
+
g(this, "ignoredLogEvents", []);
|
|
4074
4099
|
e && (this.ignoredLogEvents = e);
|
|
4075
4100
|
}
|
|
4076
4101
|
log(e, t) {
|
|
@@ -4087,10 +4112,10 @@ class Qa {
|
|
|
4087
4112
|
}
|
|
4088
4113
|
class Ka {
|
|
4089
4114
|
constructor(e, t) {
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4115
|
+
g(this, "_model");
|
|
4116
|
+
g(this, "_view");
|
|
4117
|
+
g(this, "_enableLogging");
|
|
4118
|
+
g(this, "_logger");
|
|
4094
4119
|
this._model = e, this._view = t, this._enableLogging = !1, this._logger = new Qa(["scale_event"]);
|
|
4095
4120
|
}
|
|
4096
4121
|
subscribeWithLogging(e, t) {
|
|
@@ -4146,7 +4171,7 @@ class Ka {
|
|
|
4146
4171
|
}
|
|
4147
4172
|
class pi {
|
|
4148
4173
|
constructor() {
|
|
4149
|
-
|
|
4174
|
+
g(this, "_map", /* @__PURE__ */ new Map());
|
|
4150
4175
|
}
|
|
4151
4176
|
add(e, t, s) {
|
|
4152
4177
|
let n = this._map.get(e);
|
|
@@ -4177,10 +4202,10 @@ class pi {
|
|
|
4177
4202
|
}
|
|
4178
4203
|
class er {
|
|
4179
4204
|
constructor() {
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4205
|
+
g(this, "_elements", []);
|
|
4206
|
+
g(this, "_listeners", new pi());
|
|
4207
|
+
g(this, "_lastHovered", /* @__PURE__ */ new Set());
|
|
4208
|
+
g(this, "_dragContext", null);
|
|
4184
4209
|
}
|
|
4185
4210
|
get isDragging() {
|
|
4186
4211
|
return this._dragContext !== null;
|
|
@@ -4334,8 +4359,8 @@ class tr {
|
|
|
4334
4359
|
}
|
|
4335
4360
|
} = this.model;
|
|
4336
4361
|
for (const o of s) {
|
|
4337
|
-
const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low),
|
|
4338
|
-
if (e >=
|
|
4362
|
+
const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low), f = c - r / 2, p = c + r / 2, _ = Math.min(h, d), v = Math.max(h, d);
|
|
4363
|
+
if (e >= f && e <= p && t >= _ && t <= v)
|
|
4339
4364
|
return {
|
|
4340
4365
|
target: this,
|
|
4341
4366
|
x: e,
|
|
@@ -4349,9 +4374,9 @@ class tr {
|
|
|
4349
4374
|
}
|
|
4350
4375
|
class ir {
|
|
4351
4376
|
constructor(e, t) {
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4377
|
+
g(this, "_model");
|
|
4378
|
+
g(this, "_hitManager");
|
|
4379
|
+
g(this, "_hit");
|
|
4355
4380
|
this._model = e, this._hitManager = t, this._hit = new tr(e), this._hitManager.register(this._hit);
|
|
4356
4381
|
}
|
|
4357
4382
|
register() {
|
|
@@ -4372,11 +4397,11 @@ class sr {
|
|
|
4372
4397
|
hitTest(e, t) {
|
|
4373
4398
|
const { tradedCandles: s } = this.model.trade, { x: n, y: a } = this.model.scales, r = 16, o = 4;
|
|
4374
4399
|
for (const { candle: c, trades: h } of s) {
|
|
4375
|
-
const
|
|
4400
|
+
const f = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, p = r, _ = r;
|
|
4376
4401
|
for (const v of ["buy", "sell"]) {
|
|
4377
4402
|
const b = h.filter((C) => C.type === v);
|
|
4378
4403
|
if (!b.length) continue;
|
|
4379
|
-
const w = v === "buy" ? a.convert(c.low) + o +
|
|
4404
|
+
const w = v === "buy" ? a.convert(c.low) + o + Qe(r) : a.convert(c.high) - o - r - Qe(r), x = e >= f - p / 2 && e <= f + p / 2, y = t >= w && t <= w + _;
|
|
4380
4405
|
if (x && y)
|
|
4381
4406
|
return {
|
|
4382
4407
|
target: this,
|
|
@@ -4394,9 +4419,9 @@ class sr {
|
|
|
4394
4419
|
}
|
|
4395
4420
|
class nr {
|
|
4396
4421
|
constructor(e, t) {
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4422
|
+
g(this, "_model");
|
|
4423
|
+
g(this, "_hitManager");
|
|
4424
|
+
g(this, "_tradeLabelHit");
|
|
4400
4425
|
this._model = e, this._hitManager = t, this._tradeLabelHit = new sr(e), this._hitManager.register(this._tradeLabelHit);
|
|
4401
4426
|
}
|
|
4402
4427
|
register() {
|
|
@@ -4405,7 +4430,7 @@ class nr {
|
|
|
4405
4430
|
if (!t) return;
|
|
4406
4431
|
const s = this._model.scales.x.convert(t.candle.open_time), n = this._model.scales.y.convert(
|
|
4407
4432
|
t.trades[0].type === "buy" ? t.candle.low : t.candle.high
|
|
4408
|
-
), a = t.trades[0].type === "buy" ? n + 4 +
|
|
4433
|
+
), a = t.trades[0].type === "buy" ? n + 4 + Qe(16) + 8 : n - 4 - 16 - Qe(16) + 8;
|
|
4409
4434
|
this._model.eventBus.emit("open_trade_label_tooltip", {
|
|
4410
4435
|
trade: { candle: t.candle, trades: t.trades, tradeType: t.tradeType },
|
|
4411
4436
|
x: s,
|
|
@@ -4489,18 +4514,18 @@ function At(i, e) {
|
|
|
4489
4514
|
function Mt(i) {
|
|
4490
4515
|
return i.candles.limiter.absolutePosition.width > 0;
|
|
4491
4516
|
}
|
|
4492
|
-
class
|
|
4517
|
+
class Et {
|
|
4493
4518
|
constructor(e, t, s) {
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4519
|
+
g(this, "_model");
|
|
4520
|
+
g(this, "_hitManager");
|
|
4521
|
+
g(this, "_hit");
|
|
4497
4522
|
this._model = e, this._hitManager = t, this._hit = s, t.register(s);
|
|
4498
4523
|
}
|
|
4499
4524
|
}
|
|
4500
|
-
class hr extends
|
|
4525
|
+
class hr extends Et {
|
|
4501
4526
|
constructor(t, s, n) {
|
|
4502
4527
|
super(t, s, new ar(t));
|
|
4503
|
-
|
|
4528
|
+
g(this, "_view");
|
|
4504
4529
|
this._view = n;
|
|
4505
4530
|
}
|
|
4506
4531
|
register() {
|
|
@@ -4512,7 +4537,7 @@ class hr extends Lt {
|
|
|
4512
4537
|
});
|
|
4513
4538
|
}
|
|
4514
4539
|
}
|
|
4515
|
-
class dr extends
|
|
4540
|
+
class dr extends Et {
|
|
4516
4541
|
constructor(e, t) {
|
|
4517
4542
|
super(e, t, new or(e));
|
|
4518
4543
|
}
|
|
@@ -4525,10 +4550,10 @@ class dr extends Lt {
|
|
|
4525
4550
|
});
|
|
4526
4551
|
}
|
|
4527
4552
|
}
|
|
4528
|
-
class ur extends
|
|
4553
|
+
class ur extends Et {
|
|
4529
4554
|
constructor(t, s, n) {
|
|
4530
4555
|
super(t, n, new rr(t));
|
|
4531
|
-
|
|
4556
|
+
g(this, "_view");
|
|
4532
4557
|
this._view = s;
|
|
4533
4558
|
}
|
|
4534
4559
|
register() {
|
|
@@ -4557,32 +4582,32 @@ class ur extends Lt {
|
|
|
4557
4582
|
});
|
|
4558
4583
|
}
|
|
4559
4584
|
}
|
|
4560
|
-
class
|
|
4585
|
+
class gr {
|
|
4561
4586
|
constructor(e, t, s) {
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4587
|
+
g(this, "_hitManager");
|
|
4588
|
+
g(this, "_candlesHandler");
|
|
4589
|
+
g(this, "_tradeLabelsHandler");
|
|
4590
|
+
g(this, "_xAxisHandler");
|
|
4591
|
+
g(this, "_yAxisHandler");
|
|
4592
|
+
g(this, "_areaHandler");
|
|
4568
4593
|
this._hitManager = s, this._candlesHandler = new ir(e, this._hitManager), this._tradeLabelsHandler = new nr(e, this._hitManager), this._xAxisHandler = new hr(e, this._hitManager, t), this._yAxisHandler = new dr(e, this._hitManager), this._areaHandler = new ur(e, t, this._hitManager);
|
|
4569
4594
|
}
|
|
4570
4595
|
register() {
|
|
4571
4596
|
this._candlesHandler.register(), this._tradeLabelsHandler.register(), this._xAxisHandler.register(), this._yAxisHandler.register(), this._areaHandler.register();
|
|
4572
4597
|
}
|
|
4573
4598
|
}
|
|
4574
|
-
class
|
|
4599
|
+
class fr {
|
|
4575
4600
|
constructor(e, t) {
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4601
|
+
g(this, "_model");
|
|
4602
|
+
g(this, "_view");
|
|
4603
|
+
g(this, "_subscriptionsManager");
|
|
4604
|
+
g(this, "_hitManager", new er());
|
|
4605
|
+
g(this, "_boundMouseMove", this.onDocumentMouseMove.bind(this));
|
|
4606
|
+
g(this, "_boundMouseUp", this.onDocumentMouseUp.bind(this));
|
|
4582
4607
|
this._model = e, this._view = t, this._subscriptionsManager = new Ka(e, t);
|
|
4583
4608
|
}
|
|
4584
4609
|
init() {
|
|
4585
|
-
this._subscriptionsManager.init(), this._model.init(), this._view.binding.mousemove(this.onMouseMove.bind(this)), this._view.binding.mousedown(this.onMouseDown.bind(this)), this._view.binding.mouseup(this.onMouseUp.bind(this)), this._view.binding.wheel(this.onWheel.bind(this)), this._view.binding.mouseleave(this.onMouseLeave.bind(this)), this._view.binding.dblclick(this.onDoubleClick.bind(this)), this._view.binding.contextmenu(this.onContextMenu.bind(this)), window.addEventListener("scroll", this.onWindowScroll.bind(this), { passive: !0 }), document.addEventListener("click", this.onDocumentClick.bind(this)), new
|
|
4610
|
+
this._subscriptionsManager.init(), this._model.init(), this._view.binding.mousemove(this.onMouseMove.bind(this)), this._view.binding.mousedown(this.onMouseDown.bind(this)), this._view.binding.mouseup(this.onMouseUp.bind(this)), this._view.binding.wheel(this.onWheel.bind(this)), this._view.binding.mouseleave(this.onMouseLeave.bind(this)), this._view.binding.dblclick(this.onDoubleClick.bind(this)), this._view.binding.contextmenu(this.onContextMenu.bind(this)), window.addEventListener("scroll", this.onWindowScroll.bind(this), { passive: !0 }), document.addEventListener("click", this.onDocumentClick.bind(this)), new gr(this._model, this._view, this._hitManager).register();
|
|
4586
4611
|
}
|
|
4587
4612
|
onContextMenu(e) {
|
|
4588
4613
|
e.preventDefault();
|
|
@@ -4640,10 +4665,10 @@ class gr {
|
|
|
4640
4665
|
}
|
|
4641
4666
|
class _r {
|
|
4642
4667
|
constructor(e, { chartId: t, candles: s, config: n, trade: a, userMarkers: r, colorScheme: o, comments: c, renderLimiter: h }) {
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4668
|
+
g(this, "_model");
|
|
4669
|
+
g(this, "_view");
|
|
4670
|
+
g(this, "_controller");
|
|
4671
|
+
g(this, "_candlesLimiterClean");
|
|
4647
4672
|
const d = document.querySelector(e);
|
|
4648
4673
|
if (!d) throw new Error(`Element with selector "${e}" not found!`);
|
|
4649
4674
|
if (!t || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(t))
|
|
@@ -4659,9 +4684,9 @@ class _r {
|
|
|
4659
4684
|
userMarkers: r,
|
|
4660
4685
|
colorScheme: o,
|
|
4661
4686
|
comments: c
|
|
4662
|
-
}), this._view = new Ja(d), this._controller = new
|
|
4663
|
-
const
|
|
4664
|
-
this._view.candles.limiter.updateAbsolutePosition(), typeof
|
|
4687
|
+
}), this._view = new Ja(d), this._controller = new fr(this._model, this._view), h) {
|
|
4688
|
+
const f = h(this._view.candles.limiter.node);
|
|
4689
|
+
this._view.candles.limiter.updateAbsolutePosition(), typeof f == "function" && (this._candlesLimiterClean = f);
|
|
4665
4690
|
}
|
|
4666
4691
|
this._controller.init();
|
|
4667
4692
|
}
|
|
@@ -4702,17 +4727,17 @@ class _r {
|
|
|
4702
4727
|
<path d="M62.7358 0.0372542C60.1921 0.0372542 58.1743 0.925792 56.7875 2.29562C56.4283 1.16563 55.4364 0.462207 54.0917 0.462207H52.2471V3.14875H53.951V20.0004H56.9364V12.8792C58.3151 14.1782 60.273 15.0233 62.739 15.0233C67.485 15.0233 70.7536 11.9408 70.7536 7.5013C70.7536 3.06182 67.4802 0.0356445 62.7342 0.0356445L62.7358 0.0372542ZM62.3652 12.2756C59.1241 12.2756 56.9364 10.3247 56.9364 7.4691C56.9364 4.61355 59.1241 2.7753 62.3652 2.7753C65.6064 2.7753 67.7099 4.66989 67.7099 7.4691C67.7067 10.3311 65.464 12.2756 62.3652 12.2756Z" fill="${h}"/>
|
|
4703
4728
|
</svg>`;
|
|
4704
4729
|
try {
|
|
4705
|
-
const
|
|
4706
|
-
|
|
4707
|
-
} catch (
|
|
4708
|
-
console.warn("Failed to load logo SVG:",
|
|
4730
|
+
const f = await this._loadSvgAsImage(d);
|
|
4731
|
+
f && e.drawImage(f, r, (a - o) / 2, c, o);
|
|
4732
|
+
} catch (f) {
|
|
4733
|
+
console.warn("Failed to load logo SVG:", f);
|
|
4709
4734
|
}
|
|
4710
4735
|
}
|
|
4711
4736
|
_drawHeaderSecondLine(e, t, s, n, a, r, o = !1) {
|
|
4712
4737
|
const c = 20 * r, h = 12 * r, d = 8 * r;
|
|
4713
|
-
e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, a, n, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, a + c), e.lineTo(n, a + c), e.stroke(), e.fillStyle = o ? "#C3C3C5" : "#1C2026", e.font = `500 ${d}px Geist, Arial, sans-serif`, e.textBaseline = "middle", e.textAlign = "left";
|
|
4714
|
-
const
|
|
4715
|
-
e.fillText(
|
|
4738
|
+
e.textBaseline = "alphabetic", e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, a, n, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, a + c), e.lineTo(n, a + c), e.stroke(), e.fillStyle = o ? "#C3C3C5" : "#1C2026", e.font = `500 ${d}px Geist, Arial, sans-serif`, e.textBaseline = "middle", e.textAlign = "left";
|
|
4739
|
+
const f = t ? `${t} created with Scope360, ${s}` : `Scope360, ${s}`;
|
|
4740
|
+
e.fillText(f, h, a + c / 2);
|
|
4716
4741
|
}
|
|
4717
4742
|
_loadSvgAsImage(e) {
|
|
4718
4743
|
return new Promise((t, s) => {
|
|
@@ -4724,29 +4749,27 @@ class _r {
|
|
|
4724
4749
|
}, n.src = r;
|
|
4725
4750
|
});
|
|
4726
4751
|
}
|
|
4752
|
+
async _ensureFontLoaded() {
|
|
4753
|
+
"fonts" in document && (await document.fonts.load("500 12px Geist"), await document.fonts.ready);
|
|
4754
|
+
}
|
|
4727
4755
|
_drawFooter(e, t, s, n, a, r, o = !1) {
|
|
4728
|
-
const c = 32 * r, h = 12 * r, d = 12 * r,
|
|
4729
|
-
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";
|
|
4756
|
+
const c = 32 * r, h = 12 * r, d = 12 * r, f = 4 * r, p = n + a;
|
|
4757
|
+
e.textBaseline = "alphabetic", 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";
|
|
4730
4758
|
const _ = [];
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
_.push({
|
|
4734
|
-
label: "Net P&L",
|
|
4735
|
-
value: t.net_pnl,
|
|
4736
|
-
valueColor: C ? "#56B683" : "#F18169"
|
|
4737
|
-
});
|
|
4738
|
-
}
|
|
4739
|
-
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 });
|
|
4740
|
-
const v = p + c / 2, b = 24 * r;
|
|
4759
|
+
t.pair && _.push({ label: "", value: t.pair }), t.type && _.push({ label: "Side", 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 });
|
|
4760
|
+
const v = p + c / 2;
|
|
4741
4761
|
if (_.length === 0) return;
|
|
4742
4762
|
e.font = `500 ${d}px Geist, Arial, sans-serif`;
|
|
4743
|
-
const
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4763
|
+
const b = o ? "#878788" : "#8E8E93", w = o ? "#FAFAFA" : "#1C2026", x = _.reduce((T, k) => {
|
|
4764
|
+
const I = e.measureText(k.label).width, V = e.measureText(k.value).width;
|
|
4765
|
+
return T + I + f + V;
|
|
4766
|
+
}, 0), y = s - h * 2, C = _.length > 1 ? (y - x) / (_.length - 1) : 0;
|
|
4767
|
+
let M = h;
|
|
4768
|
+
_.forEach((T) => {
|
|
4769
|
+
const k = e.measureText(T.label).width, I = e.measureText(T.value).width;
|
|
4770
|
+
e.fillStyle = b, e.fillText(T.label, M, v);
|
|
4771
|
+
const V = M + k + f;
|
|
4772
|
+
e.fillStyle = T.valueColor || w, e.fillText(T.value, V, v), M += k + f + I + C;
|
|
4750
4773
|
});
|
|
4751
4774
|
}
|
|
4752
4775
|
getChartState() {
|
|
@@ -4759,6 +4782,7 @@ class _r {
|
|
|
4759
4782
|
this._model.updateConfig(e.config), this._model.applyViewState(e.view);
|
|
4760
4783
|
}
|
|
4761
4784
|
async captureScreenshot(e = {}) {
|
|
4785
|
+
await this._ensureFontLoaded();
|
|
4762
4786
|
const t = typeof e == "string" ? e : e.filename || "candlestick-chart.png", n = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
4763
4787
|
month: "short",
|
|
4764
4788
|
day: "numeric",
|
|
@@ -4766,91 +4790,89 @@ class _r {
|
|
|
4766
4790
|
hour: "2-digit",
|
|
4767
4791
|
minute: "2-digit",
|
|
4768
4792
|
timeZoneName: "short"
|
|
4769
|
-
})
|
|
4770
|
-
|
|
4771
|
-
const 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(
|
|
4772
|
-
g.node.querySelectorAll("canvas")
|
|
4793
|
+
}), a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1, d = a.download || !1, { canvasesContainer: f, width: p, height: _ } = this._view, v = Array.from(
|
|
4794
|
+
f.node.querySelectorAll("canvas")
|
|
4773
4795
|
);
|
|
4774
4796
|
if (v.length === 0) {
|
|
4775
4797
|
console.warn("No canvas elements found for screenshot");
|
|
4776
4798
|
return;
|
|
4777
4799
|
}
|
|
4778
|
-
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, M = w - x - y - C, T = b,
|
|
4779
|
-
let
|
|
4780
|
-
|
|
4781
|
-
const z = window.devicePixelRatio || 1,
|
|
4782
|
-
|
|
4783
|
-
const O =
|
|
4800
|
+
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, M = w - x - y - C, T = b, k = p / _, I = T / M;
|
|
4801
|
+
let V, Z, te = 0, K = 0;
|
|
4802
|
+
k > I ? (Z = M, V = Z * k, te = 0, K = 0) : (V = T, Z = V / k, K = (M - Z) / 2);
|
|
4803
|
+
const z = window.devicePixelRatio || 1, Y = document.createElement("canvas");
|
|
4804
|
+
Y.width = b * z, Y.height = w * z;
|
|
4805
|
+
const O = Y.getContext("2d");
|
|
4784
4806
|
if (!O) {
|
|
4785
4807
|
console.error("Failed to get 2D context for merged canvas");
|
|
4786
4808
|
return;
|
|
4787
4809
|
}
|
|
4788
|
-
O.fillStyle = h ? "#101011" : "#ffffff", O.fillRect(0, 0,
|
|
4789
|
-
const oe = x * z,
|
|
4790
|
-
await this._drawHeader(O,
|
|
4810
|
+
O.fillStyle = h ? "#101011" : "#ffffff", O.fillRect(0, 0, Y.width, Y.height);
|
|
4811
|
+
const oe = x * z, it = y * z, le = M * z, be = T * z, ye = oe + it;
|
|
4812
|
+
await this._drawHeader(O, Y.width, z, h), this._drawHeaderSecondLine(
|
|
4791
4813
|
O,
|
|
4792
4814
|
r,
|
|
4793
4815
|
o,
|
|
4794
|
-
|
|
4816
|
+
Y.width,
|
|
4795
4817
|
oe,
|
|
4796
4818
|
z,
|
|
4797
4819
|
h
|
|
4798
4820
|
);
|
|
4799
4821
|
const He = this._view.mainCanvas;
|
|
4800
|
-
He.background && (O.fillStyle = He.background, O.fillRect(0, ye,
|
|
4801
|
-
const
|
|
4822
|
+
He.background && (O.fillStyle = He.background, O.fillRect(0, ye, Y.width, le));
|
|
4823
|
+
const Ie = V * z, Be = Z * z, F = te * z, Re = K * z;
|
|
4802
4824
|
v.forEach((P) => {
|
|
4803
|
-
let ee = 0,
|
|
4804
|
-
if (
|
|
4805
|
-
const ce =
|
|
4806
|
-
he > be && (ee = (he - be) / ce,
|
|
4825
|
+
let ee = 0, W = 0, j = P.width, me = P.height, we = Ie, xe = Be, $e = F, Oe = Re;
|
|
4826
|
+
if (k > I) {
|
|
4827
|
+
const ce = Be / P.height, he = P.width * ce;
|
|
4828
|
+
he > be && (ee = (he - be) / ce, j = P.width - ee, we = be, $e = 0);
|
|
4807
4829
|
} else {
|
|
4808
|
-
const ce =
|
|
4830
|
+
const ce = Ie / P.width, he = P.height * ce;
|
|
4809
4831
|
if (he > le) {
|
|
4810
4832
|
const Ce = (he - le) / ce;
|
|
4811
|
-
|
|
4833
|
+
W = Ce / 2, me = P.height - Ce, xe = le, Oe = 0;
|
|
4812
4834
|
}
|
|
4813
4835
|
}
|
|
4814
4836
|
O.drawImage(
|
|
4815
4837
|
P,
|
|
4816
4838
|
ee,
|
|
4817
|
-
|
|
4818
|
-
|
|
4839
|
+
W,
|
|
4840
|
+
j,
|
|
4819
4841
|
me,
|
|
4820
|
-
|
|
4821
|
-
ye +
|
|
4842
|
+
$e,
|
|
4843
|
+
ye + Oe,
|
|
4822
4844
|
we,
|
|
4823
4845
|
xe
|
|
4824
4846
|
);
|
|
4825
4847
|
}), c && this._drawFooter(
|
|
4826
4848
|
O,
|
|
4827
4849
|
c,
|
|
4828
|
-
|
|
4850
|
+
Y.width,
|
|
4829
4851
|
ye,
|
|
4830
4852
|
le,
|
|
4831
4853
|
z,
|
|
4832
4854
|
h
|
|
4833
4855
|
);
|
|
4834
|
-
const
|
|
4835
|
-
const
|
|
4836
|
-
|
|
4856
|
+
const st = (P, ee) => {
|
|
4857
|
+
const W = URL.createObjectURL(P), j = document.createElement("a");
|
|
4858
|
+
j.href = W, j.download = ee, document.body.appendChild(j), j.click(), document.body.removeChild(j), URL.revokeObjectURL(W);
|
|
4837
4859
|
};
|
|
4838
4860
|
return new Promise((P, ee) => {
|
|
4839
|
-
|
|
4840
|
-
async (
|
|
4841
|
-
if (!
|
|
4861
|
+
Y.toBlob(
|
|
4862
|
+
async (W) => {
|
|
4863
|
+
if (!W) {
|
|
4842
4864
|
ee(new Error("Failed to create blob from canvas"));
|
|
4843
4865
|
return;
|
|
4844
4866
|
}
|
|
4845
4867
|
if (d)
|
|
4846
|
-
|
|
4868
|
+
st(W, t);
|
|
4847
4869
|
else
|
|
4848
4870
|
try {
|
|
4849
|
-
await navigator.clipboard.write([new ClipboardItem({ "image/png":
|
|
4850
|
-
} catch (
|
|
4851
|
-
console.error("Failed to copy to clipboard:",
|
|
4871
|
+
await navigator.clipboard.write([new ClipboardItem({ "image/png": W })]);
|
|
4872
|
+
} catch (j) {
|
|
4873
|
+
console.error("Failed to copy to clipboard:", j);
|
|
4852
4874
|
}
|
|
4853
|
-
a.returnBlob ? P(
|
|
4875
|
+
a.returnBlob ? P(W) : P();
|
|
4854
4876
|
},
|
|
4855
4877
|
"image/png",
|
|
4856
4878
|
1
|