charts-core 1.1.27 → 1.1.28
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 +450 -502
- 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,117 +1,65 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var f = (i, e, t) =>
|
|
4
|
-
import * as
|
|
1
|
+
var Ns = Object.defineProperty;
|
|
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 f = (i, e, t) => Fs(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import * as E from "d3";
|
|
5
5
|
const Hs = (i) => {
|
|
6
6
|
const { svg: e, config: t, y: s, width: n } = i, { margin: a, yAxis: r } = t, { customTicks: o, tickFormat: c, tickValues: h, ticks: d, isShow: g } = r;
|
|
7
7
|
if (!g) return null;
|
|
8
8
|
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((_) => {
|
|
9
|
-
let p =
|
|
10
|
-
o && c ? p = p.tickFormat(c) : p = p.tickFormat((
|
|
11
|
-
const
|
|
12
|
-
return Math.abs(
|
|
9
|
+
let p = E.axisRight(s);
|
|
10
|
+
o && c ? p = p.tickFormat(c) : p = p.tickFormat((y) => {
|
|
11
|
+
const v = Number(y), b = (x) => x.toString().replace(/\.0+$/, "");
|
|
12
|
+
return Math.abs(v) >= 1e12 ? b(v / 1e12) + "T" : Math.abs(v) >= 1e9 ? b(v / 1e9) + "B" : Math.abs(v) >= 1e6 ? b(v / 1e6) + "M" : Math.abs(v) >= 1e3 ? b(v / 1e3) + "K" : b(v);
|
|
13
13
|
}), o && d && (p = Array.isArray(d) ? p.ticks(...d) : p.ticks(d)), o && h && (p = p.tickValues(h)), _.call(p);
|
|
14
14
|
}).call((_) => {
|
|
15
15
|
let p = [];
|
|
16
|
-
_.selectAll(".tick").each((
|
|
16
|
+
_.selectAll(".tick").each((y) => p.push(y)), i.yTicks = p;
|
|
17
17
|
}).call((_) => _.select(".domain").remove()).call((_) => _.selectAll(".tick line").remove()).call((_) => {
|
|
18
18
|
const p = _.selectAll(".tick text");
|
|
19
19
|
p.classed("sc-charts__y-axis-tick", !0).attr("text-anchor", "start");
|
|
20
|
-
const
|
|
21
|
-
_.selectAll(".tick").each(function(
|
|
22
|
-
var
|
|
23
|
-
const
|
|
24
|
-
|
|
20
|
+
const y = p.nodes().map((b) => b.getBBox().width), v = Math.max(...y);
|
|
21
|
+
_.selectAll(".tick").each(function(b, x) {
|
|
22
|
+
var $;
|
|
23
|
+
const w = E.select(this), C = w.select("text"), S = y[x], M = v - S, N = w.append("g").attr("transform", "translate(10, 0)");
|
|
24
|
+
C.attr("x", M), C.remove(), ($ = N.node()) == null || $.appendChild(C.node());
|
|
25
25
|
});
|
|
26
26
|
}).attr("font-family", "inherit");
|
|
27
|
-
},
|
|
28
|
-
const { svg: e, config: t, x: s, height: n, data: a
|
|
29
|
-
if (!
|
|
30
|
-
let
|
|
31
|
-
a.length > 0 &&
|
|
32
|
-
|
|
33
|
-
a
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
a[a.length - 1].date.getDate()
|
|
39
|
-
));
|
|
40
|
-
let x = null, C = g;
|
|
41
|
-
if (a.length > 0 && a.length <= 10 && !d) {
|
|
42
|
-
const y = /* @__PURE__ */ new Set();
|
|
43
|
-
if (a.forEach((w) => {
|
|
44
|
-
const T = new Date(w.date.getFullYear(), w.date.getMonth(), w.date.getDate()).getTime();
|
|
45
|
-
y.add(T.toString());
|
|
46
|
-
}), x = Array.from(y).map((w) => new Date(parseInt(w))).sort((w, T) => w.getTime() - T.getTime()), v && b) {
|
|
47
|
-
const w = x.some(
|
|
48
|
-
(S) => S.getFullYear() === v.getFullYear() && S.getMonth() === v.getMonth() && S.getDate() === v.getDate()
|
|
49
|
-
), T = x.some(
|
|
50
|
-
(S) => S.getFullYear() === b.getFullYear() && S.getMonth() === b.getMonth() && S.getDate() === b.getDate()
|
|
51
|
-
);
|
|
52
|
-
w || (x.unshift(v), x.sort((S, D) => S.getTime() - D.getTime())), T || (x.push(b), x.sort((S, D) => S.getTime() - D.getTime()));
|
|
53
|
-
}
|
|
54
|
-
g || (C = (w) => {
|
|
55
|
-
const T = new Date(w);
|
|
27
|
+
}, Bs = (i) => {
|
|
28
|
+
const { svg: e, config: t, x: s, height: n, data: a } = i, { margin: r, xAxis: o } = t, { isShow: c, tickValues: h, tickFormat: d, customTicks: g, ticks: _ } = o;
|
|
29
|
+
if (!c) return null;
|
|
30
|
+
let p = null, y = d;
|
|
31
|
+
if (a.length > 0 && a.length <= 10 && !h) {
|
|
32
|
+
const v = /* @__PURE__ */ new Set();
|
|
33
|
+
a.forEach((b) => {
|
|
34
|
+
const x = new Date(b.date.getFullYear(), b.date.getMonth(), b.date.getDate()).getTime();
|
|
35
|
+
v.add(x.toString());
|
|
36
|
+
}), p = Array.from(v).map((b) => new Date(parseInt(b))).sort((b, x) => b.getTime() - x.getTime()), d || (y = (b) => {
|
|
37
|
+
const x = new Date(b);
|
|
56
38
|
return new Intl.DateTimeFormat("en-US", {
|
|
57
39
|
month: "short",
|
|
58
40
|
day: "numeric"
|
|
59
|
-
}).format(
|
|
41
|
+
}).format(x);
|
|
60
42
|
});
|
|
61
43
|
}
|
|
62
|
-
e.append("g").attr("transform", `translate(0,${n -
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
);
|
|
75
|
-
|
|
44
|
+
e.append("g").attr("transform", `translate(0,${n - r.bottom})`).call((v) => {
|
|
45
|
+
let b = E.axisBottom(s);
|
|
46
|
+
g ? (y && (b = b.tickFormat(y)), p ? b = b.tickValues(p) : h ? b = b.tickValues(h) : _ && (b = Array.isArray(_) ? b.ticks(..._) : b.ticks(_))) : b.ticks(5), v.call(b);
|
|
47
|
+
}).call((v) => v.select(".domain").remove()).call((v) => {
|
|
48
|
+
let b = [];
|
|
49
|
+
v.selectAll(".tick").each((x) => b.push(x)), i.xTicks = b;
|
|
50
|
+
}).call((v) => v.selectAll(".tick line").remove()).call((v) => v.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).call((v) => {
|
|
51
|
+
requestAnimationFrame(() => {
|
|
52
|
+
const b = v.select(".tick");
|
|
53
|
+
if (!b.empty()) {
|
|
54
|
+
const x = b.attr("transform"), w = x == null ? void 0 : x.match(/translate\(([^,]+)/);
|
|
55
|
+
if (w && parseFloat(w[1]) < r.left) {
|
|
56
|
+
const S = b.select("text");
|
|
57
|
+
b.attr("transform", `translate(${r.left},0)`), S.attr("text-anchor", "start").attr("dx", "0");
|
|
76
58
|
}
|
|
77
|
-
w = w.tickValues(T);
|
|
78
|
-
} else p && (w = Array.isArray(p) ? w.ticks(...p) : w.ticks(p));
|
|
79
|
-
else
|
|
80
|
-
w.ticks(5);
|
|
81
|
-
y.call(w);
|
|
82
|
-
}).call((y) => y.select(".domain").remove()).call((y) => {
|
|
83
|
-
let w = [];
|
|
84
|
-
y.selectAll(".tick").each((T) => w.push(T)), i.xTicks = w;
|
|
85
|
-
}).call((y) => y.selectAll(".tick line").remove()).call((y) => y.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).call((y) => {
|
|
86
|
-
v && b && requestAnimationFrame(() => {
|
|
87
|
-
const w = y.selectAll(".tick");
|
|
88
|
-
let T = null, S = null;
|
|
89
|
-
if (w.each(function(D) {
|
|
90
|
-
const k = D, P = new Date(
|
|
91
|
-
k.getFullYear(),
|
|
92
|
-
k.getMonth(),
|
|
93
|
-
k.getDate()
|
|
94
|
-
), z = new Date(
|
|
95
|
-
v.getFullYear(),
|
|
96
|
-
v.getMonth(),
|
|
97
|
-
v.getDate()
|
|
98
|
-
), Y = new Date(
|
|
99
|
-
b.getFullYear(),
|
|
100
|
-
b.getMonth(),
|
|
101
|
-
b.getDate()
|
|
102
|
-
);
|
|
103
|
-
P.getTime() === z.getTime() && (T = L.select(this)), P.getTime() === Y.getTime() && (S = L.select(this));
|
|
104
|
-
}), T) {
|
|
105
|
-
const D = T.select("text");
|
|
106
|
-
T.attr("transform", `translate(${o.left},0)`), D.attr("text-anchor", "start").attr("dx", "0");
|
|
107
|
-
}
|
|
108
|
-
if (S) {
|
|
109
|
-
const D = S.select("text");
|
|
110
|
-
S.attr("transform", `translate(${r - o.right},0)`), D.attr("text-anchor", "end").attr("dx", "0");
|
|
111
59
|
}
|
|
112
60
|
});
|
|
113
61
|
}).attr("font-family", "inherit");
|
|
114
|
-
},
|
|
62
|
+
}, Is = (i) => {
|
|
115
63
|
const { svg: e, config: t, y: s, width: n } = i, {
|
|
116
64
|
margin: a,
|
|
117
65
|
grid: { horizontalStyle: r }
|
|
@@ -171,58 +119,58 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
171
119
|
margin: c,
|
|
172
120
|
grid: { verticalStyle: h, tooltipNode: d, hoverCirclesRadius: g, hoverCirclesAdditionalArea: _ }
|
|
173
121
|
} = t;
|
|
174
|
-
if (i.gridHoverTooltip = null, h !== "none" && (h.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((
|
|
175
|
-
const
|
|
176
|
-
h === "every-line-dashed" &&
|
|
122
|
+
if (i.gridHoverTooltip = null, h !== "none" && (h.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((y) => {
|
|
123
|
+
const v = e.append("line").attr("x1", s(y)).attr("x2", s(y)).attr("y1", c.top).attr("y2", a - c.bottom).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
|
|
124
|
+
h === "every-line-dashed" && v.attr("stroke-dasharray", "4 4");
|
|
177
125
|
}), h === "hovered-circles")) {
|
|
178
|
-
const p = n.range()[0],
|
|
179
|
-
qt(e, { x1:
|
|
180
|
-
const { tooltipContainer:
|
|
126
|
+
const p = n.range()[0], y = s(r[0].date), v = s(r[r.length - 1].date);
|
|
127
|
+
qt(e, { x1: y, x2: v, y1: p, y2: p });
|
|
128
|
+
const { tooltipContainer: b, tooltip: x, tooltipArrow: w } = Rs(o), C = (M) => {
|
|
181
129
|
if (!d) return;
|
|
182
|
-
_i(
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
s(
|
|
130
|
+
_i(x), b.style.display = "block", x.append(d({ date: M.date, value: M.value }));
|
|
131
|
+
const N = x.getBoundingClientRect(), $ = Os(
|
|
132
|
+
N,
|
|
133
|
+
s(M.date),
|
|
186
134
|
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
187
135
|
i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
|
|
188
136
|
);
|
|
189
|
-
|
|
190
|
-
},
|
|
191
|
-
|
|
137
|
+
$ !== null && (x.style.left = $ + "px"), w.style.left = s(M.date) + "px";
|
|
138
|
+
}, S = () => {
|
|
139
|
+
b.style.display = "none";
|
|
192
140
|
};
|
|
193
141
|
i.gridHoverTooltip = d ? {
|
|
194
|
-
show: (
|
|
195
|
-
hide:
|
|
196
|
-
} : null, r.forEach((
|
|
197
|
-
const
|
|
198
|
-
Y || qt(e, { x1:
|
|
142
|
+
show: (M) => C(M),
|
|
143
|
+
hide: S
|
|
144
|
+
} : null, r.forEach((M, N) => {
|
|
145
|
+
const $ = s(M.date), z = n(M.value), V = r[N - 1], Y = N > 0 && V && M.value === V.value;
|
|
146
|
+
Y || qt(e, { x1: $, x2: $, y1: z, y2: p });
|
|
199
147
|
const re = $s(e, Y, {
|
|
200
|
-
x:
|
|
148
|
+
x: $,
|
|
201
149
|
y: p,
|
|
202
150
|
r: g,
|
|
203
151
|
hr: _
|
|
204
152
|
});
|
|
205
153
|
d && re.on("mouseover", function() {
|
|
206
|
-
|
|
154
|
+
C({ date: M.date, value: Y ? null : M.value });
|
|
207
155
|
}).on("mouseout", function() {
|
|
208
|
-
|
|
156
|
+
S();
|
|
209
157
|
});
|
|
210
158
|
});
|
|
211
159
|
}
|
|
212
160
|
}, zs = (i) => {
|
|
213
|
-
|
|
214
|
-
},
|
|
161
|
+
Is(i), Ps(i);
|
|
162
|
+
}, Vs = (i) => {
|
|
215
163
|
const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
|
|
216
|
-
|
|
164
|
+
Bs(i), Hs(i), r && e.append("image").attr("xlink:href", t.theme === "dark" ? r.picDarkTheme : r.picLightTheme).attr("width", r.width).attr("height", r.height).attr("x", r.x ?? (s - a.left - a.right) / 2 - r.width / 2 + a.left).attr("y", r.y ?? (n - a.top - a.bottom) / 2 - r.height / 2 + a.top), zs(i);
|
|
217
165
|
}, Ee = (i, e, t) => {
|
|
218
166
|
let s = i.select(`#${e}`);
|
|
219
167
|
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 }) => {
|
|
220
168
|
s.append("stop").attr("offset", n).attr("stop-color", a);
|
|
221
169
|
}), s;
|
|
222
170
|
}, _e = (i) => {
|
|
223
|
-
const e =
|
|
224
|
-
return e.empty() ?
|
|
225
|
-
},
|
|
171
|
+
const e = E.select(i).select("defs");
|
|
172
|
+
return e.empty() ? E.select(i).append("defs") : e;
|
|
173
|
+
}, Mt = (i) => {
|
|
226
174
|
const {
|
|
227
175
|
y: e,
|
|
228
176
|
config: { margin: t }
|
|
@@ -302,7 +250,7 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
302
250
|
t.remove();
|
|
303
251
|
}
|
|
304
252
|
};
|
|
305
|
-
},
|
|
253
|
+
}, Ys = (i, e = {}) => {
|
|
306
254
|
const t = "sc-charts__hover-line", s = i.append("line").style("display", e.hidden ? "none" : "block").classed(t, !0), n = i.node(), a = _e(n);
|
|
307
255
|
return ((o, c) => Ee(a, o, {
|
|
308
256
|
x1: "0%",
|
|
@@ -326,8 +274,8 @@ const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
326
274
|
s.remove();
|
|
327
275
|
}
|
|
328
276
|
};
|
|
329
|
-
}, fe = "sc-charts__range-tooltip", Kt =
|
|
330
|
-
const e =
|
|
277
|
+
}, fe = "sc-charts__range-tooltip", Kt = E.timeFormat("%b %e, %I:%M %p"), Ws = (i) => {
|
|
278
|
+
const e = E.format(",.2f");
|
|
331
279
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
332
280
|
};
|
|
333
281
|
function js(i) {
|
|
@@ -359,19 +307,19 @@ const Xs = (i) => {
|
|
|
359
307
|
},
|
|
360
308
|
update({ leftPoint: n, rightPoint: a, x: r, y: o, hidden: c, closest: h }) {
|
|
361
309
|
if (n && a && h && r !== void 0) {
|
|
362
|
-
const d = a.value - n.value, { sumFormatter: g, timeFormatter: _ } = i.config.selection, p = (i.x(a.date) + i.x(n.date)) / 2,
|
|
363
|
-
let
|
|
310
|
+
const d = a.value - n.value, { sumFormatter: g, timeFormatter: _ } = i.config.selection, p = (i.x(a.date) + i.x(n.date)) / 2, y = i.x(h.date) < p ? "left" : "right";
|
|
311
|
+
let v = "", b = "";
|
|
364
312
|
if (g)
|
|
365
|
-
|
|
313
|
+
v = g({ left: n.value, right: a.value, direction: y });
|
|
366
314
|
else {
|
|
367
|
-
const
|
|
368
|
-
|
|
315
|
+
const x = (d / Math.abs(n.value) * 100).toFixed(2);
|
|
316
|
+
v = `${Ws(d)} (${x}%)`;
|
|
369
317
|
}
|
|
370
|
-
_ ?
|
|
371
|
-
const
|
|
372
|
-
let
|
|
373
|
-
const
|
|
374
|
-
|
|
318
|
+
_ ? b = _({ left: n.date, right: a.date, direction: y }) : b = `${Kt(n.date)} to ${Kt(a.date)}`, t.textContent = v, s.textContent = b, requestAnimationFrame(() => {
|
|
319
|
+
const x = e.getBoundingClientRect(), w = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), S = i.x(a.date);
|
|
320
|
+
let N = (C + S) / 2 - x.width / 2;
|
|
321
|
+
const $ = 0, z = w.width - x.width;
|
|
322
|
+
N < $ && (N = $), N > z && (N = z), e.style.left = `${N}px`, e.style.top = `${o}px`;
|
|
375
323
|
});
|
|
376
324
|
}
|
|
377
325
|
c !== void 0 && (e.style.display = c ? "none" : "block");
|
|
@@ -380,8 +328,8 @@ const Xs = (i) => {
|
|
|
380
328
|
e.remove();
|
|
381
329
|
}
|
|
382
330
|
};
|
|
383
|
-
}, ke = "sc-charts__hover-tooltip", _t = 16, Us =
|
|
384
|
-
const e =
|
|
331
|
+
}, ke = "sc-charts__hover-tooltip", _t = 16, Us = E.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
|
|
332
|
+
const e = E.format(",.2f");
|
|
385
333
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
386
334
|
};
|
|
387
335
|
function Zs(i) {
|
|
@@ -479,7 +427,7 @@ const Js = (i) => {
|
|
|
479
427
|
},
|
|
480
428
|
enableBelowZeroLine: !1,
|
|
481
429
|
curveTension: 1
|
|
482
|
-
}, tt = () =>
|
|
430
|
+
}, tt = () => E.curveMonotoneX, Ks = (i) => {
|
|
483
431
|
const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o = _e(r);
|
|
484
432
|
Ee(o, "main-line-area-gradient", {
|
|
485
433
|
x1: "0%",
|
|
@@ -491,7 +439,7 @@ const Js = (i) => {
|
|
|
491
439
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
492
440
|
]
|
|
493
441
|
});
|
|
494
|
-
const h =
|
|
442
|
+
const h = E.area().x((_) => s(_.date)).y0(n.range()[0]).y1((_) => n(_.value)).curve(tt()), d = "sc-charts__main-line-area", g = e.append("path").datum(t).attr("d", h).attr("class", d).classed(`${d}_hidden`, !a.hasMainLineArea);
|
|
495
443
|
return {
|
|
496
444
|
className(_, p) {
|
|
497
445
|
_ === "remove" ? g.classed(`${d}${p}`, !1) : g.classed(`${d}${p}`, !0);
|
|
@@ -527,42 +475,42 @@ const Js = (i) => {
|
|
|
527
475
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
528
476
|
]
|
|
529
477
|
});
|
|
530
|
-
const p =
|
|
478
|
+
const p = E.area().x((w) => n(w.date)).y0(a.range()[0]).y1((w) => a(w.value)).curve(tt()), y = `${c}-clip-${t}`, b = g.append("clipPath").attr("id", y).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), x = s.append("path").datum(o).attr("d", p).attr("class", t).classed(`${t}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${y})`);
|
|
531
479
|
return {
|
|
532
|
-
className(
|
|
533
|
-
|
|
480
|
+
className(w, C) {
|
|
481
|
+
w === "remove" ? x.classed(`${t}${C}`, !1) : x.classed(`${t}${C}`, !0);
|
|
534
482
|
},
|
|
535
|
-
update({ data:
|
|
536
|
-
|
|
483
|
+
update({ data: w, hidden: C, clip: S }) {
|
|
484
|
+
w !== void 0 && x.datum(w).attr("d", p), C !== void 0 && x.classed(`${t}_hidden`, C), S !== void 0 && b.attr("x", S.x).attr("y", S.y).attr("width", S.width).attr("height", S.height);
|
|
537
485
|
},
|
|
538
486
|
destroy() {
|
|
539
|
-
|
|
487
|
+
x.remove();
|
|
540
488
|
}
|
|
541
489
|
};
|
|
542
490
|
}, vt = (i, e) => {
|
|
543
|
-
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = _e(d), _ =
|
|
491
|
+
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = _e(d), _ = E.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(tt()), p = `${r}-clip-${o}`, v = g.append("clipPath").attr("id", p).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), b = t.append("path").classed(o, !0).datum(s).attr("d", _).attr("id", c).attr("clip-path", `url(#${p})`);
|
|
544
492
|
return {
|
|
545
|
-
className(
|
|
546
|
-
|
|
493
|
+
className(x, w) {
|
|
494
|
+
x === "remove" ? b.classed(`${o}${w}`, !1) : b.classed(`${o}${w}`, !0);
|
|
547
495
|
},
|
|
548
|
-
update({ data:
|
|
549
|
-
|
|
496
|
+
update({ data: x, clip: w, hidden: C }) {
|
|
497
|
+
x !== void 0 && b.datum(x).attr("d", _), C !== void 0 && b.classed(`${o}_hidden`, C), w !== void 0 && v.attr("x", w.x).attr("y", w.y).attr("width", w.width).attr("height", w.height);
|
|
550
498
|
},
|
|
551
499
|
destroy() {
|
|
552
|
-
|
|
500
|
+
b.remove();
|
|
553
501
|
}
|
|
554
502
|
};
|
|
555
503
|
}, tn = (i, e) => {
|
|
556
|
-
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), _ = _e(g), p =
|
|
504
|
+
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), _ = _e(g), p = E.line().x((w) => n(w.date)).y((w) => a(w.value)).curve(tt()), y = `${r}-clip-${c}`, b = _.append("clipPath").attr("id", y).append("rect").attr("x", (d == null ? void 0 : d.x) || 0).attr("y", (d == null ? void 0 : d.y) || 0).attr("width", (d == null ? void 0 : d.width) || "100%").attr("height", (d == null ? void 0 : d.height) || "100%"), x = t.append("path").classed(c, !0).datum(s).attr("d", p).attr("id", h).attr("clip-path", `url(#${y})`);
|
|
557
505
|
return {
|
|
558
|
-
className(
|
|
559
|
-
|
|
506
|
+
className(w, C) {
|
|
507
|
+
w === "remove" ? x.classed(`${c}${C}`, !1) : x.classed(`${c}${C}`, !0);
|
|
560
508
|
},
|
|
561
|
-
update({ data:
|
|
562
|
-
|
|
509
|
+
update({ data: w, clip: C, hidden: S }) {
|
|
510
|
+
w !== void 0 && x.datum(w).attr("d", p), S !== void 0 && x.classed(`${c}_hidden`, S), C !== void 0 && (o.hover.transitionName === "default" ? b.transition().duration(o.hover.transitionDuration).attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height).ease(E.easeLinear) : b.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
|
|
563
511
|
},
|
|
564
512
|
destroy() {
|
|
565
|
-
|
|
513
|
+
x.remove();
|
|
566
514
|
}
|
|
567
515
|
};
|
|
568
516
|
}, sn = (i) => {
|
|
@@ -573,10 +521,10 @@ const Js = (i) => {
|
|
|
573
521
|
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);
|
|
574
522
|
return ((g) => {
|
|
575
523
|
if (!g || g.length === 0) return;
|
|
576
|
-
const _ = g[g.length - 1], p = n(_.date),
|
|
577
|
-
c.attr("cx", p).attr("cy",
|
|
578
|
-
const
|
|
579
|
-
h.attr("x", p).attr("y",
|
|
524
|
+
const _ = g[g.length - 1], p = n(_.date), y = a(_.value);
|
|
525
|
+
c.attr("cx", p).attr("cy", y);
|
|
526
|
+
const v = i.config.extremePointFormatter || sn;
|
|
527
|
+
h.attr("x", p).attr("y", y).text(v(_.value));
|
|
580
528
|
})(s), {
|
|
581
529
|
className(g, _) {
|
|
582
530
|
g === "remove" ? o.classed(`${r}${_}`, !1) : o.classed(`${r}${_}`, !0);
|
|
@@ -597,7 +545,7 @@ const Js = (i) => {
|
|
|
597
545
|
i.config.hasExtremePoint && (s = nn(i, {
|
|
598
546
|
baseClassName: "sc-charts__extreme-point"
|
|
599
547
|
}));
|
|
600
|
-
const n =
|
|
548
|
+
const n = Ys(i.svg), a = tn(i, {
|
|
601
549
|
baseClassName: "sc-charts__highlight-line",
|
|
602
550
|
id: `${i.chartId}-sc-charts__highlight-line`,
|
|
603
551
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
@@ -606,7 +554,7 @@ const Js = (i) => {
|
|
|
606
554
|
i.config.enableBelowZeroLine && (r = vt(i, {
|
|
607
555
|
baseClassName: "sc-charts__below-zero-line",
|
|
608
556
|
id: `${i.chartId}-sc-charts__below-zero-line`,
|
|
609
|
-
clip:
|
|
557
|
+
clip: Mt(i)
|
|
610
558
|
}));
|
|
611
559
|
const o = pt(i.svg, {
|
|
612
560
|
className: "sc-charts__hover-circle",
|
|
@@ -621,20 +569,20 @@ const Js = (i) => {
|
|
|
621
569
|
}), _ = pt(i.svg, {
|
|
622
570
|
className: "sc-charts__range-circle-right",
|
|
623
571
|
hidden: !0
|
|
624
|
-
}), p = Xs(i),
|
|
572
|
+
}), p = Xs(i), y = Js(i), v = en(i);
|
|
625
573
|
return {
|
|
626
574
|
hoverLine: n,
|
|
627
575
|
hoverCircle: o,
|
|
628
576
|
rangeBorderLeft: c,
|
|
629
577
|
rangeBorderRight: h,
|
|
630
578
|
rangeLine: d,
|
|
631
|
-
rangeLineArea:
|
|
579
|
+
rangeLineArea: v,
|
|
632
580
|
rangeCircleLeft: g,
|
|
633
581
|
rangeCircleRight: _,
|
|
634
582
|
mainLine: e,
|
|
635
583
|
rangeTooltip: p,
|
|
636
584
|
highlightLine: a,
|
|
637
|
-
hoverTooltip:
|
|
585
|
+
hoverTooltip: y,
|
|
638
586
|
mainLineArea: t,
|
|
639
587
|
belowZeroLine: r,
|
|
640
588
|
extremePoint: s
|
|
@@ -758,14 +706,14 @@ const Js = (i) => {
|
|
|
758
706
|
})), n.mainLine.className("add", "_muted");
|
|
759
707
|
} else
|
|
760
708
|
n.highlightLine.update({ hidden: !0 }), n.mainLine.className("remove", "_muted"), (h = n.belowZeroLine) == null || h.update({
|
|
761
|
-
clip:
|
|
709
|
+
clip: Mt(i)
|
|
762
710
|
});
|
|
763
711
|
(d = i.gridHoverTooltip) == null || d.show({ date: e.date, value: e.value });
|
|
764
712
|
}, ti = (i) => {
|
|
765
713
|
var t, s;
|
|
766
714
|
const { elements: e } = i;
|
|
767
715
|
e.hoverLine.update({ hidden: !0 }), e.hoverCircle.update({ hidden: !0 }), e.highlightLine.update({ hidden: !0 }), e.mainLine.className("remove", "_muted"), e.hoverTooltip.update({ hidden: !0 }), (t = i.gridHoverTooltip) == null || t.hide(), i.action !== "selection" && ((s = e.belowZeroLine) == null || s.update({
|
|
768
|
-
clip:
|
|
716
|
+
clip: Mt(i)
|
|
769
717
|
}));
|
|
770
718
|
}, on = (i, e) => {
|
|
771
719
|
[
|
|
@@ -780,7 +728,7 @@ const Js = (i) => {
|
|
|
780
728
|
e ? (i[s].className("remove", "_down"), i[s].className("add", "_up")) : (i[s].className("remove", "_up"), i[s].className("add", "_down"));
|
|
781
729
|
});
|
|
782
730
|
}, ln = (i, e, t) => {
|
|
783
|
-
var
|
|
731
|
+
var y;
|
|
784
732
|
const {
|
|
785
733
|
x: s,
|
|
786
734
|
y: n,
|
|
@@ -831,7 +779,7 @@ const Js = (i) => {
|
|
|
831
779
|
x: g + p / 2,
|
|
832
780
|
y: 0,
|
|
833
781
|
hidden: !1
|
|
834
|
-
}), (
|
|
782
|
+
}), (y = o.belowZeroLine) == null || y.update({
|
|
835
783
|
hidden: !0
|
|
836
784
|
}), o.mainLineArea.update({ hidden: !0 }), on(o, d), o.mainLine.className("add", "_selected-muted");
|
|
837
785
|
}, ii = (i) => {
|
|
@@ -841,32 +789,32 @@ const Js = (i) => {
|
|
|
841
789
|
}, cn = (i) => {
|
|
842
790
|
const { svg: e, data: t, x: s, config: n, width: a, height: r } = i, { margin: o, hover: c, selection: h } = n;
|
|
843
791
|
let d = null, g = !1;
|
|
844
|
-
const _ = (
|
|
845
|
-
(
|
|
792
|
+
const _ = (y) => t.reduce(
|
|
793
|
+
(v, b) => Math.abs(s(v.date) - y) < Math.abs(s(b.date) - y) ? v : b
|
|
846
794
|
);
|
|
847
|
-
e.append("rect").attr("width", a - o.left - o.right).attr("height", r - o.top - o.bottom).attr("x", o.left).attr("y", o.top).attr("fill", "transparent").on("mousemove", function(
|
|
848
|
-
const [
|
|
849
|
-
!g && c.enable ? (i.action = "hover", ei(i,
|
|
795
|
+
e.append("rect").attr("width", a - o.left - o.right).attr("height", r - o.top - o.bottom).attr("x", o.left).attr("y", o.top).attr("fill", "transparent").on("mousemove", function(y) {
|
|
796
|
+
const [v] = E.pointer(y, this), b = _(v);
|
|
797
|
+
!g && c.enable ? (i.action = "hover", ei(i, b)) : (i.action = g ? "selection" : "none", ti(i)), d && h.enable && (i.action = "selection", ln(i, d, b));
|
|
850
798
|
}).on("mouseleave", () => {
|
|
851
799
|
i.action = "none", g = !1, d = null, ti(i), ii(i);
|
|
852
|
-
}).on("mousedown", function(
|
|
800
|
+
}).on("mousedown", function(y) {
|
|
853
801
|
if (h.enable) {
|
|
854
802
|
g = !0, i.action = "selection";
|
|
855
|
-
const [
|
|
856
|
-
d = _(
|
|
803
|
+
const [v] = E.pointer(y, this);
|
|
804
|
+
d = _(v);
|
|
857
805
|
}
|
|
858
|
-
}).on("mouseup", function(
|
|
859
|
-
const [
|
|
860
|
-
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i,
|
|
806
|
+
}).on("mouseup", function(y) {
|
|
807
|
+
const [v] = E.pointer(y, this), b = _(v);
|
|
808
|
+
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i, b);
|
|
861
809
|
});
|
|
862
810
|
}, hn = (i, e, t) => {
|
|
863
|
-
const { margin: s } = e, n =
|
|
811
|
+
const { margin: s } = e, n = E.scaleTime(), a = E.extent(i, (r) => new Date(r.date));
|
|
864
812
|
return a[0] == null || a[1] == null ? n : n.domain([a[0], a[1]]).range([s.left, t - s.right]);
|
|
865
813
|
}, dn = (i, e, t) => {
|
|
866
|
-
const { margin: s } = e, n =
|
|
867
|
-
return
|
|
814
|
+
const { margin: s } = e, n = E.max(i, (r) => r.value) ?? 0, a = E.min(i, (r) => r.value) ?? 0;
|
|
815
|
+
return E.scaleLinear().domain([a, n]).range([t - s.bottom, s.top]);
|
|
868
816
|
}, pr = (i, e) => {
|
|
869
|
-
const t =
|
|
817
|
+
const t = E.select(i);
|
|
870
818
|
if (t.empty())
|
|
871
819
|
return console.error(`Element with selector ${i} not found!`), null;
|
|
872
820
|
if (!e.chartId || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.chartId))
|
|
@@ -878,29 +826,29 @@ const Js = (i) => {
|
|
|
878
826
|
r = a.getBoundingClientRect(), o = r.width, c = r.height, _({ data: d, config: h });
|
|
879
827
|
};
|
|
880
828
|
window.addEventListener("resize", g);
|
|
881
|
-
const _ = (p,
|
|
882
|
-
|
|
883
|
-
const
|
|
829
|
+
const _ = (p, y = !1) => {
|
|
830
|
+
y && p.config && (h = Jt(h, p.config)), y && p.data && (d = p.data);
|
|
831
|
+
const v = d.map((S) => ({ date: new Date(S.date), value: S.value })).sort((S, M) => S.date.getTime() - M.date.getTime()), b = hn(v, h, o), x = dn(v, h, c);
|
|
884
832
|
s.attr("class", `sc-charts sc-charts__${h.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${o} ${c}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
|
|
885
|
-
const
|
|
833
|
+
const w = {
|
|
886
834
|
chartId: e.chartId,
|
|
887
835
|
svg: n,
|
|
888
836
|
wrapperNode: s.node(),
|
|
889
|
-
data:
|
|
890
|
-
x,
|
|
891
|
-
y:
|
|
837
|
+
data: v,
|
|
838
|
+
x: b,
|
|
839
|
+
y: x,
|
|
892
840
|
config: h,
|
|
893
841
|
action: "none",
|
|
894
842
|
width: o,
|
|
895
843
|
height: c,
|
|
896
844
|
gridHoverTooltip: null
|
|
897
845
|
};
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
...
|
|
901
|
-
elements: an(
|
|
846
|
+
Vs(w);
|
|
847
|
+
const C = {
|
|
848
|
+
...w,
|
|
849
|
+
elements: an(w)
|
|
902
850
|
};
|
|
903
|
-
cn(
|
|
851
|
+
cn(C);
|
|
904
852
|
};
|
|
905
853
|
return _(e), {
|
|
906
854
|
update: (p) => _(p, !0),
|
|
@@ -913,13 +861,13 @@ var Ze = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
913
861
|
function un(i) {
|
|
914
862
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
915
863
|
}
|
|
916
|
-
var
|
|
917
|
-
|
|
864
|
+
var Me = { exports: {} };
|
|
865
|
+
Me.exports;
|
|
918
866
|
var si;
|
|
919
867
|
function fn() {
|
|
920
868
|
return si || (si = 1, function(i, e) {
|
|
921
|
-
var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", _ = "[object Error]", p = "[object Function]",
|
|
922
|
-
|
|
869
|
+
var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", _ = "[object Error]", p = "[object Function]", y = "[object GeneratorFunction]", v = "[object Map]", b = "[object Number]", x = "[object Null]", w = "[object Object]", C = "[object Proxy]", S = "[object RegExp]", M = "[object Set]", N = "[object String]", $ = "[object Undefined]", z = "[object WeakMap]", V = "[object ArrayBuffer]", Y = "[object DataView]", re = "[object Float32Array]", P = "[object Float64Array]", U = "[object Int8Array]", G = "[object Int16Array]", Fe = "[object Int32Array]", st = "[object Uint8Array]", oe = "[object Uint8ClampedArray]", ve = "[object Uint16Array]", be = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Be = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, F = {};
|
|
870
|
+
F[re] = F[P] = F[U] = F[G] = F[Fe] = F[st] = F[oe] = F[ve] = F[be] = !0, F[o] = F[c] = F[V] = F[d] = F[Y] = F[g] = F[_] = F[p] = F[v] = F[b] = F[w] = F[S] = F[M] = F[N] = F[z] = !1;
|
|
923
871
|
var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self, O = Re || $e || Function("return this")(), ee = e && !e.nodeType && e, Z = ee && !0 && i && !i.nodeType && i, q = Z && Z.exports === ee, ge = q && Re.process, ye = function() {
|
|
924
872
|
try {
|
|
925
873
|
var l = Z && Z.require && Z.require("util").types;
|
|
@@ -941,9 +889,9 @@ function fn() {
|
|
|
941
889
|
return l.apply(u, m);
|
|
942
890
|
}
|
|
943
891
|
function Pe(l, u) {
|
|
944
|
-
for (var m = -1,
|
|
945
|
-
|
|
946
|
-
return
|
|
892
|
+
for (var m = -1, T = Array(l); ++m < l; )
|
|
893
|
+
T[m] = u(m);
|
|
894
|
+
return T;
|
|
947
895
|
}
|
|
948
896
|
function le(l) {
|
|
949
897
|
return function(u) {
|
|
@@ -958,20 +906,20 @@ function fn() {
|
|
|
958
906
|
return l(u(m));
|
|
959
907
|
};
|
|
960
908
|
}
|
|
961
|
-
var xe = Array.prototype,
|
|
909
|
+
var xe = Array.prototype, Ai = Function.prototype, ze = Object.prototype, at = O["__core-js_shared__"], Ve = Ai.toString, ne = ze.hasOwnProperty, Nt = function() {
|
|
962
910
|
var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
|
|
963
911
|
return l ? "Symbol(src)_1." + l : "";
|
|
964
|
-
}(),
|
|
965
|
-
"^" +
|
|
966
|
-
),
|
|
967
|
-
|
|
968
|
-
var
|
|
912
|
+
}(), Ft = ze.toString, Si = Ve.call(Object), Mi = RegExp(
|
|
913
|
+
"^" + Ve.call(ne).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
914
|
+
), Ye = q ? O.Buffer : void 0, Ht = O.Symbol, Bt = O.Uint8Array;
|
|
915
|
+
Ye && Ye.allocUnsafe;
|
|
916
|
+
var It = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = ze.propertyIsEnumerable, ki = xe.splice, he = Ht ? Ht.toStringTag : void 0, We = function() {
|
|
969
917
|
try {
|
|
970
918
|
var l = lt(Object, "defineProperty");
|
|
971
919
|
return l({}, "", {}), l;
|
|
972
920
|
} catch {
|
|
973
921
|
}
|
|
974
|
-
}(), Ei =
|
|
922
|
+
}(), Ei = Ye ? Ye.isBuffer : void 0, $t = Math.max, Li = Date.now, Ot = lt(O, "Map"), Ce = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
|
|
975
923
|
function l() {
|
|
976
924
|
}
|
|
977
925
|
return function(u) {
|
|
@@ -987,18 +935,18 @@ function fn() {
|
|
|
987
935
|
function de(l) {
|
|
988
936
|
var u = -1, m = l == null ? 0 : l.length;
|
|
989
937
|
for (this.clear(); ++u < m; ) {
|
|
990
|
-
var
|
|
991
|
-
this.set(
|
|
938
|
+
var T = l[u];
|
|
939
|
+
this.set(T[0], T[1]);
|
|
992
940
|
}
|
|
993
941
|
}
|
|
994
|
-
function
|
|
942
|
+
function Fi() {
|
|
995
943
|
this.__data__ = Ce ? Ce(null) : {}, this.size = 0;
|
|
996
944
|
}
|
|
997
945
|
function Hi(l) {
|
|
998
946
|
var u = this.has(l) && delete this.__data__[l];
|
|
999
947
|
return this.size -= u ? 1 : 0, u;
|
|
1000
948
|
}
|
|
1001
|
-
function
|
|
949
|
+
function Bi(l) {
|
|
1002
950
|
var u = this.__data__;
|
|
1003
951
|
if (Ce) {
|
|
1004
952
|
var m = u[l];
|
|
@@ -1006,7 +954,7 @@ function fn() {
|
|
|
1006
954
|
}
|
|
1007
955
|
return ne.call(u, l) ? u[l] : void 0;
|
|
1008
956
|
}
|
|
1009
|
-
function
|
|
957
|
+
function Ii(l) {
|
|
1010
958
|
var u = this.__data__;
|
|
1011
959
|
return Ce ? u[l] !== void 0 : ne.call(u, l);
|
|
1012
960
|
}
|
|
@@ -1014,12 +962,12 @@ function fn() {
|
|
|
1014
962
|
var m = this.__data__;
|
|
1015
963
|
return this.size += this.has(l) ? 0 : 1, m[l] = Ce && u === void 0 ? s : u, this;
|
|
1016
964
|
}
|
|
1017
|
-
de.prototype.clear =
|
|
965
|
+
de.prototype.clear = Fi, de.prototype.delete = Hi, de.prototype.get = Bi, de.prototype.has = Ii, de.prototype.set = Ri;
|
|
1018
966
|
function te(l) {
|
|
1019
967
|
var u = -1, m = l == null ? 0 : l.length;
|
|
1020
968
|
for (this.clear(); ++u < m; ) {
|
|
1021
|
-
var
|
|
1022
|
-
this.set(
|
|
969
|
+
var T = l[u];
|
|
970
|
+
this.set(T[0], T[1]);
|
|
1023
971
|
}
|
|
1024
972
|
}
|
|
1025
973
|
function $i() {
|
|
@@ -1029,8 +977,8 @@ function fn() {
|
|
|
1029
977
|
var u = this.__data__, m = je(u, l);
|
|
1030
978
|
if (m < 0)
|
|
1031
979
|
return !1;
|
|
1032
|
-
var
|
|
1033
|
-
return m ==
|
|
980
|
+
var T = u.length - 1;
|
|
981
|
+
return m == T ? u.pop() : ki.call(u, m, 1), --this.size, !0;
|
|
1034
982
|
}
|
|
1035
983
|
function Pi(l) {
|
|
1036
984
|
var u = this.__data__, m = je(u, l);
|
|
@@ -1039,19 +987,19 @@ function fn() {
|
|
|
1039
987
|
function zi(l) {
|
|
1040
988
|
return je(this.__data__, l) > -1;
|
|
1041
989
|
}
|
|
1042
|
-
function
|
|
1043
|
-
var m = this.__data__,
|
|
1044
|
-
return
|
|
990
|
+
function Vi(l, u) {
|
|
991
|
+
var m = this.__data__, T = je(m, l);
|
|
992
|
+
return T < 0 ? (++this.size, m.push([l, u])) : m[T][1] = u, this;
|
|
1045
993
|
}
|
|
1046
|
-
te.prototype.clear = $i, te.prototype.delete = Oi, te.prototype.get = Pi, te.prototype.has = zi, te.prototype.set =
|
|
994
|
+
te.prototype.clear = $i, te.prototype.delete = Oi, te.prototype.get = Pi, te.prototype.has = zi, te.prototype.set = Vi;
|
|
1047
995
|
function me(l) {
|
|
1048
996
|
var u = -1, m = l == null ? 0 : l.length;
|
|
1049
997
|
for (this.clear(); ++u < m; ) {
|
|
1050
|
-
var
|
|
1051
|
-
this.set(
|
|
998
|
+
var T = l[u];
|
|
999
|
+
this.set(T[0], T[1]);
|
|
1052
1000
|
}
|
|
1053
1001
|
}
|
|
1054
|
-
function
|
|
1002
|
+
function Yi() {
|
|
1055
1003
|
this.size = 0, this.__data__ = {
|
|
1056
1004
|
hash: new de(),
|
|
1057
1005
|
map: new (Ot || te)(),
|
|
@@ -1069,10 +1017,10 @@ function fn() {
|
|
|
1069
1017
|
return Ue(this, l).has(l);
|
|
1070
1018
|
}
|
|
1071
1019
|
function Ui(l, u) {
|
|
1072
|
-
var m = Ue(this, l),
|
|
1073
|
-
return m.set(l, u), this.size += m.size ==
|
|
1020
|
+
var m = Ue(this, l), T = m.size;
|
|
1021
|
+
return m.set(l, u), this.size += m.size == T ? 0 : 1, this;
|
|
1074
1022
|
}
|
|
1075
|
-
me.prototype.clear =
|
|
1023
|
+
me.prototype.clear = Yi, me.prototype.delete = Wi, me.prototype.get = ji, me.prototype.has = Xi, me.prototype.set = Ui;
|
|
1076
1024
|
function pe(l) {
|
|
1077
1025
|
var u = this.__data__ = new te(l);
|
|
1078
1026
|
this.size = u.size;
|
|
@@ -1093,30 +1041,30 @@ function fn() {
|
|
|
1093
1041
|
function Qi(l, u) {
|
|
1094
1042
|
var m = this.__data__;
|
|
1095
1043
|
if (m instanceof te) {
|
|
1096
|
-
var
|
|
1097
|
-
if (!Ot ||
|
|
1098
|
-
return
|
|
1099
|
-
m = this.__data__ = new me(
|
|
1044
|
+
var T = m.__data__;
|
|
1045
|
+
if (!Ot || T.length < t - 1)
|
|
1046
|
+
return T.push([l, u]), this.size = ++m.size, this;
|
|
1047
|
+
m = this.__data__ = new me(T);
|
|
1100
1048
|
}
|
|
1101
1049
|
return m.set(l, u), this.size = m.size, this;
|
|
1102
1050
|
}
|
|
1103
1051
|
pe.prototype.clear = Gi, pe.prototype.delete = Zi, pe.prototype.get = qi, pe.prototype.has = Ji, pe.prototype.set = Qi;
|
|
1104
1052
|
function Ki(l, u) {
|
|
1105
|
-
var m = dt(l),
|
|
1053
|
+
var m = dt(l), T = !m && ht(l), D = !m && !T && Wt(l), H = !m && !T && !D && Xt(l), B = m || T || D || H, L = B ? Pe(l.length, String) : [], I = L.length;
|
|
1106
1054
|
for (var J in l)
|
|
1107
1055
|
B && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1108
1056
|
(J == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
return
|
|
1057
|
+
D && (J == "offset" || J == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1058
|
+
H && (J == "buffer" || J == "byteLength" || J == "byteOffset") || // Skip index properties.
|
|
1059
|
+
Vt(J, I)) || L.push(J);
|
|
1060
|
+
return L;
|
|
1113
1061
|
}
|
|
1114
1062
|
function rt(l, u, m) {
|
|
1115
1063
|
(m !== void 0 && !Ge(l[u], m) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1116
1064
|
}
|
|
1117
1065
|
function es(l, u, m) {
|
|
1118
|
-
var
|
|
1119
|
-
(!(ne.call(l, u) && Ge(
|
|
1066
|
+
var T = l[u];
|
|
1067
|
+
(!(ne.call(l, u) && Ge(T, m)) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1120
1068
|
}
|
|
1121
1069
|
function je(l, u) {
|
|
1122
1070
|
for (var m = l.length; m--; )
|
|
@@ -1134,7 +1082,7 @@ function fn() {
|
|
|
1134
1082
|
}
|
|
1135
1083
|
var ts = gs();
|
|
1136
1084
|
function Xe(l) {
|
|
1137
|
-
return l == null ? l === void 0 ?
|
|
1085
|
+
return l == null ? l === void 0 ? $ : x : he && he in Object(l) ? ms(l) : ws(l);
|
|
1138
1086
|
}
|
|
1139
1087
|
function Pt(l) {
|
|
1140
1088
|
return Te(l) && Xe(l) == o;
|
|
@@ -1142,42 +1090,42 @@ function fn() {
|
|
|
1142
1090
|
function is(l) {
|
|
1143
1091
|
if (!ue(l) || bs(l))
|
|
1144
1092
|
return !1;
|
|
1145
|
-
var u = ft(l) ?
|
|
1146
|
-
return u.test(
|
|
1093
|
+
var u = ft(l) ? Mi : Be;
|
|
1094
|
+
return u.test(As(l));
|
|
1147
1095
|
}
|
|
1148
1096
|
function ss(l) {
|
|
1149
|
-
return Te(l) && jt(l.length) && !!
|
|
1097
|
+
return Te(l) && jt(l.length) && !!F[Xe(l)];
|
|
1150
1098
|
}
|
|
1151
1099
|
function ns(l) {
|
|
1152
1100
|
if (!ue(l))
|
|
1153
1101
|
return ys(l);
|
|
1154
|
-
var u =
|
|
1155
|
-
for (var
|
|
1156
|
-
|
|
1102
|
+
var u = Yt(l), m = [];
|
|
1103
|
+
for (var T in l)
|
|
1104
|
+
T == "constructor" && (u || !ne.call(l, T)) || m.push(T);
|
|
1157
1105
|
return m;
|
|
1158
1106
|
}
|
|
1159
|
-
function zt(l, u, m,
|
|
1160
|
-
l !== u && ts(u, function(
|
|
1161
|
-
if (
|
|
1162
|
-
as(l, u, B, m, zt,
|
|
1107
|
+
function zt(l, u, m, T, D) {
|
|
1108
|
+
l !== u && ts(u, function(H, B) {
|
|
1109
|
+
if (D || (D = new pe()), ue(H))
|
|
1110
|
+
as(l, u, B, m, zt, T, D);
|
|
1163
1111
|
else {
|
|
1164
|
-
var
|
|
1165
|
-
|
|
1112
|
+
var L = T ? T(ct(l, B), H, B + "", l, u, D) : void 0;
|
|
1113
|
+
L === void 0 && (L = H), rt(l, B, L);
|
|
1166
1114
|
}
|
|
1167
1115
|
}, Ut);
|
|
1168
1116
|
}
|
|
1169
|
-
function as(l, u, m,
|
|
1170
|
-
var
|
|
1117
|
+
function as(l, u, m, T, D, H, B) {
|
|
1118
|
+
var L = ct(l, m), I = ct(u, m), J = B.get(I);
|
|
1171
1119
|
if (J) {
|
|
1172
1120
|
rt(l, m, J);
|
|
1173
1121
|
return;
|
|
1174
1122
|
}
|
|
1175
|
-
var W =
|
|
1176
|
-
if (
|
|
1177
|
-
var gt = dt(
|
|
1178
|
-
W =
|
|
1123
|
+
var W = H ? H(L, I, m + "", l, u, B) : void 0, Ae = W === void 0;
|
|
1124
|
+
if (Ae) {
|
|
1125
|
+
var gt = dt(I), mt = !gt && Wt(I), Zt = !gt && !mt && Xt(I);
|
|
1126
|
+
W = I, gt || mt || Zt ? dt(L) ? W = L : Ss(L) ? W = ds(L) : mt ? (Ae = !1, W = ls(I)) : Zt ? (Ae = !1, W = hs(I)) : W = [] : Ms(I) || ht(I) ? (W = L, ht(L) ? W = Ds(L) : (!ue(L) || ft(L)) && (W = ps(I))) : Ae = !1;
|
|
1179
1127
|
}
|
|
1180
|
-
|
|
1128
|
+
Ae && (B.set(I, W), D(W, I, T, H, B), B.delete(I)), rt(l, m, W);
|
|
1181
1129
|
}
|
|
1182
1130
|
function rs(l, u) {
|
|
1183
1131
|
return Cs(xs(l, u, Gt), l + "");
|
|
@@ -1195,42 +1143,42 @@ function fn() {
|
|
|
1195
1143
|
}
|
|
1196
1144
|
function cs(l) {
|
|
1197
1145
|
var u = new l.constructor(l.byteLength);
|
|
1198
|
-
return new
|
|
1146
|
+
return new Bt(u).set(new Bt(l)), u;
|
|
1199
1147
|
}
|
|
1200
1148
|
function hs(l, u) {
|
|
1201
1149
|
var m = cs(l.buffer);
|
|
1202
1150
|
return new l.constructor(m, l.byteOffset, l.length);
|
|
1203
1151
|
}
|
|
1204
1152
|
function ds(l, u) {
|
|
1205
|
-
var m = -1,
|
|
1206
|
-
for (u || (u = Array(
|
|
1153
|
+
var m = -1, T = l.length;
|
|
1154
|
+
for (u || (u = Array(T)); ++m < T; )
|
|
1207
1155
|
u[m] = l[m];
|
|
1208
1156
|
return u;
|
|
1209
1157
|
}
|
|
1210
|
-
function us(l, u, m,
|
|
1211
|
-
var
|
|
1158
|
+
function us(l, u, m, T) {
|
|
1159
|
+
var D = !m;
|
|
1212
1160
|
m || (m = {});
|
|
1213
|
-
for (var
|
|
1214
|
-
var
|
|
1215
|
-
|
|
1161
|
+
for (var H = -1, B = u.length; ++H < B; ) {
|
|
1162
|
+
var L = u[H], I = void 0;
|
|
1163
|
+
I === void 0 && (I = l[L]), D ? ot(m, L, I) : es(m, L, I);
|
|
1216
1164
|
}
|
|
1217
1165
|
return m;
|
|
1218
1166
|
}
|
|
1219
1167
|
function fs(l) {
|
|
1220
1168
|
return rs(function(u, m) {
|
|
1221
|
-
var
|
|
1222
|
-
for (
|
|
1223
|
-
var
|
|
1224
|
-
|
|
1169
|
+
var T = -1, D = m.length, H = D > 1 ? m[D - 1] : void 0, B = D > 2 ? m[2] : void 0;
|
|
1170
|
+
for (H = l.length > 3 && typeof H == "function" ? (D--, H) : void 0, B && _s(m[0], m[1], B) && (H = D < 3 ? void 0 : H, D = 1), u = Object(u); ++T < D; ) {
|
|
1171
|
+
var L = m[T];
|
|
1172
|
+
L && l(u, L, T, H);
|
|
1225
1173
|
}
|
|
1226
1174
|
return u;
|
|
1227
1175
|
});
|
|
1228
1176
|
}
|
|
1229
1177
|
function gs(l) {
|
|
1230
|
-
return function(u, m,
|
|
1231
|
-
for (var
|
|
1232
|
-
var
|
|
1233
|
-
if (m(I
|
|
1178
|
+
return function(u, m, T) {
|
|
1179
|
+
for (var D = -1, H = Object(u), B = T(u), L = B.length; L--; ) {
|
|
1180
|
+
var I = B[++D];
|
|
1181
|
+
if (m(H[I], I, H) === !1)
|
|
1234
1182
|
break;
|
|
1235
1183
|
}
|
|
1236
1184
|
return u;
|
|
@@ -1248,33 +1196,33 @@ function fn() {
|
|
|
1248
1196
|
var u = ne.call(l, he), m = l[he];
|
|
1249
1197
|
try {
|
|
1250
1198
|
l[he] = void 0;
|
|
1251
|
-
var
|
|
1199
|
+
var T = !0;
|
|
1252
1200
|
} catch {
|
|
1253
1201
|
}
|
|
1254
|
-
var
|
|
1255
|
-
return
|
|
1202
|
+
var D = Ft.call(l);
|
|
1203
|
+
return T && (u ? l[he] = m : delete l[he]), D;
|
|
1256
1204
|
}
|
|
1257
1205
|
function ps(l) {
|
|
1258
|
-
return typeof l.constructor == "function" && !
|
|
1206
|
+
return typeof l.constructor == "function" && !Yt(l) ? Ni(It(l)) : {};
|
|
1259
1207
|
}
|
|
1260
|
-
function
|
|
1208
|
+
function Vt(l, u) {
|
|
1261
1209
|
var m = typeof l;
|
|
1262
|
-
return u = u ?? r, !!u && (m == "number" || m != "symbol" &&
|
|
1210
|
+
return u = u ?? r, !!u && (m == "number" || m != "symbol" && Ie.test(l)) && l > -1 && l % 1 == 0 && l < u;
|
|
1263
1211
|
}
|
|
1264
1212
|
function _s(l, u, m) {
|
|
1265
1213
|
if (!ue(m))
|
|
1266
1214
|
return !1;
|
|
1267
|
-
var
|
|
1268
|
-
return (
|
|
1215
|
+
var T = typeof u;
|
|
1216
|
+
return (T == "number" ? ut(m) && Vt(u, m.length) : T == "string" && u in m) ? Ge(m[u], l) : !1;
|
|
1269
1217
|
}
|
|
1270
1218
|
function vs(l) {
|
|
1271
1219
|
var u = typeof l;
|
|
1272
1220
|
return u == "string" || u == "number" || u == "symbol" || u == "boolean" ? l !== "__proto__" : l === null;
|
|
1273
1221
|
}
|
|
1274
1222
|
function bs(l) {
|
|
1275
|
-
return !!
|
|
1223
|
+
return !!Nt && Nt in l;
|
|
1276
1224
|
}
|
|
1277
|
-
function
|
|
1225
|
+
function Yt(l) {
|
|
1278
1226
|
var u = l && l.constructor, m = typeof u == "function" && u.prototype || ze;
|
|
1279
1227
|
return l === m;
|
|
1280
1228
|
}
|
|
@@ -1286,16 +1234,16 @@ function fn() {
|
|
|
1286
1234
|
return u;
|
|
1287
1235
|
}
|
|
1288
1236
|
function ws(l) {
|
|
1289
|
-
return
|
|
1237
|
+
return Ft.call(l);
|
|
1290
1238
|
}
|
|
1291
1239
|
function xs(l, u, m) {
|
|
1292
1240
|
return u = $t(u === void 0 ? l.length - 1 : u, 0), function() {
|
|
1293
|
-
for (var
|
|
1294
|
-
B[
|
|
1295
|
-
|
|
1296
|
-
for (var
|
|
1297
|
-
|
|
1298
|
-
return
|
|
1241
|
+
for (var T = arguments, D = -1, H = $t(T.length - u, 0), B = Array(H); ++D < H; )
|
|
1242
|
+
B[D] = T[u + D];
|
|
1243
|
+
D = -1;
|
|
1244
|
+
for (var L = Array(u + 1); ++D < u; )
|
|
1245
|
+
L[D] = T[D];
|
|
1246
|
+
return L[u] = m(B), Oe(l, this, L);
|
|
1299
1247
|
};
|
|
1300
1248
|
}
|
|
1301
1249
|
function ct(l, u) {
|
|
@@ -1306,8 +1254,8 @@ function fn() {
|
|
|
1306
1254
|
function Ts(l) {
|
|
1307
1255
|
var u = 0, m = 0;
|
|
1308
1256
|
return function() {
|
|
1309
|
-
var
|
|
1310
|
-
if (m =
|
|
1257
|
+
var T = Li(), D = a - (T - m);
|
|
1258
|
+
if (m = T, D > 0) {
|
|
1311
1259
|
if (++u >= n)
|
|
1312
1260
|
return arguments[0];
|
|
1313
1261
|
} else
|
|
@@ -1315,10 +1263,10 @@ function fn() {
|
|
|
1315
1263
|
return l.apply(void 0, arguments);
|
|
1316
1264
|
};
|
|
1317
1265
|
}
|
|
1318
|
-
function
|
|
1266
|
+
function As(l) {
|
|
1319
1267
|
if (l != null) {
|
|
1320
1268
|
try {
|
|
1321
|
-
return
|
|
1269
|
+
return Ve.call(l);
|
|
1322
1270
|
} catch {
|
|
1323
1271
|
}
|
|
1324
1272
|
try {
|
|
@@ -1339,7 +1287,7 @@ function fn() {
|
|
|
1339
1287
|
function ut(l) {
|
|
1340
1288
|
return l != null && jt(l.length) && !ft(l);
|
|
1341
1289
|
}
|
|
1342
|
-
function
|
|
1290
|
+
function Ss(l) {
|
|
1343
1291
|
return Te(l) && ut(l);
|
|
1344
1292
|
}
|
|
1345
1293
|
var Wt = Ei || Ls;
|
|
@@ -1347,7 +1295,7 @@ function fn() {
|
|
|
1347
1295
|
if (!ue(l))
|
|
1348
1296
|
return !1;
|
|
1349
1297
|
var u = Xe(l);
|
|
1350
|
-
return u == p || u ==
|
|
1298
|
+
return u == p || u == y || u == h || u == C;
|
|
1351
1299
|
}
|
|
1352
1300
|
function jt(l) {
|
|
1353
1301
|
return typeof l == "number" && l > -1 && l % 1 == 0 && l <= r;
|
|
@@ -1359,14 +1307,14 @@ function fn() {
|
|
|
1359
1307
|
function Te(l) {
|
|
1360
1308
|
return l != null && typeof l == "object";
|
|
1361
1309
|
}
|
|
1362
|
-
function
|
|
1363
|
-
if (!Te(l) || Xe(l) !=
|
|
1310
|
+
function Ms(l) {
|
|
1311
|
+
if (!Te(l) || Xe(l) != w)
|
|
1364
1312
|
return !1;
|
|
1365
|
-
var u =
|
|
1313
|
+
var u = It(l);
|
|
1366
1314
|
if (u === null)
|
|
1367
1315
|
return !0;
|
|
1368
1316
|
var m = ne.call(u, "constructor") && u.constructor;
|
|
1369
|
-
return typeof m == "function" && m instanceof m &&
|
|
1317
|
+
return typeof m == "function" && m instanceof m && Ve.call(m) == Si;
|
|
1370
1318
|
}
|
|
1371
1319
|
var Xt = we ? le(we) : ss;
|
|
1372
1320
|
function Ds(l) {
|
|
@@ -1390,7 +1338,7 @@ function fn() {
|
|
|
1390
1338
|
return !1;
|
|
1391
1339
|
}
|
|
1392
1340
|
i.exports = ks;
|
|
1393
|
-
}(
|
|
1341
|
+
}(Me, Me.exports)), Me.exports;
|
|
1394
1342
|
}
|
|
1395
1343
|
var gn = fn();
|
|
1396
1344
|
const Qe = /* @__PURE__ */ un(gn), ni = 12, mn = {
|
|
@@ -1607,25 +1555,25 @@ function ai(i, e) {
|
|
|
1607
1555
|
let d = c;
|
|
1608
1556
|
a.forEach((g, _) => {
|
|
1609
1557
|
const p = (h - d) / a.length;
|
|
1610
|
-
let
|
|
1611
|
-
const
|
|
1612
|
-
let
|
|
1558
|
+
let y = d + p * _, v = y + p;
|
|
1559
|
+
const b = Math.abs(y - v);
|
|
1560
|
+
let x = Math.max(y, v) + b / 2, w = Math.min(y, v) - b / 2;
|
|
1613
1561
|
if (e.trade) {
|
|
1614
|
-
const
|
|
1615
|
-
const
|
|
1616
|
-
return
|
|
1562
|
+
const S = [...e.trade.entries, ...e.trade.exits].find((M) => {
|
|
1563
|
+
const N = M.time.getTime();
|
|
1564
|
+
return N >= g && N < g + t;
|
|
1617
1565
|
});
|
|
1618
|
-
|
|
1566
|
+
S && (S.type === "buy" ? (w = S.price, v = Math.max(w, v), y = v + b, x = Math.max(y, v) + b / 2, d = y) : S.type === "sell" && (x = S.price, v = Math.min(x, v), y = v - b, w = Math.min(y, v) - b / 2, d = y));
|
|
1619
1567
|
}
|
|
1620
|
-
const
|
|
1568
|
+
const C = {
|
|
1621
1569
|
open_time: new Date(g),
|
|
1622
1570
|
close_time: new Date(g + t),
|
|
1623
|
-
open:
|
|
1624
|
-
close:
|
|
1625
|
-
high:
|
|
1626
|
-
low:
|
|
1571
|
+
open: y,
|
|
1572
|
+
close: v,
|
|
1573
|
+
high: x,
|
|
1574
|
+
low: w
|
|
1627
1575
|
};
|
|
1628
|
-
n.push(
|
|
1576
|
+
n.push(C);
|
|
1629
1577
|
});
|
|
1630
1578
|
}), n;
|
|
1631
1579
|
}
|
|
@@ -1727,12 +1675,12 @@ class vi {
|
|
|
1727
1675
|
}
|
|
1728
1676
|
class bi extends vi {
|
|
1729
1677
|
constructor() {
|
|
1730
|
-
super(), this._scale =
|
|
1678
|
+
super(), this._scale = E.scaleTime();
|
|
1731
1679
|
}
|
|
1732
1680
|
}
|
|
1733
1681
|
class wn extends vi {
|
|
1734
1682
|
constructor() {
|
|
1735
|
-
super(), this._scale =
|
|
1683
|
+
super(), this._scale = E.scaleLinear();
|
|
1736
1684
|
}
|
|
1737
1685
|
}
|
|
1738
1686
|
const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
@@ -1749,16 +1697,16 @@ const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
|
1749
1697
|
const [t, s] = e.domain().map((o) => o.getTime()), n = i.filter((o) => {
|
|
1750
1698
|
const c = o.open_time.getTime();
|
|
1751
1699
|
return c >= t && c <= s;
|
|
1752
|
-
}), a =
|
|
1700
|
+
}), a = E.min(n, (o) => o.low), r = E.max(n, (o) => o.high);
|
|
1753
1701
|
if (a == null || r == null) throw new Error("Invalid Y data");
|
|
1754
1702
|
return [a, r];
|
|
1755
1703
|
};
|
|
1756
|
-
class
|
|
1704
|
+
class An {
|
|
1757
1705
|
constructor(e) {
|
|
1758
1706
|
this.model = e;
|
|
1759
1707
|
}
|
|
1760
1708
|
initX(e) {
|
|
1761
|
-
const t = this.model.candles.preparedData, s =
|
|
1709
|
+
const t = this.model.candles.preparedData, s = E.extent(t, (n) => new Date(n.open_time));
|
|
1762
1710
|
if (!s[0] || !s[1]) throw new Error("Invalid x data");
|
|
1763
1711
|
e.setDomain(s), this.setRange(e, this.model.layout.xAxis), this.setDefaultXDomain(e), this.applyOffset(e);
|
|
1764
1712
|
}
|
|
@@ -1792,7 +1740,7 @@ class Mn {
|
|
|
1792
1740
|
e.setDomain([new Date(h.getTime() + c), new Date(d.getTime() + c)]);
|
|
1793
1741
|
}
|
|
1794
1742
|
}
|
|
1795
|
-
class
|
|
1743
|
+
class Sn {
|
|
1796
1744
|
constructor(e) {
|
|
1797
1745
|
f(this, "_model");
|
|
1798
1746
|
f(this, "_scaleX");
|
|
@@ -1804,7 +1752,7 @@ class An {
|
|
|
1804
1752
|
});
|
|
1805
1753
|
f(this, "scaleFactor", { x: 1, y: 1 });
|
|
1806
1754
|
f(this, "panOffset", { x: 0, y: 0 });
|
|
1807
|
-
this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new
|
|
1755
|
+
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 = {
|
|
1808
1756
|
x: this._scaleX.domain(),
|
|
1809
1757
|
y: this._scaleY.domain()
|
|
1810
1758
|
};
|
|
@@ -1876,7 +1824,7 @@ class An {
|
|
|
1876
1824
|
this._model.eventBus.emit("scale_event");
|
|
1877
1825
|
}
|
|
1878
1826
|
}
|
|
1879
|
-
class
|
|
1827
|
+
class Mn {
|
|
1880
1828
|
constructor(e, { entry: t = [], exit: s = [] }) {
|
|
1881
1829
|
f(this, "_model");
|
|
1882
1830
|
f(this, "_rawEntry");
|
|
@@ -2133,7 +2081,7 @@ class Ln {
|
|
|
2133
2081
|
this._updateGroups(), this._callbacks.onUpdate(e, t);
|
|
2134
2082
|
}
|
|
2135
2083
|
}
|
|
2136
|
-
class
|
|
2084
|
+
class Nn {
|
|
2137
2085
|
constructor({
|
|
2138
2086
|
chartId: e,
|
|
2139
2087
|
container: t,
|
|
@@ -2155,7 +2103,7 @@ class Fn {
|
|
|
2155
2103
|
f(this, "trade");
|
|
2156
2104
|
f(this, "userMarkers");
|
|
2157
2105
|
f(this, "comments");
|
|
2158
|
-
this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new En(o), this.layout = new _n(t, this.config), this.scales = new
|
|
2106
|
+
this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new En(o), this.layout = new _n(t, this.config), this.scales = new Sn(this), this.trade = new Mn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new Dn(this, r), this.comments = new Ln(c, this);
|
|
2159
2107
|
}
|
|
2160
2108
|
init() {
|
|
2161
2109
|
this.eventBus.emit("init_model");
|
|
@@ -2186,7 +2134,7 @@ class Fn {
|
|
|
2186
2134
|
}
|
|
2187
2135
|
}
|
|
2188
2136
|
const qe = window.devicePixelRatio || 2;
|
|
2189
|
-
class
|
|
2137
|
+
class k {
|
|
2190
2138
|
constructor({ tag: e, className: t, id: s, textContent: n }) {
|
|
2191
2139
|
f(this, "_tag");
|
|
2192
2140
|
f(this, "_className");
|
|
@@ -2224,7 +2172,7 @@ class F {
|
|
|
2224
2172
|
this.node.style.opacity = e ? "1" : "0", this.node.style.visibility = e ? "visible" : "hidden";
|
|
2225
2173
|
}
|
|
2226
2174
|
}
|
|
2227
|
-
class Le extends
|
|
2175
|
+
class Le extends k {
|
|
2228
2176
|
constructor({ className: t, id: s, width: n, height: a, isMain: r }) {
|
|
2229
2177
|
super({
|
|
2230
2178
|
tag: "canvas",
|
|
@@ -2256,20 +2204,20 @@ class Le extends F {
|
|
|
2256
2204
|
return this._height;
|
|
2257
2205
|
}
|
|
2258
2206
|
}
|
|
2259
|
-
const
|
|
2207
|
+
const Fn = 10;
|
|
2260
2208
|
function Hn(i, e) {
|
|
2261
2209
|
const {
|
|
2262
2210
|
layout: { xAxis: t },
|
|
2263
2211
|
colorScheme: { xAxis: s },
|
|
2264
2212
|
config: { xAxis: n },
|
|
2265
2213
|
scales: a
|
|
2266
|
-
} = e, r = a.x.ticks(
|
|
2214
|
+
} = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = E.timeFormat("%d %b"), h = E.timeFormat("%H:%M");
|
|
2267
2215
|
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) => {
|
|
2268
2216
|
const g = a.x.convert(d), _ = o(d) ? c(d) : h(d);
|
|
2269
2217
|
i.fillText(_, g, t.y + t.height / 2);
|
|
2270
2218
|
});
|
|
2271
2219
|
}
|
|
2272
|
-
function
|
|
2220
|
+
function Bn(i, e) {
|
|
2273
2221
|
const {
|
|
2274
2222
|
layout: { yAxis: t },
|
|
2275
2223
|
colorScheme: { yAxis: s },
|
|
@@ -2281,7 +2229,7 @@ function In(i, e) {
|
|
|
2281
2229
|
i.fillText(d, t.x + t.width / 2, h);
|
|
2282
2230
|
});
|
|
2283
2231
|
}
|
|
2284
|
-
const
|
|
2232
|
+
const In = (i, e) => {
|
|
2285
2233
|
const {
|
|
2286
2234
|
layout: { axisIntersection: t },
|
|
2287
2235
|
colorScheme: s
|
|
@@ -2298,10 +2246,10 @@ class bt {
|
|
|
2298
2246
|
Hn(e, t);
|
|
2299
2247
|
}
|
|
2300
2248
|
static yAxis(e, t) {
|
|
2301
|
-
|
|
2249
|
+
Bn(e, t);
|
|
2302
2250
|
}
|
|
2303
2251
|
static intersection(e, t) {
|
|
2304
|
-
|
|
2252
|
+
In(e, t);
|
|
2305
2253
|
}
|
|
2306
2254
|
}
|
|
2307
2255
|
class Rn {
|
|
@@ -2335,15 +2283,15 @@ function Ke(i) {
|
|
|
2335
2283
|
return i * 0.1875;
|
|
2336
2284
|
}
|
|
2337
2285
|
const $n = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2338
|
-
const g = r / 16, _ = 16 * g, p = n - _ / 2,
|
|
2339
|
-
i.save(), i.translate(p,
|
|
2340
|
-
const
|
|
2341
|
-
i.fillStyle = t, i.fillText(s, n, C), i.restore();
|
|
2342
|
-
}, On = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2343
|
-
const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
|
|
2344
|
-
i.save(), i.translate(p, v), i.scale(g, -g), i.beginPath(), i.moveTo(7.85696, 0.288512), i.lineTo(4.53377, 3.11938), i.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), i.lineTo(11.2275, 4), i.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), i.lineTo(8.52156, 0.302869), i.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), i.closePath(), i.fillStyle = e, i.fill(), i.beginPath(), i.moveTo(0, 7), i.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), i.lineTo(12, 3), i.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), i.lineTo(16, 15), i.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), i.lineTo(4, 19), i.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), i.lineTo(0, 7), i.closePath(), i.fillStyle = e, i.fill(), i.restore(), i.save(), i.font = `bold ${o}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle";
|
|
2345
|
-
const b = g * 16, x = a - g * 19 + b / 2;
|
|
2286
|
+
const g = r / 16, _ = 16 * g, p = n - _ / 2, y = a;
|
|
2287
|
+
i.save(), i.translate(p, y), i.scale(g, g), i.beginPath(), i.moveTo(7.85696, 0.288512), i.lineTo(4.53377, 3.11938), i.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), i.lineTo(11.2275, 4), i.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), i.lineTo(8.52156, 0.302869), i.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), i.closePath(), i.fillStyle = e, i.fill(), i.beginPath(), i.moveTo(0, 7), i.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), i.lineTo(12, 3), i.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), i.lineTo(16, 15), i.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), i.lineTo(4, 19), i.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), i.lineTo(0, 7), i.closePath(), i.fillStyle = e, i.fill(), i.restore(), i.save(), i.font = `bold ${o}px sans-serif`, i.textAlign = "center", i.textBaseline = "top", i.textAlign = "center", i.textBaseline = "middle";
|
|
2288
|
+
const v = a + g * 3 + 0.5, b = g * 16, x = v + b / 2;
|
|
2346
2289
|
i.fillStyle = t, i.fillText(s, n, x), i.restore();
|
|
2290
|
+
}, On = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2291
|
+
const g = r / 16, _ = 16 * g, p = n - _ / 2, y = a;
|
|
2292
|
+
i.save(), i.translate(p, y), i.scale(g, -g), i.beginPath(), i.moveTo(7.85696, 0.288512), i.lineTo(4.53377, 3.11938), i.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), i.lineTo(11.2275, 4), i.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), i.lineTo(8.52156, 0.302869), i.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), i.closePath(), i.fillStyle = e, i.fill(), i.beginPath(), i.moveTo(0, 7), i.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), i.lineTo(12, 3), i.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), i.lineTo(16, 15), i.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), i.lineTo(4, 19), i.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), i.lineTo(0, 7), i.closePath(), i.fillStyle = e, i.fill(), i.restore(), i.save(), i.font = `bold ${o}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle";
|
|
2293
|
+
const v = g * 16, b = a - g * 19 + v / 2;
|
|
2294
|
+
i.fillStyle = t, i.fillText(s, n, b), i.restore();
|
|
2347
2295
|
};
|
|
2348
2296
|
function et(i) {
|
|
2349
2297
|
"@babel/helpers - typeof";
|
|
@@ -2359,7 +2307,7 @@ function A(i, e) {
|
|
|
2359
2307
|
return i;
|
|
2360
2308
|
if (!(this instanceof A))
|
|
2361
2309
|
return new A(i, e);
|
|
2362
|
-
var t =
|
|
2310
|
+
var t = Vn(i);
|
|
2363
2311
|
this._originalInput = i, this._r = t.r, this._g = t.g, this._b = t.b, this._a = t.a, this._roundA = Math.round(100 * this._a) / 100, this._format = e.format || t.format, this._gradientType = e.gradientType, this._r < 1 && (this._r = Math.round(this._r)), this._g < 1 && (this._g = Math.round(this._g)), this._b < 1 && (this._b = Math.round(this._b)), this._ok = t.ok;
|
|
2364
2312
|
}
|
|
2365
2313
|
A.prototype = {
|
|
@@ -2443,14 +2391,14 @@ A.prototype = {
|
|
|
2443
2391
|
},
|
|
2444
2392
|
toPercentageRgb: function() {
|
|
2445
2393
|
return {
|
|
2446
|
-
r: Math.round(
|
|
2447
|
-
g: Math.round(
|
|
2448
|
-
b: Math.round(
|
|
2394
|
+
r: Math.round(R(this._r, 255) * 100) + "%",
|
|
2395
|
+
g: Math.round(R(this._g, 255) * 100) + "%",
|
|
2396
|
+
b: Math.round(R(this._b, 255) * 100) + "%",
|
|
2449
2397
|
a: this._a
|
|
2450
2398
|
};
|
|
2451
2399
|
},
|
|
2452
2400
|
toPercentageRgbString: function() {
|
|
2453
|
-
return this._a == 1 ? "rgb(" + Math.round(
|
|
2401
|
+
return this._a == 1 ? "rgb(" + Math.round(R(this._r, 255) * 100) + "%, " + Math.round(R(this._g, 255) * 100) + "%, " + Math.round(R(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(R(this._r, 255) * 100) + "%, " + Math.round(R(this._g, 255) * 100) + "%, " + Math.round(R(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
2454
2402
|
},
|
|
2455
2403
|
toName: function() {
|
|
2456
2404
|
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : na[hi(this._r, this._g, this._b, !0)] || !1;
|
|
@@ -2532,13 +2480,13 @@ A.fromRatio = function(i, e) {
|
|
|
2532
2480
|
}
|
|
2533
2481
|
return A(i, e);
|
|
2534
2482
|
};
|
|
2535
|
-
function
|
|
2483
|
+
function Vn(i) {
|
|
2536
2484
|
var e = {
|
|
2537
2485
|
r: 0,
|
|
2538
2486
|
g: 0,
|
|
2539
2487
|
b: 0
|
|
2540
2488
|
}, t = 1, s = null, n = null, a = null, r = !1, o = !1;
|
|
2541
|
-
return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e =
|
|
2489
|
+
return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e = Yn(i.r, i.g, i.b), r = !0, o = String(i.r).substr(-1) === "%" ? "prgb" : "rgb") : ie(i.h) && ie(i.s) && ie(i.v) ? (s = De(i.s), n = De(i.v), e = jn(i.h, s, n), r = !0, o = "hsv") : ie(i.h) && ie(i.s) && ie(i.l) && (s = De(i.s), a = De(i.l), e = Wn(i.h, s, a), r = !0, o = "hsl"), i.hasOwnProperty("a") && (t = i.a)), t = yi(t), {
|
|
2542
2490
|
ok: r,
|
|
2543
2491
|
format: i.format || o,
|
|
2544
2492
|
r: Math.min(255, Math.max(e.r, 0)),
|
|
@@ -2547,15 +2495,15 @@ function Yn(i) {
|
|
|
2547
2495
|
a: t
|
|
2548
2496
|
};
|
|
2549
2497
|
}
|
|
2550
|
-
function
|
|
2498
|
+
function Yn(i, e, t) {
|
|
2551
2499
|
return {
|
|
2552
|
-
r:
|
|
2553
|
-
g:
|
|
2554
|
-
b:
|
|
2500
|
+
r: R(i, 255) * 255,
|
|
2501
|
+
g: R(e, 255) * 255,
|
|
2502
|
+
b: R(t, 255) * 255
|
|
2555
2503
|
};
|
|
2556
2504
|
}
|
|
2557
2505
|
function li(i, e, t) {
|
|
2558
|
-
i =
|
|
2506
|
+
i = R(i, 255), e = R(e, 255), t = R(t, 255);
|
|
2559
2507
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = (s + n) / 2;
|
|
2560
2508
|
if (s == n)
|
|
2561
2509
|
a = r = 0;
|
|
@@ -2582,7 +2530,7 @@ function li(i, e, t) {
|
|
|
2582
2530
|
}
|
|
2583
2531
|
function Wn(i, e, t) {
|
|
2584
2532
|
var s, n, a;
|
|
2585
|
-
i =
|
|
2533
|
+
i = R(i, 360), e = R(e, 100), t = R(t, 100);
|
|
2586
2534
|
function r(h, d, g) {
|
|
2587
2535
|
return g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ? h + (d - h) * 6 * g : g < 1 / 2 ? d : g < 2 / 3 ? h + (d - h) * (2 / 3 - g) * 6 : h;
|
|
2588
2536
|
}
|
|
@@ -2599,7 +2547,7 @@ function Wn(i, e, t) {
|
|
|
2599
2547
|
};
|
|
2600
2548
|
}
|
|
2601
2549
|
function ci(i, e, t) {
|
|
2602
|
-
i =
|
|
2550
|
+
i = R(i, 255), e = R(e, 255), t = R(t, 255);
|
|
2603
2551
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = s, c = s - n;
|
|
2604
2552
|
if (r = s === 0 ? 0 : c / s, s == n)
|
|
2605
2553
|
a = 0;
|
|
@@ -2624,7 +2572,7 @@ function ci(i, e, t) {
|
|
|
2624
2572
|
};
|
|
2625
2573
|
}
|
|
2626
2574
|
function jn(i, e, t) {
|
|
2627
|
-
i =
|
|
2575
|
+
i = R(i, 360) * 6, e = R(e, 100), t = R(t, 100);
|
|
2628
2576
|
var s = Math.floor(i), n = i - s, a = t * (1 - e), r = t * (1 - n * e), o = t * (1 - (1 - n) * e), c = s % 6, h = [t, r, a, a, o, t][c], d = [o, t, t, r, a, a][c], g = [a, a, o, t, t, r][c];
|
|
2629
2577
|
return {
|
|
2630
2578
|
r: h * 255,
|
|
@@ -2930,7 +2878,7 @@ function aa(i) {
|
|
|
2930
2878
|
function yi(i) {
|
|
2931
2879
|
return i = parseFloat(i), (isNaN(i) || i < 0 || i > 1) && (i = 1), i;
|
|
2932
2880
|
}
|
|
2933
|
-
function
|
|
2881
|
+
function R(i, e) {
|
|
2934
2882
|
ra(i) && (i = "100%");
|
|
2935
2883
|
var t = oa(i);
|
|
2936
2884
|
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);
|
|
@@ -3066,15 +3014,15 @@ function ha(i, e) {
|
|
|
3066
3014
|
const { trade: o } = a, c = 4;
|
|
3067
3015
|
t.forEach(({ isHovered: h, isActive: d, candle: g, trades: _ }) => {
|
|
3068
3016
|
const p = s.convert(g.open_time);
|
|
3069
|
-
_.forEach((
|
|
3070
|
-
const
|
|
3071
|
-
let
|
|
3072
|
-
h && h[1] && h[0] ===
|
|
3017
|
+
_.forEach((y) => {
|
|
3018
|
+
const v = y.type === "buy", b = v ? o.buyLabel.text : o.sellLabel.text, x = v ? "B" : "S", w = v ? n.convert(g.low) + c : n.convert(g.high) - c, C = v ? $n : On;
|
|
3019
|
+
let S = v ? o.buyLabel.main : o.sellLabel.main;
|
|
3020
|
+
h && h[1] && h[0] === y.type && (S = A.mix(S, a.bg, 20).toString()), d && d[1] && d[0] === y.type && (S = o.activeLabel), C(i, {
|
|
3073
3021
|
x: p,
|
|
3074
|
-
y,
|
|
3075
|
-
symbol:
|
|
3076
|
-
mainColor:
|
|
3077
|
-
textColor:
|
|
3022
|
+
y: w,
|
|
3023
|
+
symbol: x,
|
|
3024
|
+
mainColor: S,
|
|
3025
|
+
textColor: b,
|
|
3078
3026
|
size: 16,
|
|
3079
3027
|
fontSize: 12
|
|
3080
3028
|
});
|
|
@@ -3117,11 +3065,11 @@ const ua = (i, e) => {
|
|
|
3117
3065
|
(p) => g.getTime() >= p.candle.open_time.getTime() && g.getTime() < p.candle.close_time.getTime()
|
|
3118
3066
|
)) == null ? void 0 : _.candle;
|
|
3119
3067
|
}, d = (g, _) => {
|
|
3120
|
-
const p = h(g.time),
|
|
3121
|
-
if (!p || !
|
|
3122
|
-
const
|
|
3123
|
-
let
|
|
3124
|
-
g.type === "buy" ? (
|
|
3068
|
+
const p = h(g.time), y = h(_.time);
|
|
3069
|
+
if (!p || !y) return;
|
|
3070
|
+
const v = t.convert(p.open_time), b = t.convert(y.open_time);
|
|
3071
|
+
let x, w;
|
|
3072
|
+
g.type === "buy" ? (x = s.convert(p.low), w = s.convert(y.high)) : (x = s.convert(p.high), w = s.convert(y.low)), i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.connectionLine, i.moveTo(v, x), i.lineTo(b, w), i.stroke(), i.setLineDash([]);
|
|
3125
3073
|
};
|
|
3126
3074
|
if (a.length === 1 && r.length > 1)
|
|
3127
3075
|
r.forEach((g) => d(a[0], g));
|
|
@@ -3130,7 +3078,7 @@ const ua = (i, e) => {
|
|
|
3130
3078
|
else if (a.length === 1 && r.length === 1)
|
|
3131
3079
|
d(a[0], r[0]);
|
|
3132
3080
|
else if (a.length > 0 && r.length > 0) {
|
|
3133
|
-
const g = a.reduce((p,
|
|
3081
|
+
const g = a.reduce((p, y) => p.time < y.time ? p : y), _ = r.reduce((p, y) => p.time > y.time ? p : y);
|
|
3134
3082
|
d(g, _);
|
|
3135
3083
|
}
|
|
3136
3084
|
i.restore();
|
|
@@ -3171,7 +3119,7 @@ function ga(i) {
|
|
|
3171
3119
|
return s.length ? s.join(" ") : "0s";
|
|
3172
3120
|
}
|
|
3173
3121
|
const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
3174
|
-
var
|
|
3122
|
+
var V;
|
|
3175
3123
|
const {
|
|
3176
3124
|
scales: { x: t, y: s },
|
|
3177
3125
|
trade: { entries: n, exits: a, holdTime: r },
|
|
@@ -3185,25 +3133,25 @@ const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
|
3185
3133
|
if (!c) return;
|
|
3186
3134
|
const _ = n.at(0), p = a.at(-1);
|
|
3187
3135
|
if (!_ || !p) return;
|
|
3188
|
-
const
|
|
3189
|
-
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(
|
|
3190
|
-
const
|
|
3136
|
+
const y = (Y) => Y ? Y instanceof Date ? Y : new Date(Y) : null, v = t.convert(y(d == null ? void 0 : d[0]) || _.candle.open_time), b = t.convert(y(d == null ? void 0 : d[1]) || p.candle.open_time), x = s.convert(g || (((V = n.at(0)) == null ? void 0 : V.price) ?? 0));
|
|
3137
|
+
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(v, x), i.lineTo(b, x), i.stroke(), i.setLineDash([]);
|
|
3138
|
+
const w = (v + b) / 2, C = h || `Hold: ${ga(r)}`, M = getComputedStyle(
|
|
3191
3139
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3192
3140
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3193
|
-
i.font = `600 ${ma}px ${
|
|
3194
|
-
const
|
|
3141
|
+
i.font = `600 ${ma}px ${M}`;
|
|
3142
|
+
const $ = i.measureText(C).width + pa * 2, z = va + _a * 2;
|
|
3195
3143
|
xi(i, {
|
|
3196
3144
|
radius: 4,
|
|
3197
3145
|
coords: {
|
|
3198
|
-
x:
|
|
3199
|
-
y:
|
|
3146
|
+
x: w - $ / 2,
|
|
3147
|
+
y: x - z / 2
|
|
3200
3148
|
},
|
|
3201
|
-
width:
|
|
3202
|
-
height:
|
|
3149
|
+
width: $,
|
|
3150
|
+
height: z,
|
|
3203
3151
|
fillColor: o.main
|
|
3204
|
-
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(
|
|
3152
|
+
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(C, w, x), i.restore();
|
|
3205
3153
|
};
|
|
3206
|
-
class
|
|
3154
|
+
class Ne {
|
|
3207
3155
|
constructor(e, t, {
|
|
3208
3156
|
CanvasClass: s = Le,
|
|
3209
3157
|
noCanvas: n = !1,
|
|
@@ -3213,7 +3161,7 @@ class Fe {
|
|
|
3213
3161
|
f(this, "dom", null);
|
|
3214
3162
|
f(this, "prefix");
|
|
3215
3163
|
const { width: r, height: o, canvasesContainer: c, domElements: h } = t;
|
|
3216
|
-
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${e}`, width: r, height: o }), c.append(this.canvas.node)), a || (this.dom = new
|
|
3164
|
+
n || (this.canvas = new s({ className: `sc-charts-cs__canvas-${e}`, width: r, height: o }), c.append(this.canvas.node)), a || (this.dom = new k({ className: `sc-charts-cs__dom-${e}` }), h.append(this.dom.node)), this.prefix = `sc-charts-cs__${e}`;
|
|
3217
3165
|
}
|
|
3218
3166
|
cx(...e) {
|
|
3219
3167
|
return e.map((t) => `${this.prefix}-${t}`).join(" ");
|
|
@@ -3234,36 +3182,36 @@ const ya = {
|
|
|
3234
3182
|
prioritySide: s = "right-bottom",
|
|
3235
3183
|
offset: n = 8
|
|
3236
3184
|
}) => {
|
|
3237
|
-
const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (
|
|
3238
|
-
const { dx:
|
|
3239
|
-
return { x:
|
|
3240
|
-
}, d = ({ x:
|
|
3241
|
-
const
|
|
3242
|
-
return
|
|
3185
|
+
const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (w) => {
|
|
3186
|
+
const { dx: C, dy: S } = ya[w], M = t.x + (C === 1 ? n : -a - n), N = t.y + (S === 1 ? n : -r - n);
|
|
3187
|
+
return { x: M, y: N, side: w };
|
|
3188
|
+
}, d = ({ x: w, y: C }) => w >= 0 && C >= 0 && w + a <= o && C + r <= c, g = () => {
|
|
3189
|
+
const w = t.y < 0, C = t.y + r > c, S = t.x < 0, M = t.x + a > o;
|
|
3190
|
+
return S && w ? "right-bottom" : S && C ? "right-top" : M && w ? "left-bottom" : M && C ? "left-top" : S ? "right-bottom" : M ? "left-bottom" : w ? "right-bottom" : C ? "right-top" : s;
|
|
3243
3191
|
}, p = [
|
|
3244
3192
|
s,
|
|
3245
3193
|
"right-bottom",
|
|
3246
3194
|
"right-top",
|
|
3247
3195
|
"left-bottom",
|
|
3248
3196
|
"left-top"
|
|
3249
|
-
].filter((
|
|
3250
|
-
let
|
|
3251
|
-
for (const
|
|
3252
|
-
const
|
|
3253
|
-
if (d(
|
|
3254
|
-
|
|
3197
|
+
].filter((w, C, S) => S.indexOf(w) === C), y = g();
|
|
3198
|
+
let v = null;
|
|
3199
|
+
for (const w of [y, ...p]) {
|
|
3200
|
+
const C = h(w);
|
|
3201
|
+
if (d(C)) {
|
|
3202
|
+
v = C;
|
|
3255
3203
|
break;
|
|
3256
3204
|
}
|
|
3257
3205
|
}
|
|
3258
|
-
|
|
3259
|
-
const
|
|
3206
|
+
v || (v = h(y));
|
|
3207
|
+
const b = Math.min(Math.max(v.x, n), o - a - n), x = Math.min(Math.max(v.y, n), c - r - n);
|
|
3260
3208
|
return {
|
|
3261
|
-
x,
|
|
3262
|
-
y:
|
|
3263
|
-
side:
|
|
3209
|
+
x: b,
|
|
3210
|
+
y: x,
|
|
3211
|
+
side: v.side
|
|
3264
3212
|
};
|
|
3265
3213
|
};
|
|
3266
|
-
class se extends
|
|
3214
|
+
class se extends k {
|
|
3267
3215
|
constructor(t) {
|
|
3268
3216
|
super(t);
|
|
3269
3217
|
f(this, "_state", {});
|
|
@@ -3306,13 +3254,13 @@ class wa extends se {
|
|
|
3306
3254
|
f(this, "manyBox");
|
|
3307
3255
|
f(this, "oneBox");
|
|
3308
3256
|
f(this, "clsx");
|
|
3309
|
-
this.clsx = t.cxFabric(s), this.title = new
|
|
3257
|
+
this.clsx = t.cxFabric(s), this.title = new k({
|
|
3310
3258
|
tag: "div",
|
|
3311
3259
|
className: this.clsx("title")
|
|
3312
|
-
}), this.manyBox = new
|
|
3260
|
+
}), this.manyBox = new k({
|
|
3313
3261
|
tag: "div",
|
|
3314
3262
|
className: this.clsx("box_many")
|
|
3315
|
-
}), this.oneBox = new
|
|
3263
|
+
}), this.oneBox = new k({
|
|
3316
3264
|
tag: "div",
|
|
3317
3265
|
className: this.clsx("box_one")
|
|
3318
3266
|
}), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() };
|
|
@@ -3321,13 +3269,13 @@ class wa extends se {
|
|
|
3321
3269
|
const n = [];
|
|
3322
3270
|
for (const a of Object.keys(s))
|
|
3323
3271
|
if (a in t) {
|
|
3324
|
-
const r = new
|
|
3272
|
+
const r = new k({
|
|
3325
3273
|
tag: "div",
|
|
3326
3274
|
className: this.clsx("line")
|
|
3327
3275
|
});
|
|
3328
3276
|
let o = t[a].toString();
|
|
3329
3277
|
a === "kind" && (o = this._formatDate(t.time));
|
|
3330
|
-
const c = new
|
|
3278
|
+
const c = new k({ tag: "strong", textContent: s[a] }), h = new k({ tag: "span", textContent: o });
|
|
3331
3279
|
r.append(c.node, h.node), n.push(r.node);
|
|
3332
3280
|
}
|
|
3333
3281
|
return n;
|
|
@@ -3357,7 +3305,7 @@ class wa extends se {
|
|
|
3357
3305
|
} else if (t.length > 1) {
|
|
3358
3306
|
this.manyBox.node.style.display = "flex";
|
|
3359
3307
|
const s = t.map((n) => {
|
|
3360
|
-
const a = new
|
|
3308
|
+
const a = new k({ tag: "div" }), r = this._createLineNodes(n, {
|
|
3361
3309
|
kind: n.kind === "entry" ? "Entry:" : "Exit:",
|
|
3362
3310
|
price: "Price:"
|
|
3363
3311
|
});
|
|
@@ -3378,7 +3326,7 @@ class wa extends se {
|
|
|
3378
3326
|
this.position(r.x, r.y);
|
|
3379
3327
|
}
|
|
3380
3328
|
}
|
|
3381
|
-
class xa extends
|
|
3329
|
+
class xa extends Ne {
|
|
3382
3330
|
constructor(t) {
|
|
3383
3331
|
super("trade", t);
|
|
3384
3332
|
f(this, "labelTooltip");
|
|
@@ -3393,7 +3341,7 @@ class xa extends Fe {
|
|
|
3393
3341
|
function Ca(i, { color: e = "#000000", lineWidth: t = 1, dashed: s, coords: n }) {
|
|
3394
3342
|
i.strokeStyle = e, i.lineWidth = t, s && i.setLineDash(s), i.beginPath(), i.moveTo(n.x1, n.y1), i.lineTo(n.x2, n.y2), i.stroke();
|
|
3395
3343
|
}
|
|
3396
|
-
const Ta = { text: "#FFFFFF", bg: "#000000" },
|
|
3344
|
+
const Ta = { text: "#FFFFFF", bg: "#000000" }, Aa = (i, e) => {
|
|
3397
3345
|
const {
|
|
3398
3346
|
coords: t,
|
|
3399
3347
|
text: s,
|
|
@@ -3408,15 +3356,15 @@ const Ta = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3408
3356
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3409
3357
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3410
3358
|
i.font = `${a} ${n}px ${p}`;
|
|
3411
|
-
const
|
|
3412
|
-
let
|
|
3413
|
-
d.x === "middle" ?
|
|
3359
|
+
const v = i.measureText(s).width + o.x * 2, b = r + o.y * 2;
|
|
3360
|
+
let x = t.x, w = t.y;
|
|
3361
|
+
d.x === "middle" ? x -= v / 2 : d.x === "right" && (x -= v), d.y === "middle" ? w -= b / 2 : d.y === "bottom" && (w -= b), xi(i, {
|
|
3414
3362
|
radius: c,
|
|
3415
|
-
coords: { x
|
|
3416
|
-
width:
|
|
3417
|
-
height:
|
|
3363
|
+
coords: { x, y: w },
|
|
3364
|
+
width: v,
|
|
3365
|
+
height: b,
|
|
3418
3366
|
fillColor: g.bg
|
|
3419
|
-
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s,
|
|
3367
|
+
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, x + v / 2, w + b / 2);
|
|
3420
3368
|
}, gi = {
|
|
3421
3369
|
line: "#000000",
|
|
3422
3370
|
text: "#ffffff",
|
|
@@ -3435,7 +3383,7 @@ const Ta = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3435
3383
|
x2: r.x,
|
|
3436
3384
|
y2: r.y
|
|
3437
3385
|
}
|
|
3438
|
-
}),
|
|
3386
|
+
}), Aa(i, {
|
|
3439
3387
|
text: e,
|
|
3440
3388
|
coords: r,
|
|
3441
3389
|
padding: { x: 6, y: 4 },
|
|
@@ -3452,7 +3400,7 @@ const Ta = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3452
3400
|
}
|
|
3453
3401
|
}), i.restore();
|
|
3454
3402
|
};
|
|
3455
|
-
class
|
|
3403
|
+
class Sa extends Le {
|
|
3456
3404
|
constructor(e) {
|
|
3457
3405
|
super(e);
|
|
3458
3406
|
}
|
|
@@ -3460,9 +3408,9 @@ class Aa extends Le {
|
|
|
3460
3408
|
Ci(this.ctx, e);
|
|
3461
3409
|
}
|
|
3462
3410
|
}
|
|
3463
|
-
class
|
|
3411
|
+
class Ma extends Ne {
|
|
3464
3412
|
constructor(e) {
|
|
3465
|
-
if (super("user-markers", e, { CanvasClass:
|
|
3413
|
+
if (super("user-markers", e, { CanvasClass: Sa, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_UserMarkers] this.canvas must be defined");
|
|
3466
3414
|
}
|
|
3467
3415
|
render(e) {
|
|
3468
3416
|
this.canvas.clear();
|
|
@@ -3501,10 +3449,10 @@ class ae {
|
|
|
3501
3449
|
}
|
|
3502
3450
|
}
|
|
3503
3451
|
const yt = new ae("comment-actions");
|
|
3504
|
-
class ka extends
|
|
3452
|
+
class ka extends k {
|
|
3505
3453
|
constructor({ onDelete: e, onUpdate: t }) {
|
|
3506
3454
|
super({ className: yt.gen() });
|
|
3507
|
-
const s = new
|
|
3455
|
+
const s = new k({ tag: "button", className: yt.gen("edit"), textContent: "Edit" }), n = new k({
|
|
3508
3456
|
tag: "button",
|
|
3509
3457
|
className: yt.gen("delete"),
|
|
3510
3458
|
textContent: "Delete"
|
|
@@ -3571,19 +3519,19 @@ class Ea {
|
|
|
3571
3519
|
this.node = t;
|
|
3572
3520
|
}
|
|
3573
3521
|
}
|
|
3574
|
-
const
|
|
3575
|
-
class La extends
|
|
3522
|
+
const Se = new ae("comment-list");
|
|
3523
|
+
class La extends k {
|
|
3576
3524
|
constructor({ onDelete: t, onOpenEditor: s, comment: n, layout: a }) {
|
|
3577
|
-
super({ className:
|
|
3525
|
+
super({ className: Se.gen("item") });
|
|
3578
3526
|
f(this, "actionTooltip");
|
|
3579
3527
|
f(this, "actionsTrigger");
|
|
3580
|
-
const r = new
|
|
3581
|
-
className:
|
|
3528
|
+
const r = new k({ className: Se.gen("text"), textContent: n.text }), o = new k({
|
|
3529
|
+
className: Se.gen("created-at"),
|
|
3582
3530
|
textContent: fa(new Date(n.createdAt))
|
|
3583
3531
|
});
|
|
3584
|
-
this.actionsTrigger = new
|
|
3532
|
+
this.actionsTrigger = new k({
|
|
3585
3533
|
tag: "button",
|
|
3586
|
-
className:
|
|
3534
|
+
className: Se.gen("action-trigger")
|
|
3587
3535
|
});
|
|
3588
3536
|
const c = new ka({
|
|
3589
3537
|
onDelete: t,
|
|
@@ -3594,11 +3542,11 @@ class La extends F {
|
|
|
3594
3542
|
}), this.actionsTrigger.node.addEventListener("click", () => {
|
|
3595
3543
|
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);
|
|
3596
3544
|
});
|
|
3597
|
-
const h = new
|
|
3545
|
+
const h = new k({ className: Se.gen("text-wrap") });
|
|
3598
3546
|
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new Ea().node), this.append(h.node, o.node);
|
|
3599
3547
|
}
|
|
3600
3548
|
}
|
|
3601
|
-
class
|
|
3549
|
+
class Na {
|
|
3602
3550
|
constructor() {
|
|
3603
3551
|
f(this, "node");
|
|
3604
3552
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3610,7 +3558,7 @@ class Fa {
|
|
|
3610
3558
|
), s.setAttribute("fill", "currentColor"), t.appendChild(s), this.node = t;
|
|
3611
3559
|
}
|
|
3612
3560
|
}
|
|
3613
|
-
class
|
|
3561
|
+
class Fa {
|
|
3614
3562
|
constructor() {
|
|
3615
3563
|
f(this, "node");
|
|
3616
3564
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3630,14 +3578,14 @@ class Ha extends se {
|
|
|
3630
3578
|
f(this, "cancelBtn");
|
|
3631
3579
|
f(this, "_onSave");
|
|
3632
3580
|
f(this, "_onCancel");
|
|
3633
|
-
this._onSave = t.onSave, this._onCancel = t.onCancel, this.input = new
|
|
3581
|
+
this._onSave = t.onSave, this._onCancel = t.onCancel, this.input = new k({ tag: "textarea", className: "sc-charts-cs__comments-edit-input" }), this.saveBtn = new k({
|
|
3634
3582
|
tag: "button",
|
|
3635
3583
|
className: "sc-charts-cs__comments-edit-save-btn"
|
|
3636
|
-
}), this.saveBtn.append(new
|
|
3584
|
+
}), this.saveBtn.append(new Na().node), this.cancelBtn = new k({
|
|
3637
3585
|
tag: "button",
|
|
3638
3586
|
className: "sc-charts-cs__comments-edit-cancel-btn"
|
|
3639
|
-
}), this.cancelBtn.append(new
|
|
3640
|
-
const s = new
|
|
3587
|
+
}), this.cancelBtn.append(new Fa().node);
|
|
3588
|
+
const s = new k({ className: "sc-charts-cs__comments-edit-btn-container" });
|
|
3641
3589
|
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();
|
|
3642
3590
|
}
|
|
3643
3591
|
_setupListeners() {
|
|
@@ -3652,10 +3600,10 @@ class Ha extends se {
|
|
|
3652
3600
|
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 }));
|
|
3653
3601
|
}
|
|
3654
3602
|
}
|
|
3655
|
-
const
|
|
3656
|
-
class
|
|
3603
|
+
const Ba = new ae("comment-list");
|
|
3604
|
+
class Ia extends se {
|
|
3657
3605
|
constructor(t, s, n, a = {}) {
|
|
3658
|
-
super({ tag: "ul", className:
|
|
3606
|
+
super({ tag: "ul", className: Ba.gen(), ...a });
|
|
3659
3607
|
f(this, "_elements", {});
|
|
3660
3608
|
f(this, "_model");
|
|
3661
3609
|
f(this, "_view");
|
|
@@ -3716,10 +3664,10 @@ class Ti extends se {
|
|
|
3716
3664
|
f(this, "btn");
|
|
3717
3665
|
f(this, "input");
|
|
3718
3666
|
f(this, "_onAdd");
|
|
3719
|
-
this._onAdd = t, this.state = { inputValue: "" }, this.input = new
|
|
3667
|
+
this._onAdd = t, this.state = { inputValue: "" }, this.input = new k({
|
|
3720
3668
|
tag: "input",
|
|
3721
3669
|
className: Je.gen("input") + " " + wt.gen("input")
|
|
3722
|
-
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new
|
|
3670
|
+
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new k({
|
|
3723
3671
|
tag: "button",
|
|
3724
3672
|
className: Je.gen("btn") + " " + wt.gen("btn")
|
|
3725
3673
|
}), this.btn.append(new Ra().node), this.append(this.input.node, this.btn.node), this._setupListeners(), this.render();
|
|
@@ -3750,7 +3698,7 @@ class Oa extends se {
|
|
|
3750
3698
|
f(this, "_size", null);
|
|
3751
3699
|
f(this, "_model");
|
|
3752
3700
|
f(this, "_prevIsShow", !1);
|
|
3753
|
-
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new
|
|
3701
|
+
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ia(t, s, n), this._addField = new Ti({
|
|
3754
3702
|
blockName: "list-tooltip-add",
|
|
3755
3703
|
onAdd: (a) => {
|
|
3756
3704
|
const r = t[0].date, o = t[0].price, c = {
|
|
@@ -3804,10 +3752,10 @@ class za extends se {
|
|
|
3804
3752
|
}
|
|
3805
3753
|
}
|
|
3806
3754
|
const mi = new ae("comment-box");
|
|
3807
|
-
class
|
|
3755
|
+
class Va extends se {
|
|
3808
3756
|
constructor({ boxId: t, model: s, view: n, comments: a, coords: r, onBoxActivate: o, onBoxDeactivate: c }) {
|
|
3809
3757
|
super({ className: mi.gen() });
|
|
3810
|
-
f(this, "pointer", new
|
|
3758
|
+
f(this, "pointer", new k({ className: "sc-charts-cs__comments-pointer" }));
|
|
3811
3759
|
f(this, "tooltip");
|
|
3812
3760
|
f(this, "anchor");
|
|
3813
3761
|
f(this, "_onBoxActivate");
|
|
@@ -3829,11 +3777,11 @@ class Ya extends se {
|
|
|
3829
3777
|
this.pointer.position(n), this.pointer.setVisible(t), this.anchor.setState({ x: n.x, isActive: t }), this.tooltip.setState({ comments: s, isShow: t });
|
|
3830
3778
|
}
|
|
3831
3779
|
}
|
|
3832
|
-
class
|
|
3780
|
+
class Ya {
|
|
3833
3781
|
static animateTo(e, t, s, n) {
|
|
3834
3782
|
const a = e.scales.panOffsetX + (e.layout.area.width / 2 - t), r = e.scales.panOffsetY + (e.layout.area.height / 2 - s), o = 300, c = performance.now(), h = e.scales.panOffsetX, d = e.scales.panOffsetY, g = (_) => {
|
|
3835
|
-
const p = _ - c,
|
|
3836
|
-
e.scales.pan("x",
|
|
3783
|
+
const p = _ - c, y = Math.min(p / o, 1), v = y * y * (3 - 2 * y), b = h + (a - h) * v, x = d + (r - d) * v;
|
|
3784
|
+
e.scales.pan("x", b, "absolute"), e.scales.pan("y", x, "absolute"), y < 1 ? requestAnimationFrame(g) : n == null || n();
|
|
3837
3785
|
};
|
|
3838
3786
|
requestAnimationFrame(g);
|
|
3839
3787
|
}
|
|
@@ -3852,7 +3800,7 @@ class Wa extends se {
|
|
|
3852
3800
|
f(this, "_size", null);
|
|
3853
3801
|
f(this, "_model", null);
|
|
3854
3802
|
f(this, "_candle", null);
|
|
3855
|
-
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new
|
|
3803
|
+
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }), Et(this.menu, () => {
|
|
3856
3804
|
this.setState({ isShow: !1 });
|
|
3857
3805
|
}), this.addField = new Ti({
|
|
3858
3806
|
blockName: "context-add",
|
|
@@ -3888,7 +3836,7 @@ class Wa extends se {
|
|
|
3888
3836
|
this._changeInputCorner(r.side), this.menu.position(r.x, r.y);
|
|
3889
3837
|
}
|
|
3890
3838
|
}
|
|
3891
|
-
class ja extends
|
|
3839
|
+
class ja extends Ne {
|
|
3892
3840
|
constructor(t) {
|
|
3893
3841
|
super("comments", t, { noCanvas: !0 });
|
|
3894
3842
|
f(this, "boxes", {});
|
|
@@ -3904,7 +3852,7 @@ class ja extends Fe {
|
|
|
3904
3852
|
};
|
|
3905
3853
|
}
|
|
3906
3854
|
createBox({ boxId: t, coords: s, model: n, comments: a }) {
|
|
3907
|
-
const r = new
|
|
3855
|
+
const r = new Va({
|
|
3908
3856
|
boxId: t,
|
|
3909
3857
|
model: n,
|
|
3910
3858
|
comments: a,
|
|
@@ -3912,7 +3860,7 @@ class ja extends Fe {
|
|
|
3912
3860
|
view: this._view,
|
|
3913
3861
|
onBoxActivate: (o) => {
|
|
3914
3862
|
const c = a[0].candle;
|
|
3915
|
-
|
|
3863
|
+
Ya.animateToDataCoords(n, c.open_time, (c.open + c.close) / 2), this.boxes[o].setState({ isActive: !0 });
|
|
3916
3864
|
},
|
|
3917
3865
|
onBoxDeactivate: (o) => this.boxes[o].setState({ isActive: !1 })
|
|
3918
3866
|
});
|
|
@@ -3944,7 +3892,7 @@ class Xa extends Le {
|
|
|
3944
3892
|
});
|
|
3945
3893
|
}
|
|
3946
3894
|
}
|
|
3947
|
-
class Ua extends
|
|
3895
|
+
class Ua extends Ne {
|
|
3948
3896
|
constructor(e) {
|
|
3949
3897
|
if (super("guides", e, { CanvasClass: Xa, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_Guides] Canvas must be defined");
|
|
3950
3898
|
}
|
|
@@ -3963,7 +3911,7 @@ class Ua extends Fe {
|
|
|
3963
3911
|
if (e.config.guides.isShowX) {
|
|
3964
3912
|
const n = e.config.xAxis.position;
|
|
3965
3913
|
this.canvas.drawMarker({
|
|
3966
|
-
text:
|
|
3914
|
+
text: E.timeFormat("%a %d, %b %y %H:%M")(e.scales.x.invert(t)),
|
|
3967
3915
|
startLineCoords: { x: t, y: 0 },
|
|
3968
3916
|
endMarkerCoords: { x: t, y: e.layout.xAxis[n] },
|
|
3969
3917
|
side: n,
|
|
@@ -3977,7 +3925,7 @@ class Ga extends se {
|
|
|
3977
3925
|
constructor(t) {
|
|
3978
3926
|
super({ className: t });
|
|
3979
3927
|
f(this, "_isFirstShow", !1);
|
|
3980
|
-
const s = new
|
|
3928
|
+
const s = new k({ tag: "p" });
|
|
3981
3929
|
s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() }, this.render();
|
|
3982
3930
|
}
|
|
3983
3931
|
render() {
|
|
@@ -4047,14 +3995,14 @@ class Za extends Le {
|
|
|
4047
3995
|
};
|
|
4048
3996
|
}
|
|
4049
3997
|
}
|
|
4050
|
-
class qa extends
|
|
3998
|
+
class qa extends Ne {
|
|
4051
3999
|
constructor(t) {
|
|
4052
4000
|
super("candles", t, { CanvasClass: Za });
|
|
4053
4001
|
f(this, "_noDataTooltip", null);
|
|
4054
4002
|
f(this, "limiter");
|
|
4055
4003
|
if (!this.dom) throw new Error("[CS_V_Candles] this.dom must be defined");
|
|
4056
4004
|
if (!this.canvas) throw new Error("[CS_V_Candles] this.canvas must be defined");
|
|
4057
|
-
this._noDataTooltip = new Ga(this.cx("no-data")), this.limiter = new
|
|
4005
|
+
this._noDataTooltip = new Ga(this.cx("no-data")), this.limiter = new k({ className: this.cx("limiter") }), this.limiter.setVisible(!1), this.dom.append(this._noDataTooltip.node, this.limiter.node);
|
|
4058
4006
|
}
|
|
4059
4007
|
get noDataTooltip() {
|
|
4060
4008
|
return this._noDataTooltip;
|
|
@@ -4087,14 +4035,14 @@ class Ja {
|
|
|
4087
4035
|
f(this, "trade");
|
|
4088
4036
|
f(this, "comments");
|
|
4089
4037
|
f(this, "candles");
|
|
4090
|
-
this.container = e, this.wrapper = new
|
|
4038
|
+
this.container = e, this.wrapper = new k({ tag: "div", className: "sc-charts-cs" }), e.append(this.wrapper.node);
|
|
4091
4039
|
const { width: t, height: s } = e.getBoundingClientRect();
|
|
4092
4040
|
this.width = t, this.height = s, this.mainCanvas = new Le({
|
|
4093
4041
|
className: "sc-charts-cs__canvas-main",
|
|
4094
4042
|
width: t,
|
|
4095
4043
|
height: s,
|
|
4096
4044
|
isMain: !0
|
|
4097
|
-
}), this.domElements = new
|
|
4045
|
+
}), this.domElements = new k({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new k({ tag: "div", className: "sc-charts-cs__canvases" }), this.canvasesContainer.append(this.mainCanvas.node), this.wrapper.append(this.canvasesContainer.node, this.domElements.node), this.mainCanvas.updateAbsolutePosition(), this.binding = new Rn(this.mainCanvas.node), this.comments = new ja(this), this.candles = new qa(this), this.trade = new xa(this), this.guideMarkers = new Ua(this), this.userMarkers = new Ma(this);
|
|
4098
4046
|
}
|
|
4099
4047
|
renderAll(e) {
|
|
4100
4048
|
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);
|
|
@@ -4375,8 +4323,8 @@ class tr {
|
|
|
4375
4323
|
}
|
|
4376
4324
|
} = this.model;
|
|
4377
4325
|
for (const o of s) {
|
|
4378
|
-
const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low), g = c - r / 2, _ = c + r / 2, p = Math.min(h, d),
|
|
4379
|
-
if (e >= g && e <= _ && t >= p && t <=
|
|
4326
|
+
const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low), g = c - r / 2, _ = c + r / 2, p = Math.min(h, d), y = Math.max(h, d);
|
|
4327
|
+
if (e >= g && e <= _ && t >= p && t <= y)
|
|
4380
4328
|
return {
|
|
4381
4329
|
target: this,
|
|
4382
4330
|
x: e,
|
|
@@ -4414,19 +4362,19 @@ class sr {
|
|
|
4414
4362
|
const { tradedCandles: s } = this.model.trade, { x: n, y: a } = this.model.scales, r = 16, o = 4;
|
|
4415
4363
|
for (const { candle: c, trades: h } of s) {
|
|
4416
4364
|
const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, _ = r, p = r;
|
|
4417
|
-
for (const
|
|
4418
|
-
const
|
|
4419
|
-
if (!
|
|
4420
|
-
const
|
|
4421
|
-
if (
|
|
4365
|
+
for (const y of ["buy", "sell"]) {
|
|
4366
|
+
const v = h.filter((C) => C.type === y);
|
|
4367
|
+
if (!v.length) continue;
|
|
4368
|
+
const b = y === "buy" ? a.convert(c.low) + o + Ke(r) : a.convert(c.high) - o - r - Ke(r), x = e >= g - _ / 2 && e <= g + _ / 2, w = t >= b && t <= b + p;
|
|
4369
|
+
if (x && w)
|
|
4422
4370
|
return {
|
|
4423
4371
|
target: this,
|
|
4424
4372
|
type: "trade-label",
|
|
4425
|
-
tradeType:
|
|
4373
|
+
tradeType: y,
|
|
4426
4374
|
x: e,
|
|
4427
4375
|
y: t,
|
|
4428
4376
|
candle: c,
|
|
4429
|
-
trades:
|
|
4377
|
+
trades: v
|
|
4430
4378
|
};
|
|
4431
4379
|
}
|
|
4432
4380
|
}
|
|
@@ -4523,11 +4471,11 @@ function cr(i, e) {
|
|
|
4523
4471
|
}));
|
|
4524
4472
|
};
|
|
4525
4473
|
}
|
|
4526
|
-
function
|
|
4474
|
+
function At(i, e) {
|
|
4527
4475
|
const { width: t } = e.candles.limiter.absolutePosition, s = i.config.candles.baseWidth, n = i.config.candles.limiterOffset.left + i.config.candles.limiterOffset.right, r = i.scales.x.convert(i.candles.allData[0].open_time) - t - s / 2 - n;
|
|
4528
4476
|
r > 0 && i.scales.pan("x", -r);
|
|
4529
4477
|
}
|
|
4530
|
-
function
|
|
4478
|
+
function St(i) {
|
|
4531
4479
|
return i.candles.limiter.absolutePosition.width > 0;
|
|
4532
4480
|
}
|
|
4533
4481
|
class Lt {
|
|
@@ -4547,7 +4495,7 @@ class hr extends Lt {
|
|
|
4547
4495
|
register() {
|
|
4548
4496
|
this._hitManager.on(this._hit, "drag", (t) => {
|
|
4549
4497
|
const s = t.x - (t.prevX ?? t.x);
|
|
4550
|
-
this._model.scales.scale("x", -s), this._view &&
|
|
4498
|
+
this._model.scales.scale("x", -s), this._view && St(this._view) && At(this._model, this._view);
|
|
4551
4499
|
}), this._hitManager.on(this._hit, "dblclick", () => {
|
|
4552
4500
|
this._model.scales.scale("x", 1, "absolute"), this._model.scales.pan("x", 0, "absolute");
|
|
4553
4501
|
});
|
|
@@ -4585,7 +4533,7 @@ class ur extends Lt {
|
|
|
4585
4533
|
this._hit,
|
|
4586
4534
|
"drag",
|
|
4587
4535
|
cr(1, (t) => {
|
|
4588
|
-
this._model.scales.pan("x", t.x - (t.prevX ?? t.x)),
|
|
4536
|
+
this._model.scales.pan("x", t.x - (t.prevX ?? t.x)), St(this._view) && At(this._model, this._view), this._model.scales.pan("y", t.y - (t.prevY ?? t.y)), this._view.guideMarkers.render(this._model, { x: t.x, y: t.y });
|
|
4589
4537
|
})
|
|
4590
4538
|
), this._hitManager.on(this._hit, "contextmenu", ({ x: t }) => {
|
|
4591
4539
|
const s = this._model.scales.x.invert(t), n = Dt.findByDate(s, this._model.candles.allData);
|
|
@@ -4594,7 +4542,7 @@ class ur extends Lt {
|
|
|
4594
4542
|
var a, r;
|
|
4595
4543
|
if (!t.deltaY) return;
|
|
4596
4544
|
const s = -t.deltaY, n = (r = (a = this._model.config) == null ? void 0 : a.candles) == null ? void 0 : r.zoomOnWheel;
|
|
4597
|
-
["x", "both"].includes(n) && (this._model.scales.scale("x", s),
|
|
4545
|
+
["x", "both"].includes(n) && (this._model.scales.scale("x", s), St(this._view) && At(this._model, this._view)), ["y", "both"].includes(n) && this._model.scales.scale("y", s);
|
|
4598
4546
|
});
|
|
4599
4547
|
}
|
|
4600
4548
|
}
|
|
@@ -4691,7 +4639,7 @@ class _r {
|
|
|
4691
4639
|
throw new Error(
|
|
4692
4640
|
"chartId is required and must be a valid id (only letters, numbers or underscores. The first character must be a letter)"
|
|
4693
4641
|
);
|
|
4694
|
-
if (this._model = new
|
|
4642
|
+
if (this._model = new Nn({
|
|
4695
4643
|
chartId: t,
|
|
4696
4644
|
candles: s,
|
|
4697
4645
|
config: n,
|
|
@@ -4770,20 +4718,20 @@ class _r {
|
|
|
4770
4718
|
e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, _, s, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, _), e.lineTo(s, _), e.stroke(), e.textBaseline = "middle", e.textAlign = "left";
|
|
4771
4719
|
const p = [];
|
|
4772
4720
|
if (t.pair && p.push({ label: "", value: t.pair }), t.net_pnl !== void 0) {
|
|
4773
|
-
const
|
|
4774
|
-
p.push({ label: "Net P&L", value: t.net_pnl, valueColor:
|
|
4721
|
+
const C = t.net_pnl.startsWith("+");
|
|
4722
|
+
p.push({ label: "Net P&L", value: t.net_pnl, valueColor: C ? "#56B683" : "#F18169" });
|
|
4775
4723
|
}
|
|
4776
4724
|
t.type && p.push({ label: "Type", value: t.type }), t.entry_price && p.push({ label: "Entry", value: t.entry_price }), t.exit_price && p.push({ label: "Exit", value: t.exit_price }), t.open_date && p.push({ label: "Open date", value: t.open_date }), t.close_date && p.push({ label: "Close date", value: t.close_date }), t.holdtime && p.push({ label: "Holdtime", value: t.holdtime }), t.rr && p.push({ label: "RR", value: t.rr }), t.volume && p.push({ label: "Volume", value: t.volume });
|
|
4777
|
-
const
|
|
4725
|
+
const y = _ + c / 2, v = 24 * r;
|
|
4778
4726
|
if (p.length === 0) return;
|
|
4779
4727
|
e.font = `500 ${d}px Geist, Arial, sans-serif`;
|
|
4780
|
-
const
|
|
4781
|
-
let
|
|
4782
|
-
p.forEach((
|
|
4783
|
-
const
|
|
4784
|
-
e.fillStyle =
|
|
4785
|
-
const
|
|
4786
|
-
e.fillStyle =
|
|
4728
|
+
const b = o ? "#878788" : "#8E8E93", x = o ? "#FAFAFA" : "#1C2026";
|
|
4729
|
+
let w = h;
|
|
4730
|
+
p.forEach((C) => {
|
|
4731
|
+
const S = e.measureText(C.label).width, M = e.measureText(C.value).width, N = S + g + M;
|
|
4732
|
+
e.fillStyle = b, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.label, w, y);
|
|
4733
|
+
const $ = w + S + g;
|
|
4734
|
+
e.fillStyle = C.valueColor || x, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.value, $, y), w += N + v;
|
|
4787
4735
|
});
|
|
4788
4736
|
}
|
|
4789
4737
|
async captureScreenshot(e = {}) {
|
|
@@ -4794,36 +4742,36 @@ class _r {
|
|
|
4794
4742
|
hour: "2-digit",
|
|
4795
4743
|
minute: "2-digit",
|
|
4796
4744
|
timeZoneName: "short"
|
|
4797
|
-
}), a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1, d = a.download || !1, { canvasesContainer: g, width: _, height: p } = this._view,
|
|
4745
|
+
}), a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1, d = a.download || !1, { canvasesContainer: g, width: _, height: p } = this._view, y = Array.from(
|
|
4798
4746
|
g.node.querySelectorAll("canvas")
|
|
4799
4747
|
);
|
|
4800
|
-
if (
|
|
4748
|
+
if (y.length === 0) {
|
|
4801
4749
|
console.warn("No canvas elements found for screenshot");
|
|
4802
4750
|
return;
|
|
4803
4751
|
}
|
|
4804
|
-
const
|
|
4805
|
-
let
|
|
4806
|
-
|
|
4807
|
-
const
|
|
4808
|
-
U.width =
|
|
4752
|
+
const v = 1440, b = 900, x = 48, w = 20, C = c ? 32 : 0, S = b - x - w - C, M = v, N = _ / p, $ = M / S;
|
|
4753
|
+
let z, V, Y = 0, re = 0;
|
|
4754
|
+
N > $ ? (V = S, z = V * N, Y = 0, re = 0) : (z = M, V = z / N, re = (S - V) / 2);
|
|
4755
|
+
const P = window.devicePixelRatio || 1, U = document.createElement("canvas");
|
|
4756
|
+
U.width = v * P, U.height = b * P;
|
|
4809
4757
|
const G = U.getContext("2d");
|
|
4810
4758
|
if (!G) {
|
|
4811
4759
|
console.error("Failed to get 2D context for merged canvas");
|
|
4812
4760
|
return;
|
|
4813
4761
|
}
|
|
4814
4762
|
G.fillStyle = h ? "#101011" : "#ffffff", G.fillRect(0, 0, U.width, U.height);
|
|
4815
|
-
const
|
|
4816
|
-
await this._drawHeader(G, U.width,
|
|
4763
|
+
const Fe = x * P, st = w * P, oe = S * P, ve = M * P, be = Fe + st;
|
|
4764
|
+
await this._drawHeader(G, U.width, P, h), this._drawHeaderSecondLine(G, r, o, U.width, Fe, P, h);
|
|
4817
4765
|
const He = this._view.mainCanvas;
|
|
4818
4766
|
He.background && (G.fillStyle = He.background, G.fillRect(0, be, U.width, oe));
|
|
4819
|
-
const
|
|
4820
|
-
|
|
4821
|
-
let ee = 0, Z = 0, q = O.width, ge = O.height, ye =
|
|
4822
|
-
if (
|
|
4823
|
-
const le =
|
|
4767
|
+
const Be = z * P, Ie = V * P, F = Y * P, Re = re * P;
|
|
4768
|
+
y.forEach((O) => {
|
|
4769
|
+
let ee = 0, Z = 0, q = O.width, ge = O.height, ye = Be, we = Ie, Oe = F, Pe = Re;
|
|
4770
|
+
if (N > $) {
|
|
4771
|
+
const le = Ie / O.height, ce = O.width * le;
|
|
4824
4772
|
ce > ve && (ee = (ce - ve) / le, q = O.width - ee, ye = ve, Oe = 0);
|
|
4825
4773
|
} else {
|
|
4826
|
-
const le =
|
|
4774
|
+
const le = Be / O.width, ce = O.height * le;
|
|
4827
4775
|
if (ce > oe) {
|
|
4828
4776
|
const xe = (ce - oe) / le;
|
|
4829
4777
|
Z = xe / 2, ge = O.height - xe, we = oe, Pe = 0;
|
|
@@ -4840,7 +4788,7 @@ class _r {
|
|
|
4840
4788
|
ye,
|
|
4841
4789
|
we
|
|
4842
4790
|
);
|
|
4843
|
-
}), c && this._drawFooter(G, c, U.width, be, oe,
|
|
4791
|
+
}), c && this._drawFooter(G, c, U.width, be, oe, P, h);
|
|
4844
4792
|
const $e = (O, ee) => {
|
|
4845
4793
|
const Z = URL.createObjectURL(O), q = document.createElement("a");
|
|
4846
4794
|
q.href = Z, q.download = ee, document.body.appendChild(q), q.click(), document.body.removeChild(q), URL.revokeObjectURL(Z);
|