charts-core 1.1.9 → 1.1.11
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 +903 -903
- 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,16 +1,16 @@
|
|
|
1
1
|
var Ti = Object.defineProperty;
|
|
2
2
|
var Si = (s, t, e) => t in s ? Ti(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
-
var
|
|
4
|
-
import * as
|
|
3
|
+
var c = (s, t, e) => Si(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import * as E from "d3";
|
|
5
5
|
const ki = (s) => {
|
|
6
|
-
const { svg: t, config: e, y: i, width: n } = s, { margin:
|
|
6
|
+
const { svg: t, config: e, y: i, width: n } = s, { margin: a, yAxis: r } = e, { customTicks: l, tickFormat: h, tickValues: d, ticks: g, isShow: _ } = r;
|
|
7
7
|
if (!_) return null;
|
|
8
|
-
t.append("g").attr("transform", `translate(${n -
|
|
9
|
-
let p =
|
|
10
|
-
l &&
|
|
8
|
+
t.append("g").attr("transform", `translate(${n - a.right},0)`).call((m) => {
|
|
9
|
+
let p = E.axisRight(i);
|
|
10
|
+
l && h ? p = p.tickFormat(h) : p = p.tickFormat((v) => {
|
|
11
11
|
const b = Number(v), x = (C) => C.toString().replace(/\.0+$/, "");
|
|
12
12
|
return Math.abs(b) >= 1e12 ? x(b / 1e12) + "T" : Math.abs(b) >= 1e9 ? x(b / 1e9) + "B" : Math.abs(b) >= 1e6 ? x(b / 1e6) + "M" : Math.abs(b) >= 1e3 ? x(b / 1e3) + "K" : x(b);
|
|
13
|
-
}), l && g && (p = Array.isArray(g) ? p.ticks(...g) : p.ticks(g)), l &&
|
|
13
|
+
}), l && g && (p = Array.isArray(g) ? p.ticks(...g) : p.ticks(g)), l && d && (p = p.tickValues(d)), m.call(p);
|
|
14
14
|
}).call((m) => {
|
|
15
15
|
let p = [];
|
|
16
16
|
m.selectAll(".tick").each((v) => p.push(v)), s.yTicks = p;
|
|
@@ -20,33 +20,33 @@ const ki = (s) => {
|
|
|
20
20
|
const v = p.nodes().map((x) => x.getBBox().width), b = Math.max(...v);
|
|
21
21
|
m.selectAll(".tick").each(function(x, C) {
|
|
22
22
|
var z;
|
|
23
|
-
const w =
|
|
23
|
+
const w = E.select(this), y = w.select("text"), T = v[C], D = b - T, N = w.append("g").attr("transform", "translate(10, 0)");
|
|
24
24
|
y.attr("x", D), y.remove(), (z = N.node()) == null || z.appendChild(y.node());
|
|
25
25
|
});
|
|
26
26
|
}).attr("font-family", "inherit");
|
|
27
27
|
}, Di = (s) => {
|
|
28
|
-
const { svg: t, config: e, x: i, height: n } = s, { margin:
|
|
28
|
+
const { svg: t, config: e, x: i, height: n } = s, { margin: a, xAxis: r } = e, { isShow: l, tickValues: h, tickFormat: d, customTicks: g, ticks: _ } = r;
|
|
29
29
|
if (!l) return null;
|
|
30
|
-
t.append("g").attr("transform", `translate(0,${n -
|
|
31
|
-
let p =
|
|
32
|
-
g ? (
|
|
30
|
+
t.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((m) => {
|
|
31
|
+
let p = E.axisBottom(i);
|
|
32
|
+
g ? (d && (p = p.tickFormat(d)), _ && (p = Array.isArray(_) ? p.ticks(..._) : p.ticks(_)), h && (p = p.tickValues(h))) : p.ticks(5), m.call(p);
|
|
33
33
|
}).call((m) => m.select(".domain").remove()).call((m) => {
|
|
34
34
|
let p = [];
|
|
35
35
|
m.selectAll(".tick").each((v) => p.push(v)), s.xTicks = p;
|
|
36
36
|
}).call((m) => m.selectAll(".tick line").remove()).call((m) => m.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
|
|
37
37
|
}, Ei = (s) => {
|
|
38
38
|
const { svg: t, config: e, y: i, width: n } = s, {
|
|
39
|
-
margin:
|
|
40
|
-
grid: { horizontalStyle:
|
|
39
|
+
margin: a,
|
|
40
|
+
grid: { horizontalStyle: r }
|
|
41
41
|
} = e;
|
|
42
|
-
if (
|
|
43
|
-
if (
|
|
44
|
-
const l = t.append("line").attr("x1", 0 +
|
|
45
|
-
|
|
42
|
+
if (r !== "none") {
|
|
43
|
+
if (r.startsWith("zero-line")) {
|
|
44
|
+
const l = t.append("line").attr("x1", 0 + a.left).attr("x2", n - a.right).attr("y1", i(0)).attr("y2", i(0)).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
|
|
45
|
+
r === "zero-line-dashed" && l.attr("stroke-dasharray", "4 4");
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
47
|
+
r.startsWith("every-line") && (s.yTicks || i.ticks()).forEach((h) => {
|
|
48
|
+
const d = t.append("line").attr("x1", 0 + a.left).attr("x2", n - a.right).attr("y1", i(h)).attr("y2", i(h)).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
|
|
49
|
+
r === "every-line-dashed" && d.attr("stroke-dasharray", "4 4");
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
}, Li = (s) => {
|
|
@@ -60,10 +60,10 @@ const ki = (s) => {
|
|
|
60
60
|
i.className = "sc-charts__hovered-circles-tooltip";
|
|
61
61
|
const n = document.createElement("div");
|
|
62
62
|
n.className = "sc-charts__hovered-circles-tooltip-arrow";
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
return
|
|
63
|
+
const a = document.createElementNS(t, "svg");
|
|
64
|
+
a.setAttribute("width", "12"), a.setAttribute("height", "4"), a.setAttribute("viewBox", "0 0 12 4"), a.setAttribute("fill", "none"), a.setAttribute("xmlns", t);
|
|
65
|
+
const r = document.createElementNS(t, "path");
|
|
66
|
+
return r.setAttribute("d", "M6 4L0 0H12L6 4Z"), a.appendChild(r), n.appendChild(a), e.append(n), e.append(i), s.append(e), {
|
|
67
67
|
tooltipContainer: e,
|
|
68
68
|
tooltip: i,
|
|
69
69
|
tooltipArrow: n
|
|
@@ -72,7 +72,7 @@ const ki = (s) => {
|
|
|
72
72
|
x: e,
|
|
73
73
|
y: i,
|
|
74
74
|
r: n = 3.5,
|
|
75
|
-
hr:
|
|
75
|
+
hr: a = 0
|
|
76
76
|
}) => {
|
|
77
77
|
if (t)
|
|
78
78
|
return s.append("image").attr("x", e - 6).attr("y", i - 6).attr("width", 12).attr("height", 12).attr(
|
|
@@ -80,29 +80,29 @@ const ki = (s) => {
|
|
|
80
80
|
"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTMiIGhlaWdodD0iMTMiIHZpZXdCb3g9IjAgMCAxMyAxMyIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzE0NTJfNTAwOSkiPgo8cGF0aCBkPSJNNi41MzY0NiAxMS41Njg4QzkuMjA1ODYgMTEuNTY4OCAxMS4zNjk4IDkuNDA0ODMgMTEuMzY5OCA2LjczNTQzQzExLjM2OTggNC4wNjYwNiA5LjIwNTg2IDEuOTAyMSA2LjUzNjQ2IDEuOTAyMUMzLjg2NzA4IDEuOTAyMSAxLjcwMzEyIDQuMDY2MDYgMS43MDMxMiA2LjczNTQzQzEuNzAzMTIgOS40MDQ4MyAzLjg2NzA4IDExLjU2ODggNi41MzY0NiAxMS41Njg4WiIgZmlsbD0iI0ZDRUJFOSIvPgo8cGF0aCBkPSJNMy4xMTcxOSAxMC4xNTM1TDkuOTQ3MTkgMy4zMjM0OSIgc3Ryb2tlPSIjRjE4MTY5IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPHBhdGggZD0iTTYuNTM2NDYgMTEuNTY4OEM5LjIwNTg2IDExLjU2ODggMTEuMzY5OCA5LjQwNDgzIDExLjM2OTggNi43MzU0M0MxMS4zNjk4IDQuMDY2MDYgOS4yMDU4NiAxLjkwMjEgNi41MzY0NiAxLjkwMjFDMy44NjcwOSAxLjkwMjEgMS43MDMxMiA0LjA2NjA2IDEuNzAzMTIgNi43MzU0M0MxLjcwMzEyIDkuNDA0ODMgMy44NjcwOSAxMS41Njg4IDYuNTM2NDYgMTEuNTY4OFoiIHN0cm9rZT0iI0YxODE2OSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjwvZz4KPGRlZnM+CjxjbGlwUGF0aCBpZD0iY2xpcDBfMTQ1Ml81MDA5Ij4KPHJlY3Qgd2lkdGg9IjEyIiBoZWlnaHQ9IjEyIiBmaWxsPSJ3aGl0ZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC41MzUxNTYgMC43MzUzNTIpIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg=="
|
|
81
81
|
);
|
|
82
82
|
{
|
|
83
|
-
const
|
|
84
|
-
return
|
|
83
|
+
const r = s.append("g");
|
|
84
|
+
return r.append("circle").attr("cx", e).attr("cy", i).attr("r", n).classed("sc-charts__hovered-circles", !0), r.append("circle").attr("cx", e).attr("cy", i).attr("r", n + a).classed("sc-charts__hovered-circles_add", !0), r;
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
function Fi(s, t, e, i) {
|
|
88
88
|
if (!s) return null;
|
|
89
|
-
const n = s.width / 2,
|
|
90
|
-
return
|
|
89
|
+
const n = s.width / 2, a = t - n, r = t + n;
|
|
90
|
+
return a < e ? e : r > i ? i - s.width : t - n;
|
|
91
91
|
}
|
|
92
92
|
const Se = (s, { x1: t, x2: e, y1: i, y2: n }) => s.append("line").attr("x1", t).attr("x2", e).attr("y1", i).attr("y2", n).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1), Bi = (s) => {
|
|
93
|
-
const { svg: t, config: e, x: i, y: n, height:
|
|
94
|
-
margin:
|
|
95
|
-
grid: { verticalStyle:
|
|
93
|
+
const { svg: t, config: e, x: i, y: n, height: a, data: r, wrapperNode: l } = s, {
|
|
94
|
+
margin: h,
|
|
95
|
+
grid: { verticalStyle: d, tooltipNode: g, hoverCirclesRadius: _, hoverCirclesAdditionalArea: m }
|
|
96
96
|
} = e;
|
|
97
|
-
if (
|
|
98
|
-
const b = t.append("line").attr("x1", i(v)).attr("x2", i(v)).attr("y1",
|
|
99
|
-
|
|
100
|
-
}),
|
|
101
|
-
const p = n.range()[0], v = i(
|
|
97
|
+
if (d !== "none" && (d.startsWith("every-line") && (s.xTicks || i.ticks()).forEach((v) => {
|
|
98
|
+
const b = t.append("line").attr("x1", i(v)).attr("x2", i(v)).attr("y1", h.top).attr("y2", a - h.bottom).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
|
|
99
|
+
d === "every-line-dashed" && b.attr("stroke-dasharray", "4 4");
|
|
100
|
+
}), d === "hovered-circles")) {
|
|
101
|
+
const p = n.range()[0], v = i(r[0].date), b = i(r[r.length - 1].date);
|
|
102
102
|
Se(t, { x1: v, x2: b, y1: p, y2: p });
|
|
103
103
|
const { tooltipContainer: x, tooltip: C, tooltipArrow: w } = Ni(l);
|
|
104
|
-
|
|
105
|
-
const D = i(y.date), N = n(y.value), z =
|
|
104
|
+
r.forEach((y, T) => {
|
|
105
|
+
const D = i(y.date), N = n(y.value), z = r[T - 1], O = T > 0 && z && y.value === z.value;
|
|
106
106
|
O || Se(t, { x1: D, x2: D, y1: N, y2: p });
|
|
107
107
|
const Nt = Ii(t, O, {
|
|
108
108
|
x: D,
|
|
@@ -127,22 +127,22 @@ const Se = (s, { x1: t, x2: e, y1: i, y2: n }) => s.append("line").attr("x1", t)
|
|
|
127
127
|
}, Hi = (s) => {
|
|
128
128
|
Ei(s), Bi(s);
|
|
129
129
|
}, Ri = (s) => {
|
|
130
|
-
const { svg: t, config: e, width: i, height: n } = s, { margin:
|
|
131
|
-
Di(s), ki(s),
|
|
130
|
+
const { svg: t, config: e, width: i, height: n } = s, { margin: a, logo: r } = e;
|
|
131
|
+
Di(s), ki(s), r && t.append("image").attr("xlink:href", e.theme === "dark" ? r.picDarkTheme : r.picLightTheme).attr("width", r.width).attr("height", r.height).attr("x", r.x ?? (i - 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), Hi(s);
|
|
132
132
|
}, _t = (s, t, e) => {
|
|
133
133
|
let i = s.select(`#${t}`);
|
|
134
|
-
return i.empty() && (i = s.append("linearGradient").attr("gradientUnits", "userSpaceOnUse").attr("id", t)), i.attr("x1", e.x1).attr("y1", e.x2).attr("x2", e.y1).attr("y2", e.y2), e.stops.forEach(({ offset: n, stopColor:
|
|
135
|
-
i.append("stop").attr("offset", n).attr("stop-color",
|
|
134
|
+
return i.empty() && (i = s.append("linearGradient").attr("gradientUnits", "userSpaceOnUse").attr("id", t)), i.attr("x1", e.x1).attr("y1", e.x2).attr("x2", e.y1).attr("y2", e.y2), e.stops.forEach(({ offset: n, stopColor: a }) => {
|
|
135
|
+
i.append("stop").attr("offset", n).attr("stop-color", a);
|
|
136
136
|
}), i;
|
|
137
137
|
}, nt = (s) => {
|
|
138
|
-
const t =
|
|
139
|
-
return t.empty() ?
|
|
138
|
+
const t = E.select(s).select("defs");
|
|
139
|
+
return t.empty() ? E.select(s).append("defs") : t;
|
|
140
140
|
}, Ge = (s) => {
|
|
141
141
|
const {
|
|
142
142
|
y: t,
|
|
143
143
|
config: { margin: e }
|
|
144
|
-
} = s, i = t.range()[0] - t(0), n = t.range()[0] - i >= 0 ? t.range()[0] - i : 0,
|
|
145
|
-
return { x: 0, y: n, width: "100%", height:
|
|
144
|
+
} = s, i = t.range()[0] - t(0), n = t.range()[0] - i >= 0 ? t.range()[0] - i : 0, a = i + e.bottom >= 0 ? i + e.bottom : 0;
|
|
145
|
+
return { x: 0, y: n, width: "100%", height: a };
|
|
146
146
|
}, ke = (s, t) => ({
|
|
147
147
|
...s,
|
|
148
148
|
...t,
|
|
@@ -179,70 +179,70 @@ const Se = (s, { x1: t, x2: e, y1: i, y2: n }) => s.append("line").attr("x1", t)
|
|
|
179
179
|
...t == null ? void 0 : t.selection
|
|
180
180
|
}
|
|
181
181
|
}), De = (s, t = {}) => {
|
|
182
|
-
const e = s.node(), i = nt(e), n = (l,
|
|
182
|
+
const e = s.node(), i = nt(e), n = (l, h) => _t(i, l, {
|
|
183
183
|
x1: "0%",
|
|
184
184
|
y1: "0%",
|
|
185
185
|
x2: "0%",
|
|
186
186
|
y2: "100%",
|
|
187
187
|
stops: [
|
|
188
188
|
{ offset: "0%", stopColor: "rgba(255, 255, 255, 0)" },
|
|
189
|
-
{ offset: "20%", stopColor:
|
|
190
|
-
{ offset: "60%", stopColor:
|
|
189
|
+
{ offset: "20%", stopColor: h },
|
|
190
|
+
{ offset: "60%", stopColor: h },
|
|
191
191
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
192
192
|
]
|
|
193
193
|
});
|
|
194
194
|
n("gradient-range-borders-up", "var(--sc-color-selection-up)"), n("gradient-range-borders-down", "var(--sc-color-selection-down)");
|
|
195
|
-
const
|
|
195
|
+
const a = "sc-charts__border-range-line", r = s.append("line").classed(a, !0).style("display", t.hidden ? "none" : "block");
|
|
196
196
|
return {
|
|
197
|
-
className(l,
|
|
198
|
-
l === "remove" ?
|
|
197
|
+
className(l, h) {
|
|
198
|
+
l === "remove" ? r.classed(`${a}${h}`, !1) : r.classed(`${a}${h}`, !0);
|
|
199
199
|
},
|
|
200
|
-
update({ x1: l, x2:
|
|
201
|
-
l !== void 0 &&
|
|
200
|
+
update({ x1: l, x2: h, y1: d, y2: g, hidden: _ }) {
|
|
201
|
+
l !== void 0 && r.attr("x1", l), h !== void 0 && r.attr("x2", h), d !== void 0 && r.attr("y1", d), g !== void 0 && r.attr("y2", g), _ !== void 0 && r.style("display", _ ? "none" : "block");
|
|
202
202
|
},
|
|
203
203
|
destroy() {
|
|
204
|
-
|
|
204
|
+
r.remove();
|
|
205
205
|
}
|
|
206
206
|
};
|
|
207
207
|
}, Gt = (s, t = {}) => {
|
|
208
208
|
const e = s.append("circle").attr("r", t.radius || 4).style("display", t.hidden ? "none" : "block"), i = t.className || "";
|
|
209
209
|
return i && e.classed(i, !0), {
|
|
210
|
-
className(n,
|
|
211
|
-
n === "remove" ? e.classed(`${i}${
|
|
210
|
+
className(n, a) {
|
|
211
|
+
n === "remove" ? e.classed(`${i}${a}`, !1) : e.classed(`${i}${a}`, !0);
|
|
212
212
|
},
|
|
213
|
-
update({ cx: n, cy:
|
|
214
|
-
n !== void 0 && e.attr("cx", n),
|
|
213
|
+
update({ cx: n, cy: a, hidden: r, fill: l }) {
|
|
214
|
+
n !== void 0 && e.attr("cx", n), a !== void 0 && e.attr("cy", a), l !== void 0 && e.attr("fill", l), r !== void 0 && e.style("display", r ? "none" : "block");
|
|
215
215
|
},
|
|
216
216
|
destroy() {
|
|
217
217
|
e.remove();
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
220
|
}, zi = (s, t = {}) => {
|
|
221
|
-
const e = "sc-charts__hover-line", i = s.append("line").style("display", t.hidden ? "none" : "block").classed(e, !0), n = s.node(),
|
|
222
|
-
return ((l,
|
|
221
|
+
const e = "sc-charts__hover-line", i = s.append("line").style("display", t.hidden ? "none" : "block").classed(e, !0), n = s.node(), a = nt(n);
|
|
222
|
+
return ((l, h) => _t(a, l, {
|
|
223
223
|
x1: "0%",
|
|
224
224
|
y1: "0%",
|
|
225
225
|
x2: "0%",
|
|
226
226
|
y2: "100%",
|
|
227
227
|
stops: [
|
|
228
228
|
{ offset: "0%", stopColor: "rgba(255, 255, 255, 0)" },
|
|
229
|
-
{ offset: "15%", stopColor:
|
|
230
|
-
{ offset: "75%", stopColor:
|
|
229
|
+
{ offset: "15%", stopColor: h },
|
|
230
|
+
{ offset: "75%", stopColor: h },
|
|
231
231
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
232
232
|
]
|
|
233
233
|
}))("hover-line-gradient", "var(--sc-color-hover-line)"), {
|
|
234
|
-
className(l,
|
|
235
|
-
l === "remove" ? i.classed(`${e}${
|
|
234
|
+
className(l, h) {
|
|
235
|
+
l === "remove" ? i.classed(`${e}${h}`, !1) : i.classed(`${e}${h}`, !0);
|
|
236
236
|
},
|
|
237
|
-
update({ x1: l, x2:
|
|
238
|
-
l !== void 0 && i.attr("x1", l),
|
|
237
|
+
update({ x1: l, x2: h, y1: d, y2: g, hidden: _ }) {
|
|
238
|
+
l !== void 0 && i.attr("x1", l), h !== void 0 && i.attr("x2", h), d !== void 0 && i.attr("y1", d), g !== void 0 && i.attr("y2", g), _ !== void 0 && i.style("display", _ ? "none" : "block");
|
|
239
239
|
},
|
|
240
240
|
destroy() {
|
|
241
241
|
i.remove();
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
|
-
}, tt = "sc-charts__range-tooltip", Ee =
|
|
245
|
-
const t =
|
|
244
|
+
}, tt = "sc-charts__range-tooltip", Ee = E.timeFormat("%b %e, %I:%M %p"), $i = (s) => {
|
|
245
|
+
const t = E.format(",.2f");
|
|
246
246
|
return `${s < 0 ? "-" : ""}$${t(Math.abs(s))}`;
|
|
247
247
|
};
|
|
248
248
|
function Pi(s) {
|
|
@@ -252,51 +252,51 @@ function Pi(s) {
|
|
|
252
252
|
i.className = `${tt}-container`, e.append(i);
|
|
253
253
|
const n = document.createElement("div");
|
|
254
254
|
n.className = `${tt}-sum`, i.append(n);
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
|
|
255
|
+
const a = document.createElement("div");
|
|
256
|
+
a.className = `${tt}-sum-icon`;
|
|
257
|
+
const r = document.createElementNS(t, "svg");
|
|
258
|
+
r.setAttribute("width", "14"), r.setAttribute("height", "14"), r.setAttribute("viewBox", "0 0 14 14"), r.setAttribute("fill", "none"), r.setAttribute("xmlns", t);
|
|
259
259
|
const l = document.createElementNS(t, "path");
|
|
260
260
|
l.setAttribute(
|
|
261
261
|
"d",
|
|
262
262
|
"M7 0.5C5.71442 0.5 4.45772 0.881218 3.3888 1.59545C2.31988 2.30968 1.48676 3.32484 0.994786 4.51256C0.502816 5.70028 0.374095 7.00721 0.624899 8.26809C0.875703 9.52896 1.49477 10.6872 2.40381 11.5962C3.31285 12.5052 4.47104 13.1243 5.73192 13.3751C6.99279 13.6259 8.29973 13.4972 9.48744 13.0052C10.6752 12.5132 11.6903 11.6801 12.4046 10.6112C13.1188 9.54229 13.5 8.28558 13.5 7C13.4982 5.27665 12.8128 3.62441 11.5942 2.40582C10.3756 1.18722 8.72335 0.50182 7 0.5ZM9.35375 6.85375C9.30732 6.90024 9.25217 6.93712 9.19147 6.96228C9.13077 6.98744 9.06571 7.00039 9 7.00039C8.93429 7.00039 8.86923 6.98744 8.80853 6.96228C8.74783 6.93712 8.69269 6.90024 8.64625 6.85375L7.5 5.70687V9.5C7.5 9.63261 7.44732 9.75979 7.35356 9.85355C7.25979 9.94732 7.13261 10 7 10C6.86739 10 6.74022 9.94732 6.64645 9.85355C6.55268 9.75979 6.5 9.63261 6.5 9.5V5.70687L5.35375 6.85375C5.25993 6.94757 5.13268 7.00028 5 7.00028C4.86732 7.00028 4.74007 6.94757 4.64625 6.85375C4.55243 6.75993 4.49972 6.63268 4.49972 6.5C4.49972 6.36732 4.55243 6.24007 4.64625 6.14625L6.64625 4.14625C6.69269 4.09976 6.74783 4.06288 6.80853 4.03772C6.86923 4.01256 6.9343 3.99961 7 3.99961C7.06571 3.99961 7.13077 4.01256 7.19147 4.03772C7.25217 4.06288 7.30732 4.09976 7.35375 4.14625L9.35375 6.14625C9.40024 6.19269 9.43712 6.24783 9.46228 6.30853C9.48744 6.36923 9.5004 6.43429 9.5004 6.5C9.5004 6.56571 9.48744 6.63077 9.46228 6.69147C9.43712 6.75217 9.40024 6.80731 9.35375 6.85375Z"
|
|
263
|
-
), l.setAttribute("fill", "currentColor"),
|
|
264
|
-
const c = document.createElement("div");
|
|
265
|
-
n.append(c);
|
|
263
|
+
), l.setAttribute("fill", "currentColor"), r.appendChild(l), a.appendChild(r), n.append(a);
|
|
266
264
|
const h = document.createElement("div");
|
|
267
|
-
|
|
265
|
+
n.append(h);
|
|
266
|
+
const d = document.createElement("div");
|
|
267
|
+
return d.className = `${tt}-time`, i.append(d), { wrapper: e, sumNode: h, timeNode: d };
|
|
268
268
|
}
|
|
269
269
|
const Oi = (s) => {
|
|
270
270
|
const { wrapper: t, sumNode: e, timeNode: i } = Pi(s.wrapperNode);
|
|
271
271
|
return {
|
|
272
|
-
className(n,
|
|
273
|
-
n === "remove" ? t.classList.remove(`${tt}${
|
|
272
|
+
className(n, a) {
|
|
273
|
+
n === "remove" ? t.classList.remove(`${tt}${a}`) : t.classList.add(`${tt}${a}`);
|
|
274
274
|
},
|
|
275
|
-
update({ leftPoint: n, rightPoint:
|
|
276
|
-
if (n &&
|
|
277
|
-
const g =
|
|
275
|
+
update({ leftPoint: n, rightPoint: a, x: r, y: l, hidden: h, closest: d }) {
|
|
276
|
+
if (n && a && d && r !== void 0) {
|
|
277
|
+
const g = a.value - n.value, { sumFormatter: _, timeFormatter: m } = s.config.selection, p = (s.x(a.date) + s.x(n.date)) / 2, v = s.x(d.date) < p ? "left" : "right";
|
|
278
278
|
let b = "", x = "";
|
|
279
279
|
if (_)
|
|
280
|
-
b = _({ left: n.value, right:
|
|
280
|
+
b = _({ left: n.value, right: a.value, direction: v });
|
|
281
281
|
else {
|
|
282
282
|
const C = (g / Math.abs(n.value) * 100).toFixed(2);
|
|
283
283
|
b = `${$i(g)} (${C}%)`;
|
|
284
284
|
}
|
|
285
|
-
m ? x = m({ left: n.date, right:
|
|
286
|
-
const C = t.getBoundingClientRect(), w = s.wrapperNode.getBoundingClientRect(), y = s.x(n.date), T = s.x(
|
|
285
|
+
m ? x = m({ left: n.date, right: a.date, direction: v }) : x = `${Ee(n.date)} to ${Ee(a.date)}`, e.textContent = b, i.textContent = x, requestAnimationFrame(() => {
|
|
286
|
+
const C = t.getBoundingClientRect(), w = s.wrapperNode.getBoundingClientRect(), y = s.x(n.date), T = s.x(a.date);
|
|
287
287
|
let N = (y + T) / 2 - C.width / 2;
|
|
288
288
|
const z = 0, O = w.width - C.width;
|
|
289
289
|
N < z && (N = z), N > O && (N = O), t.style.left = `${N}px`, t.style.top = `${l}px`;
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
-
|
|
292
|
+
h !== void 0 && (t.style.display = h ? "none" : "block");
|
|
293
293
|
},
|
|
294
294
|
destroy() {
|
|
295
295
|
t.remove();
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
|
-
}, gt = "sc-charts__hover-tooltip", Ut = 16, Yi =
|
|
299
|
-
const t =
|
|
298
|
+
}, gt = "sc-charts__hover-tooltip", Ut = 16, Yi = E.timeFormat("%a, %b %d, %-I:%M %p"), ji = (s) => {
|
|
299
|
+
const t = E.format(",.2f");
|
|
300
300
|
return `${s < 0 ? "-" : ""}$${t(Math.abs(s))}`;
|
|
301
301
|
};
|
|
302
302
|
function Xi(s) {
|
|
@@ -313,19 +313,19 @@ function Wi(s, t, e) {
|
|
|
313
313
|
const Vi = (s) => {
|
|
314
314
|
const { wrapper: t, sumNode: e, timeNode: i } = Xi(s.wrapperNode);
|
|
315
315
|
return {
|
|
316
|
-
className(n,
|
|
317
|
-
n === "remove" ? t.classList.remove(`${gt}${
|
|
316
|
+
className(n, a) {
|
|
317
|
+
n === "remove" ? t.classList.remove(`${gt}${a}`) : t.classList.add(`${gt}${a}`);
|
|
318
318
|
},
|
|
319
|
-
update({ hidden: n, dataItem:
|
|
320
|
-
if (
|
|
321
|
-
const { sumFormatter:
|
|
322
|
-
e.textContent =
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
s.x(
|
|
319
|
+
update({ hidden: n, dataItem: a }) {
|
|
320
|
+
if (a) {
|
|
321
|
+
const { sumFormatter: r, timeFormatter: l } = s.config.hover;
|
|
322
|
+
e.textContent = r ? r(a.value) : ji(a.value), i.textContent = l ? l(a.date) : Yi(a.date), requestAnimationFrame(() => {
|
|
323
|
+
const h = t.getBoundingClientRect(), d = Wi(
|
|
324
|
+
h,
|
|
325
|
+
s.x(a.date),
|
|
326
326
|
s.width - s.config.margin.right
|
|
327
327
|
);
|
|
328
|
-
|
|
328
|
+
d && (t.style.left = d + "px");
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
331
|
n !== void 0 && (t.style.display = n ? "none" : "block");
|
|
@@ -385,8 +385,8 @@ const Vi = (s) => {
|
|
|
385
385
|
},
|
|
386
386
|
enableBelowZeroLine: !1,
|
|
387
387
|
curveTension: 1
|
|
388
|
-
}, Et = (s) =>
|
|
389
|
-
const { svg: t, data: e, x: i, y: n, config:
|
|
388
|
+
}, Et = (s) => E.curveCardinal.tension(s.config.curveTension), Ui = (s) => {
|
|
389
|
+
const { svg: t, data: e, x: i, y: n, config: a } = s, r = t.node(), l = nt(r);
|
|
390
390
|
_t(l, "main-line-area-gradient", {
|
|
391
391
|
x1: "0%",
|
|
392
392
|
y1: "0%",
|
|
@@ -397,14 +397,14 @@ const Vi = (s) => {
|
|
|
397
397
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
398
398
|
]
|
|
399
399
|
});
|
|
400
|
-
const
|
|
400
|
+
const d = E.area().x((m) => i(m.date)).y0(n.range()[0]).y1((m) => n(m.value)).curve(Et(s)), g = "sc-charts__main-line-area", _ = t.append("path").datum(e).attr("d", d).attr("class", g).classed(`${g}_hidden`, !a.hasMainLineArea);
|
|
401
401
|
return {
|
|
402
402
|
className(m, p) {
|
|
403
403
|
m === "remove" ? _.classed(`${g}${p}`, !1) : _.classed(`${g}${p}`, !0);
|
|
404
404
|
},
|
|
405
405
|
update({ data: m, hidden: p }) {
|
|
406
|
-
if (m !== void 0 && _.datum(m).attr("d",
|
|
407
|
-
if (!
|
|
406
|
+
if (m !== void 0 && _.datum(m).attr("d", d), p !== void 0) {
|
|
407
|
+
if (!a.hasMainLineArea) return null;
|
|
408
408
|
_.classed(`${g}_hidden`, p);
|
|
409
409
|
}
|
|
410
410
|
},
|
|
@@ -413,7 +413,7 @@ const Vi = (s) => {
|
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
415
|
}, Zi = (s, t = {}) => {
|
|
416
|
-
const e = "sc-charts__range-line-area", { svg: i, x: n, y:
|
|
416
|
+
const e = "sc-charts__range-line-area", { svg: i, x: n, y: a, config: r, data: l, chartId: h } = s, { clip: d } = t, g = i.node(), _ = nt(g), m = "range-line-area-gradient";
|
|
417
417
|
_t(_, m + "_up", {
|
|
418
418
|
x1: "0%",
|
|
419
419
|
y1: "0%",
|
|
@@ -433,7 +433,7 @@ const Vi = (s) => {
|
|
|
433
433
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
434
434
|
]
|
|
435
435
|
});
|
|
436
|
-
const p =
|
|
436
|
+
const p = E.area().x((w) => n(w.date)).y0(a.range()[0]).y1((w) => a(w.value)).curve(Et(s)), v = `${h}-clip-${e}`, x = _.append("clipPath").attr("id", v).append("rect").attr("x", (d == null ? void 0 : d.x) || 0).attr("y", (d == null ? void 0 : d.y) || 0).attr("width", (d == null ? void 0 : d.width) || "100%").attr("height", (d == null ? void 0 : d.height) || "100%"), C = i.append("path").datum(l).attr("d", p).attr("class", e).classed(`${e}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${v})`);
|
|
437
437
|
return {
|
|
438
438
|
className(w, y) {
|
|
439
439
|
w === "remove" ? C.classed(`${e}${y}`, !1) : C.classed(`${e}${y}`, !0);
|
|
@@ -446,7 +446,7 @@ const Vi = (s) => {
|
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
448
|
}, Zt = (s, t) => {
|
|
449
|
-
const { svg: e, data: i, x: n, y:
|
|
449
|
+
const { svg: e, data: i, x: n, y: a, chartId: r } = s, { baseClassName: l, id: h, clip: d } = t, g = e.node(), _ = nt(g), m = E.line().x((C) => n(C.date)).y((C) => a(C.value)).curve(Et(s)), p = `${r}-clip-${l}`, b = _.append("clipPath").attr("id", p).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 = e.append("path").classed(l, !0).datum(i).attr("d", m).attr("id", h).attr("clip-path", `url(#${p})`);
|
|
450
450
|
return {
|
|
451
451
|
className(C, w) {
|
|
452
452
|
C === "remove" ? x.classed(`${l}${w}`, !1) : x.classed(`${l}${w}`, !0);
|
|
@@ -459,13 +459,13 @@ const Vi = (s) => {
|
|
|
459
459
|
}
|
|
460
460
|
};
|
|
461
461
|
}, qi = (s, t) => {
|
|
462
|
-
const { svg: e, data: i, x: n, y:
|
|
462
|
+
const { svg: e, data: i, x: n, y: a, chartId: r, config: l } = s, { baseClassName: h, id: d, clip: g } = t, _ = e.node(), m = nt(_), p = E.line().x((w) => n(w.date)).y((w) => a(w.value)).curve(Et(s)), v = `${r}-clip-${h}`, x = m.append("clipPath").attr("id", v).append("rect").attr("x", (g == null ? void 0 : g.x) || 0).attr("y", (g == null ? void 0 : g.y) || 0).attr("width", (g == null ? void 0 : g.width) || "100%").attr("height", (g == null ? void 0 : g.height) || "100%"), C = e.append("path").classed(h, !0).datum(i).attr("d", p).attr("id", d).attr("clip-path", `url(#${v})`);
|
|
463
463
|
return {
|
|
464
464
|
className(w, y) {
|
|
465
|
-
w === "remove" ? C.classed(`${
|
|
465
|
+
w === "remove" ? C.classed(`${h}${y}`, !1) : C.classed(`${h}${y}`, !0);
|
|
466
466
|
},
|
|
467
467
|
update({ data: w, clip: y, hidden: T }) {
|
|
468
|
-
w !== void 0 && C.datum(w).attr("d", p), T !== void 0 && C.classed(`${
|
|
468
|
+
w !== void 0 && C.datum(w).attr("d", p), T !== void 0 && C.classed(`${h}_hidden`, T), y !== void 0 && (l.hover.transitionName === "default" ? x.transition().duration(l.hover.transitionDuration).attr("x", y.x).attr("y", y.y).attr("width", y.width).attr("height", y.height).ease(E.easeLinear) : x.attr("x", y.x).attr("y", y.y).attr("width", y.width).attr("height", y.height));
|
|
469
469
|
},
|
|
470
470
|
destroy() {
|
|
471
471
|
C.remove();
|
|
@@ -476,19 +476,19 @@ const Vi = (s) => {
|
|
|
476
476
|
let e;
|
|
477
477
|
return t >= 1e9 ? e = (s / 1e9).toFixed(1) + "B" : t >= 1e6 ? e = (s / 1e6).toFixed(1) + "M" : t >= 1e3 ? e = (s / 1e3).toFixed(1) + "K" : e = s.toFixed(1), e;
|
|
478
478
|
}, Qi = (s, t) => {
|
|
479
|
-
const { svg: e, data: i, x: n, y:
|
|
479
|
+
const { svg: e, data: i, x: n, y: a } = s, { baseClassName: r } = t, l = e.append("g").classed(r, !0), h = l.append("circle").attr("r", 5).classed(`${r}-circle`, !0), d = l.append("text").attr("text-anchor", "middle").attr("dy", "-9px").classed(`${r}-label`, !0);
|
|
480
480
|
return ((_) => {
|
|
481
481
|
if (!_ || _.length === 0) return;
|
|
482
|
-
const m = _[_.length - 1], p = n(m.date), v =
|
|
483
|
-
|
|
482
|
+
const m = _[_.length - 1], p = n(m.date), v = a(m.value);
|
|
483
|
+
h.attr("cx", p).attr("cy", v);
|
|
484
484
|
const b = s.config.extremePointFormatter || Ji;
|
|
485
|
-
|
|
485
|
+
d.attr("x", p).attr("y", v).text(b(m.value));
|
|
486
486
|
})(i), {
|
|
487
487
|
className(_, m) {
|
|
488
|
-
_ === "remove" ? l.classed(`${
|
|
488
|
+
_ === "remove" ? l.classed(`${r}${m}`, !1) : l.classed(`${r}${m}`, !0);
|
|
489
489
|
},
|
|
490
490
|
update({ hidden: _ }) {
|
|
491
|
-
_ !== void 0 && l.classed(`${
|
|
491
|
+
_ !== void 0 && l.classed(`${r}_hidden`, _);
|
|
492
492
|
},
|
|
493
493
|
destroy() {
|
|
494
494
|
l.remove();
|
|
@@ -503,13 +503,13 @@ const Vi = (s) => {
|
|
|
503
503
|
s.config.hasExtremePoint && (i = Qi(s, {
|
|
504
504
|
baseClassName: "sc-charts__extreme-point"
|
|
505
505
|
}));
|
|
506
|
-
const n = zi(s.svg),
|
|
506
|
+
const n = zi(s.svg), a = qi(s, {
|
|
507
507
|
baseClassName: "sc-charts__highlight-line",
|
|
508
508
|
id: `${s.chartId}-sc-charts__highlight-line`,
|
|
509
509
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
510
510
|
});
|
|
511
|
-
let
|
|
512
|
-
s.config.enableBelowZeroLine && (
|
|
511
|
+
let r = null;
|
|
512
|
+
s.config.enableBelowZeroLine && (r = Zt(s, {
|
|
513
513
|
baseClassName: "sc-charts__below-zero-line",
|
|
514
514
|
id: `${s.chartId}-sc-charts__below-zero-line`,
|
|
515
515
|
clip: Ge(s)
|
|
@@ -517,7 +517,7 @@ const Vi = (s) => {
|
|
|
517
517
|
const l = Gt(s.svg, {
|
|
518
518
|
className: "sc-charts__hover-circle",
|
|
519
519
|
hidden: !0
|
|
520
|
-
}),
|
|
520
|
+
}), h = De(s.svg), d = De(s.svg), g = Zt(s, {
|
|
521
521
|
baseClassName: "sc-charts__range-line",
|
|
522
522
|
id: `${s.chartId}-sc-charts__range-line`,
|
|
523
523
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
@@ -531,18 +531,18 @@ const Vi = (s) => {
|
|
|
531
531
|
return {
|
|
532
532
|
hoverLine: n,
|
|
533
533
|
hoverCircle: l,
|
|
534
|
-
rangeBorderLeft:
|
|
535
|
-
rangeBorderRight:
|
|
534
|
+
rangeBorderLeft: h,
|
|
535
|
+
rangeBorderRight: d,
|
|
536
536
|
rangeLine: g,
|
|
537
537
|
rangeLineArea: b,
|
|
538
538
|
rangeCircleLeft: _,
|
|
539
539
|
rangeCircleRight: m,
|
|
540
540
|
mainLine: t,
|
|
541
541
|
rangeTooltip: p,
|
|
542
|
-
highlightLine:
|
|
542
|
+
highlightLine: a,
|
|
543
543
|
hoverTooltip: v,
|
|
544
544
|
mainLineArea: e,
|
|
545
|
-
belowZeroLine:
|
|
545
|
+
belowZeroLine: r,
|
|
546
546
|
extremePoint: i
|
|
547
547
|
};
|
|
548
548
|
}, tn = (s, t, e) => {
|
|
@@ -554,25 +554,25 @@ const Vi = (s) => {
|
|
|
554
554
|
width: "100%",
|
|
555
555
|
height: "100%"
|
|
556
556
|
};
|
|
557
|
-
const [, n,
|
|
558
|
-
let
|
|
559
|
-
for (;
|
|
560
|
-
let g = new Date(
|
|
561
|
-
switch (
|
|
557
|
+
const [, n, a] = i, r = parseInt(n, 10), [l, h] = e.domain();
|
|
558
|
+
let d = new Date(l);
|
|
559
|
+
for (; d < h; ) {
|
|
560
|
+
let g = new Date(d);
|
|
561
|
+
switch (a) {
|
|
562
562
|
case "M":
|
|
563
|
-
g.setMinutes(g.getMinutes() +
|
|
563
|
+
g.setMinutes(g.getMinutes() + r);
|
|
564
564
|
break;
|
|
565
565
|
case "h":
|
|
566
|
-
g.setHours(g.getHours() +
|
|
566
|
+
g.setHours(g.getHours() + r);
|
|
567
567
|
break;
|
|
568
568
|
case "d":
|
|
569
|
-
g.setDate(g.getDate() +
|
|
569
|
+
g.setDate(g.getDate() + r);
|
|
570
570
|
break;
|
|
571
571
|
case "w":
|
|
572
|
-
g.setDate(g.getDate() +
|
|
572
|
+
g.setDate(g.getDate() + r * 7);
|
|
573
573
|
break;
|
|
574
574
|
case "m":
|
|
575
|
-
g = new Date(
|
|
575
|
+
g = new Date(d.getFullYear(), d.getMonth() + r, 1);
|
|
576
576
|
break;
|
|
577
577
|
default:
|
|
578
578
|
return {
|
|
@@ -582,8 +582,8 @@ const Vi = (s) => {
|
|
|
582
582
|
height: "100%"
|
|
583
583
|
};
|
|
584
584
|
}
|
|
585
|
-
if (t >=
|
|
586
|
-
const _ = e(
|
|
585
|
+
if (t >= d && t < g) {
|
|
586
|
+
const _ = e(d), m = e(g);
|
|
587
587
|
return {
|
|
588
588
|
x: _,
|
|
589
589
|
y: 0,
|
|
@@ -591,28 +591,28 @@ const Vi = (s) => {
|
|
|
591
591
|
height: "100%"
|
|
592
592
|
};
|
|
593
593
|
}
|
|
594
|
-
|
|
594
|
+
d = new Date(g);
|
|
595
595
|
}
|
|
596
|
-
if (t.getTime() ===
|
|
597
|
-
let g = new Date(
|
|
598
|
-
switch (
|
|
596
|
+
if (t.getTime() === h.getTime()) {
|
|
597
|
+
let g = new Date(h);
|
|
598
|
+
switch (a) {
|
|
599
599
|
case "M":
|
|
600
|
-
g.setMinutes(g.getMinutes() -
|
|
600
|
+
g.setMinutes(g.getMinutes() - r);
|
|
601
601
|
break;
|
|
602
602
|
case "h":
|
|
603
|
-
g.setHours(g.getHours() -
|
|
603
|
+
g.setHours(g.getHours() - r);
|
|
604
604
|
break;
|
|
605
605
|
case "d":
|
|
606
|
-
g.setDate(g.getDate() -
|
|
606
|
+
g.setDate(g.getDate() - r);
|
|
607
607
|
break;
|
|
608
608
|
case "w":
|
|
609
|
-
g.setDate(g.getDate() -
|
|
609
|
+
g.setDate(g.getDate() - r * 7);
|
|
610
610
|
break;
|
|
611
611
|
case "m":
|
|
612
|
-
g = new Date(
|
|
612
|
+
g = new Date(h.getFullYear(), h.getMonth() - r, 1);
|
|
613
613
|
break;
|
|
614
614
|
}
|
|
615
|
-
const _ = e(g), m = e(
|
|
615
|
+
const _ = e(g), m = e(h);
|
|
616
616
|
return {
|
|
617
617
|
x: _,
|
|
618
618
|
y: 0,
|
|
@@ -627,19 +627,19 @@ const Vi = (s) => {
|
|
|
627
627
|
height: "100%"
|
|
628
628
|
};
|
|
629
629
|
}, Le = (s, t) => {
|
|
630
|
-
var
|
|
630
|
+
var d;
|
|
631
631
|
const {
|
|
632
632
|
x: e,
|
|
633
633
|
y: i,
|
|
634
634
|
elements: n,
|
|
635
|
-
config: { margin:
|
|
636
|
-
height:
|
|
635
|
+
config: { margin: a },
|
|
636
|
+
height: r
|
|
637
637
|
} = s;
|
|
638
638
|
n.hoverLine.update({
|
|
639
639
|
x1: e(t.date),
|
|
640
640
|
x2: e(t.date),
|
|
641
|
-
y1:
|
|
642
|
-
y2:
|
|
641
|
+
y1: a.top,
|
|
642
|
+
y2: r - a.bottom,
|
|
643
643
|
hidden: !1
|
|
644
644
|
}), n.hoverCircle.update({
|
|
645
645
|
cx: e(t.date),
|
|
@@ -654,12 +654,12 @@ const Vi = (s) => {
|
|
|
654
654
|
clip: l,
|
|
655
655
|
hidden: !1
|
|
656
656
|
});
|
|
657
|
-
const
|
|
658
|
-
|
|
657
|
+
const h = i.range()[0] - i(0) + a.bottom;
|
|
658
|
+
h >= 0 && ((d = n.belowZeroLine) == null || d.update({
|
|
659
659
|
clip: {
|
|
660
660
|
...l,
|
|
661
661
|
y: i(0),
|
|
662
|
-
height:
|
|
662
|
+
height: h
|
|
663
663
|
}
|
|
664
664
|
})), n.mainLine.className("add", "_muted");
|
|
665
665
|
}, Ne = (s) => {
|
|
@@ -685,29 +685,29 @@ const Vi = (s) => {
|
|
|
685
685
|
const {
|
|
686
686
|
x: i,
|
|
687
687
|
y: n,
|
|
688
|
-
config: { margin:
|
|
689
|
-
height:
|
|
688
|
+
config: { margin: a },
|
|
689
|
+
height: r,
|
|
690
690
|
elements: l
|
|
691
|
-
} = s,
|
|
691
|
+
} = s, h = i(t.date) < i(e.date) ? t : e, d = i(t.date) >= i(e.date) ? t : e, g = d.value - h.value >= 0, _ = i(h.date), m = i(d.date), p = m - _;
|
|
692
692
|
l.rangeBorderLeft.update({
|
|
693
693
|
x1: _,
|
|
694
694
|
x2: _,
|
|
695
|
-
y1:
|
|
696
|
-
y2:
|
|
695
|
+
y1: a.top,
|
|
696
|
+
y2: r - a.bottom,
|
|
697
697
|
hidden: !1
|
|
698
698
|
}), l.rangeBorderRight.update({
|
|
699
699
|
x1: m,
|
|
700
700
|
x2: m,
|
|
701
|
-
y1:
|
|
702
|
-
y2:
|
|
701
|
+
y1: a.top,
|
|
702
|
+
y2: r - a.bottom,
|
|
703
703
|
hidden: !1
|
|
704
704
|
}), l.rangeCircleLeft.update({
|
|
705
705
|
cx: _,
|
|
706
|
-
cy: n(
|
|
706
|
+
cy: n(h.value),
|
|
707
707
|
hidden: !1
|
|
708
708
|
}), l.rangeCircleRight.update({
|
|
709
709
|
cx: m,
|
|
710
|
-
cy: n(
|
|
710
|
+
cy: n(d.value),
|
|
711
711
|
hidden: !1
|
|
712
712
|
}), l.rangeLine.update({
|
|
713
713
|
clip: {
|
|
@@ -726,8 +726,8 @@ const Vi = (s) => {
|
|
|
726
726
|
},
|
|
727
727
|
hidden: !1
|
|
728
728
|
}), l.rangeTooltip.update({
|
|
729
|
-
rightPoint:
|
|
730
|
-
leftPoint:
|
|
729
|
+
rightPoint: d,
|
|
730
|
+
leftPoint: h,
|
|
731
731
|
closest: e,
|
|
732
732
|
x: _ + p / 2,
|
|
733
733
|
y: 0,
|
|
@@ -740,49 +740,49 @@ const Vi = (s) => {
|
|
|
740
740
|
const { elements: t } = s;
|
|
741
741
|
t.rangeLine.update({ hidden: !0 }), t.rangeLineArea.update({ hidden: !0 }), t.rangeBorderLeft.update({ hidden: !0 }), t.rangeBorderRight.update({ hidden: !0 }), t.rangeCircleLeft.update({ hidden: !0 }), t.rangeCircleRight.update({ hidden: !0 }), t.rangeTooltip.update({ hidden: !0 }), t.mainLine.className("remove", "_selected-muted"), t.mainLineArea.update({ hidden: !1 }), (e = t.belowZeroLine) == null || e.update({ hidden: !1 });
|
|
742
742
|
}, nn = (s) => {
|
|
743
|
-
const { svg: t, data: e, x: i, config: n, width:
|
|
743
|
+
const { svg: t, data: e, x: i, config: n, width: a, height: r } = s, { margin: l, hover: h, selection: d } = n;
|
|
744
744
|
let g = null, _ = !1;
|
|
745
745
|
const m = (v) => e.reduce(
|
|
746
746
|
(b, x) => Math.abs(i(b.date) - v) < Math.abs(i(x.date) - v) ? b : x
|
|
747
747
|
);
|
|
748
|
-
t.append("rect").attr("width",
|
|
749
|
-
const [b] =
|
|
750
|
-
!_ &&
|
|
748
|
+
t.append("rect").attr("width", a - l.left - l.right).attr("height", r - l.top - l.bottom).attr("x", l.left).attr("y", l.top).attr("fill", "transparent").on("mousemove", function(v) {
|
|
749
|
+
const [b] = E.pointer(v, this), x = m(b);
|
|
750
|
+
!_ && h.enable ? (s.action = "hover", Le(s, x)) : (s.action = _ ? "selection" : "none", Ne(s)), g && d.enable && (s.action = "selection", sn(s, g, x));
|
|
751
751
|
}).on("mouseleave", () => {
|
|
752
752
|
s.action = "none", _ = !1, g = null, Ne(s), Ie(s);
|
|
753
753
|
}).on("mousedown", function(v) {
|
|
754
|
-
if (
|
|
754
|
+
if (d.enable) {
|
|
755
755
|
_ = !0, s.action = "selection";
|
|
756
|
-
const [b] =
|
|
756
|
+
const [b] = E.pointer(v, this);
|
|
757
757
|
g = m(b);
|
|
758
758
|
}
|
|
759
759
|
}).on("mouseup", function(v) {
|
|
760
|
-
const [b] =
|
|
761
|
-
_ = !1, g = null, s.action = "hover",
|
|
760
|
+
const [b] = E.pointer(v, this), x = m(b);
|
|
761
|
+
_ = !1, g = null, s.action = "hover", d.enable && Ie(s), h.enable && Le(s, x);
|
|
762
762
|
});
|
|
763
|
-
}, rn = (s, t, e) => {
|
|
764
|
-
const { margin: i } = t, n = L.scaleTime(), r = L.extent(s, (a) => new Date(a.date));
|
|
765
|
-
return r[0] == null || r[1] == null ? n : n.domain([r[0], r[1]]).range([i.left, e - i.right]);
|
|
766
763
|
}, an = (s, t, e) => {
|
|
767
|
-
const { margin: i } = t, n =
|
|
768
|
-
return
|
|
769
|
-
},
|
|
770
|
-
const
|
|
764
|
+
const { margin: i } = t, n = E.scaleTime(), a = E.extent(s, (r) => new Date(r.date));
|
|
765
|
+
return a[0] == null || a[1] == null ? n : n.domain([a[0], a[1]]).range([i.left, e - i.right]);
|
|
766
|
+
}, rn = (s, t, e) => {
|
|
767
|
+
const { margin: i } = t, n = E.max(s, (r) => r.value) ?? 0, a = E.min(s, (r) => r.value) ?? 0;
|
|
768
|
+
return E.scaleLinear().domain([a, n]).range([e - i.bottom, i.top]);
|
|
769
|
+
}, or = (s, t) => {
|
|
770
|
+
const e = E.select(s);
|
|
771
771
|
if (e.empty())
|
|
772
772
|
return console.error(`Element with selector ${s} not found!`), null;
|
|
773
773
|
if (!t.chartId || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(t.chartId))
|
|
774
774
|
return console.error(`chartId is required and must be a valid id
|
|
775
775
|
(only letters, numbers or underscores. The first character must be a letter)`), null;
|
|
776
|
-
const i = e.append("div"), n = i.append("svg"),
|
|
777
|
-
let
|
|
776
|
+
const i = e.append("div"), n = i.append("svg"), a = e.node();
|
|
777
|
+
let r = a.getBoundingClientRect(), l = r.width, h = r.height, d = ke({ ...Gi }, t.config), g = t.data;
|
|
778
778
|
const _ = () => {
|
|
779
|
-
|
|
779
|
+
r = a.getBoundingClientRect(), l = r.width, h = r.height, m({ data: g, config: d });
|
|
780
780
|
};
|
|
781
781
|
window.addEventListener("resize", _);
|
|
782
782
|
const m = (p, v = !1) => {
|
|
783
|
-
v && p.config && (
|
|
784
|
-
const b = g.map((T) => ({ date: new Date(T.date), value: T.value })).sort((T, D) => T.date.getTime() - D.date.getTime()), x =
|
|
785
|
-
i.attr("class", `sc-charts sc-charts__${
|
|
783
|
+
v && p.config && (d = ke(d, p.config)), v && p.data && (g = p.data);
|
|
784
|
+
const b = g.map((T) => ({ date: new Date(T.date), value: T.value })).sort((T, D) => T.date.getTime() - D.date.getTime()), x = an(b, d, l), C = rn(b, d, h);
|
|
785
|
+
i.attr("class", `sc-charts sc-charts__${d.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${l} ${h}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
|
|
786
786
|
const w = {
|
|
787
787
|
chartId: t.chartId,
|
|
788
788
|
svg: n,
|
|
@@ -790,10 +790,10 @@ const Vi = (s) => {
|
|
|
790
790
|
data: b,
|
|
791
791
|
x,
|
|
792
792
|
y: C,
|
|
793
|
-
config:
|
|
793
|
+
config: d,
|
|
794
794
|
action: "none",
|
|
795
795
|
width: l,
|
|
796
|
-
height:
|
|
796
|
+
height: h
|
|
797
797
|
};
|
|
798
798
|
Ri(w);
|
|
799
799
|
const y = {
|
|
@@ -818,11 +818,11 @@ dt.exports;
|
|
|
818
818
|
var Fe;
|
|
819
819
|
function ln() {
|
|
820
820
|
return Fe || (Fe = 1, function(s, t) {
|
|
821
|
-
var e = 200, i = "__lodash_hash_undefined__", n = 800,
|
|
822
|
-
F[Ft] = F[es] = F[ss] = F[is] = F[ns] = F[
|
|
823
|
-
var ne = typeof Ct == "object" && Ct && Ct.Object === Object && Ct, us = typeof self == "object" && self && self.Object === Object && self,
|
|
821
|
+
var e = 200, i = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, l = "[object Arguments]", h = "[object Array]", d = "[object AsyncFunction]", g = "[object Boolean]", _ = "[object Date]", m = "[object Error]", p = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", x = "[object Number]", C = "[object Null]", w = "[object Object]", y = "[object Proxy]", T = "[object RegExp]", D = "[object Set]", N = "[object String]", z = "[object Undefined]", O = "[object WeakMap]", Nt = "[object ArrayBuffer]", It = "[object DataView]", Ft = "[object Float32Array]", es = "[object Float64Array]", ss = "[object Int8Array]", is = "[object Int16Array]", ns = "[object Int32Array]", as = "[object Uint8Array]", rs = "[object Uint8ClampedArray]", os = "[object Uint16Array]", ls = "[object Uint32Array]", cs = /[\\^$.*+?()[\]{}|]/g, hs = /^\[object .+?Constructor\]$/, ds = /^(?:0|[1-9]\d*)$/, F = {};
|
|
822
|
+
F[Ft] = F[es] = F[ss] = F[is] = F[ns] = F[as] = F[rs] = F[os] = F[ls] = !0, F[l] = F[h] = F[Nt] = F[g] = F[It] = F[_] = F[m] = F[p] = F[b] = F[x] = F[w] = F[T] = F[D] = F[N] = F[O] = !1;
|
|
823
|
+
var ne = typeof Ct == "object" && Ct && Ct.Object === Object && Ct, us = typeof self == "object" && self && self.Object === Object && self, at = ne || us || Function("return this")(), ae = t && !t.nodeType && t, rt = ae && !0 && s && !s.nodeType && s, re = rt && rt.exports === ae, Bt = re && ne.process, oe = function() {
|
|
824
824
|
try {
|
|
825
|
-
var o =
|
|
825
|
+
var o = rt && rt.require && rt.require("util").types;
|
|
826
826
|
return o || Bt && Bt.binding && Bt.binding("util");
|
|
827
827
|
} catch {
|
|
828
828
|
}
|
|
@@ -858,12 +858,12 @@ function ln() {
|
|
|
858
858
|
return o(u(f));
|
|
859
859
|
};
|
|
860
860
|
}
|
|
861
|
-
var vs = Array.prototype, bs = Function.prototype, ft = Object.prototype, Ht =
|
|
861
|
+
var vs = Array.prototype, bs = Function.prototype, ft = Object.prototype, Ht = at["__core-js_shared__"], mt = bs.toString, Z = ft.hasOwnProperty, ce = function() {
|
|
862
862
|
var o = /[^.]+$/.exec(Ht && Ht.keys && Ht.keys.IE_PROTO || "");
|
|
863
863
|
return o ? "Symbol(src)_1." + o : "";
|
|
864
864
|
}(), he = ft.toString, ys = mt.call(Object), xs = RegExp(
|
|
865
865
|
"^" + mt.call(Z).replace(cs, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
866
|
-
), pt =
|
|
866
|
+
), pt = re ? at.Buffer : void 0, de = at.Symbol, ue = at.Uint8Array;
|
|
867
867
|
pt && pt.allocUnsafe;
|
|
868
868
|
var ge = ps(Object.getPrototypeOf, Object), _e = Object.create, ws = ft.propertyIsEnumerable, Cs = vs.splice, J = de ? de.toStringTag : void 0, vt = function() {
|
|
869
869
|
try {
|
|
@@ -871,7 +871,7 @@ function ln() {
|
|
|
871
871
|
return o({}, "", {}), o;
|
|
872
872
|
} catch {
|
|
873
873
|
}
|
|
874
|
-
}(), Ms = pt ? pt.isBuffer : void 0, fe = Math.max, As = Date.now, me = $t(
|
|
874
|
+
}(), Ms = pt ? pt.isBuffer : void 0, fe = Math.max, As = Date.now, me = $t(at, "Map"), ot = $t(Object, "create"), Ts = /* @__PURE__ */ function() {
|
|
875
875
|
function o() {
|
|
876
876
|
}
|
|
877
877
|
return function(u) {
|
|
@@ -1002,14 +1002,14 @@ function ln() {
|
|
|
1002
1002
|
}
|
|
1003
1003
|
it.prototype.clear = Ys, it.prototype.delete = js, it.prototype.get = Xs, it.prototype.has = Ws, it.prototype.set = Vs;
|
|
1004
1004
|
function Gs(o, u) {
|
|
1005
|
-
var f = Yt(o), M = !f && Ot(o), k = !f && !M && xe(o), I = !f && !M && !k && Ce(o), B = f || M || k || I,
|
|
1005
|
+
var f = Yt(o), M = !f && Ot(o), k = !f && !M && xe(o), I = !f && !M && !k && Ce(o), B = f || M || k || I, L = B ? _s(o.length, String) : [], H = L.length;
|
|
1006
1006
|
for (var Y in o)
|
|
1007
1007
|
B && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1008
1008
|
(Y == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1009
1009
|
k && (Y == "offset" || Y == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1010
1010
|
I && (Y == "buffer" || Y == "byteLength" || Y == "byteOffset") || // Skip index properties.
|
|
1011
|
-
be(Y, H)) ||
|
|
1012
|
-
return
|
|
1011
|
+
be(Y, H)) || L.push(Y);
|
|
1012
|
+
return L;
|
|
1013
1013
|
}
|
|
1014
1014
|
function Rt(o, u, f) {
|
|
1015
1015
|
(f !== void 0 && !wt(o[u], f) || f === void 0 && !(u in o)) && zt(o, u, f);
|
|
@@ -1061,21 +1061,21 @@ function ln() {
|
|
|
1061
1061
|
if (k || (k = new it()), K(I))
|
|
1062
1062
|
Ks(o, u, B, f, ve, M, k);
|
|
1063
1063
|
else {
|
|
1064
|
-
var
|
|
1065
|
-
|
|
1064
|
+
var L = M ? M(Pt(o, B), I, B + "", o, u, k) : void 0;
|
|
1065
|
+
L === void 0 && (L = I), Rt(o, B, L);
|
|
1066
1066
|
}
|
|
1067
1067
|
}, Me);
|
|
1068
1068
|
}
|
|
1069
1069
|
function Ks(o, u, f, M, k, I, B) {
|
|
1070
|
-
var
|
|
1070
|
+
var L = Pt(o, f), H = Pt(u, f), Y = B.get(H);
|
|
1071
1071
|
if (Y) {
|
|
1072
1072
|
Rt(o, f, Y);
|
|
1073
1073
|
return;
|
|
1074
1074
|
}
|
|
1075
|
-
var $ = I ? I(
|
|
1075
|
+
var $ = I ? I(L, H, f + "", o, u, B) : void 0, ct = $ === void 0;
|
|
1076
1076
|
if (ct) {
|
|
1077
1077
|
var Wt = Yt(H), Vt = !Wt && xe(H), Te = !Wt && !Vt && Ce(H);
|
|
1078
|
-
$ = H, Wt || Vt || Te ? Yt(
|
|
1078
|
+
$ = H, Wt || Vt || Te ? Yt(L) ? $ = L : yi(L) ? $ = ai(L) : Vt ? (ct = !1, $ = si(H)) : Te ? (ct = !1, $ = ni(H)) : $ = [] : xi(H) || Ot(H) ? ($ = L, Ot(L) ? $ = wi(L) : (!K(L) || Xt(L)) && ($ = hi(H))) : ct = !1;
|
|
1079
1079
|
}
|
|
1080
1080
|
ct && (B.set(H, $), k($, H, M, I, B), B.delete(H)), Rt(o, f, $);
|
|
1081
1081
|
}
|
|
@@ -1101,18 +1101,18 @@ function ln() {
|
|
|
1101
1101
|
var f = ii(o.buffer);
|
|
1102
1102
|
return new o.constructor(f, o.byteOffset, o.length);
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1104
|
+
function ai(o, u) {
|
|
1105
1105
|
var f = -1, M = o.length;
|
|
1106
1106
|
for (u || (u = Array(M)); ++f < M; )
|
|
1107
1107
|
u[f] = o[f];
|
|
1108
1108
|
return u;
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1110
|
+
function ri(o, u, f, M) {
|
|
1111
1111
|
var k = !f;
|
|
1112
1112
|
f || (f = {});
|
|
1113
1113
|
for (var I = -1, B = u.length; ++I < B; ) {
|
|
1114
|
-
var
|
|
1115
|
-
H === void 0 && (H = o[
|
|
1114
|
+
var L = u[I], H = void 0;
|
|
1115
|
+
H === void 0 && (H = o[L]), k ? zt(f, L, H) : Us(f, L, H);
|
|
1116
1116
|
}
|
|
1117
1117
|
return f;
|
|
1118
1118
|
}
|
|
@@ -1120,15 +1120,15 @@ function ln() {
|
|
|
1120
1120
|
return ti(function(u, f) {
|
|
1121
1121
|
var M = -1, k = f.length, I = k > 1 ? f[k - 1] : void 0, B = k > 2 ? f[2] : void 0;
|
|
1122
1122
|
for (I = o.length > 3 && typeof I == "function" ? (k--, I) : void 0, B && di(f[0], f[1], B) && (I = k < 3 ? void 0 : I, k = 1), u = Object(u); ++M < k; ) {
|
|
1123
|
-
var
|
|
1124
|
-
|
|
1123
|
+
var L = f[M];
|
|
1124
|
+
L && o(u, L, M, I);
|
|
1125
1125
|
}
|
|
1126
1126
|
return u;
|
|
1127
1127
|
});
|
|
1128
1128
|
}
|
|
1129
1129
|
function li(o) {
|
|
1130
1130
|
return function(u, f, M) {
|
|
1131
|
-
for (var k = -1, I = Object(u), B = M(u),
|
|
1131
|
+
for (var k = -1, I = Object(u), B = M(u), L = B.length; L--; ) {
|
|
1132
1132
|
var H = B[++k];
|
|
1133
1133
|
if (f(I[H], H, I) === !1)
|
|
1134
1134
|
break;
|
|
@@ -1159,7 +1159,7 @@ function ln() {
|
|
|
1159
1159
|
}
|
|
1160
1160
|
function be(o, u) {
|
|
1161
1161
|
var f = typeof o;
|
|
1162
|
-
return u = u ??
|
|
1162
|
+
return u = u ?? r, !!u && (f == "number" || f != "symbol" && ds.test(o)) && o > -1 && o % 1 == 0 && o < u;
|
|
1163
1163
|
}
|
|
1164
1164
|
function di(o, u, f) {
|
|
1165
1165
|
if (!K(f))
|
|
@@ -1193,9 +1193,9 @@ function ln() {
|
|
|
1193
1193
|
for (var M = arguments, k = -1, I = fe(M.length - u, 0), B = Array(I); ++k < I; )
|
|
1194
1194
|
B[k] = M[u + k];
|
|
1195
1195
|
k = -1;
|
|
1196
|
-
for (var
|
|
1197
|
-
|
|
1198
|
-
return
|
|
1196
|
+
for (var L = Array(u + 1); ++k < u; )
|
|
1197
|
+
L[k] = M[k];
|
|
1198
|
+
return L[u] = f(B), gs(o, this, L);
|
|
1199
1199
|
};
|
|
1200
1200
|
}
|
|
1201
1201
|
function Pt(o, u) {
|
|
@@ -1206,7 +1206,7 @@ function ln() {
|
|
|
1206
1206
|
function vi(o) {
|
|
1207
1207
|
var u = 0, f = 0;
|
|
1208
1208
|
return function() {
|
|
1209
|
-
var M = As(), k =
|
|
1209
|
+
var M = As(), k = a - (M - f);
|
|
1210
1210
|
if (f = M, k > 0) {
|
|
1211
1211
|
if (++u >= n)
|
|
1212
1212
|
return arguments[0];
|
|
@@ -1247,10 +1247,10 @@ function ln() {
|
|
|
1247
1247
|
if (!K(o))
|
|
1248
1248
|
return !1;
|
|
1249
1249
|
var u = yt(o);
|
|
1250
|
-
return u == p || u == v || u ==
|
|
1250
|
+
return u == p || u == v || u == d || u == y;
|
|
1251
1251
|
}
|
|
1252
1252
|
function we(o) {
|
|
1253
|
-
return typeof o == "number" && o > -1 && o % 1 == 0 && o <=
|
|
1253
|
+
return typeof o == "number" && o > -1 && o % 1 == 0 && o <= r;
|
|
1254
1254
|
}
|
|
1255
1255
|
function K(o) {
|
|
1256
1256
|
var u = typeof o;
|
|
@@ -1270,7 +1270,7 @@ function ln() {
|
|
|
1270
1270
|
}
|
|
1271
1271
|
var Ce = le ? fs(le) : Js;
|
|
1272
1272
|
function wi(o) {
|
|
1273
|
-
return
|
|
1273
|
+
return ri(o, Me(o));
|
|
1274
1274
|
}
|
|
1275
1275
|
function Me(o) {
|
|
1276
1276
|
return jt(o) ? Gs(o) : Qs(o);
|
|
@@ -1335,11 +1335,11 @@ const Tt = /* @__PURE__ */ on(cn), Be = 12, hn = {
|
|
|
1335
1335
|
};
|
|
1336
1336
|
class dn {
|
|
1337
1337
|
constructor(t) {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1338
|
+
c(this, "_candles");
|
|
1339
|
+
c(this, "_xAxis");
|
|
1340
|
+
c(this, "_yAxis");
|
|
1341
|
+
c(this, "_guides");
|
|
1342
|
+
c(this, "_trade");
|
|
1343
1343
|
const e = Tt({}, hn, t);
|
|
1344
1344
|
this._candles = e.candles, this._xAxis = e.xAxis, this._yAxis = e.yAxis, this._guides = e.guides, this._trade = e.trade;
|
|
1345
1345
|
}
|
|
@@ -1375,16 +1375,16 @@ class dn {
|
|
|
1375
1375
|
}
|
|
1376
1376
|
class j {
|
|
1377
1377
|
constructor(t) {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1378
|
+
c(this, "_x");
|
|
1379
|
+
c(this, "_y");
|
|
1380
|
+
c(this, "_width");
|
|
1381
|
+
c(this, "_height");
|
|
1382
1382
|
let e;
|
|
1383
1383
|
if (!t)
|
|
1384
1384
|
e = { x: 0, y: 0, width: 0, height: 0 };
|
|
1385
1385
|
else if (t instanceof HTMLElement || t instanceof Element) {
|
|
1386
|
-
const { x: i, y: n, width:
|
|
1387
|
-
e = { x: i, y: n, width:
|
|
1386
|
+
const { x: i, y: n, width: a, height: r } = t.getBoundingClientRect();
|
|
1387
|
+
e = { x: i, y: n, width: a, height: r };
|
|
1388
1388
|
} else
|
|
1389
1389
|
e = t;
|
|
1390
1390
|
this._x = e.x, this._y = e.y, this._width = e.width, this._height = e.height;
|
|
@@ -1416,34 +1416,34 @@ class j {
|
|
|
1416
1416
|
}
|
|
1417
1417
|
class un {
|
|
1418
1418
|
constructor(t, e) {
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1419
|
+
c(this, "_chart", new j());
|
|
1420
|
+
c(this, "_area", new j());
|
|
1421
|
+
c(this, "_xAxis", new j());
|
|
1422
|
+
c(this, "_yAxis", new j());
|
|
1423
|
+
c(this, "_axisIntersection", new j());
|
|
1424
1424
|
const { xAxis: i, yAxis: n } = e;
|
|
1425
1425
|
this._chart = new j(t), this._calc(i, n);
|
|
1426
1426
|
}
|
|
1427
1427
|
_calc(t, e) {
|
|
1428
|
-
const i = t.isShow ? t.height : 0, n = e.isShow ? e.width : 0,
|
|
1428
|
+
const i = t.isShow ? t.height : 0, n = e.isShow ? e.width : 0, a = this._chart.height - i, r = this._chart.width - n;
|
|
1429
1429
|
this._area = new j({
|
|
1430
1430
|
x: e.position === "left" ? n : 0,
|
|
1431
1431
|
y: t.position === "top" ? i : 0,
|
|
1432
|
-
width:
|
|
1433
|
-
height:
|
|
1432
|
+
width: r,
|
|
1433
|
+
height: a
|
|
1434
1434
|
}), this._xAxis = new j({
|
|
1435
|
-
y: t.position === "top" ? 0 :
|
|
1435
|
+
y: t.position === "top" ? 0 : a,
|
|
1436
1436
|
x: e.position === "left" ? n : 0,
|
|
1437
1437
|
height: i,
|
|
1438
|
-
width:
|
|
1438
|
+
width: r
|
|
1439
1439
|
}), this._yAxis = new j({
|
|
1440
1440
|
y: t.position === "top" ? i : 0,
|
|
1441
|
-
x: e.position === "left" ? 0 :
|
|
1441
|
+
x: e.position === "left" ? 0 : r,
|
|
1442
1442
|
width: n,
|
|
1443
|
-
height:
|
|
1443
|
+
height: a
|
|
1444
1444
|
}), this._axisIntersection = new j({
|
|
1445
|
-
y: t.position === "top" ? 0 :
|
|
1446
|
-
x: e.position === "left" ? 0 :
|
|
1445
|
+
y: t.position === "top" ? 0 : a,
|
|
1446
|
+
x: e.position === "left" ? 0 : r,
|
|
1447
1447
|
width: n,
|
|
1448
1448
|
height: i
|
|
1449
1449
|
});
|
|
@@ -1477,29 +1477,29 @@ function _n(s, t) {
|
|
|
1477
1477
|
if (s.length < 2) return [];
|
|
1478
1478
|
const e = [];
|
|
1479
1479
|
for (let i = 0; i < s.length - 1; i++) {
|
|
1480
|
-
const n = s[i].close_time.getTime(),
|
|
1480
|
+
const n = s[i].close_time.getTime(), a = s[i].open_time.getTime(), l = new Date(s[i + 1].open_time).getTime() - n;
|
|
1481
1481
|
if (l >= t) {
|
|
1482
|
-
const
|
|
1483
|
-
for (let g = 1; g <=
|
|
1484
|
-
|
|
1485
|
-
|
|
1482
|
+
const h = Math.floor(l / t), d = [];
|
|
1483
|
+
for (let g = 1; g <= h; g++)
|
|
1484
|
+
d.push(a + g * t);
|
|
1485
|
+
d.length > 0 && e.push(d);
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
1488
|
return e;
|
|
1489
1489
|
}
|
|
1490
1490
|
function He(s, t) {
|
|
1491
1491
|
const e = gn(s[0]), i = _n(s, e), n = [];
|
|
1492
|
-
return i.forEach((
|
|
1493
|
-
if (
|
|
1494
|
-
const
|
|
1495
|
-
(_) => _.open_time.getTime() ===
|
|
1492
|
+
return i.forEach((a) => {
|
|
1493
|
+
if (a.length === 0) return;
|
|
1494
|
+
const r = s.find((_) => _.close_time.getTime() === a[0]), l = s.find(
|
|
1495
|
+
(_) => _.open_time.getTime() === a[a.length - 1] + e
|
|
1496
1496
|
);
|
|
1497
|
-
if (!
|
|
1497
|
+
if (!r || !l)
|
|
1498
1498
|
throw new Error("[CS_Data] error while creating missing data");
|
|
1499
|
-
const
|
|
1500
|
-
let g =
|
|
1501
|
-
|
|
1502
|
-
const p = (
|
|
1499
|
+
const h = r.close, d = l.open;
|
|
1500
|
+
let g = h;
|
|
1501
|
+
a.forEach((_, m) => {
|
|
1502
|
+
const p = (d - g) / a.length;
|
|
1503
1503
|
let v = g + p * m, b = v + p;
|
|
1504
1504
|
const x = Math.abs(v - b);
|
|
1505
1505
|
let C = Math.max(v, b) + x / 2, w = Math.min(v, b) - x / 2;
|
|
@@ -1524,12 +1524,12 @@ function He(s, t) {
|
|
|
1524
1524
|
}
|
|
1525
1525
|
class se {
|
|
1526
1526
|
constructor(t, e) {
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1527
|
+
c(this, "_initialData", []);
|
|
1528
|
+
c(this, "_preparedData", []);
|
|
1529
|
+
c(this, "_missingData", []);
|
|
1530
|
+
c(this, "_count", 0);
|
|
1531
|
+
c(this, "_model");
|
|
1532
|
+
c(this, "_interval", 0);
|
|
1533
1533
|
this._model = e, this.update(t);
|
|
1534
1534
|
}
|
|
1535
1535
|
_prepare(t) {
|
|
@@ -1565,7 +1565,7 @@ class se {
|
|
|
1565
1565
|
}
|
|
1566
1566
|
class fn {
|
|
1567
1567
|
constructor() {
|
|
1568
|
-
|
|
1568
|
+
c(this, "listeners", {});
|
|
1569
1569
|
}
|
|
1570
1570
|
subscribe(t, e) {
|
|
1571
1571
|
return this.listeners[t] || (this.listeners[t] = []), this.listeners[t].push(e), () => this.unsubscribe(t, e);
|
|
@@ -1577,14 +1577,14 @@ class fn {
|
|
|
1577
1577
|
emit(t, ...e) {
|
|
1578
1578
|
var n;
|
|
1579
1579
|
const i = e[0];
|
|
1580
|
-
(n = this.listeners[t]) == null || n.forEach((
|
|
1581
|
-
|
|
1580
|
+
(n = this.listeners[t]) == null || n.forEach((a) => {
|
|
1581
|
+
a(i);
|
|
1582
1582
|
});
|
|
1583
1583
|
}
|
|
1584
1584
|
}
|
|
1585
1585
|
class Ue {
|
|
1586
1586
|
constructor() {
|
|
1587
|
-
|
|
1587
|
+
c(this, "_scale");
|
|
1588
1588
|
}
|
|
1589
1589
|
domain() {
|
|
1590
1590
|
const t = this._scale.domain();
|
|
@@ -1620,12 +1620,12 @@ class Ue {
|
|
|
1620
1620
|
}
|
|
1621
1621
|
class Ze extends Ue {
|
|
1622
1622
|
constructor() {
|
|
1623
|
-
super(), this._scale =
|
|
1623
|
+
super(), this._scale = E.scaleTime();
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
1626
|
class mn extends Ue {
|
|
1627
1627
|
constructor() {
|
|
1628
|
-
super(), this._scale =
|
|
1628
|
+
super(), this._scale = E.scaleLinear();
|
|
1629
1629
|
}
|
|
1630
1630
|
}
|
|
1631
1631
|
const Re = { x: 0.2, y: 0.2 }, ze = 1e-3, pn = {
|
|
@@ -1640,18 +1640,18 @@ const Re = { x: 0.2, y: 0.2 }, ze = 1e-3, pn = {
|
|
|
1640
1640
|
return [parseInt(t[1]), t[2]];
|
|
1641
1641
|
}, bn = (s, t) => {
|
|
1642
1642
|
const [e, i] = t.domain().map((l) => l.getTime()), n = s.filter((l) => {
|
|
1643
|
-
const
|
|
1644
|
-
return
|
|
1645
|
-
}),
|
|
1646
|
-
if (
|
|
1647
|
-
return [
|
|
1643
|
+
const h = l.open_time.getTime();
|
|
1644
|
+
return h >= e && h <= i;
|
|
1645
|
+
}), a = E.min(n, (l) => l.low), r = E.max(n, (l) => l.high);
|
|
1646
|
+
if (a == null || r == null) throw new Error("Invalid Y data");
|
|
1647
|
+
return [a, r];
|
|
1648
1648
|
};
|
|
1649
1649
|
class yn {
|
|
1650
1650
|
constructor(t) {
|
|
1651
1651
|
this.model = t;
|
|
1652
1652
|
}
|
|
1653
1653
|
initX(t) {
|
|
1654
|
-
const e = this.model.candles.preparedData, i =
|
|
1654
|
+
const e = this.model.candles.preparedData, i = E.extent(e, (n) => new Date(n.open_time));
|
|
1655
1655
|
if (!i[0] || !i[1]) throw new Error("Invalid x data");
|
|
1656
1656
|
t.setDomain(i), this.setRange(t, this.model.layout.xAxis), this.setDefaultXDomain(t), this.applyOffset(t);
|
|
1657
1657
|
}
|
|
@@ -1662,17 +1662,17 @@ class yn {
|
|
|
1662
1662
|
init(t) {
|
|
1663
1663
|
this.initX(t.x), this.initY(t.y, t.x);
|
|
1664
1664
|
}
|
|
1665
|
-
setRange(t, { x: e, y: i, width: n, height:
|
|
1666
|
-
t instanceof Ze ? t.setRange([e, e + n]) : t.setRange([i +
|
|
1665
|
+
setRange(t, { x: e, y: i, width: n, height: a }) {
|
|
1666
|
+
t instanceof Ze ? t.setRange([e, e + n]) : t.setRange([i + a, i]);
|
|
1667
1667
|
}
|
|
1668
1668
|
setDefaultXDomain(t) {
|
|
1669
1669
|
const {
|
|
1670
1670
|
candles: { count: e },
|
|
1671
1671
|
layout: { area: i },
|
|
1672
1672
|
config: {
|
|
1673
|
-
candles: { baseWidth: n, bodyRatio:
|
|
1673
|
+
candles: { baseWidth: n, bodyRatio: a, direction: r }
|
|
1674
1674
|
}
|
|
1675
|
-
} = this.model, [l,
|
|
1675
|
+
} = this.model, [l, h] = t.domain().map((p) => p.getTime()), d = h - l, g = n / a * e, _ = d * (i.width / g), m = r === "left" ? [new Date(l), new Date(l + _)] : [new Date(h - _), new Date(h)];
|
|
1676
1676
|
t.setDomain(m);
|
|
1677
1677
|
}
|
|
1678
1678
|
applyOffset(t) {
|
|
@@ -1681,22 +1681,22 @@ class yn {
|
|
|
1681
1681
|
candles: { offset: e, direction: i }
|
|
1682
1682
|
},
|
|
1683
1683
|
layout: { xAxis: n }
|
|
1684
|
-
} = this.model, [
|
|
1685
|
-
t.setDomain([new Date(
|
|
1684
|
+
} = this.model, [a, r] = vn(e), l = r === "px" ? t.invert(n.x + a).getTime() - t.invert(n.x).getTime() : pn[r] * a, h = i === "left" ? -l : l, [d, g] = t.domain();
|
|
1685
|
+
t.setDomain([new Date(d.getTime() + h), new Date(g.getTime() + h)]);
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
1688
|
class xn {
|
|
1689
1689
|
constructor(t) {
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1690
|
+
c(this, "_model");
|
|
1691
|
+
c(this, "_scaleX");
|
|
1692
|
+
c(this, "_scaleY");
|
|
1693
|
+
c(this, "_initializer");
|
|
1694
|
+
c(this, "_baseDomain", {
|
|
1695
1695
|
x: [/* @__PURE__ */ new Date(), /* @__PURE__ */ new Date()],
|
|
1696
1696
|
y: [0, 0]
|
|
1697
1697
|
});
|
|
1698
|
-
|
|
1699
|
-
|
|
1698
|
+
c(this, "scaleFactor", { x: 1, y: 1 });
|
|
1699
|
+
c(this, "panOffset", { x: 0, y: 0 });
|
|
1700
1700
|
this._model = t, this._scaleX = new Ze(), this._scaleY = new mn(), this._initializer = new yn(t), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
|
|
1701
1701
|
x: this._scaleX.domain(),
|
|
1702
1702
|
y: this._scaleY.domain()
|
|
@@ -1729,12 +1729,12 @@ class xn {
|
|
|
1729
1729
|
fitYToVisibleCandles() {
|
|
1730
1730
|
const t = this._model.candles.allData, [e, i] = this._scaleX.domain(), n = t.filter((_) => _.open_time >= e && _.open_time <= i);
|
|
1731
1731
|
if (!n.length) return;
|
|
1732
|
-
const
|
|
1732
|
+
const a = Math.min(...n.map((_) => _.low)), r = Math.max(...n.map((_) => _.high)), l = r - a;
|
|
1733
1733
|
if (l === 0) return;
|
|
1734
|
-
const
|
|
1735
|
-
this.scale("y", (
|
|
1736
|
-
const
|
|
1737
|
-
this.pan("y", g -
|
|
1734
|
+
const h = this._baseDomain.y;
|
|
1735
|
+
this.scale("y", (h[1] - h[0]) / l, "absolute");
|
|
1736
|
+
const d = this._scaleY.convert((a + r) / 2), g = this._scaleY.convert((h[0] + h[1]) / 2);
|
|
1737
|
+
this.pan("y", g - d, "absolute");
|
|
1738
1738
|
}
|
|
1739
1739
|
scale(t, e, i = "delta") {
|
|
1740
1740
|
if (i === "absolute") {
|
|
@@ -1742,9 +1742,9 @@ class xn {
|
|
|
1742
1742
|
if (Math.abs(n - this.scaleFactor[t]) < ze) return;
|
|
1743
1743
|
this.scaleFactor[t] = n;
|
|
1744
1744
|
} else {
|
|
1745
|
-
const n = this.scaleFactor[t],
|
|
1746
|
-
if (
|
|
1747
|
-
this.scaleFactor[t] =
|
|
1745
|
+
const n = this.scaleFactor[t], a = n + e * this._model.config.candles.scaleSensitivity;
|
|
1746
|
+
if (a < Re[t] || Math.abs(a - n) < ze) return;
|
|
1747
|
+
this.scaleFactor[t] = a;
|
|
1748
1748
|
}
|
|
1749
1749
|
this._updateDomain(t);
|
|
1750
1750
|
}
|
|
@@ -1754,16 +1754,16 @@ class xn {
|
|
|
1754
1754
|
_updateDomain(t) {
|
|
1755
1755
|
const e = this._baseDomain[t], i = this.scaleFactor[t], n = this.panOffset[t];
|
|
1756
1756
|
if (t === "x") {
|
|
1757
|
-
const [
|
|
1757
|
+
const [a, r] = e, l = r.getTime() - a.getTime(), h = l / i, d = a.getTime() + l / 2, g = this._scaleX.invert(0 - n).getTime() - this._scaleX.invert(0).getTime();
|
|
1758
1758
|
this._scaleX.setDomain([
|
|
1759
|
-
new Date(
|
|
1760
|
-
new Date(
|
|
1759
|
+
new Date(d - h / 2 + g),
|
|
1760
|
+
new Date(d + h / 2 + g)
|
|
1761
1761
|
]);
|
|
1762
1762
|
} else {
|
|
1763
|
-
const [
|
|
1763
|
+
const [a, r] = e, l = r - a, h = l / i, d = a + l / 2, g = this._scaleY.invert(0 - n) - this._scaleY.invert(0);
|
|
1764
1764
|
this._scaleY.setDomain([
|
|
1765
|
-
|
|
1766
|
-
|
|
1765
|
+
d - h / 2 + g,
|
|
1766
|
+
d + h / 2 + g
|
|
1767
1767
|
]);
|
|
1768
1768
|
}
|
|
1769
1769
|
this._model.eventBus.emit("scale_event");
|
|
@@ -1771,14 +1771,14 @@ class xn {
|
|
|
1771
1771
|
}
|
|
1772
1772
|
class wn {
|
|
1773
1773
|
constructor(t, { entry: e = [], exit: i = [] }) {
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1774
|
+
c(this, "_model");
|
|
1775
|
+
c(this, "_rawEntry");
|
|
1776
|
+
c(this, "_rawExit");
|
|
1777
|
+
c(this, "_mapped", []);
|
|
1778
|
+
c(this, "_entries", []);
|
|
1779
|
+
c(this, "_exits", []);
|
|
1780
|
+
c(this, "_activeTradeTime", null);
|
|
1781
|
+
c(this, "_hoveredTradeTime", null);
|
|
1782
1782
|
this._model = t, this._rawEntry = e, this._rawExit = i, this.recalculate();
|
|
1783
1783
|
}
|
|
1784
1784
|
_findTradeCandle(t) {
|
|
@@ -1797,11 +1797,11 @@ class wn {
|
|
|
1797
1797
|
candle: this._model.candles.allData.find(this._findTradeCandle(new Date(n.time)))
|
|
1798
1798
|
})), i = [...t, ...e];
|
|
1799
1799
|
this._mapped = this._model.candles.allData.map((n) => {
|
|
1800
|
-
const
|
|
1801
|
-
(
|
|
1800
|
+
const a = i.filter(
|
|
1801
|
+
(r) => r.time >= n.open_time && r.time < n.close_time
|
|
1802
1802
|
);
|
|
1803
|
-
return { candle: n, trades:
|
|
1804
|
-
}).filter((n) => n.trades.length > 0), this._entries = t.sort((n,
|
|
1803
|
+
return { candle: n, trades: a };
|
|
1804
|
+
}).filter((n) => n.trades.length > 0), this._entries = t.sort((n, a) => n.time.getTime() - a.time.getTime()), this._exits = e.sort((n, a) => n.time.getTime() - a.time.getTime());
|
|
1805
1805
|
}
|
|
1806
1806
|
updateTrade({ entry: t, exit: e }) {
|
|
1807
1807
|
this._rawEntry = t, this._rawExit = e, this.recalculate();
|
|
@@ -1842,13 +1842,13 @@ class wn {
|
|
|
1842
1842
|
return ((t = this._exits.at(-1)) == null ? void 0 : t.time.getTime()) ?? 0;
|
|
1843
1843
|
}
|
|
1844
1844
|
get timeRange() {
|
|
1845
|
-
const { allData: t, interval: e } = this._model.candles, i = t.map((
|
|
1846
|
-
let n = 0,
|
|
1847
|
-
for (let
|
|
1848
|
-
const l = i[
|
|
1849
|
-
if (n === 0 &&
|
|
1845
|
+
const { allData: t, interval: e } = this._model.candles, i = t.map((r) => r.open_time.getTime());
|
|
1846
|
+
let n = 0, a = i.length - 1;
|
|
1847
|
+
for (let r = 0; r < i.length; r++) {
|
|
1848
|
+
const l = i[r], h = l <= this.entryMinTime && l + e >= this.entryMinTime, d = l <= this.exitMaxTime && l + e >= this.exitMaxTime;
|
|
1849
|
+
if (n === 0 && h && (n = r), a === i.length - 1 && d && (a = r), n !== 0 && a !== i.length - 1) break;
|
|
1850
1850
|
}
|
|
1851
|
-
return i.slice(n,
|
|
1851
|
+
return i.slice(n, a + 1);
|
|
1852
1852
|
}
|
|
1853
1853
|
get hasTrade() {
|
|
1854
1854
|
return this._rawEntry.length > 0 && this._rawExit.length > 0;
|
|
@@ -1859,10 +1859,10 @@ class wn {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
class Cn {
|
|
1861
1861
|
constructor(t, e) {
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1862
|
+
c(this, "_rawMarkers");
|
|
1863
|
+
c(this, "_markers", []);
|
|
1864
|
+
c(this, "_model");
|
|
1865
|
+
c(this, "_defaults", {
|
|
1866
1866
|
mainColor: "#000000",
|
|
1867
1867
|
textColor: "#ffffff",
|
|
1868
1868
|
lineColor: "#000000",
|
|
@@ -1877,20 +1877,20 @@ class Cn {
|
|
|
1877
1877
|
const {
|
|
1878
1878
|
layout: { area: t, chart: e },
|
|
1879
1879
|
config: i,
|
|
1880
|
-
scales: { x: n, y:
|
|
1880
|
+
scales: { x: n, y: a },
|
|
1881
1881
|
colorScheme: {
|
|
1882
|
-
userMarkers: { default:
|
|
1882
|
+
userMarkers: { default: r }
|
|
1883
1883
|
}
|
|
1884
1884
|
} = this._model;
|
|
1885
1885
|
this._markers = this._rawMarkers.map((l) => {
|
|
1886
1886
|
var g, _;
|
|
1887
|
-
const
|
|
1888
|
-
mainColor: l.mainColor ??
|
|
1889
|
-
textColor: l.textColor ??
|
|
1890
|
-
lineColor: l.lineColor ??
|
|
1887
|
+
const h = {
|
|
1888
|
+
mainColor: l.mainColor ?? r.main,
|
|
1889
|
+
textColor: l.textColor ?? r.text,
|
|
1890
|
+
lineColor: l.lineColor ?? r.line
|
|
1891
1891
|
};
|
|
1892
1892
|
if ((l.type ?? "horizontal") === "horizontal") {
|
|
1893
|
-
const m = l, p =
|
|
1893
|
+
const m = l, p = a.convert(m.value), b = (m.formatter ?? ((g = this._defaults.formatter) == null ? void 0 : g.horizontal) ?? ((x) => x.toString()))(m.value);
|
|
1894
1894
|
return {
|
|
1895
1895
|
value: m.value,
|
|
1896
1896
|
type: "horizontal",
|
|
@@ -1899,7 +1899,7 @@ class Cn {
|
|
|
1899
1899
|
y: p,
|
|
1900
1900
|
lineLength: e.width,
|
|
1901
1901
|
position: i.yAxis.position,
|
|
1902
|
-
...
|
|
1902
|
+
...h
|
|
1903
1903
|
};
|
|
1904
1904
|
} else {
|
|
1905
1905
|
const m = l, p = m.value instanceof Date ? m.value : new Date(m.value), v = n.convert(p), x = (m.formatter ?? ((_ = this._defaults.formatter) == null ? void 0 : _.vertical) ?? ((C) => C.toLocaleString()))(p);
|
|
@@ -1911,7 +1911,7 @@ class Cn {
|
|
|
1911
1911
|
y: t.y,
|
|
1912
1912
|
lineLength: e.height,
|
|
1913
1913
|
position: i.xAxis.position,
|
|
1914
|
-
...
|
|
1914
|
+
...h
|
|
1915
1915
|
};
|
|
1916
1916
|
}
|
|
1917
1917
|
});
|
|
@@ -1925,17 +1925,17 @@ class Cn {
|
|
|
1925
1925
|
}
|
|
1926
1926
|
class Mn {
|
|
1927
1927
|
constructor() {
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1928
|
+
c(this, "bg", "#FFFFFF");
|
|
1929
|
+
c(this, "axisIntersection", "#FFFFFF");
|
|
1930
|
+
c(this, "xAxis", {
|
|
1931
1931
|
bg: "#FFFFFF",
|
|
1932
1932
|
text: "#7F7F83"
|
|
1933
1933
|
});
|
|
1934
|
-
|
|
1934
|
+
c(this, "yAxis", {
|
|
1935
1935
|
bg: "#FFFFFF",
|
|
1936
1936
|
text: "#7F7F83"
|
|
1937
1937
|
});
|
|
1938
|
-
|
|
1938
|
+
c(this, "candles", {
|
|
1939
1939
|
risingFill: "#56B683",
|
|
1940
1940
|
risingStroke: "#000000",
|
|
1941
1941
|
fallingFill: "#F18169",
|
|
@@ -1943,7 +1943,7 @@ class Mn {
|
|
|
1943
1943
|
noDataFill: ["#d9d9da", "#ededed"],
|
|
1944
1944
|
noDataStroke: "#000000"
|
|
1945
1945
|
});
|
|
1946
|
-
|
|
1946
|
+
c(this, "guides", {
|
|
1947
1947
|
horizontalMarker: {
|
|
1948
1948
|
main: "#1C2026",
|
|
1949
1949
|
text: "#ffffff",
|
|
@@ -1955,9 +1955,9 @@ class Mn {
|
|
|
1955
1955
|
line: "#1C2026"
|
|
1956
1956
|
}
|
|
1957
1957
|
});
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1958
|
+
c(this, "trade");
|
|
1959
|
+
c(this, "userMarkers");
|
|
1960
|
+
c(this, "comments", {
|
|
1961
1961
|
scaleAnchor: {
|
|
1962
1962
|
bgActive: "#007AFF",
|
|
1963
1963
|
bgInactive: "#A1BBFF",
|
|
@@ -2006,15 +2006,15 @@ class Mn {
|
|
|
2006
2006
|
const An = new Mn().toObject();
|
|
2007
2007
|
class Tn {
|
|
2008
2008
|
constructor(t) {
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2009
|
+
c(this, "_bg");
|
|
2010
|
+
c(this, "_candles");
|
|
2011
|
+
c(this, "_xAxis");
|
|
2012
|
+
c(this, "_yAxis");
|
|
2013
|
+
c(this, "_guides");
|
|
2014
|
+
c(this, "_axisIntersection");
|
|
2015
|
+
c(this, "_trade");
|
|
2016
|
+
c(this, "_userMarkers");
|
|
2017
|
+
c(this, "_comments");
|
|
2018
2018
|
const e = Tt({}, An, t);
|
|
2019
2019
|
this._candles = e.candles, this._bg = e.bg, this._xAxis = e.xAxis, this._yAxis = e.yAxis, this._guides = e.guides, this._axisIntersection = e.axisIntersection, this._trade = e.trade, this._userMarkers = e.userMarkers, this._comments = e.comments;
|
|
2020
2020
|
}
|
|
@@ -2066,8 +2066,8 @@ class Tn {
|
|
|
2066
2066
|
}
|
|
2067
2067
|
class Sn {
|
|
2068
2068
|
constructor(t, e) {
|
|
2069
|
-
|
|
2070
|
-
|
|
2069
|
+
c(this, "_data");
|
|
2070
|
+
c(this, "_callbacks", {
|
|
2071
2071
|
onAdd: () => {
|
|
2072
2072
|
},
|
|
2073
2073
|
onUpdate: () => {
|
|
@@ -2075,8 +2075,8 @@ class Sn {
|
|
|
2075
2075
|
onDelete: () => {
|
|
2076
2076
|
}
|
|
2077
2077
|
});
|
|
2078
|
-
|
|
2079
|
-
|
|
2078
|
+
c(this, "_model");
|
|
2079
|
+
c(this, "_grouped", {});
|
|
2080
2080
|
this._data = (t == null ? void 0 : t.data) || [], this._model = e, this._updateGroups(), t != null && t.onAdd && (this._callbacks.onAdd = t.onAdd), t != null && t.onUpdate && (this._callbacks.onUpdate = t.onUpdate), t != null && t.onDelete && (this._callbacks.onDelete = t.onDelete);
|
|
2081
2081
|
}
|
|
2082
2082
|
_updateGroups() {
|
|
@@ -2113,23 +2113,23 @@ class kn {
|
|
|
2113
2113
|
container: e,
|
|
2114
2114
|
candles: i,
|
|
2115
2115
|
config: n,
|
|
2116
|
-
trade:
|
|
2117
|
-
userMarkers:
|
|
2116
|
+
trade: a = { entry: [], exit: [] },
|
|
2117
|
+
userMarkers: r = [],
|
|
2118
2118
|
colorScheme: l,
|
|
2119
|
-
comments:
|
|
2119
|
+
comments: h
|
|
2120
2120
|
}) {
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
this._chartId = t, this._container = e, this._candles = new se(i, this), this._config = new dn(n), this._colorScheme = new Tn(l), this._layout = new un(e, this._config), this._scaleManager = new xn(this), this._trade = new wn(this,
|
|
2121
|
+
c(this, "_chartId");
|
|
2122
|
+
c(this, "_container");
|
|
2123
|
+
c(this, "_eventBus", new fn());
|
|
2124
|
+
c(this, "_candles");
|
|
2125
|
+
c(this, "_config");
|
|
2126
|
+
c(this, "_colorScheme");
|
|
2127
|
+
c(this, "_layout");
|
|
2128
|
+
c(this, "_scaleManager");
|
|
2129
|
+
c(this, "_trade");
|
|
2130
|
+
c(this, "_userMarkers");
|
|
2131
|
+
c(this, "_comments");
|
|
2132
|
+
this._chartId = t, this._container = e, this._candles = new se(i, this), this._config = new dn(n), this._colorScheme = new Tn(l), this._layout = new un(e, this._config), this._scaleManager = new xn(this), this._trade = new wn(this, a), this._candles.updateMissingCandles(), this._trade.recalculate(), this._userMarkers = new Cn(this, r), this._comments = new Sn(h, this);
|
|
2133
2133
|
}
|
|
2134
2134
|
init() {
|
|
2135
2135
|
this._eventBus.emit("init_model");
|
|
@@ -2195,15 +2195,15 @@ class kn {
|
|
|
2195
2195
|
const Mt = window.devicePixelRatio || 2;
|
|
2196
2196
|
class S {
|
|
2197
2197
|
constructor({ tag: t, className: e, id: i, textContent: n }) {
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2198
|
+
c(this, "_tag");
|
|
2199
|
+
c(this, "_className");
|
|
2200
|
+
c(this, "_id");
|
|
2201
|
+
c(this, "_textContent");
|
|
2202
|
+
c(this, "_node");
|
|
2203
|
+
c(this, "_absolutePosition", new DOMRect());
|
|
2204
2204
|
this._tag = t || "div", this._className = e || "", this._id = i || "", this._textContent = n || "";
|
|
2205
|
-
const
|
|
2206
|
-
this._className && (
|
|
2205
|
+
const a = document.createElement(this._tag);
|
|
2206
|
+
this._className && (a.className = this._className), this._id && (a.id = this._id), this._textContent && (a.textContent = this._textContent), this._node = a;
|
|
2207
2207
|
}
|
|
2208
2208
|
get node() {
|
|
2209
2209
|
return this._node;
|
|
@@ -2232,17 +2232,17 @@ class S {
|
|
|
2232
2232
|
}
|
|
2233
2233
|
}
|
|
2234
2234
|
class St extends S {
|
|
2235
|
-
constructor({ className: e, id: i, width: n, height:
|
|
2235
|
+
constructor({ className: e, id: i, width: n, height: a, isMain: r }) {
|
|
2236
2236
|
super({
|
|
2237
2237
|
tag: "canvas",
|
|
2238
|
-
className: `${e} sc-charts-cs__canvas ${
|
|
2238
|
+
className: `${e} sc-charts-cs__canvas ${r ? "" : "sc-charts-cs__canvas-additional"}`,
|
|
2239
2239
|
id: i
|
|
2240
2240
|
});
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
this._width = n, this._height =
|
|
2241
|
+
c(this, "_ctx");
|
|
2242
|
+
c(this, "_width");
|
|
2243
|
+
c(this, "_height");
|
|
2244
|
+
c(this, "background", null);
|
|
2245
|
+
this._width = n, this._height = a, this.updateSize({ width: n, height: a });
|
|
2246
2246
|
const l = this._node.getContext("2d");
|
|
2247
2247
|
if (!l) throw new Error("Failed to get 2D context");
|
|
2248
2248
|
l.scale(Mt, Mt), this._ctx = l;
|
|
@@ -2304,8 +2304,8 @@ A.prototype = {
|
|
|
2304
2304
|
return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3;
|
|
2305
2305
|
},
|
|
2306
2306
|
getLuminance: function() {
|
|
2307
|
-
var t = this.toRgb(), e, i, n,
|
|
2308
|
-
return e = t.r / 255, i = t.g / 255, n = t.b / 255, e <= 0.03928 ?
|
|
2307
|
+
var t = this.toRgb(), e, i, n, a, r, l;
|
|
2308
|
+
return e = t.r / 255, i = t.g / 255, n = t.b / 255, e <= 0.03928 ? a = e / 12.92 : a = Math.pow((e + 0.055) / 1.055, 2.4), i <= 0.03928 ? r = i / 12.92 : r = Math.pow((i + 0.055) / 1.055, 2.4), n <= 0.03928 ? l = n / 12.92 : l = Math.pow((n + 0.055) / 1.055, 2.4), 0.2126 * a + 0.7152 * r + 0.0722 * l;
|
|
2309
2309
|
},
|
|
2310
2310
|
setAlpha: function(t) {
|
|
2311
2311
|
return this._a = qe(t), this._roundA = Math.round(100 * this._a) / 100, this;
|
|
@@ -2376,16 +2376,16 @@ A.prototype = {
|
|
|
2376
2376
|
toFilter: function(t) {
|
|
2377
2377
|
var e = "#" + Ye(this._r, this._g, this._b, this._a), i = e, n = this._gradientType ? "GradientType = 1, " : "";
|
|
2378
2378
|
if (t) {
|
|
2379
|
-
var
|
|
2380
|
-
i = "#" + Ye(
|
|
2379
|
+
var a = A(t);
|
|
2380
|
+
i = "#" + Ye(a._r, a._g, a._b, a._a);
|
|
2381
2381
|
}
|
|
2382
2382
|
return "progid:DXImageTransform.Microsoft.gradient(" + n + "startColorstr=" + e + ",endColorstr=" + i + ")";
|
|
2383
2383
|
},
|
|
2384
2384
|
toString: function(t) {
|
|
2385
2385
|
var e = !!t;
|
|
2386
2386
|
t = t || this._format;
|
|
2387
|
-
var i = !1, n = this._a < 1 && this._a >= 0,
|
|
2388
|
-
return
|
|
2387
|
+
var i = !1, n = this._a < 1 && this._a >= 0, a = !e && n && (t === "hex" || t === "hex6" || t === "hex3" || t === "hex4" || t === "hex8" || t === "name");
|
|
2388
|
+
return a ? t === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (t === "rgb" && (i = this.toRgbString()), t === "prgb" && (i = this.toPercentageRgbString()), (t === "hex" || t === "hex6") && (i = this.toHexString()), t === "hex3" && (i = this.toHexString(!0)), t === "hex4" && (i = this.toHex8String(!0)), t === "hex8" && (i = this.toHex8String()), t === "name" && (i = this.toName()), t === "hsl" && (i = this.toHslString()), t === "hsv" && (i = this.toHsvString()), i || this.toHexString());
|
|
2389
2389
|
},
|
|
2390
2390
|
clone: function() {
|
|
2391
2391
|
return A(this.toString());
|
|
@@ -2455,9 +2455,9 @@ function Ln(s) {
|
|
|
2455
2455
|
r: 0,
|
|
2456
2456
|
g: 0,
|
|
2457
2457
|
b: 0
|
|
2458
|
-
}, e = 1, i = null, n = null,
|
|
2459
|
-
return typeof s == "string" && (s = Jn(s)), kt(s) == "object" && (U(s.r) && U(s.g) && U(s.b) ? (t = Nn(s.r, s.g, s.b),
|
|
2460
|
-
ok:
|
|
2458
|
+
}, e = 1, i = null, n = null, a = null, r = !1, l = !1;
|
|
2459
|
+
return typeof s == "string" && (s = Jn(s)), kt(s) == "object" && (U(s.r) && U(s.g) && U(s.b) ? (t = Nn(s.r, s.g, s.b), r = !0, l = String(s.r).substr(-1) === "%" ? "prgb" : "rgb") : U(s.h) && U(s.s) && U(s.v) ? (i = ut(s.s), n = ut(s.v), t = Fn(s.h, i, n), r = !0, l = "hsv") : U(s.h) && U(s.s) && U(s.l) && (i = ut(s.s), a = ut(s.l), t = In(s.h, i, a), r = !0, l = "hsl"), s.hasOwnProperty("a") && (e = s.a)), e = qe(e), {
|
|
2460
|
+
ok: r,
|
|
2461
2461
|
format: s.format || l,
|
|
2462
2462
|
r: Math.min(255, Math.max(t.r, 0)),
|
|
2463
2463
|
g: Math.min(255, Math.max(t.g, 0)),
|
|
@@ -2474,78 +2474,78 @@ function Nn(s, t, e) {
|
|
|
2474
2474
|
}
|
|
2475
2475
|
function $e(s, t, e) {
|
|
2476
2476
|
s = R(s, 255), t = R(t, 255), e = R(e, 255);
|
|
2477
|
-
var i = Math.max(s, t, e), n = Math.min(s, t, e),
|
|
2477
|
+
var i = Math.max(s, t, e), n = Math.min(s, t, e), a, r, l = (i + n) / 2;
|
|
2478
2478
|
if (i == n)
|
|
2479
|
-
|
|
2479
|
+
a = r = 0;
|
|
2480
2480
|
else {
|
|
2481
|
-
var
|
|
2482
|
-
switch (
|
|
2481
|
+
var h = i - n;
|
|
2482
|
+
switch (r = l > 0.5 ? h / (2 - i - n) : h / (i + n), i) {
|
|
2483
2483
|
case s:
|
|
2484
|
-
|
|
2484
|
+
a = (t - e) / h + (t < e ? 6 : 0);
|
|
2485
2485
|
break;
|
|
2486
2486
|
case t:
|
|
2487
|
-
|
|
2487
|
+
a = (e - s) / h + 2;
|
|
2488
2488
|
break;
|
|
2489
2489
|
case e:
|
|
2490
|
-
|
|
2490
|
+
a = (s - t) / h + 4;
|
|
2491
2491
|
break;
|
|
2492
2492
|
}
|
|
2493
|
-
|
|
2493
|
+
a /= 6;
|
|
2494
2494
|
}
|
|
2495
2495
|
return {
|
|
2496
|
-
h:
|
|
2497
|
-
s:
|
|
2496
|
+
h: a,
|
|
2497
|
+
s: r,
|
|
2498
2498
|
l
|
|
2499
2499
|
};
|
|
2500
2500
|
}
|
|
2501
2501
|
function In(s, t, e) {
|
|
2502
|
-
var i, n,
|
|
2502
|
+
var i, n, a;
|
|
2503
2503
|
s = R(s, 360), t = R(t, 100), e = R(e, 100);
|
|
2504
|
-
function
|
|
2505
|
-
return _ < 0 && (_ += 1), _ > 1 && (_ -= 1), _ < 1 / 6 ?
|
|
2504
|
+
function r(d, g, _) {
|
|
2505
|
+
return _ < 0 && (_ += 1), _ > 1 && (_ -= 1), _ < 1 / 6 ? d + (g - d) * 6 * _ : _ < 1 / 2 ? g : _ < 2 / 3 ? d + (g - d) * (2 / 3 - _) * 6 : d;
|
|
2506
2506
|
}
|
|
2507
2507
|
if (t === 0)
|
|
2508
|
-
i = n =
|
|
2508
|
+
i = n = a = e;
|
|
2509
2509
|
else {
|
|
2510
|
-
var l = e < 0.5 ? e * (1 + t) : e + t - e * t,
|
|
2511
|
-
i =
|
|
2510
|
+
var l = e < 0.5 ? e * (1 + t) : e + t - e * t, h = 2 * e - l;
|
|
2511
|
+
i = r(h, l, s + 1 / 3), n = r(h, l, s), a = r(h, l, s - 1 / 3);
|
|
2512
2512
|
}
|
|
2513
2513
|
return {
|
|
2514
2514
|
r: i * 255,
|
|
2515
2515
|
g: n * 255,
|
|
2516
|
-
b:
|
|
2516
|
+
b: a * 255
|
|
2517
2517
|
};
|
|
2518
2518
|
}
|
|
2519
2519
|
function Pe(s, t, e) {
|
|
2520
2520
|
s = R(s, 255), t = R(t, 255), e = R(e, 255);
|
|
2521
|
-
var i = Math.max(s, t, e), n = Math.min(s, t, e),
|
|
2522
|
-
if (
|
|
2523
|
-
|
|
2521
|
+
var i = Math.max(s, t, e), n = Math.min(s, t, e), a, r, l = i, h = i - n;
|
|
2522
|
+
if (r = i === 0 ? 0 : h / i, i == n)
|
|
2523
|
+
a = 0;
|
|
2524
2524
|
else {
|
|
2525
2525
|
switch (i) {
|
|
2526
2526
|
case s:
|
|
2527
|
-
|
|
2527
|
+
a = (t - e) / h + (t < e ? 6 : 0);
|
|
2528
2528
|
break;
|
|
2529
2529
|
case t:
|
|
2530
|
-
|
|
2530
|
+
a = (e - s) / h + 2;
|
|
2531
2531
|
break;
|
|
2532
2532
|
case e:
|
|
2533
|
-
|
|
2533
|
+
a = (s - t) / h + 4;
|
|
2534
2534
|
break;
|
|
2535
2535
|
}
|
|
2536
|
-
|
|
2536
|
+
a /= 6;
|
|
2537
2537
|
}
|
|
2538
2538
|
return {
|
|
2539
|
-
h:
|
|
2540
|
-
s:
|
|
2539
|
+
h: a,
|
|
2540
|
+
s: r,
|
|
2541
2541
|
v: l
|
|
2542
2542
|
};
|
|
2543
2543
|
}
|
|
2544
2544
|
function Fn(s, t, e) {
|
|
2545
2545
|
s = R(s, 360) * 6, t = R(t, 100), e = R(e, 100);
|
|
2546
|
-
var i = Math.floor(s), n = s - i,
|
|
2546
|
+
var i = Math.floor(s), n = s - i, a = e * (1 - t), r = e * (1 - n * t), l = e * (1 - (1 - n) * t), h = i % 6, d = [e, r, a, a, l, e][h], g = [l, e, e, r, a, a][h], _ = [a, a, l, e, e, r][h];
|
|
2547
2547
|
return {
|
|
2548
|
-
r:
|
|
2548
|
+
r: d * 255,
|
|
2549
2549
|
g: g * 255,
|
|
2550
2550
|
b: _ * 255
|
|
2551
2551
|
};
|
|
@@ -2555,8 +2555,8 @@ function Oe(s, t, e, i) {
|
|
|
2555
2555
|
return i && n[0].charAt(0) == n[0].charAt(1) && n[1].charAt(0) == n[1].charAt(1) && n[2].charAt(0) == n[2].charAt(1) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) : n.join("");
|
|
2556
2556
|
}
|
|
2557
2557
|
function Bn(s, t, e, i, n) {
|
|
2558
|
-
var
|
|
2559
|
-
return n &&
|
|
2558
|
+
var a = [V(Math.round(s).toString(16)), V(Math.round(t).toString(16)), V(Math.round(e).toString(16)), V(Je(i))];
|
|
2559
|
+
return n && a[0].charAt(0) == a[0].charAt(1) && a[1].charAt(0) == a[1].charAt(1) && a[2].charAt(0) == a[2].charAt(1) && a[3].charAt(0) == a[3].charAt(1) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) + a[3].charAt(0) : a.join("");
|
|
2560
2560
|
}
|
|
2561
2561
|
function Ye(s, t, e, i) {
|
|
2562
2562
|
var n = [V(Je(i)), V(Math.round(s).toString(16)), V(Math.round(t).toString(16)), V(Math.round(e).toString(16))];
|
|
@@ -2611,9 +2611,9 @@ function jn(s) {
|
|
|
2611
2611
|
function je(s, t) {
|
|
2612
2612
|
if (isNaN(t) || t <= 0)
|
|
2613
2613
|
throw new Error("Argument to polyad must be a positive number");
|
|
2614
|
-
for (var e = A(s).toHsl(), i = [A(s)], n = 360 / t,
|
|
2614
|
+
for (var e = A(s).toHsl(), i = [A(s)], n = 360 / t, a = 1; a < t; a++)
|
|
2615
2615
|
i.push(A({
|
|
2616
|
-
h: (e.h +
|
|
2616
|
+
h: (e.h + a * n) % 360,
|
|
2617
2617
|
s: e.s,
|
|
2618
2618
|
l: e.l
|
|
2619
2619
|
}));
|
|
@@ -2633,60 +2633,60 @@ function Xn(s) {
|
|
|
2633
2633
|
}
|
|
2634
2634
|
function Wn(s, t, e) {
|
|
2635
2635
|
t = t || 6, e = e || 30;
|
|
2636
|
-
var i = A(s).toHsl(), n = 360 / e,
|
|
2636
|
+
var i = A(s).toHsl(), n = 360 / e, a = [A(s)];
|
|
2637
2637
|
for (i.h = (i.h - (n * t >> 1) + 720) % 360; --t; )
|
|
2638
|
-
i.h = (i.h + n) % 360,
|
|
2639
|
-
return
|
|
2638
|
+
i.h = (i.h + n) % 360, a.push(A(i));
|
|
2639
|
+
return a;
|
|
2640
2640
|
}
|
|
2641
2641
|
function Vn(s, t) {
|
|
2642
2642
|
t = t || 6;
|
|
2643
|
-
for (var e = A(s).toHsv(), i = e.h, n = e.s,
|
|
2644
|
-
|
|
2643
|
+
for (var e = A(s).toHsv(), i = e.h, n = e.s, a = e.v, r = [], l = 1 / t; t--; )
|
|
2644
|
+
r.push(A({
|
|
2645
2645
|
h: i,
|
|
2646
2646
|
s: n,
|
|
2647
|
-
v:
|
|
2648
|
-
})),
|
|
2649
|
-
return
|
|
2647
|
+
v: a
|
|
2648
|
+
})), a = (a + l) % 1;
|
|
2649
|
+
return r;
|
|
2650
2650
|
}
|
|
2651
2651
|
A.mix = function(s, t, e) {
|
|
2652
2652
|
e = e === 0 ? 0 : e || 50;
|
|
2653
|
-
var i = A(s).toRgb(), n = A(t).toRgb(),
|
|
2654
|
-
r: (n.r - i.r) *
|
|
2655
|
-
g: (n.g - i.g) *
|
|
2656
|
-
b: (n.b - i.b) *
|
|
2657
|
-
a: (n.a - i.a) *
|
|
2653
|
+
var i = A(s).toRgb(), n = A(t).toRgb(), a = e / 100, r = {
|
|
2654
|
+
r: (n.r - i.r) * a + i.r,
|
|
2655
|
+
g: (n.g - i.g) * a + i.g,
|
|
2656
|
+
b: (n.b - i.b) * a + i.b,
|
|
2657
|
+
a: (n.a - i.a) * a + i.a
|
|
2658
2658
|
};
|
|
2659
|
-
return A(
|
|
2659
|
+
return A(r);
|
|
2660
2660
|
};
|
|
2661
2661
|
A.readability = function(s, t) {
|
|
2662
2662
|
var e = A(s), i = A(t);
|
|
2663
2663
|
return (Math.max(e.getLuminance(), i.getLuminance()) + 0.05) / (Math.min(e.getLuminance(), i.getLuminance()) + 0.05);
|
|
2664
2664
|
};
|
|
2665
2665
|
A.isReadable = function(s, t, e) {
|
|
2666
|
-
var i = A.readability(s, t), n,
|
|
2667
|
-
switch (
|
|
2666
|
+
var i = A.readability(s, t), n, a;
|
|
2667
|
+
switch (a = !1, n = Qn(e), n.level + n.size) {
|
|
2668
2668
|
case "AAsmall":
|
|
2669
2669
|
case "AAAlarge":
|
|
2670
|
-
|
|
2670
|
+
a = i >= 4.5;
|
|
2671
2671
|
break;
|
|
2672
2672
|
case "AAlarge":
|
|
2673
|
-
|
|
2673
|
+
a = i >= 3;
|
|
2674
2674
|
break;
|
|
2675
2675
|
case "AAAsmall":
|
|
2676
|
-
|
|
2676
|
+
a = i >= 7;
|
|
2677
2677
|
break;
|
|
2678
2678
|
}
|
|
2679
|
-
return
|
|
2679
|
+
return a;
|
|
2680
2680
|
};
|
|
2681
2681
|
A.mostReadable = function(s, t, e) {
|
|
2682
|
-
var i = null, n = 0,
|
|
2683
|
-
e = e || {},
|
|
2684
|
-
for (var
|
|
2685
|
-
|
|
2682
|
+
var i = null, n = 0, a, r, l, h;
|
|
2683
|
+
e = e || {}, r = e.includeFallbackColors, l = e.level, h = e.size;
|
|
2684
|
+
for (var d = 0; d < t.length; d++)
|
|
2685
|
+
a = A.readability(s, t[d]), a > n && (n = a, i = A(t[d]));
|
|
2686
2686
|
return A.isReadable(s, i, {
|
|
2687
2687
|
level: l,
|
|
2688
|
-
size:
|
|
2689
|
-
}) || !
|
|
2688
|
+
size: h
|
|
2689
|
+
}) || !r ? i : (e.includeFallbackColors = !1, A.mostReadable(s, ["#fff", "#000"], e));
|
|
2690
2690
|
};
|
|
2691
2691
|
var ee = A.names = {
|
|
2692
2692
|
aliceblue: "f0f8ff",
|
|
@@ -2971,79 +2971,79 @@ function Qn(s) {
|
|
|
2971
2971
|
size: e
|
|
2972
2972
|
};
|
|
2973
2973
|
}
|
|
2974
|
-
function Qe(s, t, e, { fillColor: i, strokeColor: n, candleWidth:
|
|
2975
|
-
const
|
|
2976
|
-
s.fillStyle = b(i), s.strokeStyle = b(n), s.lineWidth =
|
|
2977
|
-
const x = Math.min(_, m), C = Math.abs(m - _), w = g -
|
|
2978
|
-
s.fillRect(w, x,
|
|
2974
|
+
function Qe(s, t, e, { fillColor: i, strokeColor: n, candleWidth: a, strokeWidth: r }, l) {
|
|
2975
|
+
const h = (y) => e.scales.x.convert(y), d = (y) => e.scales.y.convert(y), g = h(t.open_time), _ = d(t.open), m = d(t.close), p = e.trade.timeRange.includes(t.open_time.getTime()), v = e.trade.timeRange.length && !p, b = (y) => v ? A.mix(y, l).toString() : y;
|
|
2976
|
+
s.fillStyle = b(i), s.strokeStyle = b(n), s.lineWidth = r, s.beginPath(), s.moveTo(g, d(t.high)), s.lineTo(g, d(t.low)), s.stroke();
|
|
2977
|
+
const x = Math.min(_, m), C = Math.abs(m - _), w = g - a / 2;
|
|
2978
|
+
s.fillRect(w, x, a, C), s.strokeRect(w, x, a, C);
|
|
2979
2979
|
}
|
|
2980
2980
|
function Kn(s, t) {
|
|
2981
|
-
const { strokeWidth: e, style: i } = t.config.candles, { candles: n, bg:
|
|
2982
|
-
t.candles.missingData.forEach((l,
|
|
2983
|
-
const
|
|
2981
|
+
const { strokeWidth: e, style: i } = t.config.candles, { candles: n, bg: a } = t.colorScheme, r = t.config.candles.baseWidth * t.scales.factorX;
|
|
2982
|
+
t.candles.missingData.forEach((l, h) => {
|
|
2983
|
+
const d = n.noDataFill[h % n.noDataFill.length], g = i === "filled" ? d : n.noDataStroke;
|
|
2984
2984
|
Qe(
|
|
2985
2985
|
s,
|
|
2986
2986
|
l,
|
|
2987
2987
|
t,
|
|
2988
2988
|
{
|
|
2989
|
-
fillColor:
|
|
2989
|
+
fillColor: d,
|
|
2990
2990
|
strokeColor: g,
|
|
2991
|
-
candleWidth:
|
|
2991
|
+
candleWidth: r,
|
|
2992
2992
|
strokeWidth: e
|
|
2993
2993
|
},
|
|
2994
|
-
|
|
2994
|
+
a
|
|
2995
2995
|
);
|
|
2996
2996
|
});
|
|
2997
2997
|
}
|
|
2998
|
-
function
|
|
2999
|
-
const { strokeWidth: e, style: i } = t.config.candles, n = t.config.candles.baseWidth * t.scales.factorX, { candles:
|
|
3000
|
-
t.candles.preparedData.
|
|
3001
|
-
const
|
|
2998
|
+
function ta(s, t) {
|
|
2999
|
+
const { strokeWidth: e, style: i } = t.config.candles, n = t.config.candles.baseWidth * t.scales.factorX, { candles: a, bg: r } = t.colorScheme, [l, h] = t.scales.x.domain();
|
|
3000
|
+
t.candles.preparedData.filter((_) => _.open_time >= l && _.open_time <= h).forEach((_) => {
|
|
3001
|
+
const m = _.close >= _.open ? "up" : "down", p = m === "up" ? a.risingFill : a.fallingFill, v = m === "up" ? a.risingStroke : a.fallingStroke;
|
|
3002
3002
|
Qe(
|
|
3003
3003
|
s,
|
|
3004
|
-
|
|
3004
|
+
_,
|
|
3005
3005
|
t,
|
|
3006
3006
|
{
|
|
3007
|
-
fillColor:
|
|
3008
|
-
strokeColor: i === "filled" ?
|
|
3007
|
+
fillColor: p,
|
|
3008
|
+
strokeColor: i === "filled" ? p : v,
|
|
3009
3009
|
candleWidth: n,
|
|
3010
3010
|
strokeWidth: e
|
|
3011
3011
|
},
|
|
3012
|
-
|
|
3012
|
+
r
|
|
3013
3013
|
);
|
|
3014
3014
|
});
|
|
3015
3015
|
}
|
|
3016
|
-
class
|
|
3016
|
+
class ea {
|
|
3017
3017
|
static renderAll(t, e) {
|
|
3018
|
-
Kn(t, e),
|
|
3018
|
+
Kn(t, e), ta(t, e);
|
|
3019
3019
|
}
|
|
3020
3020
|
}
|
|
3021
|
-
const
|
|
3022
|
-
function
|
|
3021
|
+
const sa = 10;
|
|
3022
|
+
function ia(s, t) {
|
|
3023
3023
|
const {
|
|
3024
3024
|
layout: { xAxis: e },
|
|
3025
3025
|
colorScheme: { xAxis: i },
|
|
3026
3026
|
config: { xAxis: n },
|
|
3027
|
-
scales:
|
|
3028
|
-
} = t,
|
|
3029
|
-
s.save(), s.fillStyle = i.bg, s.fillRect(e.x, e.y, e.width, e.height), s.restore(), s.fillStyle = i.text, s.font = `${n.text.fontSize} ${n.text.font}`, s.textAlign = "center", s.textBaseline = "middle",
|
|
3030
|
-
const
|
|
3031
|
-
s.fillText(
|
|
3027
|
+
scales: a
|
|
3028
|
+
} = t, r = a.x.ticks(sa), l = (g) => g.getHours() === 0 && g.getMinutes() === 0, h = E.timeFormat("%d %b"), d = E.timeFormat("%H:%M");
|
|
3029
|
+
s.save(), s.fillStyle = i.bg, s.fillRect(e.x, e.y, e.width, e.height), s.restore(), s.fillStyle = i.text, s.font = `${n.text.fontSize} ${n.text.font}`, s.textAlign = "center", s.textBaseline = "middle", r.forEach((g) => {
|
|
3030
|
+
const _ = a.x.convert(g), m = l(g) ? h(g) : d(g);
|
|
3031
|
+
s.fillText(m, _, e.y + e.height / 2);
|
|
3032
3032
|
});
|
|
3033
3033
|
}
|
|
3034
|
-
function
|
|
3034
|
+
function na(s, t) {
|
|
3035
3035
|
const {
|
|
3036
3036
|
layout: { yAxis: e },
|
|
3037
3037
|
colorScheme: { yAxis: i },
|
|
3038
3038
|
config: { yAxis: n },
|
|
3039
|
-
scales:
|
|
3040
|
-
} = t,
|
|
3041
|
-
s.save(), s.fillStyle = i.bg, s.fillRect(e.x, e.y, e.width, e.height), s.restore(), s.fillStyle = i.text, s.font = `${n.text.fontSize} ${n.text.font}`, s.textAlign = "center", s.textBaseline = "middle",
|
|
3042
|
-
const
|
|
3043
|
-
s.fillText(g, e.x + e.width / 2,
|
|
3039
|
+
scales: a
|
|
3040
|
+
} = t, r = a.y.ticks(6), l = a.y.tickFormat(6);
|
|
3041
|
+
s.save(), s.fillStyle = i.bg, s.fillRect(e.x, e.y, e.width, e.height), s.restore(), s.fillStyle = i.text, s.font = `${n.text.fontSize} ${n.text.font}`, s.textAlign = "center", s.textBaseline = "middle", r.forEach((h) => {
|
|
3042
|
+
const d = a.y.convert(h), g = l(h);
|
|
3043
|
+
s.fillText(g, e.x + e.width / 2, d);
|
|
3044
3044
|
});
|
|
3045
3045
|
}
|
|
3046
|
-
const
|
|
3046
|
+
const aa = (s, t) => {
|
|
3047
3047
|
const {
|
|
3048
3048
|
layout: { axisIntersection: e },
|
|
3049
3049
|
colorScheme: i
|
|
@@ -3057,18 +3057,18 @@ const rr = (s, t) => {
|
|
|
3057
3057
|
};
|
|
3058
3058
|
class qt {
|
|
3059
3059
|
static xAxis(t, e) {
|
|
3060
|
-
|
|
3060
|
+
ia(t, e);
|
|
3061
3061
|
}
|
|
3062
3062
|
static yAxis(t, e) {
|
|
3063
|
-
|
|
3063
|
+
na(t, e);
|
|
3064
3064
|
}
|
|
3065
3065
|
static intersection(t, e) {
|
|
3066
|
-
|
|
3066
|
+
aa(t, e);
|
|
3067
3067
|
}
|
|
3068
3068
|
}
|
|
3069
|
-
class
|
|
3069
|
+
class ra {
|
|
3070
3070
|
constructor(t) {
|
|
3071
|
-
|
|
3071
|
+
c(this, "_target");
|
|
3072
3072
|
this._target = t;
|
|
3073
3073
|
}
|
|
3074
3074
|
mousemove(t) {
|
|
@@ -3094,46 +3094,46 @@ class ar {
|
|
|
3094
3094
|
}
|
|
3095
3095
|
}
|
|
3096
3096
|
class W {
|
|
3097
|
-
static line(t, { lineColor: e, type: i, x: n, y:
|
|
3098
|
-
t.save(), t.strokeStyle = e || "#777777", t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(n,
|
|
3097
|
+
static line(t, { lineColor: e, type: i, x: n, y: a, lineLength: r }) {
|
|
3098
|
+
t.save(), t.strokeStyle = e || "#777777", t.lineWidth = 1, t.setLineDash([4, 4]), t.beginPath(), t.moveTo(n, a), t.lineTo(n + (i === "h" ? r : 0), a + (i === "v" ? r : 0)), t.stroke(), t.restore();
|
|
3099
3099
|
}
|
|
3100
3100
|
static _basicLabel(t, {
|
|
3101
3101
|
text: e,
|
|
3102
3102
|
mainColor: i,
|
|
3103
3103
|
textColor: n,
|
|
3104
|
-
position:
|
|
3104
|
+
position: a
|
|
3105
3105
|
}) {
|
|
3106
|
-
t.textContent = e, t.style.backgroundColor = i ?? "#777777", t.style.color = n ?? "#ffffff", t.style[
|
|
3106
|
+
t.textContent = e, t.style.backgroundColor = i ?? "#777777", t.style.color = n ?? "#ffffff", t.style[a] = "0px";
|
|
3107
3107
|
}
|
|
3108
|
-
static label_h(t, { text: e, y: i, mainColor: n, textColor:
|
|
3109
|
-
W._basicLabel(t, { text: e, mainColor: n, textColor:
|
|
3108
|
+
static label_h(t, { text: e, y: i, mainColor: n, textColor: a, position: r }) {
|
|
3109
|
+
W._basicLabel(t, { text: e, mainColor: n, textColor: a, position: r }), t.style.top = i + "px", t.style.transform = "translateY(-50%)";
|
|
3110
3110
|
}
|
|
3111
|
-
static label_v(t, { text: e, x: i, mainColor: n, textColor:
|
|
3112
|
-
W._basicLabel(t, { text: e, mainColor: n, textColor:
|
|
3111
|
+
static label_v(t, { text: e, x: i, mainColor: n, textColor: a, position: r }) {
|
|
3112
|
+
W._basicLabel(t, { text: e, mainColor: n, textColor: a, position: r }), t.style.left = i + "px", t.style.transform = "translateX(-50%)";
|
|
3113
3113
|
}
|
|
3114
3114
|
static horizontalMarker({
|
|
3115
3115
|
node: t,
|
|
3116
3116
|
ctx: e,
|
|
3117
3117
|
x: i,
|
|
3118
3118
|
y: n,
|
|
3119
|
-
lineLength:
|
|
3120
|
-
text:
|
|
3119
|
+
lineLength: a,
|
|
3120
|
+
text: r,
|
|
3121
3121
|
textColor: l,
|
|
3122
|
-
mainColor:
|
|
3123
|
-
lineColor:
|
|
3122
|
+
mainColor: h,
|
|
3123
|
+
lineColor: d,
|
|
3124
3124
|
position: g
|
|
3125
3125
|
}) {
|
|
3126
3126
|
W.line(e, {
|
|
3127
3127
|
type: "h",
|
|
3128
3128
|
x: i,
|
|
3129
3129
|
y: n,
|
|
3130
|
-
lineLength:
|
|
3131
|
-
lineColor:
|
|
3130
|
+
lineLength: a,
|
|
3131
|
+
lineColor: d
|
|
3132
3132
|
}), W.label_h(t, {
|
|
3133
|
-
text:
|
|
3133
|
+
text: r,
|
|
3134
3134
|
y: n,
|
|
3135
3135
|
textColor: l,
|
|
3136
|
-
mainColor:
|
|
3136
|
+
mainColor: h,
|
|
3137
3137
|
position: g
|
|
3138
3138
|
});
|
|
3139
3139
|
}
|
|
@@ -3142,45 +3142,45 @@ class W {
|
|
|
3142
3142
|
ctx: e,
|
|
3143
3143
|
x: i,
|
|
3144
3144
|
y: n,
|
|
3145
|
-
lineLength:
|
|
3146
|
-
text:
|
|
3145
|
+
lineLength: a,
|
|
3146
|
+
text: r,
|
|
3147
3147
|
textColor: l,
|
|
3148
|
-
mainColor:
|
|
3149
|
-
lineColor:
|
|
3148
|
+
mainColor: h,
|
|
3149
|
+
lineColor: d,
|
|
3150
3150
|
position: g
|
|
3151
3151
|
}) {
|
|
3152
3152
|
W.line(e, {
|
|
3153
3153
|
type: "v",
|
|
3154
3154
|
x: i,
|
|
3155
3155
|
y: n,
|
|
3156
|
-
lineLength:
|
|
3157
|
-
lineColor:
|
|
3156
|
+
lineLength: a,
|
|
3157
|
+
lineColor: d
|
|
3158
3158
|
}), W.label_v(t, {
|
|
3159
|
-
text:
|
|
3159
|
+
text: r,
|
|
3160
3160
|
x: i,
|
|
3161
3161
|
textColor: l,
|
|
3162
|
-
mainColor:
|
|
3162
|
+
mainColor: h,
|
|
3163
3163
|
position: g
|
|
3164
3164
|
});
|
|
3165
3165
|
}
|
|
3166
3166
|
}
|
|
3167
|
-
class
|
|
3167
|
+
class oa {
|
|
3168
3168
|
constructor(t, e) {
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3169
|
+
c(this, "_canvas");
|
|
3170
|
+
c(this, "_parent");
|
|
3171
|
+
c(this, "_horizontalMarker");
|
|
3172
|
+
c(this, "_verticalMarker");
|
|
3173
3173
|
this._canvas = e;
|
|
3174
3174
|
const i = new S({ tag: "div", className: "sc-charts-cs__guide-markers" });
|
|
3175
3175
|
this._parent = i;
|
|
3176
3176
|
const n = new S({
|
|
3177
3177
|
tag: "div",
|
|
3178
3178
|
className: "sc-charts-cs__guide-marker sc-charts-cs__guide-marker-h"
|
|
3179
|
-
}),
|
|
3179
|
+
}), a = new S({
|
|
3180
3180
|
tag: "div",
|
|
3181
3181
|
className: "sc-charts-cs__guide-marker sc-charts-cs__guide-marker-v"
|
|
3182
3182
|
});
|
|
3183
|
-
this._horizontalMarker = n, this._verticalMarker =
|
|
3183
|
+
this._horizontalMarker = n, this._verticalMarker = a, i.append(n.node), i.append(a.node), t.append(i.node), this.hide();
|
|
3184
3184
|
}
|
|
3185
3185
|
update(t) {
|
|
3186
3186
|
this._verticalMarker.node.style.display = t.isShowX ? "flex" : "none", this._horizontalMarker.node.style.display = t.isShowY ? "flex" : "none";
|
|
@@ -3194,31 +3194,31 @@ class or {
|
|
|
3194
3194
|
render(t, { x: e, y: i }) {
|
|
3195
3195
|
this._canvas.clear();
|
|
3196
3196
|
const {
|
|
3197
|
-
layout: { area: n, chart:
|
|
3198
|
-
config: { guides:
|
|
3197
|
+
layout: { area: n, chart: a },
|
|
3198
|
+
config: { guides: r, yAxis: l, xAxis: h },
|
|
3199
3199
|
colorScheme: {
|
|
3200
|
-
guides: { horizontalMarker:
|
|
3200
|
+
guides: { horizontalMarker: d, verticalMarker: g }
|
|
3201
3201
|
}
|
|
3202
3202
|
} = t;
|
|
3203
|
-
|
|
3203
|
+
r.isShowY && W.horizontalMarker({
|
|
3204
3204
|
ctx: this._canvas.ctx,
|
|
3205
3205
|
node: this._horizontalMarker.node,
|
|
3206
3206
|
x: n.left,
|
|
3207
3207
|
y: i,
|
|
3208
|
-
lineLength:
|
|
3208
|
+
lineLength: a.width,
|
|
3209
3209
|
text: t.scales.y.invert(i).toFixed(2),
|
|
3210
3210
|
position: l.position,
|
|
3211
|
-
mainColor:
|
|
3212
|
-
lineColor:
|
|
3213
|
-
textColor:
|
|
3214
|
-
}),
|
|
3211
|
+
mainColor: d.main,
|
|
3212
|
+
lineColor: d.line,
|
|
3213
|
+
textColor: d.text
|
|
3214
|
+
}), r.isShowX && W.verticalMarker({
|
|
3215
3215
|
ctx: this._canvas.ctx,
|
|
3216
3216
|
node: this._verticalMarker.node,
|
|
3217
|
-
text:
|
|
3218
|
-
position:
|
|
3217
|
+
text: E.timeFormat("%a %d, %b %y %H:%M")(t.scales.x.invert(e)),
|
|
3218
|
+
position: h.position,
|
|
3219
3219
|
x: e,
|
|
3220
3220
|
y: n.top,
|
|
3221
|
-
lineLength:
|
|
3221
|
+
lineLength: a.height,
|
|
3222
3222
|
mainColor: g.main,
|
|
3223
3223
|
lineColor: g.line,
|
|
3224
3224
|
textColor: g.text
|
|
@@ -3231,29 +3231,29 @@ class or {
|
|
|
3231
3231
|
function Dt(s) {
|
|
3232
3232
|
return s * 0.1875;
|
|
3233
3233
|
}
|
|
3234
|
-
const
|
|
3235
|
-
const _ =
|
|
3234
|
+
const la = (s, { mainColor: t, textColor: e, symbol: i, x: n, y: a, size: r, fontSize: l }) => {
|
|
3235
|
+
const _ = r / 16, m = 16 * _, p = n - m / 2, v = a;
|
|
3236
3236
|
s.save(), s.translate(p, v), s.scale(_, _), s.beginPath(), s.moveTo(7.85696, 0.288512), s.lineTo(4.53377, 3.11938), s.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), s.lineTo(11.2275, 4), s.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), s.lineTo(8.52156, 0.302869), s.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), s.closePath(), s.fillStyle = t, s.fill(), s.beginPath(), s.moveTo(0, 7), s.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), s.lineTo(12, 3), s.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), s.lineTo(16, 15), s.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), s.lineTo(4, 19), s.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), s.lineTo(0, 7), s.closePath(), s.fillStyle = t, s.fill(), s.restore(), s.save(), s.font = `bold ${l}px sans-serif`, s.textAlign = "center", s.textBaseline = "top", s.textAlign = "center", s.textBaseline = "middle";
|
|
3237
|
-
const b =
|
|
3237
|
+
const b = a + _ * 3 + 0.5, x = _ * 16, C = b + x / 2;
|
|
3238
3238
|
s.fillStyle = e, s.fillText(i, n, C), s.restore();
|
|
3239
|
-
},
|
|
3240
|
-
const _ =
|
|
3239
|
+
}, ca = (s, { mainColor: t, textColor: e, symbol: i, x: n, y: a, size: r, fontSize: l }) => {
|
|
3240
|
+
const _ = r / 16, m = 16 * _, p = n - m / 2, v = a;
|
|
3241
3241
|
s.save(), s.translate(p, v), s.scale(_, -_), s.beginPath(), s.moveTo(7.85696, 0.288512), s.lineTo(4.53377, 3.11938), s.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), s.lineTo(11.2275, 4), s.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), s.lineTo(8.52156, 0.302869), s.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), s.closePath(), s.fillStyle = t, s.fill(), s.beginPath(), s.moveTo(0, 7), s.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), s.lineTo(12, 3), s.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), s.lineTo(16, 15), s.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), s.lineTo(4, 19), s.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), s.lineTo(0, 7), s.closePath(), s.fillStyle = t, s.fill(), s.restore(), s.save(), s.font = `bold ${l}px sans-serif`, s.textAlign = "center", s.textBaseline = "middle";
|
|
3242
|
-
const b = _ * 16, x =
|
|
3242
|
+
const b = _ * 16, x = a - _ * 19 + b / 2;
|
|
3243
3243
|
s.fillStyle = e, s.fillText(i, n, x), s.restore();
|
|
3244
3244
|
};
|
|
3245
|
-
function
|
|
3245
|
+
function ha(s, t) {
|
|
3246
3246
|
const {
|
|
3247
3247
|
trade: { tradedCandles: e },
|
|
3248
3248
|
scales: { x: i, y: n },
|
|
3249
|
-
colorScheme:
|
|
3250
|
-
} = t, { trade:
|
|
3251
|
-
e.forEach(({ isHovered:
|
|
3249
|
+
colorScheme: a
|
|
3250
|
+
} = t, { trade: r } = a, l = 4;
|
|
3251
|
+
e.forEach(({ isHovered: h, isActive: d, candle: g, trades: _ }) => {
|
|
3252
3252
|
const m = i.convert(g.open_time);
|
|
3253
3253
|
_.forEach((p) => {
|
|
3254
|
-
const v = p.type === "buy", b = v ?
|
|
3255
|
-
let y = v ?
|
|
3256
|
-
|
|
3254
|
+
const v = p.type === "buy", b = v ? r.buyLabel.text : r.sellLabel.text, x = v ? "B" : "S", C = v ? n.convert(g.low) + l : n.convert(g.high) - l, w = v ? la : ca;
|
|
3255
|
+
let y = v ? r.buyLabel.main : r.sellLabel.main;
|
|
3256
|
+
h && h[1] && h[0] === p.type && (y = A.mix(y, a.bg, 20).toString()), d && d[1] && d[0] === p.type && (y = r.activeLabel), w(s, {
|
|
3257
3257
|
x: m,
|
|
3258
3258
|
y: C,
|
|
3259
3259
|
symbol: x,
|
|
@@ -3265,87 +3265,87 @@ function hr(s, t) {
|
|
|
3265
3265
|
});
|
|
3266
3266
|
});
|
|
3267
3267
|
}
|
|
3268
|
-
function
|
|
3268
|
+
function da(s, t) {
|
|
3269
3269
|
const {
|
|
3270
3270
|
scales: { x: e, factorX: i },
|
|
3271
3271
|
layout: { area: n },
|
|
3272
|
-
trade: { tradedCandles:
|
|
3273
|
-
config: { candles:
|
|
3274
|
-
colorScheme: { trade:
|
|
3272
|
+
trade: { tradedCandles: a, exits: r, entries: l },
|
|
3273
|
+
config: { candles: h },
|
|
3274
|
+
colorScheme: { trade: d }
|
|
3275
3275
|
} = t;
|
|
3276
|
-
if (
|
|
3277
|
-
const g =
|
|
3278
|
-
if (s.save(), s.lineWidth = 1, s.strokeStyle =
|
|
3276
|
+
if (a.length === 0) return;
|
|
3277
|
+
const g = a.map((m) => m.candle).sort((m, p) => m.open_time.getTime() - p.open_time.getTime()), _ = h.baseWidth / 2 * i + h.strokeWidth / 2;
|
|
3278
|
+
if (s.save(), s.lineWidth = 1, s.strokeStyle = d.tradeBorders, l.length) {
|
|
3279
3279
|
const m = e.convert(g[0].open_time) - _;
|
|
3280
3280
|
s.beginPath(), s.moveTo(m, n.y), s.lineTo(m, n.y + n.height), s.stroke();
|
|
3281
3281
|
}
|
|
3282
|
-
if (
|
|
3282
|
+
if (r.length) {
|
|
3283
3283
|
const m = e.convert(g[g.length - 1].open_time) + _;
|
|
3284
3284
|
s.beginPath(), s.moveTo(m, n.y), s.lineTo(m, n.y + n.height), s.stroke();
|
|
3285
3285
|
}
|
|
3286
3286
|
s.restore();
|
|
3287
3287
|
}
|
|
3288
|
-
const
|
|
3288
|
+
const ua = (s, t) => {
|
|
3289
3289
|
const {
|
|
3290
3290
|
scales: { x: e, y: i },
|
|
3291
|
-
trade: { tradedCandles: n, entries:
|
|
3291
|
+
trade: { tradedCandles: n, entries: a, exits: r },
|
|
3292
3292
|
colorScheme: { trade: l }
|
|
3293
3293
|
} = t;
|
|
3294
3294
|
s.save();
|
|
3295
|
-
const
|
|
3295
|
+
const h = (g) => {
|
|
3296
3296
|
var _;
|
|
3297
3297
|
return (_ = n.find(
|
|
3298
3298
|
(m) => g.getTime() >= m.candle.open_time.getTime() && g.getTime() < m.candle.close_time.getTime()
|
|
3299
3299
|
)) == null ? void 0 : _.candle;
|
|
3300
|
-
},
|
|
3301
|
-
const m =
|
|
3300
|
+
}, d = (g, _) => {
|
|
3301
|
+
const m = h(g.time), p = h(_.time);
|
|
3302
3302
|
if (!m || !p) return;
|
|
3303
3303
|
const v = e.convert(m.open_time), b = e.convert(p.open_time);
|
|
3304
3304
|
let x, C;
|
|
3305
3305
|
g.type === "buy" ? (x = i.convert(m.low), C = i.convert(p.high)) : (x = i.convert(m.high), C = i.convert(p.low)), s.beginPath(), s.setLineDash([4, 4]), s.strokeStyle = l.connectionLine, s.moveTo(v, x), s.lineTo(b, C), s.stroke(), s.setLineDash([]);
|
|
3306
3306
|
};
|
|
3307
|
-
if (
|
|
3308
|
-
|
|
3309
|
-
else if (
|
|
3310
|
-
|
|
3311
|
-
else if (
|
|
3312
|
-
|
|
3313
|
-
else if (
|
|
3314
|
-
const g =
|
|
3315
|
-
|
|
3307
|
+
if (a.length === 1 && r.length > 1)
|
|
3308
|
+
r.forEach((g) => d(a[0], g));
|
|
3309
|
+
else if (r.length === 1 && a.length > 1)
|
|
3310
|
+
a.forEach((g) => d(g, r[0]));
|
|
3311
|
+
else if (a.length === 1 && r.length === 1)
|
|
3312
|
+
d(a[0], r[0]);
|
|
3313
|
+
else if (a.length > 0 && r.length > 0) {
|
|
3314
|
+
const g = a.reduce((m, p) => m.time < p.time ? m : p), _ = r.reduce((m, p) => m.time > p.time ? m : p);
|
|
3315
|
+
d(g, _);
|
|
3316
3316
|
}
|
|
3317
3317
|
s.restore();
|
|
3318
3318
|
};
|
|
3319
3319
|
class Ke extends S {
|
|
3320
3320
|
constructor({ className: e, isAdaptPosition: i } = {}) {
|
|
3321
3321
|
super({ tag: "div", className: e });
|
|
3322
|
-
|
|
3322
|
+
c(this, "_isAdaptPosition");
|
|
3323
3323
|
this._isAdaptPosition = !!i;
|
|
3324
3324
|
}
|
|
3325
|
-
show({ x: e, y: i, parent: n, offset:
|
|
3326
|
-
let
|
|
3325
|
+
show({ x: e, y: i, parent: n, offset: a = 8 }) {
|
|
3326
|
+
let r = e + a, l = i + a;
|
|
3327
3327
|
if (this._isAdaptPosition) {
|
|
3328
3328
|
this.updateAbsolutePosition();
|
|
3329
|
-
const
|
|
3329
|
+
const h = this.absolutePosition, d = {
|
|
3330
3330
|
top: 0,
|
|
3331
3331
|
left: 0,
|
|
3332
3332
|
bottom: n.bottom - n.top,
|
|
3333
3333
|
right: n.right - n.left
|
|
3334
3334
|
};
|
|
3335
|
-
|
|
3335
|
+
r + h.width > d.right && (r = e - h.width - a, r < d.left + a && (r = d.left + a)), l + h.height > d.bottom && (l = i - h.height - a, l < d.top + a && (l = d.top + a));
|
|
3336
3336
|
}
|
|
3337
|
-
this.node.style.opacity = "1", this.node.style.visibility = "visible", this.node.style.left = `${
|
|
3337
|
+
this.node.style.opacity = "1", this.node.style.visibility = "visible", this.node.style.left = `${r}px`, this.node.style.top = `${l}px`;
|
|
3338
3338
|
}
|
|
3339
3339
|
hide() {
|
|
3340
3340
|
this.node.style.opacity = "0", this.node.style.visibility = "hidden";
|
|
3341
3341
|
}
|
|
3342
3342
|
}
|
|
3343
|
-
class
|
|
3343
|
+
class ga extends Ke {
|
|
3344
3344
|
constructor() {
|
|
3345
3345
|
super({ className: "sc-charts-cs__trade-label-tooltip", isAdaptPosition: !0 });
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3346
|
+
c(this, "_title");
|
|
3347
|
+
c(this, "_manyBox");
|
|
3348
|
+
c(this, "_oneBox");
|
|
3349
3349
|
this._title = new S({
|
|
3350
3350
|
tag: "div",
|
|
3351
3351
|
className: "sc-charts-cs__trade-label-tooltip-title"
|
|
@@ -3359,17 +3359,17 @@ class gr extends Ke {
|
|
|
3359
3359
|
}
|
|
3360
3360
|
_createLineNodes(e, i) {
|
|
3361
3361
|
const n = [];
|
|
3362
|
-
for (const
|
|
3363
|
-
if (
|
|
3364
|
-
const
|
|
3362
|
+
for (const a of Object.keys(i))
|
|
3363
|
+
if (a in e) {
|
|
3364
|
+
const r = new S({
|
|
3365
3365
|
tag: "div",
|
|
3366
3366
|
className: `sc-charts-cs__trade-label-tooltip-line
|
|
3367
|
-
sc-charts-cs__trade-label-tooltip-line-key-${
|
|
3367
|
+
sc-charts-cs__trade-label-tooltip-line-key-${a}`
|
|
3368
3368
|
});
|
|
3369
|
-
let l = e[
|
|
3370
|
-
|
|
3371
|
-
const
|
|
3372
|
-
|
|
3369
|
+
let l = e[a].toString();
|
|
3370
|
+
a === "kind" && (l = this._formatDate(e.time));
|
|
3371
|
+
const h = new S({ tag: "strong", textContent: i[a] }), d = new S({ tag: "span", textContent: l });
|
|
3372
|
+
r.append(h.node, d.node), n.push(r.node);
|
|
3373
3373
|
}
|
|
3374
3374
|
return n;
|
|
3375
3375
|
}
|
|
@@ -3381,8 +3381,8 @@ class gr extends Ke {
|
|
|
3381
3381
|
month: "short",
|
|
3382
3382
|
year: "numeric",
|
|
3383
3383
|
hour12: !1
|
|
3384
|
-
}).format(e), [n,
|
|
3385
|
-
return `${n}, ${
|
|
3384
|
+
}).format(e), [n, a, r] = i.split(", ");
|
|
3385
|
+
return `${n}, ${a} ${r}`;
|
|
3386
3386
|
}
|
|
3387
3387
|
_clearTooltip() {
|
|
3388
3388
|
this._title.node.style.display = "none", this._oneBox.node.style.display = "none", this._oneBox.node.replaceChildren(), this._manyBox.node.style.display = "none", this._manyBox.node.replaceChildren();
|
|
@@ -3401,18 +3401,18 @@ class gr extends Ke {
|
|
|
3401
3401
|
} else if (e.length > 1) {
|
|
3402
3402
|
this._manyBox.node.style.display = "flex";
|
|
3403
3403
|
const i = e.map((n) => {
|
|
3404
|
-
const
|
|
3404
|
+
const a = new S({ tag: "div" }), r = this._createLineNodes(n, {
|
|
3405
3405
|
kind: n.kind === "entry" ? "Entry:" : "Exit:",
|
|
3406
3406
|
price: "Price:"
|
|
3407
3407
|
});
|
|
3408
|
-
return
|
|
3408
|
+
return a.append(...r), a.node;
|
|
3409
3409
|
});
|
|
3410
3410
|
this._manyBox.append(...i), this.node.append(this._manyBox.node);
|
|
3411
3411
|
}
|
|
3412
3412
|
}
|
|
3413
3413
|
}
|
|
3414
3414
|
}
|
|
3415
|
-
const
|
|
3415
|
+
const _a = (s) => {
|
|
3416
3416
|
const t = Math.floor((Date.now() - +s) / 1e3), e = [
|
|
3417
3417
|
[60, 1, "s"],
|
|
3418
3418
|
[3600, 60, "m"],
|
|
@@ -3421,10 +3421,10 @@ const _r = (s) => {
|
|
|
3421
3421
|
[2629746, 604800, "w"],
|
|
3422
3422
|
[31556952, 2629746, "mo"],
|
|
3423
3423
|
[1 / 0, 31556952, "y"]
|
|
3424
|
-
], [, i, n] = e.find(([
|
|
3424
|
+
], [, i, n] = e.find(([r]) => t < r);
|
|
3425
3425
|
return `${Math.floor(t / i)}${n} ago`;
|
|
3426
3426
|
};
|
|
3427
|
-
function
|
|
3427
|
+
function fa(s) {
|
|
3428
3428
|
const t = Math.floor(s / 1e3), e = [
|
|
3429
3429
|
{ label: "d", value: 86400 },
|
|
3430
3430
|
{ label: "h", value: 3600 },
|
|
@@ -3432,35 +3432,35 @@ function fr(s) {
|
|
|
3432
3432
|
{ label: "s", value: 1 }
|
|
3433
3433
|
], i = [];
|
|
3434
3434
|
let n = t;
|
|
3435
|
-
for (const { label:
|
|
3436
|
-
if (n >=
|
|
3437
|
-
const l = Math.floor(n /
|
|
3438
|
-
if (i.push(`${l}${
|
|
3435
|
+
for (const { label: a, value: r } of e)
|
|
3436
|
+
if (n >= r) {
|
|
3437
|
+
const l = Math.floor(n / r);
|
|
3438
|
+
if (i.push(`${l}${a}`), n %= r, i.length === 2) break;
|
|
3439
3439
|
}
|
|
3440
3440
|
return i.length ? i.join(" ") : "0s";
|
|
3441
3441
|
}
|
|
3442
|
-
const
|
|
3442
|
+
const ma = 10, pa = 6, va = 4, ba = 12, ya = (s, t) => {
|
|
3443
3443
|
var O;
|
|
3444
3444
|
const {
|
|
3445
3445
|
scales: { x: e, y: i },
|
|
3446
|
-
trade: { entries: n, exits:
|
|
3446
|
+
trade: { entries: n, exits: a, holdTime: r },
|
|
3447
3447
|
colorScheme: {
|
|
3448
3448
|
trade: { hold: l }
|
|
3449
3449
|
},
|
|
3450
3450
|
config: {
|
|
3451
|
-
trade: { showHoldTime:
|
|
3451
|
+
trade: { showHoldTime: h }
|
|
3452
3452
|
}
|
|
3453
3453
|
} = t;
|
|
3454
|
-
if (!
|
|
3455
|
-
const
|
|
3456
|
-
if (!
|
|
3457
|
-
const _ = e.convert(
|
|
3454
|
+
if (!h) return;
|
|
3455
|
+
const d = n.at(0), g = a.at(-1);
|
|
3456
|
+
if (!d || !g) return;
|
|
3457
|
+
const _ = e.convert(d.candle.open_time), m = e.convert(g.candle.open_time), p = i.convert(((O = n.at(0)) == null ? void 0 : O.price) ?? 0);
|
|
3458
3458
|
s.beginPath(), s.setLineDash([4, 4]), s.strokeStyle = l.main, s.moveTo(_, p), s.lineTo(m, p), s.stroke(), s.setLineDash([]);
|
|
3459
|
-
const v = (_ + m) / 2, b = `Hold: ${
|
|
3459
|
+
const v = (_ + m) / 2, b = `Hold: ${fa(r)}`, C = getComputedStyle(
|
|
3460
3460
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3461
3461
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3462
|
-
s.font = `600 ${
|
|
3463
|
-
const y = s.measureText(b).width +
|
|
3462
|
+
s.font = `600 ${ma}px ${C}`;
|
|
3463
|
+
const y = s.measureText(b).width + pa * 2, T = ba + va * 2, D = v - y / 2, N = p - T / 2, z = 4;
|
|
3464
3464
|
s.beginPath(), s.fillStyle = l.main, s.lineWidth = 1, s.moveTo(D + z, N), s.lineTo(D + y - z, N), s.quadraticCurveTo(D + y, N, D + y, N + z), s.lineTo(D + y, N + T - z), s.quadraticCurveTo(
|
|
3465
3465
|
D + y,
|
|
3466
3466
|
N + T,
|
|
@@ -3468,11 +3468,11 @@ const mr = 10, pr = 6, vr = 4, br = 12, yr = (s, t) => {
|
|
|
3468
3468
|
N + T
|
|
3469
3469
|
), s.lineTo(D + z, N + T), s.quadraticCurveTo(D, N + T, D, N + T - z), s.lineTo(D, N + z), s.quadraticCurveTo(D, N, D + z, N), s.closePath(), s.fill(), s.fillStyle = l.text, s.textBaseline = "middle", s.textAlign = "center", s.fillText(b, v, p), s.restore();
|
|
3470
3470
|
};
|
|
3471
|
-
class
|
|
3471
|
+
class xa {
|
|
3472
3472
|
constructor({ domParent: t, canvasParent: e, width: i, height: n }) {
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
this._canvas = new St({ className: "sc-charts-cs__canvas-trade", width: i, height: n }), this._labelTooltip = new
|
|
3473
|
+
c(this, "_canvas");
|
|
3474
|
+
c(this, "_labelTooltip");
|
|
3475
|
+
this._canvas = new St({ className: "sc-charts-cs__canvas-trade", width: i, height: n }), this._labelTooltip = new ga(), e.append(this._canvas.node), t.append(this._labelTooltip.node);
|
|
3476
3476
|
}
|
|
3477
3477
|
get canvas() {
|
|
3478
3478
|
return this._canvas;
|
|
@@ -3481,15 +3481,15 @@ class xr {
|
|
|
3481
3481
|
return this._labelTooltip;
|
|
3482
3482
|
}
|
|
3483
3483
|
renderAll(t) {
|
|
3484
|
-
this._canvas.clear(),
|
|
3484
|
+
this._canvas.clear(), da(this._canvas.ctx, t), ha(this._canvas.ctx, t), ua(this._canvas.ctx, t), ya(this._canvas.ctx, t);
|
|
3485
3485
|
}
|
|
3486
3486
|
}
|
|
3487
|
-
class
|
|
3487
|
+
class wa {
|
|
3488
3488
|
constructor(t, e) {
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3489
|
+
c(this, "canvas");
|
|
3490
|
+
c(this, "parent");
|
|
3491
|
+
c(this, "items", {});
|
|
3492
|
+
c(this, "className");
|
|
3493
3493
|
this.className = e, this.canvas = new St({
|
|
3494
3494
|
width: t.width,
|
|
3495
3495
|
height: t.height,
|
|
@@ -3500,8 +3500,8 @@ class wr {
|
|
|
3500
3500
|
const e = new Set(t.map(this.getIdFromMarker));
|
|
3501
3501
|
this.canvas.clear(), this.removeObsoleteItems(e);
|
|
3502
3502
|
for (const i of t) {
|
|
3503
|
-
const n = this.getIdFromMarker(i),
|
|
3504
|
-
this.renderMarker(i,
|
|
3503
|
+
const n = this.getIdFromMarker(i), a = this.items[n] ?? this.createMarkerElement(n);
|
|
3504
|
+
this.renderMarker(i, a.node);
|
|
3505
3505
|
}
|
|
3506
3506
|
}
|
|
3507
3507
|
clear() {
|
|
@@ -3534,7 +3534,7 @@ class wr {
|
|
|
3534
3534
|
});
|
|
3535
3535
|
}
|
|
3536
3536
|
}
|
|
3537
|
-
class
|
|
3537
|
+
class Ca extends Ke {
|
|
3538
3538
|
constructor() {
|
|
3539
3539
|
super({ className: "sc-charts-cs__candle-tooltip_nodata", isAdaptPosition: !0 });
|
|
3540
3540
|
const t = new S({ tag: "p" });
|
|
@@ -3544,18 +3544,18 @@ class Cr extends Ke {
|
|
|
3544
3544
|
class et extends S {
|
|
3545
3545
|
constructor(e) {
|
|
3546
3546
|
super(e);
|
|
3547
|
-
|
|
3548
|
-
|
|
3547
|
+
c(this, "_state", {});
|
|
3548
|
+
c(this, "_updateScheduled", !1);
|
|
3549
3549
|
}
|
|
3550
3550
|
get state() {
|
|
3551
3551
|
return this._state;
|
|
3552
3552
|
}
|
|
3553
3553
|
set state(e) {
|
|
3554
3554
|
this._state = new Proxy(e, {
|
|
3555
|
-
set: (i, n,
|
|
3555
|
+
set: (i, n, a) => {
|
|
3556
3556
|
if (typeof n != "string") return !0;
|
|
3557
|
-
const
|
|
3558
|
-
return i[
|
|
3557
|
+
const r = n;
|
|
3558
|
+
return i[r] === a || (i[r] = a, this._scheduleUpdate()), !0;
|
|
3559
3559
|
}
|
|
3560
3560
|
});
|
|
3561
3561
|
}
|
|
@@ -3576,18 +3576,18 @@ class et extends S {
|
|
|
3576
3576
|
this._scheduleUpdate();
|
|
3577
3577
|
}
|
|
3578
3578
|
}
|
|
3579
|
-
const
|
|
3579
|
+
const Ma = "sc-charts-cs";
|
|
3580
3580
|
class q {
|
|
3581
3581
|
constructor(t) {
|
|
3582
|
-
|
|
3582
|
+
c(this, "block");
|
|
3583
3583
|
this.block = t;
|
|
3584
3584
|
}
|
|
3585
3585
|
gen(t) {
|
|
3586
|
-
return `${
|
|
3586
|
+
return `${Ma}__${this.block}${t ? "-" + t : ""}`;
|
|
3587
3587
|
}
|
|
3588
3588
|
}
|
|
3589
3589
|
const Jt = new q("comment-actions");
|
|
3590
|
-
class
|
|
3590
|
+
class Aa extends S {
|
|
3591
3591
|
constructor({ onDelete: t, onUpdate: e }) {
|
|
3592
3592
|
super({ className: Jt.gen() });
|
|
3593
3593
|
const i = new S({ tag: "button", className: Jt.gen("edit"), textContent: "Edit" }), n = new S({
|
|
@@ -3595,23 +3595,23 @@ class Ar extends S {
|
|
|
3595
3595
|
className: Jt.gen("delete"),
|
|
3596
3596
|
textContent: "Delete"
|
|
3597
3597
|
});
|
|
3598
|
-
n.node.addEventListener("click", (
|
|
3599
|
-
|
|
3600
|
-
}), i.node.addEventListener("click", (
|
|
3601
|
-
|
|
3598
|
+
n.node.addEventListener("click", (a) => {
|
|
3599
|
+
a.stopPropagation(), t();
|
|
3600
|
+
}), i.node.addEventListener("click", (a) => {
|
|
3601
|
+
a.stopPropagation(), e();
|
|
3602
3602
|
}), this.append(i.node, n.node);
|
|
3603
3603
|
}
|
|
3604
3604
|
}
|
|
3605
3605
|
function ie(s, t) {
|
|
3606
3606
|
var n;
|
|
3607
|
-
const e = (
|
|
3607
|
+
const e = (a) => {
|
|
3608
3608
|
if (!document.contains(s.node)) return;
|
|
3609
|
-
const
|
|
3610
|
-
if (s.node.contains(
|
|
3611
|
-
const l = document.elementFromPoint(
|
|
3609
|
+
const r = a.target;
|
|
3610
|
+
if (s.node.contains(r)) return;
|
|
3611
|
+
const l = document.elementFromPoint(a.clientX, a.clientY);
|
|
3612
3612
|
if (l && s.node.contains(l)) return;
|
|
3613
|
-
const
|
|
3614
|
-
|
|
3613
|
+
const h = s.node.getBoundingClientRect();
|
|
3614
|
+
a.clientX >= h.left && a.clientX <= h.right && a.clientY >= h.top && a.clientY <= h.bottom && getComputedStyle(s.node).pointerEvents !== "none" || t(a);
|
|
3615
3615
|
};
|
|
3616
3616
|
document.addEventListener("mousedown", e);
|
|
3617
3617
|
const i = (n = s.destroy) == null ? void 0 : n.bind(s);
|
|
@@ -3619,9 +3619,9 @@ function ie(s, t) {
|
|
|
3619
3619
|
document.removeEventListener("mousedown", e), i == null || i();
|
|
3620
3620
|
}, s;
|
|
3621
3621
|
}
|
|
3622
|
-
class
|
|
3622
|
+
class Ta {
|
|
3623
3623
|
constructor() {
|
|
3624
|
-
|
|
3624
|
+
c(this, "node");
|
|
3625
3625
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
3626
3626
|
e.setAttribute("width", "18"), e.setAttribute("height", "4"), e.setAttribute("viewBox", "0 0 18 4"), e.setAttribute("fill", "none"), e.setAttribute("xmlns", t);
|
|
3627
3627
|
const i = [
|
|
@@ -3651,42 +3651,42 @@ class Tr {
|
|
|
3651
3651
|
}
|
|
3652
3652
|
];
|
|
3653
3653
|
for (const n of i) {
|
|
3654
|
-
const
|
|
3655
|
-
|
|
3654
|
+
const a = document.createElementNS(t, "path");
|
|
3655
|
+
a.setAttribute("d", n.d), n.fill && a.setAttribute("fill", n.fill), n.stroke && (a.setAttribute("stroke", n.stroke), a.setAttribute("stroke-width", "2"), a.setAttribute("stroke-linecap", "round"), a.setAttribute("stroke-linejoin", "round")), e.appendChild(a);
|
|
3656
3656
|
}
|
|
3657
3657
|
this.node = e;
|
|
3658
3658
|
}
|
|
3659
3659
|
}
|
|
3660
3660
|
const ht = new q("comment-list");
|
|
3661
|
-
class
|
|
3662
|
-
constructor({ onDelete: e, onOpenEditor: i, comment: n, layout:
|
|
3661
|
+
class Sa extends S {
|
|
3662
|
+
constructor({ onDelete: e, onOpenEditor: i, comment: n, layout: a }) {
|
|
3663
3663
|
super({ className: ht.gen("item") });
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
const
|
|
3664
|
+
c(this, "actionTooltip");
|
|
3665
|
+
c(this, "actionsTrigger");
|
|
3666
|
+
const r = new S({ className: ht.gen("text"), textContent: n.text }), l = new S({
|
|
3667
3667
|
className: ht.gen("created-at"),
|
|
3668
|
-
textContent:
|
|
3668
|
+
textContent: _a(new Date(n.createdAt))
|
|
3669
3669
|
});
|
|
3670
3670
|
this.actionsTrigger = new S({
|
|
3671
3671
|
tag: "button",
|
|
3672
3672
|
className: ht.gen("action-trigger")
|
|
3673
3673
|
});
|
|
3674
|
-
const
|
|
3674
|
+
const h = new Aa({
|
|
3675
3675
|
onDelete: e,
|
|
3676
3676
|
onUpdate: i
|
|
3677
3677
|
});
|
|
3678
|
-
this.actionTooltip = ie(
|
|
3678
|
+
this.actionTooltip = ie(h, () => {
|
|
3679
3679
|
this.actionTooltip.setVisible(!1);
|
|
3680
3680
|
}), this.actionsTrigger.node.addEventListener("click", () => {
|
|
3681
|
-
this.actionsTrigger.updateAbsolutePosition(), this.actionTooltip.updateAbsolutePosition(), this.actionTooltip.node.style.top = this.actionsTrigger.absolutePosition.top -
|
|
3681
|
+
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);
|
|
3682
3682
|
});
|
|
3683
|
-
const
|
|
3684
|
-
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`),
|
|
3683
|
+
const d = new S({ className: ht.gen("text-wrap") });
|
|
3684
|
+
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), d.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new Ta().node), this.append(d.node, l.node);
|
|
3685
3685
|
}
|
|
3686
3686
|
}
|
|
3687
|
-
class
|
|
3687
|
+
class ka {
|
|
3688
3688
|
constructor() {
|
|
3689
|
-
|
|
3689
|
+
c(this, "node");
|
|
3690
3690
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
3691
3691
|
e.setAttribute("width", "14"), e.setAttribute("height", "12"), e.setAttribute("viewBox", "0 0 14 12"), e.setAttribute("fill", "none"), e.setAttribute("xmlns", t);
|
|
3692
3692
|
const i = document.createElementNS(t, "path");
|
|
@@ -3696,9 +3696,9 @@ class kr {
|
|
|
3696
3696
|
), i.setAttribute("fill", "currentColor"), e.appendChild(i), this.node = e;
|
|
3697
3697
|
}
|
|
3698
3698
|
}
|
|
3699
|
-
class
|
|
3699
|
+
class Da {
|
|
3700
3700
|
constructor() {
|
|
3701
|
-
|
|
3701
|
+
c(this, "node");
|
|
3702
3702
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
3703
3703
|
e.setAttribute("width", "10"), e.setAttribute("height", "10"), e.setAttribute("viewBox", "0 0 10 10"), e.setAttribute("fill", "none"), e.setAttribute("xmlns", t);
|
|
3704
3704
|
const i = document.createElementNS(t, "path");
|
|
@@ -3708,21 +3708,21 @@ class Dr {
|
|
|
3708
3708
|
), i.setAttribute("fill", "currentColor"), e.appendChild(i), this.node = e;
|
|
3709
3709
|
}
|
|
3710
3710
|
}
|
|
3711
|
-
class
|
|
3711
|
+
class Ea extends et {
|
|
3712
3712
|
constructor(e) {
|
|
3713
3713
|
super({ className: "sc-charts-cs__comments-edit" });
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3714
|
+
c(this, "input");
|
|
3715
|
+
c(this, "saveBtn");
|
|
3716
|
+
c(this, "cancelBtn");
|
|
3717
|
+
c(this, "_onSave");
|
|
3718
|
+
c(this, "_onCancel");
|
|
3719
3719
|
this._onSave = e.onSave, this._onCancel = e.onCancel, this.input = new S({ tag: "textarea", className: "sc-charts-cs__comments-edit-input" }), this.saveBtn = new S({
|
|
3720
3720
|
tag: "button",
|
|
3721
3721
|
className: "sc-charts-cs__comments-edit-save-btn"
|
|
3722
|
-
}), this.saveBtn.append(new
|
|
3722
|
+
}), this.saveBtn.append(new ka().node), this.cancelBtn = new S({
|
|
3723
3723
|
tag: "button",
|
|
3724
3724
|
className: "sc-charts-cs__comments-edit-cancel-btn"
|
|
3725
|
-
}), this.cancelBtn.append(new
|
|
3725
|
+
}), this.cancelBtn.append(new Da().node);
|
|
3726
3726
|
const i = new S({ className: "sc-charts-cs__comments-edit-btn-container" });
|
|
3727
3727
|
i.append(this.cancelBtn.node, this.saveBtn.node), this.append(this.input.node, i.node), this.state = { inputValue: e.initialValue || "", hasInitFocused: !1 }, this._setupListeners(), this.render();
|
|
3728
3728
|
}
|
|
@@ -3738,13 +3738,13 @@ class Er extends et {
|
|
|
3738
3738
|
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 }));
|
|
3739
3739
|
}
|
|
3740
3740
|
}
|
|
3741
|
-
const
|
|
3742
|
-
class
|
|
3743
|
-
constructor(e, i, n,
|
|
3744
|
-
super({ tag: "ul", className:
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3741
|
+
const La = new q("comment-list");
|
|
3742
|
+
class Na extends et {
|
|
3743
|
+
constructor(e, i, n, a = {}) {
|
|
3744
|
+
super({ tag: "ul", className: La.gen(), ...a });
|
|
3745
|
+
c(this, "_elements", {});
|
|
3746
|
+
c(this, "_model");
|
|
3747
|
+
c(this, "_view");
|
|
3748
3748
|
this._model = i, this._view = n, this.state = { items: e, editId: null }, this.render();
|
|
3749
3749
|
}
|
|
3750
3750
|
render() {
|
|
@@ -3757,16 +3757,16 @@ class Nr extends et {
|
|
|
3757
3757
|
}
|
|
3758
3758
|
_createItem(e) {
|
|
3759
3759
|
if (this.state.editId === e.id)
|
|
3760
|
-
return new
|
|
3761
|
-
onSave: (
|
|
3762
|
-
this._model.comments.update(e.id,
|
|
3760
|
+
return new Ea({
|
|
3761
|
+
onSave: (a) => {
|
|
3762
|
+
this._model.comments.update(e.id, a), this.setState({ editId: null });
|
|
3763
3763
|
},
|
|
3764
3764
|
onCancel: () => {
|
|
3765
3765
|
this.setState({ editId: null });
|
|
3766
3766
|
},
|
|
3767
3767
|
initialValue: e.text
|
|
3768
3768
|
});
|
|
3769
|
-
const i = new
|
|
3769
|
+
const i = new Sa({
|
|
3770
3770
|
onDelete: () => {
|
|
3771
3771
|
this._model.comments.remove(e.id), i.actionTooltip.setVisible(!1);
|
|
3772
3772
|
},
|
|
@@ -3782,9 +3782,9 @@ class Nr extends et {
|
|
|
3782
3782
|
return Object.values(this._elements).sort((e, i) => e.order - i.order).map((e) => e.element.node);
|
|
3783
3783
|
}
|
|
3784
3784
|
}
|
|
3785
|
-
class
|
|
3785
|
+
class Ia {
|
|
3786
3786
|
constructor() {
|
|
3787
|
-
|
|
3787
|
+
c(this, "node");
|
|
3788
3788
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
3789
3789
|
e.setAttribute("width", "14"), e.setAttribute("height", "14"), e.setAttribute("viewBox", "0 0 14 14"), e.setAttribute("fill", "none"), e.setAttribute("xmlns", t);
|
|
3790
3790
|
const i = document.createElementNS(t, "path");
|
|
@@ -3799,16 +3799,16 @@ class ts extends et {
|
|
|
3799
3799
|
constructor({ onAdd: e, blockName: i }) {
|
|
3800
3800
|
At.block = i;
|
|
3801
3801
|
super({ className: At.gen() + " " + Qt.gen() });
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3802
|
+
c(this, "btn");
|
|
3803
|
+
c(this, "input");
|
|
3804
|
+
c(this, "_onAdd");
|
|
3805
3805
|
this._onAdd = e, this.state = { inputValue: "" }, this.input = new S({
|
|
3806
3806
|
tag: "input",
|
|
3807
3807
|
className: At.gen("input") + " " + Qt.gen("input")
|
|
3808
3808
|
}), this.input.node.setAttribute("placeholder", "Add comment..."), this.btn = new S({
|
|
3809
3809
|
tag: "button",
|
|
3810
3810
|
className: At.gen("btn") + " " + Qt.gen("btn")
|
|
3811
|
-
}), this.btn.append(new
|
|
3811
|
+
}), this.btn.append(new Ia().node), this.append(this.input.node, this.btn.node), this._setupListeners(), this.render();
|
|
3812
3812
|
}
|
|
3813
3813
|
_addComment() {
|
|
3814
3814
|
this._onAdd(this.input.node.value), this.setState({ inputValue: "" }), this.input.node.value = "", this.input.node.blur();
|
|
@@ -3827,32 +3827,32 @@ class ts extends et {
|
|
|
3827
3827
|
this.btn.node.disabled = !this.state.inputValue.trim();
|
|
3828
3828
|
}
|
|
3829
3829
|
}
|
|
3830
|
-
const
|
|
3831
|
-
class
|
|
3830
|
+
const Fa = new q("list-tooltip"), Kt = 8;
|
|
3831
|
+
class Ba extends et {
|
|
3832
3832
|
constructor(e, i, n) {
|
|
3833
|
-
super({ className:
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
this._model = i, this.state = { isShow: !1, comments: e }, this._list = new
|
|
3833
|
+
super({ className: Fa.gen() });
|
|
3834
|
+
c(this, "_list");
|
|
3835
|
+
c(this, "_addField");
|
|
3836
|
+
c(this, "_size", null);
|
|
3837
|
+
c(this, "_model");
|
|
3838
|
+
c(this, "_prevIsShow", !1);
|
|
3839
|
+
this._model = i, this.state = { isShow: !1, comments: e }, this._list = new Na(e, i, n), this._addField = new ts({
|
|
3840
3840
|
blockName: "list-tooltip-add",
|
|
3841
|
-
onAdd: (
|
|
3842
|
-
const
|
|
3841
|
+
onAdd: (a) => {
|
|
3842
|
+
const r = e[0].date, l = e[0].price, h = {
|
|
3843
3843
|
id: crypto.randomUUID(),
|
|
3844
|
-
text:
|
|
3845
|
-
date:
|
|
3844
|
+
text: a,
|
|
3845
|
+
date: r,
|
|
3846
3846
|
price: l,
|
|
3847
3847
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3848
3848
|
};
|
|
3849
|
-
i.comments.add(
|
|
3849
|
+
i.comments.add(h);
|
|
3850
3850
|
}
|
|
3851
3851
|
}), this.node.append(this._list.node, this._addField.node);
|
|
3852
3852
|
}
|
|
3853
3853
|
render() {
|
|
3854
|
-
const { isShow: e, comments: i } = this.state, { width: n, height:
|
|
3855
|
-
this._prevIsShow !== e && (this._list.forceUpdate(), this._prevIsShow = e), this.node.style.maxHeight =
|
|
3854
|
+
const { isShow: e, comments: i } = this.state, { width: n, height: a } = this._model.layout.area;
|
|
3855
|
+
this._prevIsShow !== e && (this._list.forceUpdate(), this._prevIsShow = e), this.node.style.maxHeight = a / 2 - Kt + "px", this.setVisible(e), e && !this._size && (this.updateAbsolutePosition(), this._size = this.absolutePosition, this.position(n / 2 - this._size.width - Kt, a / 2 + Kt)), this._list.setState({ items: i }), requestAnimationFrame(() => {
|
|
3856
3856
|
this._list.node.scrollTop = this._list.node.scrollHeight;
|
|
3857
3857
|
});
|
|
3858
3858
|
}
|
|
@@ -3860,9 +3860,9 @@ class Br extends et {
|
|
|
3860
3860
|
return this._list;
|
|
3861
3861
|
}
|
|
3862
3862
|
}
|
|
3863
|
-
class
|
|
3863
|
+
class Ha {
|
|
3864
3864
|
constructor() {
|
|
3865
|
-
|
|
3865
|
+
c(this, "node");
|
|
3866
3866
|
const t = "http://www.w3.org/2000/svg", e = document.createElementNS(t, "svg");
|
|
3867
3867
|
e.setAttribute("width", "16"), e.setAttribute("height", "16"), e.setAttribute("viewBox", "0 0 16 16"), e.setAttribute("fill", "none"), e.setAttribute("xmlns", t);
|
|
3868
3868
|
const i = document.createElementNS(t, "path");
|
|
@@ -3872,42 +3872,42 @@ class Hr {
|
|
|
3872
3872
|
), i.setAttribute("fill", "currentColor"), e.appendChild(i), this.node = e;
|
|
3873
3873
|
}
|
|
3874
3874
|
}
|
|
3875
|
-
class
|
|
3875
|
+
class Ra extends et {
|
|
3876
3876
|
constructor({ x: e, ...i }, n) {
|
|
3877
3877
|
super(i);
|
|
3878
|
-
|
|
3878
|
+
c(this, "_colors");
|
|
3879
3879
|
this._colors = n.colorScheme.comments.scaleAnchor, this.state = {
|
|
3880
3880
|
x: e,
|
|
3881
3881
|
y: n.layout.xAxis.top,
|
|
3882
3882
|
isActive: !1
|
|
3883
|
-
}, this.node.append(new
|
|
3883
|
+
}, this.node.append(new Ha().node), this.render();
|
|
3884
3884
|
}
|
|
3885
3885
|
render() {
|
|
3886
3886
|
const { x: e, y: i, isActive: n } = this.state;
|
|
3887
3887
|
this.position({ x: e, y: i });
|
|
3888
|
-
const
|
|
3889
|
-
this.node.style.backgroundColor = this._colors[`bg${
|
|
3888
|
+
const a = n ? "Active" : "Inactive";
|
|
3889
|
+
this.node.style.backgroundColor = this._colors[`bg${a}`], this.node.style.color = this._colors[`icon${a}`];
|
|
3890
3890
|
}
|
|
3891
3891
|
}
|
|
3892
3892
|
const We = new q("comment-box");
|
|
3893
|
-
class
|
|
3894
|
-
constructor({ boxId: e, model: i, view: n, comments:
|
|
3893
|
+
class za extends et {
|
|
3894
|
+
constructor({ boxId: e, model: i, view: n, comments: a, coords: r, onBoxActivate: l, onBoxDeactivate: h }) {
|
|
3895
3895
|
super({ className: We.gen() });
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
this._boxId = e, this._onBoxActivate = l, this._onBoxDeactivate =
|
|
3896
|
+
c(this, "pointer", new S({ className: "sc-charts-cs__comments-pointer" }));
|
|
3897
|
+
c(this, "tooltip");
|
|
3898
|
+
c(this, "anchor");
|
|
3899
|
+
c(this, "_onBoxActivate");
|
|
3900
|
+
c(this, "_onBoxDeactivate");
|
|
3901
|
+
c(this, "_boxId");
|
|
3902
|
+
this._boxId = e, this._onBoxActivate = l, this._onBoxDeactivate = h, this.state = {
|
|
3903
3903
|
isActive: !1,
|
|
3904
|
-
comments:
|
|
3905
|
-
coords:
|
|
3906
|
-
}, this.pointer.position(
|
|
3907
|
-
const
|
|
3908
|
-
|
|
3909
|
-
}), this.tooltip = ie(new
|
|
3910
|
-
this.state.isActive && (this.anchor.node.contains(
|
|
3904
|
+
comments: a,
|
|
3905
|
+
coords: r
|
|
3906
|
+
}, this.pointer.position(r), this.anchor = new Ra({ x: r.x, className: We.gen("anchor") }, i), this.anchor.node.addEventListener("click", () => {
|
|
3907
|
+
const d = !this.state.isActive;
|
|
3908
|
+
d ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: d });
|
|
3909
|
+
}), this.tooltip = ie(new Ba(a, i, n), (d) => {
|
|
3910
|
+
this.state.isActive && (this.anchor.node.contains(d.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
|
|
3911
3911
|
}), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
|
|
3912
3912
|
}
|
|
3913
3913
|
render() {
|
|
@@ -3915,36 +3915,36 @@ class zr extends et {
|
|
|
3915
3915
|
this.pointer.position(n), this.pointer.setVisible(e), this.anchor.setState({ x: n.x, isActive: e }), this.tooltip.setState({ comments: i, isShow: e });
|
|
3916
3916
|
}
|
|
3917
3917
|
}
|
|
3918
|
-
class $
|
|
3918
|
+
class $a {
|
|
3919
3919
|
static animateTo(t, e, i, n) {
|
|
3920
|
-
const
|
|
3921
|
-
const p = m -
|
|
3920
|
+
const a = t.scales.panOffsetX + (t.layout.area.width / 2 - e), r = t.scales.panOffsetY + (t.layout.area.height / 2 - i), l = 300, h = performance.now(), d = t.scales.panOffsetX, g = t.scales.panOffsetY, _ = (m) => {
|
|
3921
|
+
const p = m - h, v = Math.min(p / l, 1), b = v * v * (3 - 2 * v), x = d + (a - d) * b, C = g + (r - g) * b;
|
|
3922
3922
|
t.scales.pan("x", x, "absolute"), t.scales.pan("y", C, "absolute"), v < 1 ? requestAnimationFrame(_) : n == null || n();
|
|
3923
3923
|
};
|
|
3924
3924
|
requestAnimationFrame(_);
|
|
3925
3925
|
}
|
|
3926
3926
|
static animateToDataCoords(t, e, i, n) {
|
|
3927
|
-
const
|
|
3928
|
-
this.animateTo(t,
|
|
3927
|
+
const a = typeof e == "number" ? t.scales.x.convert(new Date(e)) : t.scales.x.convert(e), r = t.scales.y.convert(i);
|
|
3928
|
+
this.animateTo(t, a, r, n);
|
|
3929
3929
|
}
|
|
3930
3930
|
}
|
|
3931
|
-
const
|
|
3931
|
+
const Pa = {
|
|
3932
3932
|
"right-bottom": { dx: 1, dy: 1 },
|
|
3933
3933
|
"left-top": { dx: -1, dy: -1 },
|
|
3934
3934
|
"right-top": { dx: 1, dy: -1 },
|
|
3935
3935
|
"left-bottom": { dx: -1, dy: 1 }
|
|
3936
|
-
},
|
|
3936
|
+
}, Oa = ({
|
|
3937
3937
|
size: s,
|
|
3938
3938
|
parent: t,
|
|
3939
3939
|
coords: e,
|
|
3940
3940
|
prioritySide: i = "right-bottom",
|
|
3941
3941
|
offset: n = 8
|
|
3942
3942
|
}) => {
|
|
3943
|
-
const { width:
|
|
3944
|
-
const { dx: y, dy: T } =
|
|
3943
|
+
const { width: a, height: r } = s, l = t.right - t.left, h = t.bottom - t.top, d = (w) => {
|
|
3944
|
+
const { dx: y, dy: T } = Pa[w], D = e.x + (y === 1 ? n : -a - n), N = e.y + (T === 1 ? n : -r - n);
|
|
3945
3945
|
return { x: D, y: N, side: w };
|
|
3946
|
-
}, g = ({ x: w, y }) => w >= 0 && y >= 0 && w +
|
|
3947
|
-
const w = e.y < 0, y = e.y +
|
|
3946
|
+
}, g = ({ x: w, y }) => w >= 0 && y >= 0 && w + a <= l && y + r <= h, _ = () => {
|
|
3947
|
+
const w = e.y < 0, y = e.y + r > h, T = e.x < 0, D = e.x + a > l;
|
|
3948
3948
|
return T && w ? "right-bottom" : T && y ? "right-top" : D && w ? "left-bottom" : D && y ? "left-top" : T ? "right-bottom" : D ? "left-bottom" : w ? "right-bottom" : y ? "right-top" : i;
|
|
3949
3949
|
}, p = [
|
|
3950
3950
|
i,
|
|
@@ -3955,29 +3955,29 @@ const Pr = {
|
|
|
3955
3955
|
].filter((w, y, T) => T.indexOf(w) === y), v = _();
|
|
3956
3956
|
let b = null;
|
|
3957
3957
|
for (const w of [v, ...p]) {
|
|
3958
|
-
const y =
|
|
3958
|
+
const y = d(w);
|
|
3959
3959
|
if (g(y)) {
|
|
3960
3960
|
b = y;
|
|
3961
3961
|
break;
|
|
3962
3962
|
}
|
|
3963
3963
|
}
|
|
3964
|
-
b || (b =
|
|
3965
|
-
const x = Math.min(Math.max(b.x, n), l -
|
|
3964
|
+
b || (b = d(v));
|
|
3965
|
+
const x = Math.min(Math.max(b.x, n), l - a - n), C = Math.min(Math.max(b.y, n), h - r - n);
|
|
3966
3966
|
return {
|
|
3967
3967
|
x,
|
|
3968
3968
|
y: C,
|
|
3969
3969
|
side: b.side
|
|
3970
3970
|
};
|
|
3971
3971
|
}, te = new q("comments-context");
|
|
3972
|
-
class
|
|
3972
|
+
class Ya extends et {
|
|
3973
3973
|
constructor() {
|
|
3974
3974
|
super({ className: te.gen() });
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3975
|
+
c(this, "pointer");
|
|
3976
|
+
c(this, "addField");
|
|
3977
|
+
c(this, "menu");
|
|
3978
|
+
c(this, "_size", null);
|
|
3979
|
+
c(this, "_model", null);
|
|
3980
|
+
c(this, "_candle", null);
|
|
3981
3981
|
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new S({ className: te.gen("pointer") }), this.menu = new S({ className: te.gen("menu") }), ie(this.menu, () => {
|
|
3982
3982
|
this.setState({ isShow: !1 });
|
|
3983
3983
|
}), this.addField = new ts({
|
|
@@ -4000,27 +4000,27 @@ class Yr extends et {
|
|
|
4000
4000
|
const { candle: e, isShow: i, model: n } = this.state;
|
|
4001
4001
|
if (this.setVisible(i), !n || !e) return;
|
|
4002
4002
|
this._model = n, this._candle = e;
|
|
4003
|
-
const
|
|
4003
|
+
const a = {
|
|
4004
4004
|
x: n == null ? void 0 : n.scales.x.convert(e.open_time),
|
|
4005
4005
|
y: n == null ? void 0 : n.scales.y.convert((e.open + e.close) / 2)
|
|
4006
4006
|
};
|
|
4007
|
-
this.pointer.position(
|
|
4008
|
-
const
|
|
4007
|
+
this.pointer.position(a), this._size || (this.menu.position(a), this.menu.updateAbsolutePosition());
|
|
4008
|
+
const r = Oa({
|
|
4009
4009
|
size: this.menu.absolutePosition,
|
|
4010
4010
|
parent: n.layout.area,
|
|
4011
4011
|
offset: 9,
|
|
4012
|
-
coords:
|
|
4012
|
+
coords: a
|
|
4013
4013
|
});
|
|
4014
|
-
this._changeInputCorner(
|
|
4014
|
+
this._changeInputCorner(r.side), this.menu.position(r.x, r.y);
|
|
4015
4015
|
}
|
|
4016
4016
|
}
|
|
4017
|
-
class
|
|
4017
|
+
class ja {
|
|
4018
4018
|
constructor(t, e) {
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
this._container = new S({ className: e }), this._contextMenu = new
|
|
4019
|
+
c(this, "_container");
|
|
4020
|
+
c(this, "_boxes", {});
|
|
4021
|
+
c(this, "_contextMenu");
|
|
4022
|
+
c(this, "_view");
|
|
4023
|
+
this._container = new S({ className: e }), this._contextMenu = new Ya(), this._view = t, t.domElements.append(this._container.node, this._contextMenu.node);
|
|
4024
4024
|
}
|
|
4025
4025
|
_getCandleCoords(t, e) {
|
|
4026
4026
|
return {
|
|
@@ -4029,26 +4029,26 @@ class jr {
|
|
|
4029
4029
|
};
|
|
4030
4030
|
}
|
|
4031
4031
|
createBox({ boxId: t, coords: e, model: i, comments: n }) {
|
|
4032
|
-
const
|
|
4032
|
+
const a = new za({
|
|
4033
4033
|
boxId: t,
|
|
4034
4034
|
model: i,
|
|
4035
4035
|
comments: n,
|
|
4036
4036
|
coords: e,
|
|
4037
4037
|
view: this._view,
|
|
4038
|
-
onBoxActivate: (
|
|
4038
|
+
onBoxActivate: (r) => {
|
|
4039
4039
|
const l = n[0].candle;
|
|
4040
|
-
$
|
|
4040
|
+
$a.animateToDataCoords(i, l.open_time, (l.open + l.close) / 2), this._boxes[r].setState({ isActive: !0 });
|
|
4041
4041
|
},
|
|
4042
|
-
onBoxDeactivate: (
|
|
4042
|
+
onBoxDeactivate: (r) => this._boxes[r].setState({ isActive: !1 })
|
|
4043
4043
|
});
|
|
4044
|
-
this._boxes[t] =
|
|
4044
|
+
this._boxes[t] = a, this._container.append(a.node);
|
|
4045
4045
|
}
|
|
4046
4046
|
render(t) {
|
|
4047
4047
|
this._contextMenu.setState({ model: t }), this._contextMenu.forceUpdate();
|
|
4048
4048
|
const e = t.comments.grouped, i = new Set(Object.keys(e));
|
|
4049
|
-
Object.entries(e).forEach(([n,
|
|
4050
|
-
const
|
|
4051
|
-
this._boxes[n] ? this._boxes[n].setState({ comments:
|
|
4049
|
+
Object.entries(e).forEach(([n, a]) => {
|
|
4050
|
+
const r = this._getCandleCoords(t, a[0].candle), l = { boxId: n, coords: r, comments: a };
|
|
4051
|
+
this._boxes[n] ? this._boxes[n].setState({ comments: a, coords: r }) : this.createBox({ ...l, model: t });
|
|
4052
4052
|
}), Object.keys(this._boxes).forEach((n) => {
|
|
4053
4053
|
i.has(n) || (this._boxes[n].node.remove(), delete this._boxes[n]);
|
|
4054
4054
|
});
|
|
@@ -4060,22 +4060,22 @@ class jr {
|
|
|
4060
4060
|
return this._boxes;
|
|
4061
4061
|
}
|
|
4062
4062
|
}
|
|
4063
|
-
class
|
|
4063
|
+
class Xa {
|
|
4064
4064
|
constructor(t) {
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4065
|
+
c(this, "_container");
|
|
4066
|
+
c(this, "_width");
|
|
4067
|
+
c(this, "_height");
|
|
4068
|
+
c(this, "_wrapper");
|
|
4069
|
+
c(this, "_domElements");
|
|
4070
|
+
c(this, "_canvasesContainer");
|
|
4071
|
+
c(this, "_mainCanvas");
|
|
4072
|
+
c(this, "_guidesCanvas");
|
|
4073
|
+
c(this, "_bindingManager");
|
|
4074
|
+
c(this, "_userMarkers");
|
|
4075
|
+
c(this, "_guideMarkers");
|
|
4076
|
+
c(this, "_trade");
|
|
4077
|
+
c(this, "_noDataTooltip");
|
|
4078
|
+
c(this, "_comments");
|
|
4079
4079
|
this._container = t, this._wrapper = new S({ tag: "div", className: "sc-charts-cs" }), t.append(this._wrapper.node);
|
|
4080
4080
|
const { width: e, height: i } = t.getBoundingClientRect();
|
|
4081
4081
|
this._width = e, this._height = i, this._mainCanvas = new St({
|
|
@@ -4083,12 +4083,12 @@ class Xr {
|
|
|
4083
4083
|
width: e,
|
|
4084
4084
|
height: i,
|
|
4085
4085
|
isMain: !0
|
|
4086
|
-
}), this._guidesCanvas = new St({ className: "sc-charts-cs__canvas-guides", width: e, height: i }), this._domElements = new S({ tag: "div", className: "sc-charts-cs__dom-elements" }), this._canvasesContainer = new S({ tag: "div", className: "sc-charts-cs__canvases" }), this._noDataTooltip = new
|
|
4086
|
+
}), this._guidesCanvas = new St({ className: "sc-charts-cs__canvas-guides", width: e, height: i }), this._domElements = new S({ tag: "div", className: "sc-charts-cs__dom-elements" }), this._canvasesContainer = new S({ tag: "div", className: "sc-charts-cs__canvases" }), this._noDataTooltip = new Ca(), this._canvasesContainer.append(this._mainCanvas.node), this._wrapper.append(this._canvasesContainer.node, this._domElements.node), this._mainCanvas.updateAbsolutePosition(), this._bindingManager = new ra(this._mainCanvas.node), this._userMarkers = new wa(this, "sc-charts-cs__user-markers"), this._comments = new ja(this, "sc-charts-cs__comments"), this._trade = new xa({
|
|
4087
4087
|
width: e,
|
|
4088
4088
|
height: i,
|
|
4089
4089
|
canvasParent: this._canvasesContainer,
|
|
4090
4090
|
domParent: this._domElements
|
|
4091
|
-
}), this._guideMarkers = new
|
|
4091
|
+
}), this._guideMarkers = new oa(this._domElements, this._guidesCanvas), this._domElements.append(this._noDataTooltip.node), this._canvasesContainer.append(this._guidesCanvas.node);
|
|
4092
4092
|
}
|
|
4093
4093
|
get container() {
|
|
4094
4094
|
return this._container;
|
|
@@ -4133,12 +4133,12 @@ class Xr {
|
|
|
4133
4133
|
return this._comments;
|
|
4134
4134
|
}
|
|
4135
4135
|
renderAll(t) {
|
|
4136
|
-
this._mainCanvas.clear(),
|
|
4136
|
+
this._mainCanvas.clear(), ea.renderAll(this._mainCanvas.ctx, t), qt.xAxis(this._mainCanvas.ctx, t), qt.yAxis(this._mainCanvas.ctx, t), qt.intersection(this._mainCanvas.ctx, t), this._trade.renderAll(t), this._userMarkers.render(t.userMarkers.data), this._comments.render(t);
|
|
4137
4137
|
}
|
|
4138
4138
|
}
|
|
4139
|
-
class
|
|
4139
|
+
class Wa {
|
|
4140
4140
|
constructor(t) {
|
|
4141
|
-
|
|
4141
|
+
c(this, "logColors", {
|
|
4142
4142
|
init_model: "color: green",
|
|
4143
4143
|
scale_event: "color: orange",
|
|
4144
4144
|
update_config: "color: blue",
|
|
@@ -4147,7 +4147,7 @@ class Wr {
|
|
|
4147
4147
|
update_user_markers: "color: brown",
|
|
4148
4148
|
update_color_scheme: "color: teal"
|
|
4149
4149
|
});
|
|
4150
|
-
|
|
4150
|
+
c(this, "ignoredLogEvents", []);
|
|
4151
4151
|
t && (this.ignoredLogEvents = t);
|
|
4152
4152
|
}
|
|
4153
4153
|
log(t, e) {
|
|
@@ -4162,13 +4162,13 @@ class Wr {
|
|
|
4162
4162
|
console.log(`%c[SUBSCRIBE] ${t}`, i, n);
|
|
4163
4163
|
}
|
|
4164
4164
|
}
|
|
4165
|
-
class
|
|
4165
|
+
class Va {
|
|
4166
4166
|
constructor(t, e) {
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
this._model = t, this._view = e, this._enableLogging = !1, this._logger = new
|
|
4167
|
+
c(this, "_model");
|
|
4168
|
+
c(this, "_view");
|
|
4169
|
+
c(this, "_enableLogging");
|
|
4170
|
+
c(this, "_logger");
|
|
4171
|
+
this._model = t, this._view = e, this._enableLogging = !1, this._logger = new Wa(["scale_event"]);
|
|
4172
4172
|
}
|
|
4173
4173
|
subscribeWithLogging(t, e) {
|
|
4174
4174
|
const i = (n) => {
|
|
@@ -4211,16 +4211,16 @@ class Vr {
|
|
|
4211
4211
|
}
|
|
4212
4212
|
class Ve {
|
|
4213
4213
|
constructor() {
|
|
4214
|
-
|
|
4214
|
+
c(this, "_map", /* @__PURE__ */ new Map());
|
|
4215
4215
|
}
|
|
4216
4216
|
add(t, e, i) {
|
|
4217
4217
|
let n = this._map.get(t);
|
|
4218
4218
|
n || (n = {}, this._map.set(t, n)), n[e] || (n[e] = /* @__PURE__ */ new Set()), n[e].add(i);
|
|
4219
4219
|
}
|
|
4220
4220
|
remove(t, e, i) {
|
|
4221
|
-
var
|
|
4221
|
+
var a;
|
|
4222
4222
|
const n = this._map.get(t);
|
|
4223
|
-
(
|
|
4223
|
+
(a = n == null ? void 0 : n[e]) == null || a.delete(i);
|
|
4224
4224
|
}
|
|
4225
4225
|
removeAll(t) {
|
|
4226
4226
|
this._map.delete(t);
|
|
@@ -4228,24 +4228,24 @@ class Ve {
|
|
|
4228
4228
|
emit(t, e) {
|
|
4229
4229
|
const i = this._map.get(t), n = i == null ? void 0 : i[e.type];
|
|
4230
4230
|
if (!n) return !1;
|
|
4231
|
-
let
|
|
4232
|
-
const
|
|
4231
|
+
let a = !1;
|
|
4232
|
+
const r = {
|
|
4233
4233
|
...e,
|
|
4234
4234
|
stopPropagation: () => {
|
|
4235
|
-
|
|
4235
|
+
a = !0;
|
|
4236
4236
|
}
|
|
4237
4237
|
};
|
|
4238
4238
|
for (const l of n)
|
|
4239
|
-
if (l(
|
|
4240
|
-
return
|
|
4239
|
+
if (l(r), a) break;
|
|
4240
|
+
return a;
|
|
4241
4241
|
}
|
|
4242
4242
|
}
|
|
4243
|
-
class
|
|
4243
|
+
class Ga {
|
|
4244
4244
|
constructor() {
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4245
|
+
c(this, "_elements", []);
|
|
4246
|
+
c(this, "_listeners", new Ve());
|
|
4247
|
+
c(this, "_lastHovered", /* @__PURE__ */ new Set());
|
|
4248
|
+
c(this, "_dragContext", null);
|
|
4249
4249
|
}
|
|
4250
4250
|
get isDragging() {
|
|
4251
4251
|
return this._dragContext !== null;
|
|
@@ -4277,23 +4277,23 @@ class Gr {
|
|
|
4277
4277
|
}), this._dragContext.lastX = t, this._dragContext.lastY = e;
|
|
4278
4278
|
return;
|
|
4279
4279
|
}
|
|
4280
|
-
const i = this._getHitsAt(t, e), n = new Set(i.map((
|
|
4281
|
-
for (const
|
|
4282
|
-
if (!this._lastHovered.has(
|
|
4280
|
+
const i = this._getHitsAt(t, e), n = new Set(i.map((a) => a.target));
|
|
4281
|
+
for (const a of i)
|
|
4282
|
+
if (!this._lastHovered.has(a.target) && this._emitSingle(a.target, {
|
|
4283
4283
|
type: "mouseover",
|
|
4284
|
-
target:
|
|
4285
|
-
x:
|
|
4286
|
-
y:
|
|
4287
|
-
}) || this._emitSingle(
|
|
4284
|
+
target: a.target,
|
|
4285
|
+
x: a.x,
|
|
4286
|
+
y: a.y
|
|
4287
|
+
}) || this._emitSingle(a.target, {
|
|
4288
4288
|
type: "mousemove",
|
|
4289
|
-
target:
|
|
4290
|
-
x:
|
|
4291
|
-
y:
|
|
4289
|
+
target: a.target,
|
|
4290
|
+
x: a.x,
|
|
4291
|
+
y: a.y
|
|
4292
4292
|
})) break;
|
|
4293
|
-
for (const
|
|
4294
|
-
n.has(
|
|
4293
|
+
for (const a of this._lastHovered)
|
|
4294
|
+
n.has(a) || this._emitSingle(a, {
|
|
4295
4295
|
type: "mouseleave",
|
|
4296
|
-
target:
|
|
4296
|
+
target: a,
|
|
4297
4297
|
x: t,
|
|
4298
4298
|
y: e
|
|
4299
4299
|
});
|
|
@@ -4356,9 +4356,9 @@ class Gr {
|
|
|
4356
4356
|
y: n.y
|
|
4357
4357
|
})) break;
|
|
4358
4358
|
}
|
|
4359
|
-
dispatchWheel(t, e, i, n,
|
|
4360
|
-
const
|
|
4361
|
-
for (const l of
|
|
4359
|
+
dispatchWheel(t, e, i, n, a) {
|
|
4360
|
+
const r = this._getHitsAt(t, e);
|
|
4361
|
+
for (const l of r)
|
|
4362
4362
|
if (this._emitSingle(l.target, {
|
|
4363
4363
|
type: "wheel",
|
|
4364
4364
|
target: l.target,
|
|
@@ -4366,7 +4366,7 @@ class Gr {
|
|
|
4366
4366
|
y: l.y,
|
|
4367
4367
|
deltaX: i,
|
|
4368
4368
|
deltaY: n,
|
|
4369
|
-
deltaZ:
|
|
4369
|
+
deltaZ: a
|
|
4370
4370
|
})) break;
|
|
4371
4371
|
}
|
|
4372
4372
|
hitTestAll(t, e) {
|
|
@@ -4386,20 +4386,20 @@ class Gr {
|
|
|
4386
4386
|
return this._listeners.emit(t, n), i;
|
|
4387
4387
|
}
|
|
4388
4388
|
}
|
|
4389
|
-
class
|
|
4389
|
+
class Ua {
|
|
4390
4390
|
constructor(t) {
|
|
4391
4391
|
this.model = t;
|
|
4392
4392
|
}
|
|
4393
4393
|
hitTest(t, e) {
|
|
4394
4394
|
const {
|
|
4395
4395
|
candles: { missingData: i },
|
|
4396
|
-
scales: { x: n, y:
|
|
4396
|
+
scales: { x: n, y: a },
|
|
4397
4397
|
config: {
|
|
4398
|
-
candles: { baseWidth:
|
|
4398
|
+
candles: { baseWidth: r }
|
|
4399
4399
|
}
|
|
4400
4400
|
} = this.model;
|
|
4401
4401
|
for (const l of i) {
|
|
4402
|
-
const
|
|
4402
|
+
const h = n.convert(l.open_time), d = a.convert(l.high), g = a.convert(l.low), _ = h - r / 2, m = h + r / 2, p = Math.min(d, g), v = Math.max(d, g);
|
|
4403
4403
|
if (t >= _ && t <= m && e >= p && e <= v)
|
|
4404
4404
|
return {
|
|
4405
4405
|
target: this,
|
|
@@ -4412,12 +4412,12 @@ class Ur {
|
|
|
4412
4412
|
return null;
|
|
4413
4413
|
}
|
|
4414
4414
|
}
|
|
4415
|
-
class
|
|
4415
|
+
class Za {
|
|
4416
4416
|
constructor(t, e) {
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
this._model = t, this._hitManager = e, this._hit = new
|
|
4417
|
+
c(this, "_model");
|
|
4418
|
+
c(this, "_hitManager");
|
|
4419
|
+
c(this, "_hit");
|
|
4420
|
+
this._model = t, this._hitManager = e, this._hit = new Ua(t), this._hitManager.register(this._hit);
|
|
4421
4421
|
}
|
|
4422
4422
|
register() {
|
|
4423
4423
|
this._hitManager.on(this._hit, "mouseover", (t) => {
|
|
@@ -4430,18 +4430,18 @@ class Zr {
|
|
|
4430
4430
|
});
|
|
4431
4431
|
}
|
|
4432
4432
|
}
|
|
4433
|
-
class
|
|
4433
|
+
class qa {
|
|
4434
4434
|
constructor(t) {
|
|
4435
4435
|
this.model = t;
|
|
4436
4436
|
}
|
|
4437
4437
|
hitTest(t, e) {
|
|
4438
|
-
const { tradedCandles: i } = this.model.trade, { x: n, y:
|
|
4439
|
-
for (const { candle:
|
|
4440
|
-
const _ = n.convert(
|
|
4438
|
+
const { tradedCandles: i } = this.model.trade, { x: n, y: a } = this.model.scales, r = 16, l = 4;
|
|
4439
|
+
for (const { candle: h, trades: d } of i) {
|
|
4440
|
+
const _ = n.convert(h.open_time) + this.model.config.candles.baseWidth / 2, m = r, p = r;
|
|
4441
4441
|
for (const v of ["buy", "sell"]) {
|
|
4442
|
-
const b =
|
|
4442
|
+
const b = d.filter((y) => y.type === v);
|
|
4443
4443
|
if (!b.length) continue;
|
|
4444
|
-
const x = v === "buy" ?
|
|
4444
|
+
const x = v === "buy" ? a.convert(h.low) + l + Dt(r) : a.convert(h.high) - l - r - Dt(r), C = t >= _ - m / 2 && t <= _ + m / 2, w = e >= x && e <= x + p;
|
|
4445
4445
|
if (C && w)
|
|
4446
4446
|
return {
|
|
4447
4447
|
target: this,
|
|
@@ -4449,7 +4449,7 @@ class qr {
|
|
|
4449
4449
|
tradeType: v,
|
|
4450
4450
|
x: t,
|
|
4451
4451
|
y: e,
|
|
4452
|
-
candle:
|
|
4452
|
+
candle: h,
|
|
4453
4453
|
trades: b
|
|
4454
4454
|
};
|
|
4455
4455
|
}
|
|
@@ -4457,12 +4457,12 @@ class qr {
|
|
|
4457
4457
|
return null;
|
|
4458
4458
|
}
|
|
4459
4459
|
}
|
|
4460
|
-
class
|
|
4460
|
+
class Ja {
|
|
4461
4461
|
constructor(t, e) {
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
this._model = t, this._hitManager = e, this._tradeLabelHit = new
|
|
4462
|
+
c(this, "_model");
|
|
4463
|
+
c(this, "_hitManager");
|
|
4464
|
+
c(this, "_tradeLabelHit");
|
|
4465
|
+
this._model = t, this._hitManager = e, this._tradeLabelHit = new qa(t), this._hitManager.register(this._tradeLabelHit);
|
|
4466
4466
|
}
|
|
4467
4467
|
register() {
|
|
4468
4468
|
this._hitManager.on(this._tradeLabelHit, "click", (t) => {
|
|
@@ -4470,11 +4470,11 @@ class Jr {
|
|
|
4470
4470
|
if (!e) return;
|
|
4471
4471
|
const i = this._model.scales.x.convert(e.candle.open_time), n = this._model.scales.y.convert(
|
|
4472
4472
|
e.trades[0].type === "buy" ? e.candle.low : e.candle.high
|
|
4473
|
-
),
|
|
4473
|
+
), a = e.trades[0].type === "buy" ? n + 4 + Dt(16) + 8 : n - 4 - 16 - Dt(16) + 8;
|
|
4474
4474
|
this._model.eventBus.emit("open_trade_label_tooltip", {
|
|
4475
4475
|
trade: { candle: e.candle, trades: e.trades, tradeType: e.tradeType },
|
|
4476
4476
|
x: i,
|
|
4477
|
-
y:
|
|
4477
|
+
y: a
|
|
4478
4478
|
});
|
|
4479
4479
|
}), this._hitManager.on(this._tradeLabelHit, "mouseover", (t) => {
|
|
4480
4480
|
const e = this._tradeLabelHit.hitTest(t.x, t.y);
|
|
@@ -4488,7 +4488,7 @@ class Jr {
|
|
|
4488
4488
|
});
|
|
4489
4489
|
}
|
|
4490
4490
|
}
|
|
4491
|
-
class
|
|
4491
|
+
class Qa {
|
|
4492
4492
|
constructor(t) {
|
|
4493
4493
|
this.model = t;
|
|
4494
4494
|
}
|
|
@@ -4502,7 +4502,7 @@ class Qr {
|
|
|
4502
4502
|
} : null;
|
|
4503
4503
|
}
|
|
4504
4504
|
}
|
|
4505
|
-
class
|
|
4505
|
+
class Ka {
|
|
4506
4506
|
constructor(t) {
|
|
4507
4507
|
this.model = t;
|
|
4508
4508
|
}
|
|
@@ -4516,7 +4516,7 @@ class Kr {
|
|
|
4516
4516
|
} : null;
|
|
4517
4517
|
}
|
|
4518
4518
|
}
|
|
4519
|
-
class
|
|
4519
|
+
class tr {
|
|
4520
4520
|
constructor(t) {
|
|
4521
4521
|
this.model = t;
|
|
4522
4522
|
}
|
|
@@ -4530,45 +4530,45 @@ class ta {
|
|
|
4530
4530
|
} : null;
|
|
4531
4531
|
}
|
|
4532
4532
|
}
|
|
4533
|
-
class
|
|
4533
|
+
class er {
|
|
4534
4534
|
constructor(t, e) {
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
this._model = t, this._hitManager = e, this._hit = new
|
|
4535
|
+
c(this, "_model");
|
|
4536
|
+
c(this, "_hitManager");
|
|
4537
|
+
c(this, "_hit");
|
|
4538
|
+
this._model = t, this._hitManager = e, this._hit = new Qa(t), this._hitManager.register(this._hit);
|
|
4539
4539
|
}
|
|
4540
4540
|
register() {
|
|
4541
4541
|
this._hitManager.on(this._hit, "drag", (t) => {
|
|
4542
4542
|
const e = t.x - (t.prevX ?? t.x);
|
|
4543
|
-
this._model.scales.scale("x", e);
|
|
4543
|
+
this._model.scales.scale("x", -e);
|
|
4544
4544
|
}), this._hitManager.on(this._hit, "dblclick", () => {
|
|
4545
4545
|
this._model.scales.scale("x", 1, "absolute"), this._model.scales.pan("x", 0, "absolute");
|
|
4546
4546
|
});
|
|
4547
4547
|
}
|
|
4548
4548
|
}
|
|
4549
|
-
class
|
|
4549
|
+
class sr {
|
|
4550
4550
|
constructor(t, e) {
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
this._model = t, this._hitManager = e, this._hit = new
|
|
4551
|
+
c(this, "_model");
|
|
4552
|
+
c(this, "_hitManager");
|
|
4553
|
+
c(this, "_hit");
|
|
4554
|
+
this._model = t, this._hitManager = e, this._hit = new tr(t), this._hitManager.register(this._hit);
|
|
4555
4555
|
}
|
|
4556
4556
|
register() {
|
|
4557
4557
|
this._hitManager.on(this._hit, "drag", (t) => {
|
|
4558
4558
|
const e = t.y - (t.prevY ?? t.y);
|
|
4559
|
-
this._model.scales.scale("y", e);
|
|
4559
|
+
this._model.scales.scale("y", -e);
|
|
4560
4560
|
}), this._hitManager.on(this._hit, "dblclick", () => {
|
|
4561
4561
|
this._model.scales.fitYToVisibleCandles();
|
|
4562
4562
|
});
|
|
4563
4563
|
}
|
|
4564
4564
|
}
|
|
4565
|
-
class
|
|
4565
|
+
class ir {
|
|
4566
4566
|
constructor(t, e, i) {
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
this._model = t, this._view = e, this._hitManager = i, this._hit = new
|
|
4567
|
+
c(this, "_model");
|
|
4568
|
+
c(this, "_view");
|
|
4569
|
+
c(this, "_hitManager");
|
|
4570
|
+
c(this, "_hit");
|
|
4571
|
+
this._model = t, this._view = e, this._hitManager = i, this._hit = new Ka(t), this._hitManager.register(this._hit);
|
|
4572
4572
|
}
|
|
4573
4573
|
register() {
|
|
4574
4574
|
this._hitManager.on(this._hit, "mousemove", (t) => {
|
|
@@ -4585,39 +4585,39 @@ class ia {
|
|
|
4585
4585
|
candle: i
|
|
4586
4586
|
}), this._view.comments.render(this._model));
|
|
4587
4587
|
}), this._hitManager.on(this._hit, "wheel", (t) => {
|
|
4588
|
-
var n,
|
|
4588
|
+
var n, a;
|
|
4589
4589
|
if (!t.deltaY) return;
|
|
4590
|
-
const e = -t.deltaY, i = (
|
|
4590
|
+
const e = -t.deltaY, i = (a = (n = this._model.config) == null ? void 0 : n.candles) == null ? void 0 : a.zoomOnWheel;
|
|
4591
4591
|
["x", "both"].includes(i) && this._model.scales.scale("x", e), ["y", "both"].includes(i) && this._model.scales.scale("y", e);
|
|
4592
4592
|
});
|
|
4593
4593
|
}
|
|
4594
4594
|
}
|
|
4595
|
-
class
|
|
4595
|
+
class nr {
|
|
4596
4596
|
constructor(t, e, i) {
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
this._hitManager = i, this._candlesHandler = new
|
|
4597
|
+
c(this, "_hitManager");
|
|
4598
|
+
c(this, "_candlesHandler");
|
|
4599
|
+
c(this, "_tradeLabelsHandler");
|
|
4600
|
+
c(this, "_xAxisHandler");
|
|
4601
|
+
c(this, "_yAxisHandler");
|
|
4602
|
+
c(this, "_areaHandler");
|
|
4603
|
+
this._hitManager = i, this._candlesHandler = new Za(t, this._hitManager), this._tradeLabelsHandler = new Ja(t, this._hitManager), this._xAxisHandler = new er(t, this._hitManager), this._yAxisHandler = new sr(t, this._hitManager), this._areaHandler = new ir(t, e, this._hitManager);
|
|
4604
4604
|
}
|
|
4605
4605
|
register() {
|
|
4606
4606
|
this._candlesHandler.register(), this._tradeLabelsHandler.register(), this._xAxisHandler.register(), this._yAxisHandler.register(), this._areaHandler.register();
|
|
4607
4607
|
}
|
|
4608
4608
|
}
|
|
4609
|
-
class
|
|
4609
|
+
class ar {
|
|
4610
4610
|
constructor(t, e) {
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
this._model = t, this._view = e, this._subscriptionsManager = new
|
|
4611
|
+
c(this, "_model");
|
|
4612
|
+
c(this, "_view");
|
|
4613
|
+
c(this, "_subscriptionsManager");
|
|
4614
|
+
c(this, "_hitManager", new Ga());
|
|
4615
|
+
c(this, "_boundMouseMove", this.onDocumentMouseMove.bind(this));
|
|
4616
|
+
c(this, "_boundMouseUp", this.onDocumentMouseUp.bind(this));
|
|
4617
|
+
this._model = t, this._view = e, this._subscriptionsManager = new Va(t, e);
|
|
4618
4618
|
}
|
|
4619
4619
|
init() {
|
|
4620
|
-
this._subscriptionsManager.init(), this._model.init(), this._view.binding.mousemove(this.onMouseMove.bind(this)), this._view.binding.mousedown(this.onMouseDown.bind(this)), this._view.binding.mouseup(this.onMouseUp.bind(this)), this._view.binding.wheel(this.onWheel.bind(this)), this._view.binding.mouseleave(this.onMouseLeave.bind(this)), this._view.binding.dblclick(this.onDoubleClick.bind(this)), this._view.binding.contextmenu(this.onContextMenu.bind(this)), window.addEventListener("scroll", this.onWindowScroll.bind(this), { passive: !0 }), document.addEventListener("click", this.onDocumentClick.bind(this)), new
|
|
4620
|
+
this._subscriptionsManager.init(), this._model.init(), this._view.binding.mousemove(this.onMouseMove.bind(this)), this._view.binding.mousedown(this.onMouseDown.bind(this)), this._view.binding.mouseup(this.onMouseUp.bind(this)), this._view.binding.wheel(this.onWheel.bind(this)), this._view.binding.mouseleave(this.onMouseLeave.bind(this)), this._view.binding.dblclick(this.onDoubleClick.bind(this)), this._view.binding.contextmenu(this.onContextMenu.bind(this)), window.addEventListener("scroll", this.onWindowScroll.bind(this), { passive: !0 }), document.addEventListener("click", this.onDocumentClick.bind(this)), new nr(this._model, this._view, this._hitManager).register();
|
|
4621
4621
|
}
|
|
4622
4622
|
onContextMenu(t) {
|
|
4623
4623
|
t.preventDefault();
|
|
@@ -4661,25 +4661,25 @@ class ra {
|
|
|
4661
4661
|
this._hitManager.dispatchMouseUp(e, i), document.removeEventListener("mouseup", this._boundMouseUp), document.removeEventListener("mousemove", this._boundMouseMove);
|
|
4662
4662
|
}
|
|
4663
4663
|
onMouseMove(t) {
|
|
4664
|
-
var
|
|
4664
|
+
var a;
|
|
4665
4665
|
if (!this._hitManager.isDragging) {
|
|
4666
|
-
const { x:
|
|
4667
|
-
this._hitManager.dispatchMouseMove(
|
|
4666
|
+
const { x: r, y: l } = this.getMouseRelative(t);
|
|
4667
|
+
this._hitManager.dispatchMouseMove(r, l);
|
|
4668
4668
|
}
|
|
4669
4669
|
const { x: e, y: i } = this.getMouseRelative(t), n = this._hitManager.hitTestAll(e, i);
|
|
4670
|
-
(
|
|
4670
|
+
(a = n[0]) != null && a.type && (n[0].type === "area" ? this._view.mainCanvas.node.style.cursor = "crosshair" : n[0].type === "trade-label" ? this._view.mainCanvas.node.style.cursor = "pointer" : n[0].type === "x-axis" ? this._view.mainCanvas.node.style.cursor = "ew-resize" : n[0].type === "y-axis" ? this._view.mainCanvas.node.style.cursor = "ns-resize" : this._view.mainCanvas.node.style.cursor = "default");
|
|
4671
4671
|
}
|
|
4672
4672
|
onWheel(t) {
|
|
4673
4673
|
t.preventDefault(), this._hitManager.dispatchWheel(t.offsetX, t.offsetY, t.deltaX, t.deltaY, t.deltaZ);
|
|
4674
4674
|
}
|
|
4675
4675
|
}
|
|
4676
|
-
class
|
|
4677
|
-
constructor(t, { chartId: e, candles: i, config: n, trade:
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
const
|
|
4682
|
-
if (!
|
|
4676
|
+
class lr {
|
|
4677
|
+
constructor(t, { chartId: e, candles: i, config: n, trade: a, userMarkers: r, colorScheme: l, comments: h }) {
|
|
4678
|
+
c(this, "_model");
|
|
4679
|
+
c(this, "_view");
|
|
4680
|
+
c(this, "_controller");
|
|
4681
|
+
const d = document.querySelector(t);
|
|
4682
|
+
if (!d) throw new Error(`Element with selector "${t}" not found!`);
|
|
4683
4683
|
if (!e || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e))
|
|
4684
4684
|
throw new Error(
|
|
4685
4685
|
"chartId is required and must be a valid id (only letters, numbers or underscores. The first character must be a letter)"
|
|
@@ -4688,12 +4688,12 @@ class la {
|
|
|
4688
4688
|
chartId: e,
|
|
4689
4689
|
candles: i,
|
|
4690
4690
|
config: n,
|
|
4691
|
-
container:
|
|
4692
|
-
trade:
|
|
4693
|
-
userMarkers:
|
|
4691
|
+
container: d,
|
|
4692
|
+
trade: a,
|
|
4693
|
+
userMarkers: r,
|
|
4694
4694
|
colorScheme: l,
|
|
4695
|
-
comments:
|
|
4696
|
-
}), this._view = new
|
|
4695
|
+
comments: h
|
|
4696
|
+
}), this._view = new Xa(d), this._controller = new ar(this._model, this._view), this._controller.init();
|
|
4697
4697
|
}
|
|
4698
4698
|
updateConfig(t) {
|
|
4699
4699
|
this._model.updateConfig(t);
|
|
@@ -4715,7 +4715,7 @@ class la {
|
|
|
4715
4715
|
}
|
|
4716
4716
|
}
|
|
4717
4717
|
export {
|
|
4718
|
-
|
|
4719
|
-
|
|
4718
|
+
lr as CandlestickChart,
|
|
4719
|
+
or as createLineChart
|
|
4720
4720
|
};
|
|
4721
4721
|
//# sourceMappingURL=charts-core.js.map
|