charts-core 1.1.24 → 1.1.26
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 +840 -817
- 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,40 +1,40 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var f = (i, e, t) =>
|
|
4
|
-
import * as
|
|
5
|
-
const
|
|
6
|
-
const { svg: e, config: t, y: s, width: n } = i, { margin: a, yAxis: r } = t, { customTicks: o, tickFormat: c, tickValues: h, ticks:
|
|
1
|
+
var Ns = Object.defineProperty;
|
|
2
|
+
var Fs = (i, e, t) => e in i ? Ns(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var f = (i, e, t) => Fs(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import * as L from "d3";
|
|
5
|
+
const Hs = (i) => {
|
|
6
|
+
const { svg: e, config: t, y: s, width: n } = i, { margin: a, yAxis: r } = t, { customTicks: o, tickFormat: c, tickValues: h, ticks: d, isShow: g } = r;
|
|
7
7
|
if (!g) return null;
|
|
8
|
-
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((
|
|
9
|
-
let
|
|
10
|
-
o && c ?
|
|
8
|
+
e.append("g").attr("transform", `translate(${n - a.right},0)`).call((_) => {
|
|
9
|
+
let p = L.axisRight(s);
|
|
10
|
+
o && c ? p = p.tickFormat(c) : p = p.tickFormat((v) => {
|
|
11
11
|
const b = Number(v), w = (x) => x.toString().replace(/\.0+$/, "");
|
|
12
12
|
return Math.abs(b) >= 1e12 ? w(b / 1e12) + "T" : Math.abs(b) >= 1e9 ? w(b / 1e9) + "B" : Math.abs(b) >= 1e6 ? w(b / 1e6) + "M" : Math.abs(b) >= 1e3 ? w(b / 1e3) + "K" : w(b);
|
|
13
|
-
}), o &&
|
|
14
|
-
}).call((
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
}).call((
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const v =
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
const y =
|
|
24
|
-
C.attr("x",
|
|
13
|
+
}), o && d && (p = Array.isArray(d) ? p.ticks(...d) : p.ticks(d)), o && h && (p = p.tickValues(h)), _.call(p);
|
|
14
|
+
}).call((_) => {
|
|
15
|
+
let p = [];
|
|
16
|
+
_.selectAll(".tick").each((v) => p.push(v)), i.yTicks = p;
|
|
17
|
+
}).call((_) => _.select(".domain").remove()).call((_) => _.selectAll(".tick line").remove()).call((_) => {
|
|
18
|
+
const p = _.selectAll(".tick text");
|
|
19
|
+
p.classed("sc-charts__y-axis-tick", !0).attr("text-anchor", "start");
|
|
20
|
+
const v = p.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
|
|
21
|
+
_.selectAll(".tick").each(function(w, x) {
|
|
22
|
+
var $;
|
|
23
|
+
const y = L.select(this), C = y.select("text"), M = v[x], S = b - M, N = y.append("g").attr("transform", "translate(10, 0)");
|
|
24
|
+
C.attr("x", S), C.remove(), ($ = N.node()) == null || $.appendChild(C.node());
|
|
25
25
|
});
|
|
26
26
|
}).attr("font-family", "inherit");
|
|
27
|
-
}, Hs = (i) => {
|
|
28
|
-
const { svg: e, config: t, x: s, height: n } = i, { margin: a, xAxis: r } = t, { isShow: o, tickValues: c, tickFormat: h, customTicks: u, ticks: g } = r;
|
|
29
|
-
if (!o) return null;
|
|
30
|
-
e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((p) => {
|
|
31
|
-
let _ = D.axisBottom(s);
|
|
32
|
-
u ? (h && (_ = _.tickFormat(h)), g && (_ = Array.isArray(g) ? _.ticks(...g) : _.ticks(g)), c && (_ = _.tickValues(c))) : _.ticks(5), p.call(_);
|
|
33
|
-
}).call((p) => p.select(".domain").remove()).call((p) => {
|
|
34
|
-
let _ = [];
|
|
35
|
-
p.selectAll(".tick").each((v) => _.push(v)), i.xTicks = _;
|
|
36
|
-
}).call((p) => p.selectAll(".tick line").remove()).call((p) => p.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
|
|
37
27
|
}, Bs = (i) => {
|
|
28
|
+
const { svg: e, config: t, x: s, height: n } = i, { margin: a, xAxis: r } = t, { isShow: o, tickValues: c, tickFormat: h, customTicks: d, ticks: g } = r;
|
|
29
|
+
if (!o) return null;
|
|
30
|
+
e.append("g").attr("transform", `translate(0,${n - a.bottom})`).call((_) => {
|
|
31
|
+
let p = L.axisBottom(s);
|
|
32
|
+
d ? (h && (p = p.tickFormat(h)), g && (p = Array.isArray(g) ? p.ticks(...g) : p.ticks(g)), c && (p = p.tickValues(c))) : p.ticks(5), _.call(p);
|
|
33
|
+
}).call((_) => _.select(".domain").remove()).call((_) => {
|
|
34
|
+
let p = [];
|
|
35
|
+
_.selectAll(".tick").each((v) => p.push(v)), i.xTicks = p;
|
|
36
|
+
}).call((_) => _.selectAll(".tick line").remove()).call((_) => _.selectAll(".tick text").classed("sc-charts__x-axis-tick", !0)).attr("font-family", "inherit");
|
|
37
|
+
}, Is = (i) => {
|
|
38
38
|
const { svg: e, config: t, y: s, width: n } = i, {
|
|
39
39
|
margin: a,
|
|
40
40
|
grid: { horizontalStyle: r }
|
|
@@ -49,7 +49,7 @@ const Fs = (i) => {
|
|
|
49
49
|
r === "every-line-dashed" && h.attr("stroke-dasharray", "4 4");
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
},
|
|
52
|
+
}, _i = (i) => {
|
|
53
53
|
const e = Array.from(i.childNodes);
|
|
54
54
|
for (let t = 0; t < e.length; t++)
|
|
55
55
|
i.removeChild(e[t]);
|
|
@@ -89,61 +89,69 @@ function Os(i, e, t, s) {
|
|
|
89
89
|
const n = i.width / 2, a = e - n, r = e + n;
|
|
90
90
|
return a < t ? t : r > s ? s - i.width : e - n;
|
|
91
91
|
}
|
|
92
|
-
const
|
|
92
|
+
const qt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e).attr("x2", t).attr("y1", s).attr("y2", n).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1), Ps = (i) => {
|
|
93
93
|
const { svg: e, config: t, x: s, y: n, height: a, data: r, wrapperNode: o } = i, {
|
|
94
94
|
margin: c,
|
|
95
|
-
grid: { verticalStyle: h, tooltipNode:
|
|
95
|
+
grid: { verticalStyle: h, tooltipNode: d, hoverCirclesRadius: g, hoverCirclesAdditionalArea: _ }
|
|
96
96
|
} = t;
|
|
97
|
-
if (h !== "none" && (h.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((v) => {
|
|
97
|
+
if (i.gridHoverTooltip = null, h !== "none" && (h.startsWith("every-line") && (i.xTicks || s.ticks()).forEach((v) => {
|
|
98
98
|
const b = e.append("line").attr("x1", s(v)).attr("x2", s(v)).attr("y1", c.top).attr("y2", a - c.bottom).attr("stroke", "var(--sc-color-axis-zero-line)").attr("stroke-width", 1);
|
|
99
99
|
h === "every-line-dashed" && b.attr("stroke-dasharray", "4 4");
|
|
100
100
|
}), h === "hovered-circles")) {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Rs(o)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
const p = n.range()[0], v = s(r[0].date), b = s(r[r.length - 1].date);
|
|
102
|
+
qt(e, { x1: v, x2: b, y1: p, y2: p });
|
|
103
|
+
const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Rs(o), C = (S) => {
|
|
104
|
+
if (!d) return;
|
|
105
|
+
_i(x), w.style.display = "block", x.append(d({ date: S.date, value: S.value }));
|
|
106
|
+
const N = x.getBoundingClientRect(), $ = Os(
|
|
107
|
+
N,
|
|
108
|
+
s(S.date),
|
|
109
|
+
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
110
|
+
i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
|
|
111
|
+
);
|
|
112
|
+
$ !== null && (x.style.left = $ + "px"), y.style.left = s(S.date) + "px";
|
|
113
|
+
}, M = () => {
|
|
114
|
+
w.style.display = "none";
|
|
115
|
+
};
|
|
116
|
+
i.gridHoverTooltip = d ? {
|
|
117
|
+
show: (S) => C(S),
|
|
118
|
+
hide: M
|
|
119
|
+
} : null, r.forEach((S, N) => {
|
|
120
|
+
const $ = s(S.date), z = n(S.value), V = r[N - 1], Y = N > 0 && V && S.value === V.value;
|
|
121
|
+
Y || qt(e, { x1: $, x2: $, y1: z, y2: p });
|
|
122
|
+
const re = $s(e, Y, {
|
|
123
|
+
x: $,
|
|
124
|
+
y: p,
|
|
110
125
|
r: g,
|
|
111
|
-
hr:
|
|
126
|
+
hr: _
|
|
112
127
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const U = x.getBoundingClientRect(), re = Os(
|
|
116
|
-
U,
|
|
117
|
-
s(C.date),
|
|
118
|
-
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
119
|
-
i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
|
|
120
|
-
);
|
|
121
|
-
x.style.left = re + "px", y.style.left = s(C.date) + "px";
|
|
128
|
+
d && re.on("mouseover", function() {
|
|
129
|
+
C({ date: S.date, value: Y ? null : S.value });
|
|
122
130
|
}).on("mouseout", function() {
|
|
123
|
-
|
|
131
|
+
M();
|
|
124
132
|
});
|
|
125
133
|
});
|
|
126
134
|
}
|
|
127
135
|
}, zs = (i) => {
|
|
128
|
-
|
|
136
|
+
Is(i), Ps(i);
|
|
129
137
|
}, Vs = (i) => {
|
|
130
138
|
const { svg: e, config: t, width: s, height: n } = i, { margin: a, logo: r } = t;
|
|
131
|
-
|
|
132
|
-
},
|
|
139
|
+
Bs(i), Hs(i), r && e.append("image").attr("xlink:href", t.theme === "dark" ? r.picDarkTheme : r.picLightTheme).attr("width", r.width).attr("height", r.height).attr("x", r.x ?? (s - a.left - a.right) / 2 - r.width / 2 + a.left).attr("y", r.y ?? (n - a.top - a.bottom) / 2 - r.height / 2 + a.top), zs(i);
|
|
140
|
+
}, Le = (i, e, t) => {
|
|
133
141
|
let s = i.select(`#${e}`);
|
|
134
142
|
return s.empty() && (s = i.append("linearGradient").attr("gradientUnits", "userSpaceOnUse").attr("id", e)), s.attr("x1", t.x1).attr("y1", t.x2).attr("x2", t.y1).attr("y2", t.y2), t.stops.forEach(({ offset: n, stopColor: a }) => {
|
|
135
143
|
s.append("stop").attr("offset", n).attr("stop-color", a);
|
|
136
144
|
}), s;
|
|
137
|
-
},
|
|
138
|
-
const e =
|
|
139
|
-
return e.empty() ?
|
|
140
|
-
},
|
|
145
|
+
}, _e = (i) => {
|
|
146
|
+
const e = L.select(i).select("defs");
|
|
147
|
+
return e.empty() ? L.select(i).append("defs") : e;
|
|
148
|
+
}, St = (i) => {
|
|
141
149
|
const {
|
|
142
150
|
y: e,
|
|
143
151
|
config: { margin: t }
|
|
144
152
|
} = i, s = e.range()[0] - e(0), n = e.range()[0] - s >= 0 ? e.range()[0] - s : 0, a = s + t.bottom >= 0 ? s + t.bottom : 0;
|
|
145
153
|
return { x: 0, y: n, width: "100%", height: a };
|
|
146
|
-
},
|
|
154
|
+
}, Jt = (i, e) => ({
|
|
147
155
|
...i,
|
|
148
156
|
...e,
|
|
149
157
|
margin: {
|
|
@@ -178,8 +186,8 @@ const Zt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
178
186
|
...i.selection,
|
|
179
187
|
...e == null ? void 0 : e.selection
|
|
180
188
|
}
|
|
181
|
-
}),
|
|
182
|
-
const t = i.node(), s =
|
|
189
|
+
}), Qt = (i, e = {}) => {
|
|
190
|
+
const t = i.node(), s = _e(t), n = (o, c) => Le(s, o, {
|
|
183
191
|
x1: "0%",
|
|
184
192
|
y1: "0%",
|
|
185
193
|
x2: "0%",
|
|
@@ -197,14 +205,14 @@ const Zt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
197
205
|
className(o, c) {
|
|
198
206
|
o === "remove" ? r.classed(`${a}${c}`, !1) : r.classed(`${a}${c}`, !0);
|
|
199
207
|
},
|
|
200
|
-
update({ x1: o, x2: c, y1: h, y2:
|
|
201
|
-
o !== void 0 && r.attr("x1", o), c !== void 0 && r.attr("x2", c), h !== void 0 && r.attr("y1", h),
|
|
208
|
+
update({ x1: o, x2: c, y1: h, y2: d, hidden: g }) {
|
|
209
|
+
o !== void 0 && r.attr("x1", o), c !== void 0 && r.attr("x2", c), h !== void 0 && r.attr("y1", h), d !== void 0 && r.attr("y2", d), g !== void 0 && r.style("display", g ? "none" : "block");
|
|
202
210
|
},
|
|
203
211
|
destroy() {
|
|
204
212
|
r.remove();
|
|
205
213
|
}
|
|
206
214
|
};
|
|
207
|
-
},
|
|
215
|
+
}, pt = (i, e = {}) => {
|
|
208
216
|
const t = i.append("circle").attr("r", e.radius || 4).style("display", e.hidden ? "none" : "block"), s = e.className || "";
|
|
209
217
|
return s && t.classed(s, !0), {
|
|
210
218
|
className(n, a) {
|
|
@@ -218,8 +226,8 @@ const Zt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
218
226
|
}
|
|
219
227
|
};
|
|
220
228
|
}, Ys = (i, e = {}) => {
|
|
221
|
-
const t = "sc-charts__hover-line", s = i.append("line").style("display", e.hidden ? "none" : "block").classed(t, !0), n = i.node(), a =
|
|
222
|
-
return ((o, c) =>
|
|
229
|
+
const t = "sc-charts__hover-line", s = i.append("line").style("display", e.hidden ? "none" : "block").classed(t, !0), n = i.node(), a = _e(n);
|
|
230
|
+
return ((o, c) => Le(a, o, {
|
|
223
231
|
x1: "0%",
|
|
224
232
|
y1: "0%",
|
|
225
233
|
x2: "0%",
|
|
@@ -234,15 +242,15 @@ const Zt = (i, { x1: e, x2: t, y1: s, y2: n }) => i.append("line").attr("x1", e)
|
|
|
234
242
|
className(o, c) {
|
|
235
243
|
o === "remove" ? s.classed(`${t}${c}`, !1) : s.classed(`${t}${c}`, !0);
|
|
236
244
|
},
|
|
237
|
-
update({ x1: o, x2: c, y1: h, y2:
|
|
238
|
-
o !== void 0 && s.attr("x1", o), c !== void 0 && s.attr("x2", c), h !== void 0 && s.attr("y1", h),
|
|
245
|
+
update({ x1: o, x2: c, y1: h, y2: d, hidden: g }) {
|
|
246
|
+
o !== void 0 && s.attr("x1", o), c !== void 0 && s.attr("x2", c), h !== void 0 && s.attr("y1", h), d !== void 0 && s.attr("y2", d), g !== void 0 && s.style("display", g ? "none" : "block");
|
|
239
247
|
},
|
|
240
248
|
destroy() {
|
|
241
249
|
s.remove();
|
|
242
250
|
}
|
|
243
251
|
};
|
|
244
|
-
}, fe = "sc-charts__range-tooltip",
|
|
245
|
-
const e =
|
|
252
|
+
}, fe = "sc-charts__range-tooltip", Kt = L.timeFormat("%b %e, %I:%M %p"), Ws = (i) => {
|
|
253
|
+
const e = L.format(",.2f");
|
|
246
254
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
247
255
|
};
|
|
248
256
|
function js(i) {
|
|
@@ -274,19 +282,19 @@ const Xs = (i) => {
|
|
|
274
282
|
},
|
|
275
283
|
update({ leftPoint: n, rightPoint: a, x: r, y: o, hidden: c, closest: h }) {
|
|
276
284
|
if (n && a && h && r !== void 0) {
|
|
277
|
-
const
|
|
285
|
+
const d = a.value - n.value, { sumFormatter: g, timeFormatter: _ } = i.config.selection, p = (i.x(a.date) + i.x(n.date)) / 2, v = i.x(h.date) < p ? "left" : "right";
|
|
278
286
|
let b = "", w = "";
|
|
279
287
|
if (g)
|
|
280
288
|
b = g({ left: n.value, right: a.value, direction: v });
|
|
281
289
|
else {
|
|
282
|
-
const x = (
|
|
283
|
-
b = `${Ws(
|
|
290
|
+
const x = (d / Math.abs(n.value) * 100).toFixed(2);
|
|
291
|
+
b = `${Ws(d)} (${x}%)`;
|
|
284
292
|
}
|
|
285
|
-
|
|
286
|
-
const x = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date),
|
|
287
|
-
let
|
|
288
|
-
const
|
|
289
|
-
|
|
293
|
+
_ ? w = _({ left: n.date, right: a.date, direction: v }) : w = `${Kt(n.date)} to ${Kt(a.date)}`, t.textContent = b, s.textContent = w, requestAnimationFrame(() => {
|
|
294
|
+
const x = e.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), M = i.x(a.date);
|
|
295
|
+
let N = (C + M) / 2 - x.width / 2;
|
|
296
|
+
const $ = 0, z = y.width - x.width;
|
|
297
|
+
N < $ && (N = $), N > z && (N = z), e.style.left = `${N}px`, e.style.top = `${o}px`;
|
|
290
298
|
});
|
|
291
299
|
}
|
|
292
300
|
c !== void 0 && (e.style.display = c ? "none" : "block");
|
|
@@ -295,40 +303,46 @@ const Xs = (i) => {
|
|
|
295
303
|
e.remove();
|
|
296
304
|
}
|
|
297
305
|
};
|
|
298
|
-
},
|
|
299
|
-
const e =
|
|
306
|
+
}, ke = "sc-charts__hover-tooltip", _t = 16, Us = L.timeFormat("%a, %b %d, %-I:%M %p"), Gs = (i) => {
|
|
307
|
+
const e = L.format(",.2f");
|
|
300
308
|
return `${i < 0 ? "-" : ""}$${e(Math.abs(i))}`;
|
|
301
309
|
};
|
|
302
310
|
function Zs(i) {
|
|
303
311
|
const e = document.createElement("div");
|
|
304
|
-
e.className = `${
|
|
312
|
+
e.className = `${ke}-container`, e.style.position = "absolute", e.style.top = "0", e.style.pointerEvents = "none", e.style.display = "none", i.appendChild(e);
|
|
305
313
|
const t = document.createElement("div");
|
|
306
|
-
t.className = `${
|
|
314
|
+
t.className = `${ke}-sum`;
|
|
307
315
|
const s = document.createElement("div");
|
|
308
|
-
return s.className = `${
|
|
316
|
+
return s.className = `${ke}-time`, { wrapper: e, sumNode: t, timeNode: s };
|
|
309
317
|
}
|
|
310
318
|
function qs(i, e, t) {
|
|
311
|
-
return i ? e +
|
|
319
|
+
return i ? e + _t + i.width < t ? e + _t : e - _t - i.width : null;
|
|
312
320
|
}
|
|
313
321
|
const Js = (i) => {
|
|
314
|
-
const { wrapper: e, sumNode: t, timeNode: s } = Zs(i.wrapperNode)
|
|
322
|
+
const { wrapper: e, sumNode: t, timeNode: s } = Zs(i.wrapperNode), n = () => {
|
|
323
|
+
t.parentNode || (e.appendChild(t), e.appendChild(s));
|
|
324
|
+
};
|
|
315
325
|
return {
|
|
316
|
-
className(
|
|
317
|
-
|
|
326
|
+
className(a, r) {
|
|
327
|
+
a === "remove" ? e.classList.remove(`${ke}${r}`) : e.classList.add(`${ke}${r}`);
|
|
318
328
|
},
|
|
319
|
-
update({ hidden:
|
|
320
|
-
if (
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
329
|
+
update({ hidden: a, dataItem: r }) {
|
|
330
|
+
if (!i.config.hover.showDefaultTooltip) {
|
|
331
|
+
e.style.display = "none";
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (r) {
|
|
335
|
+
const { sumFormatter: o, timeFormatter: c, tooltipNode: h } = i.config.hover;
|
|
336
|
+
h ? (_i(e), e.appendChild(h({ date: r.date, value: r.value }))) : (n(), t.textContent = o ? o(r.value) : Gs(r.value), s.textContent = c ? c(r.date) : Us(r.date)), requestAnimationFrame(() => {
|
|
337
|
+
const d = e.getBoundingClientRect(), g = qs(
|
|
338
|
+
d,
|
|
339
|
+
i.x(r.date),
|
|
326
340
|
i.width - i.config.margin.right
|
|
327
341
|
);
|
|
328
|
-
|
|
342
|
+
g && (e.style.left = g + "px");
|
|
329
343
|
});
|
|
330
344
|
}
|
|
331
|
-
|
|
345
|
+
a !== void 0 && (e.style.display = a ? "none" : "block");
|
|
332
346
|
},
|
|
333
347
|
destroy() {
|
|
334
348
|
e.remove();
|
|
@@ -353,8 +367,11 @@ const Js = (i) => {
|
|
|
353
367
|
range: "1m",
|
|
354
368
|
transitionDuration: 150,
|
|
355
369
|
transitionName: "default",
|
|
370
|
+
highlightRange: !0,
|
|
371
|
+
showDefaultTooltip: !0,
|
|
356
372
|
sumFormatter: null,
|
|
357
|
-
timeFormatter: null
|
|
373
|
+
timeFormatter: null,
|
|
374
|
+
tooltipNode: null
|
|
358
375
|
},
|
|
359
376
|
selection: {
|
|
360
377
|
enable: !0,
|
|
@@ -385,9 +402,9 @@ const Js = (i) => {
|
|
|
385
402
|
},
|
|
386
403
|
enableBelowZeroLine: !1,
|
|
387
404
|
curveTension: 1
|
|
388
|
-
}, tt = (
|
|
389
|
-
const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o =
|
|
390
|
-
|
|
405
|
+
}, tt = () => L.curveMonotoneX, Ks = (i) => {
|
|
406
|
+
const { svg: e, data: t, x: s, y: n, config: a } = i, r = e.node(), o = _e(r);
|
|
407
|
+
Le(o, "main-line-area-gradient", {
|
|
391
408
|
x1: "0%",
|
|
392
409
|
y1: "0%",
|
|
393
410
|
x2: "0%",
|
|
@@ -397,15 +414,15 @@ const Js = (i) => {
|
|
|
397
414
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
398
415
|
]
|
|
399
416
|
});
|
|
400
|
-
const h =
|
|
417
|
+
const h = L.area().x((_) => s(_.date)).y0(n.range()[0]).y1((_) => n(_.value)).curve(tt()), d = "sc-charts__main-line-area", g = e.append("path").datum(t).attr("d", h).attr("class", d).classed(`${d}_hidden`, !a.hasMainLineArea);
|
|
401
418
|
return {
|
|
402
|
-
className(
|
|
403
|
-
|
|
419
|
+
className(_, p) {
|
|
420
|
+
_ === "remove" ? g.classed(`${d}${p}`, !1) : g.classed(`${d}${p}`, !0);
|
|
404
421
|
},
|
|
405
|
-
update({ data:
|
|
406
|
-
if (
|
|
422
|
+
update({ data: _, hidden: p }) {
|
|
423
|
+
if (_ !== void 0 && g.datum(_).attr("d", h), p !== void 0) {
|
|
407
424
|
if (!a.hasMainLineArea) return null;
|
|
408
|
-
g.classed(`${
|
|
425
|
+
g.classed(`${d}_hidden`, p);
|
|
409
426
|
}
|
|
410
427
|
},
|
|
411
428
|
destroy() {
|
|
@@ -413,8 +430,8 @@ const Js = (i) => {
|
|
|
413
430
|
}
|
|
414
431
|
};
|
|
415
432
|
}, en = (i, e = {}) => {
|
|
416
|
-
const t = "sc-charts__range-line-area", { svg: s, x: n, y: a, config: r, data: o, chartId: c } = i, { clip: h } = e,
|
|
417
|
-
|
|
433
|
+
const t = "sc-charts__range-line-area", { svg: s, x: n, y: a, config: r, data: o, chartId: c } = i, { clip: h } = e, d = s.node(), g = _e(d), _ = "range-line-area-gradient";
|
|
434
|
+
Le(g, _ + "_up", {
|
|
418
435
|
x1: "0%",
|
|
419
436
|
y1: "0%",
|
|
420
437
|
x2: "0%",
|
|
@@ -423,7 +440,7 @@ const Js = (i) => {
|
|
|
423
440
|
{ offset: "0%", stopColor: "var(--sc-color-selection-up)" },
|
|
424
441
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
425
442
|
]
|
|
426
|
-
}),
|
|
443
|
+
}), Le(g, _ + "_down", {
|
|
427
444
|
x1: "0%",
|
|
428
445
|
y1: "0%",
|
|
429
446
|
x2: "0%",
|
|
@@ -433,39 +450,39 @@ const Js = (i) => {
|
|
|
433
450
|
{ offset: "100%", stopColor: "rgba(255, 255, 255, 0)" }
|
|
434
451
|
]
|
|
435
452
|
});
|
|
436
|
-
const
|
|
453
|
+
const p = L.area().x((y) => n(y.date)).y0(a.range()[0]).y1((y) => a(y.value)).curve(tt()), v = `${c}-clip-${t}`, w = g.append("clipPath").attr("id", v).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), x = s.append("path").datum(o).attr("d", p).attr("class", t).classed(`${t}_hidden`, !r.hasMainLineArea).attr("clip-path", `url(#${v})`);
|
|
437
454
|
return {
|
|
438
455
|
className(y, C) {
|
|
439
456
|
y === "remove" ? x.classed(`${t}${C}`, !1) : x.classed(`${t}${C}`, !0);
|
|
440
457
|
},
|
|
441
|
-
update({ data: y, hidden: C, clip:
|
|
442
|
-
y !== void 0 && x.datum(y).attr("d",
|
|
458
|
+
update({ data: y, hidden: C, clip: M }) {
|
|
459
|
+
y !== void 0 && x.datum(y).attr("d", p), C !== void 0 && x.classed(`${t}_hidden`, C), M !== void 0 && w.attr("x", M.x).attr("y", M.y).attr("width", M.width).attr("height", M.height);
|
|
443
460
|
},
|
|
444
461
|
destroy() {
|
|
445
462
|
x.remove();
|
|
446
463
|
}
|
|
447
464
|
};
|
|
448
465
|
}, vt = (i, e) => {
|
|
449
|
-
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e,
|
|
466
|
+
const { svg: t, data: s, x: n, y: a, chartId: r } = i, { baseClassName: o, id: c, clip: h } = e, d = t.node(), g = _e(d), _ = L.line().x((x) => n(x.date)).y((x) => a(x.value)).curve(tt()), p = `${r}-clip-${o}`, b = g.append("clipPath").attr("id", p).append("rect").attr("x", (h == null ? void 0 : h.x) || 0).attr("y", (h == null ? void 0 : h.y) || 0).attr("width", (h == null ? void 0 : h.width) || "100%").attr("height", (h == null ? void 0 : h.height) || "100%"), w = t.append("path").classed(o, !0).datum(s).attr("d", _).attr("id", c).attr("clip-path", `url(#${p})`);
|
|
450
467
|
return {
|
|
451
468
|
className(x, y) {
|
|
452
469
|
x === "remove" ? w.classed(`${o}${y}`, !1) : w.classed(`${o}${y}`, !0);
|
|
453
470
|
},
|
|
454
471
|
update({ data: x, clip: y, hidden: C }) {
|
|
455
|
-
x !== void 0 && w.datum(x).attr("d",
|
|
472
|
+
x !== void 0 && w.datum(x).attr("d", _), C !== void 0 && w.classed(`${o}_hidden`, C), y !== void 0 && b.attr("x", y.x).attr("y", y.y).attr("width", y.width).attr("height", y.height);
|
|
456
473
|
},
|
|
457
474
|
destroy() {
|
|
458
475
|
w.remove();
|
|
459
476
|
}
|
|
460
477
|
};
|
|
461
478
|
}, tn = (i, e) => {
|
|
462
|
-
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip:
|
|
479
|
+
const { svg: t, data: s, x: n, y: a, chartId: r, config: o } = i, { baseClassName: c, id: h, clip: d } = e, g = t.node(), _ = _e(g), p = L.line().x((y) => n(y.date)).y((y) => a(y.value)).curve(tt()), v = `${r}-clip-${c}`, w = _.append("clipPath").attr("id", v).append("rect").attr("x", (d == null ? void 0 : d.x) || 0).attr("y", (d == null ? void 0 : d.y) || 0).attr("width", (d == null ? void 0 : d.width) || "100%").attr("height", (d == null ? void 0 : d.height) || "100%"), x = t.append("path").classed(c, !0).datum(s).attr("d", p).attr("id", h).attr("clip-path", `url(#${v})`);
|
|
463
480
|
return {
|
|
464
481
|
className(y, C) {
|
|
465
482
|
y === "remove" ? x.classed(`${c}${C}`, !1) : x.classed(`${c}${C}`, !0);
|
|
466
483
|
},
|
|
467
|
-
update({ data: y, clip: C, hidden:
|
|
468
|
-
y !== void 0 && x.datum(y).attr("d",
|
|
484
|
+
update({ data: y, clip: C, hidden: M }) {
|
|
485
|
+
y !== void 0 && x.datum(y).attr("d", p), M !== void 0 && x.classed(`${c}_hidden`, M), C !== void 0 && (o.hover.transitionName === "default" ? w.transition().duration(o.hover.transitionDuration).attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height).ease(L.easeLinear) : w.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
|
|
469
486
|
},
|
|
470
487
|
destroy() {
|
|
471
488
|
x.remove();
|
|
@@ -479,13 +496,13 @@ const Js = (i) => {
|
|
|
479
496
|
const { svg: t, data: s, x: n, y: a } = i, { baseClassName: r } = e, o = t.append("g").classed(r, !0), c = o.append("circle").attr("r", 5).classed(`${r}-circle`, !0), h = o.append("text").attr("text-anchor", "middle").attr("dy", "-9px").classed(`${r}-label`, !0);
|
|
480
497
|
return ((g) => {
|
|
481
498
|
if (!g || g.length === 0) return;
|
|
482
|
-
const
|
|
483
|
-
c.attr("cx",
|
|
499
|
+
const _ = g[g.length - 1], p = n(_.date), v = a(_.value);
|
|
500
|
+
c.attr("cx", p).attr("cy", v);
|
|
484
501
|
const b = i.config.extremePointFormatter || sn;
|
|
485
|
-
h.attr("x",
|
|
502
|
+
h.attr("x", p).attr("y", v).text(b(_.value));
|
|
486
503
|
})(s), {
|
|
487
|
-
className(g,
|
|
488
|
-
g === "remove" ? o.classed(`${r}${
|
|
504
|
+
className(g, _) {
|
|
505
|
+
g === "remove" ? o.classed(`${r}${_}`, !1) : o.classed(`${r}${_}`, !0);
|
|
489
506
|
},
|
|
490
507
|
update({ hidden: g }) {
|
|
491
508
|
g !== void 0 && o.classed(`${r}_hidden`, g);
|
|
@@ -512,33 +529,33 @@ const Js = (i) => {
|
|
|
512
529
|
i.config.enableBelowZeroLine && (r = vt(i, {
|
|
513
530
|
baseClassName: "sc-charts__below-zero-line",
|
|
514
531
|
id: `${i.chartId}-sc-charts__below-zero-line`,
|
|
515
|
-
clip:
|
|
532
|
+
clip: St(i)
|
|
516
533
|
}));
|
|
517
|
-
const o =
|
|
534
|
+
const o = pt(i.svg, {
|
|
518
535
|
className: "sc-charts__hover-circle",
|
|
519
536
|
hidden: !0
|
|
520
|
-
}), c =
|
|
537
|
+
}), c = Qt(i.svg), h = Qt(i.svg), d = vt(i, {
|
|
521
538
|
baseClassName: "sc-charts__range-line",
|
|
522
539
|
id: `${i.chartId}-sc-charts__range-line`,
|
|
523
540
|
clip: { x: 0, y: 0, width: "0", height: "0" }
|
|
524
|
-
}), g =
|
|
541
|
+
}), g = pt(i.svg, {
|
|
525
542
|
className: "sc-charts__range-circle-left",
|
|
526
543
|
hidden: !0
|
|
527
|
-
}),
|
|
544
|
+
}), _ = pt(i.svg, {
|
|
528
545
|
className: "sc-charts__range-circle-right",
|
|
529
546
|
hidden: !0
|
|
530
|
-
}),
|
|
547
|
+
}), p = Xs(i), v = Js(i), b = en(i);
|
|
531
548
|
return {
|
|
532
549
|
hoverLine: n,
|
|
533
550
|
hoverCircle: o,
|
|
534
551
|
rangeBorderLeft: c,
|
|
535
552
|
rangeBorderRight: h,
|
|
536
|
-
rangeLine:
|
|
553
|
+
rangeLine: d,
|
|
537
554
|
rangeLineArea: b,
|
|
538
555
|
rangeCircleLeft: g,
|
|
539
|
-
rangeCircleRight:
|
|
556
|
+
rangeCircleRight: _,
|
|
540
557
|
mainLine: e,
|
|
541
|
-
rangeTooltip:
|
|
558
|
+
rangeTooltip: p,
|
|
542
559
|
highlightLine: a,
|
|
543
560
|
hoverTooltip: v,
|
|
544
561
|
mainLineArea: t,
|
|
@@ -557,22 +574,22 @@ const Js = (i) => {
|
|
|
557
574
|
const [, n, a] = s, r = parseInt(n, 10), [o, c] = t.domain();
|
|
558
575
|
let h = new Date(o);
|
|
559
576
|
for (; h < c; ) {
|
|
560
|
-
let
|
|
577
|
+
let d = new Date(h);
|
|
561
578
|
switch (a) {
|
|
562
579
|
case "M":
|
|
563
|
-
|
|
580
|
+
d.setMinutes(d.getMinutes() + r);
|
|
564
581
|
break;
|
|
565
582
|
case "h":
|
|
566
|
-
|
|
583
|
+
d.setHours(d.getHours() + r);
|
|
567
584
|
break;
|
|
568
585
|
case "d":
|
|
569
|
-
|
|
586
|
+
d.setDate(d.getDate() + r);
|
|
570
587
|
break;
|
|
571
588
|
case "w":
|
|
572
|
-
|
|
589
|
+
d.setDate(d.getDate() + r * 7);
|
|
573
590
|
break;
|
|
574
591
|
case "m":
|
|
575
|
-
|
|
592
|
+
d = new Date(h.getFullYear(), h.getMonth() + r, 1);
|
|
576
593
|
break;
|
|
577
594
|
default:
|
|
578
595
|
return {
|
|
@@ -582,41 +599,41 @@ const Js = (i) => {
|
|
|
582
599
|
height: "100%"
|
|
583
600
|
};
|
|
584
601
|
}
|
|
585
|
-
if (e >= h && e <
|
|
586
|
-
const g = t(h),
|
|
602
|
+
if (e >= h && e < d) {
|
|
603
|
+
const g = t(h), _ = t(d);
|
|
587
604
|
return {
|
|
588
605
|
x: g,
|
|
589
606
|
y: 0,
|
|
590
|
-
width:
|
|
607
|
+
width: _ - g,
|
|
591
608
|
height: "100%"
|
|
592
609
|
};
|
|
593
610
|
}
|
|
594
|
-
h = new Date(
|
|
611
|
+
h = new Date(d);
|
|
595
612
|
}
|
|
596
613
|
if (e.getTime() === c.getTime()) {
|
|
597
|
-
let
|
|
614
|
+
let d = new Date(c);
|
|
598
615
|
switch (a) {
|
|
599
616
|
case "M":
|
|
600
|
-
|
|
617
|
+
d.setMinutes(d.getMinutes() - r);
|
|
601
618
|
break;
|
|
602
619
|
case "h":
|
|
603
|
-
|
|
620
|
+
d.setHours(d.getHours() - r);
|
|
604
621
|
break;
|
|
605
622
|
case "d":
|
|
606
|
-
|
|
623
|
+
d.setDate(d.getDate() - r);
|
|
607
624
|
break;
|
|
608
625
|
case "w":
|
|
609
|
-
|
|
626
|
+
d.setDate(d.getDate() - r * 7);
|
|
610
627
|
break;
|
|
611
628
|
case "m":
|
|
612
|
-
|
|
629
|
+
d = new Date(c.getFullYear(), c.getMonth() - r, 1);
|
|
613
630
|
break;
|
|
614
631
|
}
|
|
615
|
-
const g = t(
|
|
632
|
+
const g = t(d), _ = t(c);
|
|
616
633
|
return {
|
|
617
634
|
x: g,
|
|
618
635
|
y: 0,
|
|
619
|
-
width:
|
|
636
|
+
width: _ - g,
|
|
620
637
|
height: "100%"
|
|
621
638
|
};
|
|
622
639
|
}
|
|
@@ -626,20 +643,20 @@ const Js = (i) => {
|
|
|
626
643
|
width: "100%",
|
|
627
644
|
height: "100%"
|
|
628
645
|
};
|
|
629
|
-
},
|
|
630
|
-
var h;
|
|
646
|
+
}, ei = (i, e) => {
|
|
647
|
+
var c, h, d;
|
|
631
648
|
const {
|
|
632
649
|
x: t,
|
|
633
650
|
y: s,
|
|
634
651
|
elements: n,
|
|
635
|
-
config: { margin: a },
|
|
636
|
-
height:
|
|
652
|
+
config: { margin: a, hover: r },
|
|
653
|
+
height: o
|
|
637
654
|
} = i;
|
|
638
|
-
n.hoverLine.update({
|
|
655
|
+
if (n.hoverLine.update({
|
|
639
656
|
x1: t(e.date),
|
|
640
657
|
x2: t(e.date),
|
|
641
658
|
y1: a.top,
|
|
642
|
-
y2:
|
|
659
|
+
y2: o - a.bottom,
|
|
643
660
|
hidden: !1
|
|
644
661
|
}), n.hoverCircle.update({
|
|
645
662
|
cx: t(e.date),
|
|
@@ -648,25 +665,30 @@ const Js = (i) => {
|
|
|
648
665
|
}), n.hoverTooltip.update({
|
|
649
666
|
dataItem: e,
|
|
650
667
|
hidden: !1
|
|
651
|
-
})
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
}
|
|
666
|
-
|
|
668
|
+
}), r.highlightRange) {
|
|
669
|
+
const g = rn(r.range, e.date, t);
|
|
670
|
+
n.highlightLine.update({
|
|
671
|
+
clip: g,
|
|
672
|
+
hidden: !1
|
|
673
|
+
});
|
|
674
|
+
const _ = s.range()[0] - s(0) + a.bottom;
|
|
675
|
+
_ >= 0 && ((c = n.belowZeroLine) == null || c.update({
|
|
676
|
+
clip: {
|
|
677
|
+
...g,
|
|
678
|
+
y: s(0),
|
|
679
|
+
height: _
|
|
680
|
+
}
|
|
681
|
+
})), n.mainLine.className("add", "_muted");
|
|
682
|
+
} else
|
|
683
|
+
n.highlightLine.update({ hidden: !0 }), n.mainLine.className("remove", "_muted"), (h = n.belowZeroLine) == null || h.update({
|
|
684
|
+
clip: St(i)
|
|
685
|
+
});
|
|
686
|
+
(d = i.gridHoverTooltip) == null || d.show({ date: e.date, value: e.value });
|
|
687
|
+
}, ti = (i) => {
|
|
688
|
+
var t, s;
|
|
667
689
|
const { elements: e } = i;
|
|
668
|
-
e.hoverLine.update({ hidden: !0 }), e.hoverCircle.update({ hidden: !0 }), e.highlightLine.update({ hidden: !0 }), e.mainLine.className("remove", "_muted"), e.hoverTooltip.update({ hidden: !0 }), i.action !== "selection" && ((
|
|
669
|
-
clip:
|
|
690
|
+
e.hoverLine.update({ hidden: !0 }), e.hoverCircle.update({ hidden: !0 }), e.highlightLine.update({ hidden: !0 }), e.mainLine.className("remove", "_muted"), e.hoverTooltip.update({ hidden: !0 }), (t = i.gridHoverTooltip) == null || t.hide(), i.action !== "selection" && ((s = e.belowZeroLine) == null || s.update({
|
|
691
|
+
clip: St(i)
|
|
670
692
|
}));
|
|
671
693
|
}, on = (i, e) => {
|
|
672
694
|
[
|
|
@@ -688,7 +710,7 @@ const Js = (i) => {
|
|
|
688
710
|
config: { margin: a },
|
|
689
711
|
height: r,
|
|
690
712
|
elements: o
|
|
691
|
-
} = i, c = s(e.date) < s(t.date) ? e : t, h = s(e.date) >= s(t.date) ? e : t,
|
|
713
|
+
} = i, c = s(e.date) < s(t.date) ? e : t, h = s(e.date) >= s(t.date) ? e : t, d = h.value - c.value >= 0, g = s(c.date), _ = s(h.date), p = _ - g;
|
|
692
714
|
o.rangeBorderLeft.update({
|
|
693
715
|
x1: g,
|
|
694
716
|
x2: g,
|
|
@@ -696,8 +718,8 @@ const Js = (i) => {
|
|
|
696
718
|
y2: r - a.bottom,
|
|
697
719
|
hidden: !1
|
|
698
720
|
}), o.rangeBorderRight.update({
|
|
699
|
-
x1:
|
|
700
|
-
x2:
|
|
721
|
+
x1: _,
|
|
722
|
+
x2: _,
|
|
701
723
|
y1: a.top,
|
|
702
724
|
y2: r - a.bottom,
|
|
703
725
|
hidden: !1
|
|
@@ -706,14 +728,14 @@ const Js = (i) => {
|
|
|
706
728
|
cy: n(c.value),
|
|
707
729
|
hidden: !1
|
|
708
730
|
}), o.rangeCircleRight.update({
|
|
709
|
-
cx:
|
|
731
|
+
cx: _,
|
|
710
732
|
cy: n(h.value),
|
|
711
733
|
hidden: !1
|
|
712
734
|
}), o.rangeLine.update({
|
|
713
735
|
clip: {
|
|
714
736
|
x: g,
|
|
715
737
|
y: 0,
|
|
716
|
-
width:
|
|
738
|
+
width: p,
|
|
717
739
|
height: n.range()[0]
|
|
718
740
|
},
|
|
719
741
|
hidden: !1
|
|
@@ -721,7 +743,7 @@ const Js = (i) => {
|
|
|
721
743
|
clip: {
|
|
722
744
|
x: g,
|
|
723
745
|
y: 0,
|
|
724
|
-
width:
|
|
746
|
+
width: p,
|
|
725
747
|
height: n.range()[0]
|
|
726
748
|
},
|
|
727
749
|
hidden: !1
|
|
@@ -729,59 +751,59 @@ const Js = (i) => {
|
|
|
729
751
|
rightPoint: h,
|
|
730
752
|
leftPoint: c,
|
|
731
753
|
closest: t,
|
|
732
|
-
x: g +
|
|
754
|
+
x: g + p / 2,
|
|
733
755
|
y: 0,
|
|
734
756
|
hidden: !1
|
|
735
757
|
}), (v = o.belowZeroLine) == null || v.update({
|
|
736
758
|
hidden: !0
|
|
737
|
-
}), o.mainLineArea.update({ hidden: !0 }), on(o,
|
|
738
|
-
},
|
|
759
|
+
}), o.mainLineArea.update({ hidden: !0 }), on(o, d), o.mainLine.className("add", "_selected-muted");
|
|
760
|
+
}, ii = (i) => {
|
|
739
761
|
var t;
|
|
740
762
|
const { elements: e } = i;
|
|
741
763
|
e.rangeLine.update({ hidden: !0 }), e.rangeLineArea.update({ hidden: !0 }), e.rangeBorderLeft.update({ hidden: !0 }), e.rangeBorderRight.update({ hidden: !0 }), e.rangeCircleLeft.update({ hidden: !0 }), e.rangeCircleRight.update({ hidden: !0 }), e.rangeTooltip.update({ hidden: !0 }), e.mainLine.className("remove", "_selected-muted"), e.mainLineArea.update({ hidden: !1 }), (t = e.belowZeroLine) == null || t.update({ hidden: !1 });
|
|
742
764
|
}, cn = (i) => {
|
|
743
765
|
const { svg: e, data: t, x: s, config: n, width: a, height: r } = i, { margin: o, hover: c, selection: h } = n;
|
|
744
|
-
let
|
|
745
|
-
const
|
|
766
|
+
let d = null, g = !1;
|
|
767
|
+
const _ = (v) => t.reduce(
|
|
746
768
|
(b, w) => Math.abs(s(b.date) - v) < Math.abs(s(w.date) - v) ? b : w
|
|
747
769
|
);
|
|
748
770
|
e.append("rect").attr("width", a - o.left - o.right).attr("height", r - o.top - o.bottom).attr("x", o.left).attr("y", o.top).attr("fill", "transparent").on("mousemove", function(v) {
|
|
749
|
-
const [b] =
|
|
750
|
-
!g && c.enable ? (i.action = "hover",
|
|
771
|
+
const [b] = L.pointer(v, this), w = _(b);
|
|
772
|
+
!g && c.enable ? (i.action = "hover", ei(i, w)) : (i.action = g ? "selection" : "none", ti(i)), d && h.enable && (i.action = "selection", ln(i, d, w));
|
|
751
773
|
}).on("mouseleave", () => {
|
|
752
|
-
i.action = "none", g = !1,
|
|
774
|
+
i.action = "none", g = !1, d = null, ti(i), ii(i);
|
|
753
775
|
}).on("mousedown", function(v) {
|
|
754
776
|
if (h.enable) {
|
|
755
777
|
g = !0, i.action = "selection";
|
|
756
|
-
const [b] =
|
|
757
|
-
|
|
778
|
+
const [b] = L.pointer(v, this);
|
|
779
|
+
d = _(b);
|
|
758
780
|
}
|
|
759
781
|
}).on("mouseup", function(v) {
|
|
760
|
-
const [b] =
|
|
761
|
-
g = !1,
|
|
782
|
+
const [b] = L.pointer(v, this), w = _(b);
|
|
783
|
+
g = !1, d = null, i.action = "hover", h.enable && ii(i), c.enable && ei(i, w);
|
|
762
784
|
});
|
|
763
785
|
}, hn = (i, e, t) => {
|
|
764
|
-
const { margin: s } = e, n =
|
|
786
|
+
const { margin: s } = e, n = L.scaleTime(), a = L.extent(i, (r) => new Date(r.date));
|
|
765
787
|
return a[0] == null || a[1] == null ? n : n.domain([a[0], a[1]]).range([s.left, t - s.right]);
|
|
766
788
|
}, dn = (i, e, t) => {
|
|
767
|
-
const { margin: s } = e, n =
|
|
768
|
-
return
|
|
769
|
-
},
|
|
770
|
-
const t =
|
|
789
|
+
const { margin: s } = e, n = L.max(i, (r) => r.value) ?? 0, a = L.min(i, (r) => r.value) ?? 0;
|
|
790
|
+
return L.scaleLinear().domain([a, n]).range([t - s.bottom, s.top]);
|
|
791
|
+
}, pr = (i, e) => {
|
|
792
|
+
const t = L.select(i);
|
|
771
793
|
if (t.empty())
|
|
772
794
|
return console.error(`Element with selector ${i} not found!`), null;
|
|
773
795
|
if (!e.chartId || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e.chartId))
|
|
774
796
|
return console.error(`chartId is required and must be a valid id
|
|
775
797
|
(only letters, numbers or underscores. The first character must be a letter)`), null;
|
|
776
798
|
const s = t.append("div"), n = s.append("svg"), a = t.node();
|
|
777
|
-
let r = a.getBoundingClientRect(), o = r.width, c = r.height, h =
|
|
799
|
+
let r = a.getBoundingClientRect(), o = r.width, c = r.height, h = Jt({ ...Qs }, e.config), d = e.data;
|
|
778
800
|
const g = () => {
|
|
779
|
-
r = a.getBoundingClientRect(), o = r.width, c = r.height,
|
|
801
|
+
r = a.getBoundingClientRect(), o = r.width, c = r.height, _({ data: d, config: h });
|
|
780
802
|
};
|
|
781
803
|
window.addEventListener("resize", g);
|
|
782
|
-
const
|
|
783
|
-
v &&
|
|
784
|
-
const b =
|
|
804
|
+
const _ = (p, v = !1) => {
|
|
805
|
+
v && p.config && (h = Jt(h, p.config)), v && p.data && (d = p.data);
|
|
806
|
+
const b = d.map((M) => ({ date: new Date(M.date), value: M.value })).sort((M, S) => M.date.getTime() - S.date.getTime()), w = hn(b, h, o), x = dn(b, h, c);
|
|
785
807
|
s.attr("class", `sc-charts sc-charts__${h.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${o} ${c}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
|
|
786
808
|
const y = {
|
|
787
809
|
chartId: e.chartId,
|
|
@@ -793,7 +815,8 @@ const Js = (i) => {
|
|
|
793
815
|
config: h,
|
|
794
816
|
action: "none",
|
|
795
817
|
width: o,
|
|
796
|
-
height: c
|
|
818
|
+
height: c,
|
|
819
|
+
gridHoverTooltip: null
|
|
797
820
|
};
|
|
798
821
|
Vs(y);
|
|
799
822
|
const C = {
|
|
@@ -802,8 +825,8 @@ const Js = (i) => {
|
|
|
802
825
|
};
|
|
803
826
|
cn(C);
|
|
804
827
|
};
|
|
805
|
-
return
|
|
806
|
-
update: (
|
|
828
|
+
return _(e), {
|
|
829
|
+
update: (p) => _(p, !0),
|
|
807
830
|
destroy: () => {
|
|
808
831
|
window.removeEventListener("resize", g), n.remove();
|
|
809
832
|
}
|
|
@@ -813,405 +836,405 @@ var Ze = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
813
836
|
function un(i) {
|
|
814
837
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
815
838
|
}
|
|
816
|
-
var
|
|
817
|
-
|
|
818
|
-
var
|
|
839
|
+
var Se = { exports: {} };
|
|
840
|
+
Se.exports;
|
|
841
|
+
var si;
|
|
819
842
|
function fn() {
|
|
820
|
-
return
|
|
821
|
-
var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]",
|
|
822
|
-
|
|
823
|
-
var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self,
|
|
843
|
+
return si || (si = 1, function(i, e) {
|
|
844
|
+
var t = 200, s = "__lodash_hash_undefined__", n = 800, a = 16, r = 9007199254740991, o = "[object Arguments]", c = "[object Array]", h = "[object AsyncFunction]", d = "[object Boolean]", g = "[object Date]", _ = "[object Error]", p = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", M = "[object RegExp]", S = "[object Set]", N = "[object String]", $ = "[object Undefined]", z = "[object WeakMap]", V = "[object ArrayBuffer]", Y = "[object DataView]", re = "[object Float32Array]", P = "[object Float64Array]", U = "[object Int8Array]", G = "[object Int16Array]", Fe = "[object Int32Array]", st = "[object Uint8Array]", oe = "[object Uint8ClampedArray]", ve = "[object Uint16Array]", be = "[object Uint32Array]", He = /[\\^$.*+?()[\]{}|]/g, Be = /^\[object .+?Constructor\]$/, Ie = /^(?:0|[1-9]\d*)$/, F = {};
|
|
845
|
+
F[re] = F[P] = F[U] = F[G] = F[Fe] = F[st] = F[oe] = F[ve] = F[be] = !0, F[o] = F[c] = F[V] = F[d] = F[Y] = F[g] = F[_] = F[p] = F[b] = F[w] = F[y] = F[M] = F[S] = F[N] = F[z] = !1;
|
|
846
|
+
var Re = typeof Ze == "object" && Ze && Ze.Object === Object && Ze, $e = typeof self == "object" && self && self.Object === Object && self, O = Re || $e || Function("return this")(), ee = e && !e.nodeType && e, Z = ee && !0 && i && !i.nodeType && i, q = Z && Z.exports === ee, ge = q && Re.process, ye = function() {
|
|
824
847
|
try {
|
|
825
848
|
var l = Z && Z.require && Z.require("util").types;
|
|
826
849
|
return l || ge && ge.binding && ge.binding("util");
|
|
827
850
|
} catch {
|
|
828
851
|
}
|
|
829
852
|
}(), we = ye && ye.isTypedArray;
|
|
830
|
-
function Oe(l,
|
|
853
|
+
function Oe(l, u, m) {
|
|
831
854
|
switch (m.length) {
|
|
832
855
|
case 0:
|
|
833
|
-
return l.call(
|
|
856
|
+
return l.call(u);
|
|
834
857
|
case 1:
|
|
835
|
-
return l.call(
|
|
858
|
+
return l.call(u, m[0]);
|
|
836
859
|
case 2:
|
|
837
|
-
return l.call(
|
|
860
|
+
return l.call(u, m[0], m[1]);
|
|
838
861
|
case 3:
|
|
839
|
-
return l.call(
|
|
862
|
+
return l.call(u, m[0], m[1], m[2]);
|
|
840
863
|
}
|
|
841
|
-
return l.apply(
|
|
864
|
+
return l.apply(u, m);
|
|
842
865
|
}
|
|
843
|
-
function Pe(l,
|
|
844
|
-
for (var m = -1,
|
|
845
|
-
|
|
846
|
-
return
|
|
866
|
+
function Pe(l, u) {
|
|
867
|
+
for (var m = -1, T = Array(l); ++m < l; )
|
|
868
|
+
T[m] = u(m);
|
|
869
|
+
return T;
|
|
847
870
|
}
|
|
848
871
|
function le(l) {
|
|
849
|
-
return function(
|
|
850
|
-
return l(
|
|
872
|
+
return function(u) {
|
|
873
|
+
return l(u);
|
|
851
874
|
};
|
|
852
875
|
}
|
|
853
|
-
function ce(l,
|
|
854
|
-
return l == null ? void 0 : l[
|
|
876
|
+
function ce(l, u) {
|
|
877
|
+
return l == null ? void 0 : l[u];
|
|
855
878
|
}
|
|
856
|
-
function nt(l,
|
|
879
|
+
function nt(l, u) {
|
|
857
880
|
return function(m) {
|
|
858
|
-
return l(
|
|
881
|
+
return l(u(m));
|
|
859
882
|
};
|
|
860
883
|
}
|
|
861
|
-
var xe = Array.prototype, Ai = Function.prototype, ze = Object.prototype, at =
|
|
884
|
+
var xe = Array.prototype, Ai = Function.prototype, ze = Object.prototype, at = O["__core-js_shared__"], Ve = Ai.toString, ne = ze.hasOwnProperty, Nt = function() {
|
|
862
885
|
var l = /[^.]+$/.exec(at && at.keys && at.keys.IE_PROTO || "");
|
|
863
886
|
return l ? "Symbol(src)_1." + l : "";
|
|
864
|
-
}(),
|
|
887
|
+
}(), Ft = ze.toString, Mi = Ve.call(Object), Si = RegExp(
|
|
865
888
|
"^" + Ve.call(ne).replace(He, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
866
|
-
), Ye = q ?
|
|
889
|
+
), Ye = q ? O.Buffer : void 0, Ht = O.Symbol, Bt = O.Uint8Array;
|
|
867
890
|
Ye && Ye.allocUnsafe;
|
|
868
|
-
var
|
|
891
|
+
var It = nt(Object.getPrototypeOf, Object), Rt = Object.create, Di = ze.propertyIsEnumerable, ki = xe.splice, he = Ht ? Ht.toStringTag : void 0, We = function() {
|
|
869
892
|
try {
|
|
870
893
|
var l = lt(Object, "defineProperty");
|
|
871
894
|
return l({}, "", {}), l;
|
|
872
895
|
} catch {
|
|
873
896
|
}
|
|
874
|
-
}(),
|
|
897
|
+
}(), Li = Ye ? Ye.isBuffer : void 0, $t = Math.max, Ei = Date.now, Ot = lt(O, "Map"), Ce = lt(Object, "create"), Ni = /* @__PURE__ */ function() {
|
|
875
898
|
function l() {
|
|
876
899
|
}
|
|
877
|
-
return function(
|
|
878
|
-
if (!ue(
|
|
900
|
+
return function(u) {
|
|
901
|
+
if (!ue(u))
|
|
879
902
|
return {};
|
|
880
|
-
if (
|
|
881
|
-
return
|
|
882
|
-
l.prototype =
|
|
903
|
+
if (Rt)
|
|
904
|
+
return Rt(u);
|
|
905
|
+
l.prototype = u;
|
|
883
906
|
var m = new l();
|
|
884
907
|
return l.prototype = void 0, m;
|
|
885
908
|
};
|
|
886
909
|
}();
|
|
887
910
|
function de(l) {
|
|
888
|
-
var
|
|
889
|
-
for (this.clear(); ++
|
|
890
|
-
var
|
|
891
|
-
this.set(
|
|
911
|
+
var u = -1, m = l == null ? 0 : l.length;
|
|
912
|
+
for (this.clear(); ++u < m; ) {
|
|
913
|
+
var T = l[u];
|
|
914
|
+
this.set(T[0], T[1]);
|
|
892
915
|
}
|
|
893
916
|
}
|
|
894
|
-
function
|
|
917
|
+
function Fi() {
|
|
895
918
|
this.__data__ = Ce ? Ce(null) : {}, this.size = 0;
|
|
896
919
|
}
|
|
897
|
-
function Fi(l) {
|
|
898
|
-
var d = this.has(l) && delete this.__data__[l];
|
|
899
|
-
return this.size -= d ? 1 : 0, d;
|
|
900
|
-
}
|
|
901
920
|
function Hi(l) {
|
|
902
|
-
var
|
|
921
|
+
var u = this.has(l) && delete this.__data__[l];
|
|
922
|
+
return this.size -= u ? 1 : 0, u;
|
|
923
|
+
}
|
|
924
|
+
function Bi(l) {
|
|
925
|
+
var u = this.__data__;
|
|
903
926
|
if (Ce) {
|
|
904
|
-
var m =
|
|
927
|
+
var m = u[l];
|
|
905
928
|
return m === s ? void 0 : m;
|
|
906
929
|
}
|
|
907
|
-
return ne.call(
|
|
930
|
+
return ne.call(u, l) ? u[l] : void 0;
|
|
908
931
|
}
|
|
909
|
-
function
|
|
910
|
-
var
|
|
911
|
-
return Ce ?
|
|
932
|
+
function Ii(l) {
|
|
933
|
+
var u = this.__data__;
|
|
934
|
+
return Ce ? u[l] !== void 0 : ne.call(u, l);
|
|
912
935
|
}
|
|
913
|
-
function
|
|
936
|
+
function Ri(l, u) {
|
|
914
937
|
var m = this.__data__;
|
|
915
|
-
return this.size += this.has(l) ? 0 : 1, m[l] = Ce &&
|
|
938
|
+
return this.size += this.has(l) ? 0 : 1, m[l] = Ce && u === void 0 ? s : u, this;
|
|
916
939
|
}
|
|
917
|
-
de.prototype.clear =
|
|
940
|
+
de.prototype.clear = Fi, de.prototype.delete = Hi, de.prototype.get = Bi, de.prototype.has = Ii, de.prototype.set = Ri;
|
|
918
941
|
function te(l) {
|
|
919
|
-
var
|
|
920
|
-
for (this.clear(); ++
|
|
921
|
-
var
|
|
922
|
-
this.set(
|
|
942
|
+
var u = -1, m = l == null ? 0 : l.length;
|
|
943
|
+
for (this.clear(); ++u < m; ) {
|
|
944
|
+
var T = l[u];
|
|
945
|
+
this.set(T[0], T[1]);
|
|
923
946
|
}
|
|
924
947
|
}
|
|
925
|
-
function
|
|
948
|
+
function $i() {
|
|
926
949
|
this.__data__ = [], this.size = 0;
|
|
927
950
|
}
|
|
928
|
-
function
|
|
929
|
-
var
|
|
951
|
+
function Oi(l) {
|
|
952
|
+
var u = this.__data__, m = je(u, l);
|
|
930
953
|
if (m < 0)
|
|
931
954
|
return !1;
|
|
932
|
-
var
|
|
933
|
-
return m ==
|
|
934
|
-
}
|
|
935
|
-
function Oi(l) {
|
|
936
|
-
var d = this.__data__, m = je(d, l);
|
|
937
|
-
return m < 0 ? void 0 : d[m][1];
|
|
955
|
+
var T = u.length - 1;
|
|
956
|
+
return m == T ? u.pop() : ki.call(u, m, 1), --this.size, !0;
|
|
938
957
|
}
|
|
939
958
|
function Pi(l) {
|
|
959
|
+
var u = this.__data__, m = je(u, l);
|
|
960
|
+
return m < 0 ? void 0 : u[m][1];
|
|
961
|
+
}
|
|
962
|
+
function zi(l) {
|
|
940
963
|
return je(this.__data__, l) > -1;
|
|
941
964
|
}
|
|
942
|
-
function
|
|
943
|
-
var m = this.__data__,
|
|
944
|
-
return
|
|
965
|
+
function Vi(l, u) {
|
|
966
|
+
var m = this.__data__, T = je(m, l);
|
|
967
|
+
return T < 0 ? (++this.size, m.push([l, u])) : m[T][1] = u, this;
|
|
945
968
|
}
|
|
946
|
-
te.prototype.clear =
|
|
969
|
+
te.prototype.clear = $i, te.prototype.delete = Oi, te.prototype.get = Pi, te.prototype.has = zi, te.prototype.set = Vi;
|
|
947
970
|
function me(l) {
|
|
948
|
-
var
|
|
949
|
-
for (this.clear(); ++
|
|
950
|
-
var
|
|
951
|
-
this.set(
|
|
971
|
+
var u = -1, m = l == null ? 0 : l.length;
|
|
972
|
+
for (this.clear(); ++u < m; ) {
|
|
973
|
+
var T = l[u];
|
|
974
|
+
this.set(T[0], T[1]);
|
|
952
975
|
}
|
|
953
976
|
}
|
|
954
|
-
function
|
|
977
|
+
function Yi() {
|
|
955
978
|
this.size = 0, this.__data__ = {
|
|
956
979
|
hash: new de(),
|
|
957
|
-
map: new (
|
|
980
|
+
map: new (Ot || te)(),
|
|
958
981
|
string: new de()
|
|
959
982
|
};
|
|
960
983
|
}
|
|
961
|
-
function Yi(l) {
|
|
962
|
-
var d = Ue(this, l).delete(l);
|
|
963
|
-
return this.size -= d ? 1 : 0, d;
|
|
964
|
-
}
|
|
965
984
|
function Wi(l) {
|
|
966
|
-
|
|
985
|
+
var u = Ue(this, l).delete(l);
|
|
986
|
+
return this.size -= u ? 1 : 0, u;
|
|
967
987
|
}
|
|
968
988
|
function ji(l) {
|
|
989
|
+
return Ue(this, l).get(l);
|
|
990
|
+
}
|
|
991
|
+
function Xi(l) {
|
|
969
992
|
return Ue(this, l).has(l);
|
|
970
993
|
}
|
|
971
|
-
function
|
|
972
|
-
var m = Ue(this, l),
|
|
973
|
-
return m.set(l,
|
|
994
|
+
function Ui(l, u) {
|
|
995
|
+
var m = Ue(this, l), T = m.size;
|
|
996
|
+
return m.set(l, u), this.size += m.size == T ? 0 : 1, this;
|
|
974
997
|
}
|
|
975
|
-
me.prototype.clear =
|
|
976
|
-
function
|
|
977
|
-
var
|
|
978
|
-
this.size =
|
|
998
|
+
me.prototype.clear = Yi, me.prototype.delete = Wi, me.prototype.get = ji, me.prototype.has = Xi, me.prototype.set = Ui;
|
|
999
|
+
function pe(l) {
|
|
1000
|
+
var u = this.__data__ = new te(l);
|
|
1001
|
+
this.size = u.size;
|
|
979
1002
|
}
|
|
980
|
-
function
|
|
1003
|
+
function Gi() {
|
|
981
1004
|
this.__data__ = new te(), this.size = 0;
|
|
982
1005
|
}
|
|
983
|
-
function Gi(l) {
|
|
984
|
-
var d = this.__data__, m = d.delete(l);
|
|
985
|
-
return this.size = d.size, m;
|
|
986
|
-
}
|
|
987
1006
|
function Zi(l) {
|
|
988
|
-
|
|
1007
|
+
var u = this.__data__, m = u.delete(l);
|
|
1008
|
+
return this.size = u.size, m;
|
|
989
1009
|
}
|
|
990
1010
|
function qi(l) {
|
|
1011
|
+
return this.__data__.get(l);
|
|
1012
|
+
}
|
|
1013
|
+
function Ji(l) {
|
|
991
1014
|
return this.__data__.has(l);
|
|
992
1015
|
}
|
|
993
|
-
function
|
|
1016
|
+
function Qi(l, u) {
|
|
994
1017
|
var m = this.__data__;
|
|
995
1018
|
if (m instanceof te) {
|
|
996
|
-
var
|
|
997
|
-
if (
|
|
998
|
-
return
|
|
999
|
-
m = this.__data__ = new me(
|
|
1019
|
+
var T = m.__data__;
|
|
1020
|
+
if (!Ot || T.length < t - 1)
|
|
1021
|
+
return T.push([l, u]), this.size = ++m.size, this;
|
|
1022
|
+
m = this.__data__ = new me(T);
|
|
1000
1023
|
}
|
|
1001
|
-
return m.set(l,
|
|
1024
|
+
return m.set(l, u), this.size = m.size, this;
|
|
1002
1025
|
}
|
|
1003
|
-
|
|
1004
|
-
function
|
|
1005
|
-
var m = dt(l),
|
|
1026
|
+
pe.prototype.clear = Gi, pe.prototype.delete = Zi, pe.prototype.get = qi, pe.prototype.has = Ji, pe.prototype.set = Qi;
|
|
1027
|
+
function Ki(l, u) {
|
|
1028
|
+
var m = dt(l), T = !m && ht(l), D = !m && !T && Wt(l), H = !m && !T && !D && Xt(l), B = m || T || D || H, E = B ? Pe(l.length, String) : [], I = E.length;
|
|
1006
1029
|
for (var J in l)
|
|
1007
1030
|
B && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1008
1031
|
(J == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1032
|
+
D && (J == "offset" || J == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1033
|
+
H && (J == "buffer" || J == "byteLength" || J == "byteOffset") || // Skip index properties.
|
|
1034
|
+
Vt(J, I)) || E.push(J);
|
|
1012
1035
|
return E;
|
|
1013
1036
|
}
|
|
1014
|
-
function rt(l,
|
|
1015
|
-
(m !== void 0 && !Ge(l[
|
|
1037
|
+
function rt(l, u, m) {
|
|
1038
|
+
(m !== void 0 && !Ge(l[u], m) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1016
1039
|
}
|
|
1017
|
-
function
|
|
1018
|
-
var
|
|
1019
|
-
(!(ne.call(l,
|
|
1040
|
+
function es(l, u, m) {
|
|
1041
|
+
var T = l[u];
|
|
1042
|
+
(!(ne.call(l, u) && Ge(T, m)) || m === void 0 && !(u in l)) && ot(l, u, m);
|
|
1020
1043
|
}
|
|
1021
|
-
function je(l,
|
|
1044
|
+
function je(l, u) {
|
|
1022
1045
|
for (var m = l.length; m--; )
|
|
1023
|
-
if (Ge(l[m][0],
|
|
1046
|
+
if (Ge(l[m][0], u))
|
|
1024
1047
|
return m;
|
|
1025
1048
|
return -1;
|
|
1026
1049
|
}
|
|
1027
|
-
function ot(l,
|
|
1028
|
-
|
|
1050
|
+
function ot(l, u, m) {
|
|
1051
|
+
u == "__proto__" && We ? We(l, u, {
|
|
1029
1052
|
configurable: !0,
|
|
1030
1053
|
enumerable: !0,
|
|
1031
1054
|
value: m,
|
|
1032
1055
|
writable: !0
|
|
1033
|
-
}) : l[
|
|
1056
|
+
}) : l[u] = m;
|
|
1034
1057
|
}
|
|
1035
|
-
var
|
|
1058
|
+
var ts = gs();
|
|
1036
1059
|
function Xe(l) {
|
|
1037
|
-
return l == null ? l === void 0 ?
|
|
1060
|
+
return l == null ? l === void 0 ? $ : x : he && he in Object(l) ? ms(l) : ws(l);
|
|
1038
1061
|
}
|
|
1039
|
-
function
|
|
1040
|
-
return
|
|
1041
|
-
}
|
|
1042
|
-
function ts(l) {
|
|
1043
|
-
if (!ue(l) || vs(l))
|
|
1044
|
-
return !1;
|
|
1045
|
-
var d = ft(l) ? Si : Be;
|
|
1046
|
-
return d.test(As(l));
|
|
1062
|
+
function Pt(l) {
|
|
1063
|
+
return Te(l) && Xe(l) == o;
|
|
1047
1064
|
}
|
|
1048
1065
|
function is(l) {
|
|
1049
|
-
|
|
1066
|
+
if (!ue(l) || bs(l))
|
|
1067
|
+
return !1;
|
|
1068
|
+
var u = ft(l) ? Si : Be;
|
|
1069
|
+
return u.test(As(l));
|
|
1050
1070
|
}
|
|
1051
1071
|
function ss(l) {
|
|
1072
|
+
return Te(l) && jt(l.length) && !!F[Xe(l)];
|
|
1073
|
+
}
|
|
1074
|
+
function ns(l) {
|
|
1052
1075
|
if (!ue(l))
|
|
1053
|
-
return
|
|
1054
|
-
var
|
|
1055
|
-
for (var
|
|
1056
|
-
|
|
1076
|
+
return ys(l);
|
|
1077
|
+
var u = Yt(l), m = [];
|
|
1078
|
+
for (var T in l)
|
|
1079
|
+
T == "constructor" && (u || !ne.call(l, T)) || m.push(T);
|
|
1057
1080
|
return m;
|
|
1058
1081
|
}
|
|
1059
|
-
function
|
|
1060
|
-
l !==
|
|
1061
|
-
if (
|
|
1062
|
-
|
|
1082
|
+
function zt(l, u, m, T, D) {
|
|
1083
|
+
l !== u && ts(u, function(H, B) {
|
|
1084
|
+
if (D || (D = new pe()), ue(H))
|
|
1085
|
+
as(l, u, B, m, zt, T, D);
|
|
1063
1086
|
else {
|
|
1064
|
-
var E =
|
|
1065
|
-
E === void 0 && (E =
|
|
1087
|
+
var E = T ? T(ct(l, B), H, B + "", l, u, D) : void 0;
|
|
1088
|
+
E === void 0 && (E = H), rt(l, B, E);
|
|
1066
1089
|
}
|
|
1067
|
-
},
|
|
1090
|
+
}, Ut);
|
|
1068
1091
|
}
|
|
1069
|
-
function
|
|
1070
|
-
var E = ct(l, m), I = ct(
|
|
1092
|
+
function as(l, u, m, T, D, H, B) {
|
|
1093
|
+
var E = ct(l, m), I = ct(u, m), J = B.get(I);
|
|
1071
1094
|
if (J) {
|
|
1072
1095
|
rt(l, m, J);
|
|
1073
1096
|
return;
|
|
1074
1097
|
}
|
|
1075
|
-
var
|
|
1076
|
-
if (
|
|
1077
|
-
var gt = dt(I), mt = !gt &&
|
|
1078
|
-
|
|
1098
|
+
var W = H ? H(E, I, m + "", l, u, B) : void 0, Ae = W === void 0;
|
|
1099
|
+
if (Ae) {
|
|
1100
|
+
var gt = dt(I), mt = !gt && Wt(I), Zt = !gt && !mt && Xt(I);
|
|
1101
|
+
W = I, gt || mt || Zt ? dt(E) ? W = E : Ms(E) ? W = ds(E) : mt ? (Ae = !1, W = ls(I)) : Zt ? (Ae = !1, W = hs(I)) : W = [] : Ss(I) || ht(I) ? (W = E, ht(E) ? W = Ds(E) : (!ue(E) || ft(E)) && (W = ps(I))) : Ae = !1;
|
|
1079
1102
|
}
|
|
1080
|
-
|
|
1103
|
+
Ae && (B.set(I, W), D(W, I, T, H, B), B.delete(I)), rt(l, m, W);
|
|
1081
1104
|
}
|
|
1082
|
-
function
|
|
1083
|
-
return xs(
|
|
1105
|
+
function rs(l, u) {
|
|
1106
|
+
return Cs(xs(l, u, Gt), l + "");
|
|
1084
1107
|
}
|
|
1085
|
-
var
|
|
1108
|
+
var os = We ? function(l, u) {
|
|
1086
1109
|
return We(l, "toString", {
|
|
1087
1110
|
configurable: !0,
|
|
1088
1111
|
enumerable: !1,
|
|
1089
|
-
value:
|
|
1112
|
+
value: Ls(u),
|
|
1090
1113
|
writable: !0
|
|
1091
1114
|
});
|
|
1092
|
-
} :
|
|
1093
|
-
function
|
|
1115
|
+
} : Gt;
|
|
1116
|
+
function ls(l, u) {
|
|
1094
1117
|
return l.slice();
|
|
1095
1118
|
}
|
|
1096
|
-
function
|
|
1097
|
-
var
|
|
1098
|
-
return new
|
|
1119
|
+
function cs(l) {
|
|
1120
|
+
var u = new l.constructor(l.byteLength);
|
|
1121
|
+
return new Bt(u).set(new Bt(l)), u;
|
|
1099
1122
|
}
|
|
1100
|
-
function
|
|
1101
|
-
var m =
|
|
1123
|
+
function hs(l, u) {
|
|
1124
|
+
var m = cs(l.buffer);
|
|
1102
1125
|
return new l.constructor(m, l.byteOffset, l.length);
|
|
1103
1126
|
}
|
|
1104
|
-
function
|
|
1105
|
-
var m = -1,
|
|
1106
|
-
for (
|
|
1107
|
-
|
|
1108
|
-
return
|
|
1127
|
+
function ds(l, u) {
|
|
1128
|
+
var m = -1, T = l.length;
|
|
1129
|
+
for (u || (u = Array(T)); ++m < T; )
|
|
1130
|
+
u[m] = l[m];
|
|
1131
|
+
return u;
|
|
1109
1132
|
}
|
|
1110
|
-
function
|
|
1111
|
-
var
|
|
1133
|
+
function us(l, u, m, T) {
|
|
1134
|
+
var D = !m;
|
|
1112
1135
|
m || (m = {});
|
|
1113
|
-
for (var
|
|
1114
|
-
var E =
|
|
1115
|
-
I === void 0 && (I = l[E]),
|
|
1136
|
+
for (var H = -1, B = u.length; ++H < B; ) {
|
|
1137
|
+
var E = u[H], I = void 0;
|
|
1138
|
+
I === void 0 && (I = l[E]), D ? ot(m, E, I) : es(m, E, I);
|
|
1116
1139
|
}
|
|
1117
1140
|
return m;
|
|
1118
1141
|
}
|
|
1119
|
-
function
|
|
1120
|
-
return
|
|
1121
|
-
var
|
|
1122
|
-
for (
|
|
1123
|
-
var E = m[
|
|
1124
|
-
E && l(
|
|
1142
|
+
function fs(l) {
|
|
1143
|
+
return rs(function(u, m) {
|
|
1144
|
+
var T = -1, D = m.length, H = D > 1 ? m[D - 1] : void 0, B = D > 2 ? m[2] : void 0;
|
|
1145
|
+
for (H = l.length > 3 && typeof H == "function" ? (D--, H) : void 0, B && _s(m[0], m[1], B) && (H = D < 3 ? void 0 : H, D = 1), u = Object(u); ++T < D; ) {
|
|
1146
|
+
var E = m[T];
|
|
1147
|
+
E && l(u, E, T, H);
|
|
1125
1148
|
}
|
|
1126
|
-
return
|
|
1149
|
+
return u;
|
|
1127
1150
|
});
|
|
1128
1151
|
}
|
|
1129
|
-
function
|
|
1130
|
-
return function(
|
|
1131
|
-
for (var
|
|
1132
|
-
var I = B[++
|
|
1133
|
-
if (m(
|
|
1152
|
+
function gs(l) {
|
|
1153
|
+
return function(u, m, T) {
|
|
1154
|
+
for (var D = -1, H = Object(u), B = T(u), E = B.length; E--; ) {
|
|
1155
|
+
var I = B[++D];
|
|
1156
|
+
if (m(H[I], I, H) === !1)
|
|
1134
1157
|
break;
|
|
1135
1158
|
}
|
|
1136
|
-
return
|
|
1159
|
+
return u;
|
|
1137
1160
|
};
|
|
1138
1161
|
}
|
|
1139
|
-
function Ue(l,
|
|
1162
|
+
function Ue(l, u) {
|
|
1140
1163
|
var m = l.__data__;
|
|
1141
|
-
return
|
|
1164
|
+
return vs(u) ? m[typeof u == "string" ? "string" : "hash"] : m.map;
|
|
1142
1165
|
}
|
|
1143
|
-
function lt(l,
|
|
1144
|
-
var m = ce(l,
|
|
1145
|
-
return
|
|
1166
|
+
function lt(l, u) {
|
|
1167
|
+
var m = ce(l, u);
|
|
1168
|
+
return is(m) ? m : void 0;
|
|
1146
1169
|
}
|
|
1147
|
-
function
|
|
1148
|
-
var
|
|
1170
|
+
function ms(l) {
|
|
1171
|
+
var u = ne.call(l, he), m = l[he];
|
|
1149
1172
|
try {
|
|
1150
1173
|
l[he] = void 0;
|
|
1151
|
-
var
|
|
1174
|
+
var T = !0;
|
|
1152
1175
|
} catch {
|
|
1153
1176
|
}
|
|
1154
|
-
var
|
|
1155
|
-
return
|
|
1177
|
+
var D = Ft.call(l);
|
|
1178
|
+
return T && (u ? l[he] = m : delete l[he]), D;
|
|
1156
1179
|
}
|
|
1157
|
-
function
|
|
1158
|
-
return typeof l.constructor == "function" && !
|
|
1180
|
+
function ps(l) {
|
|
1181
|
+
return typeof l.constructor == "function" && !Yt(l) ? Ni(It(l)) : {};
|
|
1159
1182
|
}
|
|
1160
|
-
function
|
|
1183
|
+
function Vt(l, u) {
|
|
1161
1184
|
var m = typeof l;
|
|
1162
|
-
return
|
|
1185
|
+
return u = u ?? r, !!u && (m == "number" || m != "symbol" && Ie.test(l)) && l > -1 && l % 1 == 0 && l < u;
|
|
1163
1186
|
}
|
|
1164
|
-
function _s(l,
|
|
1187
|
+
function _s(l, u, m) {
|
|
1165
1188
|
if (!ue(m))
|
|
1166
1189
|
return !1;
|
|
1167
|
-
var
|
|
1168
|
-
return (
|
|
1169
|
-
}
|
|
1170
|
-
function ps(l) {
|
|
1171
|
-
var d = typeof l;
|
|
1172
|
-
return d == "string" || d == "number" || d == "symbol" || d == "boolean" ? l !== "__proto__" : l === null;
|
|
1190
|
+
var T = typeof u;
|
|
1191
|
+
return (T == "number" ? ut(m) && Vt(u, m.length) : T == "string" && u in m) ? Ge(m[u], l) : !1;
|
|
1173
1192
|
}
|
|
1174
1193
|
function vs(l) {
|
|
1175
|
-
|
|
1194
|
+
var u = typeof l;
|
|
1195
|
+
return u == "string" || u == "number" || u == "symbol" || u == "boolean" ? l !== "__proto__" : l === null;
|
|
1176
1196
|
}
|
|
1177
|
-
function
|
|
1178
|
-
|
|
1197
|
+
function bs(l) {
|
|
1198
|
+
return !!Nt && Nt in l;
|
|
1199
|
+
}
|
|
1200
|
+
function Yt(l) {
|
|
1201
|
+
var u = l && l.constructor, m = typeof u == "function" && u.prototype || ze;
|
|
1179
1202
|
return l === m;
|
|
1180
1203
|
}
|
|
1181
|
-
function
|
|
1182
|
-
var
|
|
1204
|
+
function ys(l) {
|
|
1205
|
+
var u = [];
|
|
1183
1206
|
if (l != null)
|
|
1184
1207
|
for (var m in Object(l))
|
|
1185
|
-
|
|
1186
|
-
return
|
|
1187
|
-
}
|
|
1188
|
-
function
|
|
1189
|
-
return
|
|
1190
|
-
}
|
|
1191
|
-
function
|
|
1192
|
-
return
|
|
1193
|
-
for (var
|
|
1194
|
-
B[
|
|
1195
|
-
|
|
1196
|
-
for (var E = Array(
|
|
1197
|
-
E[
|
|
1198
|
-
return E[
|
|
1208
|
+
u.push(m);
|
|
1209
|
+
return u;
|
|
1210
|
+
}
|
|
1211
|
+
function ws(l) {
|
|
1212
|
+
return Ft.call(l);
|
|
1213
|
+
}
|
|
1214
|
+
function xs(l, u, m) {
|
|
1215
|
+
return u = $t(u === void 0 ? l.length - 1 : u, 0), function() {
|
|
1216
|
+
for (var T = arguments, D = -1, H = $t(T.length - u, 0), B = Array(H); ++D < H; )
|
|
1217
|
+
B[D] = T[u + D];
|
|
1218
|
+
D = -1;
|
|
1219
|
+
for (var E = Array(u + 1); ++D < u; )
|
|
1220
|
+
E[D] = T[D];
|
|
1221
|
+
return E[u] = m(B), Oe(l, this, E);
|
|
1199
1222
|
};
|
|
1200
1223
|
}
|
|
1201
|
-
function ct(l,
|
|
1202
|
-
if (!(
|
|
1203
|
-
return l[
|
|
1224
|
+
function ct(l, u) {
|
|
1225
|
+
if (!(u === "constructor" && typeof l[u] == "function") && u != "__proto__")
|
|
1226
|
+
return l[u];
|
|
1204
1227
|
}
|
|
1205
|
-
var
|
|
1206
|
-
function
|
|
1207
|
-
var
|
|
1228
|
+
var Cs = Ts(os);
|
|
1229
|
+
function Ts(l) {
|
|
1230
|
+
var u = 0, m = 0;
|
|
1208
1231
|
return function() {
|
|
1209
|
-
var
|
|
1210
|
-
if (m =
|
|
1211
|
-
if (++
|
|
1232
|
+
var T = Ei(), D = a - (T - m);
|
|
1233
|
+
if (m = T, D > 0) {
|
|
1234
|
+
if (++u >= n)
|
|
1212
1235
|
return arguments[0];
|
|
1213
1236
|
} else
|
|
1214
|
-
|
|
1237
|
+
u = 0;
|
|
1215
1238
|
return l.apply(void 0, arguments);
|
|
1216
1239
|
};
|
|
1217
1240
|
}
|
|
@@ -1228,78 +1251,78 @@ function fn() {
|
|
|
1228
1251
|
}
|
|
1229
1252
|
return "";
|
|
1230
1253
|
}
|
|
1231
|
-
function Ge(l,
|
|
1232
|
-
return l ===
|
|
1254
|
+
function Ge(l, u) {
|
|
1255
|
+
return l === u || l !== l && u !== u;
|
|
1233
1256
|
}
|
|
1234
|
-
var ht =
|
|
1257
|
+
var ht = Pt(/* @__PURE__ */ function() {
|
|
1235
1258
|
return arguments;
|
|
1236
|
-
}()) ?
|
|
1237
|
-
return
|
|
1259
|
+
}()) ? Pt : function(l) {
|
|
1260
|
+
return Te(l) && ne.call(l, "callee") && !Di.call(l, "callee");
|
|
1238
1261
|
}, dt = Array.isArray;
|
|
1239
1262
|
function ut(l) {
|
|
1240
|
-
return l != null &&
|
|
1263
|
+
return l != null && jt(l.length) && !ft(l);
|
|
1241
1264
|
}
|
|
1242
1265
|
function Ms(l) {
|
|
1243
|
-
return
|
|
1266
|
+
return Te(l) && ut(l);
|
|
1244
1267
|
}
|
|
1245
|
-
var
|
|
1268
|
+
var Wt = Li || Es;
|
|
1246
1269
|
function ft(l) {
|
|
1247
1270
|
if (!ue(l))
|
|
1248
1271
|
return !1;
|
|
1249
|
-
var
|
|
1250
|
-
return
|
|
1272
|
+
var u = Xe(l);
|
|
1273
|
+
return u == p || u == v || u == h || u == C;
|
|
1251
1274
|
}
|
|
1252
|
-
function
|
|
1275
|
+
function jt(l) {
|
|
1253
1276
|
return typeof l == "number" && l > -1 && l % 1 == 0 && l <= r;
|
|
1254
1277
|
}
|
|
1255
1278
|
function ue(l) {
|
|
1256
|
-
var
|
|
1257
|
-
return l != null && (
|
|
1279
|
+
var u = typeof l;
|
|
1280
|
+
return l != null && (u == "object" || u == "function");
|
|
1258
1281
|
}
|
|
1259
|
-
function
|
|
1282
|
+
function Te(l) {
|
|
1260
1283
|
return l != null && typeof l == "object";
|
|
1261
1284
|
}
|
|
1262
1285
|
function Ss(l) {
|
|
1263
|
-
if (!
|
|
1286
|
+
if (!Te(l) || Xe(l) != y)
|
|
1264
1287
|
return !1;
|
|
1265
|
-
var
|
|
1266
|
-
if (
|
|
1288
|
+
var u = It(l);
|
|
1289
|
+
if (u === null)
|
|
1267
1290
|
return !0;
|
|
1268
|
-
var m = ne.call(
|
|
1291
|
+
var m = ne.call(u, "constructor") && u.constructor;
|
|
1269
1292
|
return typeof m == "function" && m instanceof m && Ve.call(m) == Mi;
|
|
1270
1293
|
}
|
|
1271
|
-
var
|
|
1272
|
-
function
|
|
1273
|
-
return
|
|
1294
|
+
var Xt = we ? le(we) : ss;
|
|
1295
|
+
function Ds(l) {
|
|
1296
|
+
return us(l, Ut(l));
|
|
1274
1297
|
}
|
|
1275
|
-
function
|
|
1276
|
-
return ut(l) ?
|
|
1298
|
+
function Ut(l) {
|
|
1299
|
+
return ut(l) ? Ki(l) : ns(l);
|
|
1277
1300
|
}
|
|
1278
|
-
var ks =
|
|
1279
|
-
|
|
1301
|
+
var ks = fs(function(l, u, m) {
|
|
1302
|
+
zt(l, u, m);
|
|
1280
1303
|
});
|
|
1281
|
-
function
|
|
1304
|
+
function Ls(l) {
|
|
1282
1305
|
return function() {
|
|
1283
1306
|
return l;
|
|
1284
1307
|
};
|
|
1285
1308
|
}
|
|
1286
|
-
function
|
|
1309
|
+
function Gt(l) {
|
|
1287
1310
|
return l;
|
|
1288
1311
|
}
|
|
1289
1312
|
function Es() {
|
|
1290
1313
|
return !1;
|
|
1291
1314
|
}
|
|
1292
1315
|
i.exports = ks;
|
|
1293
|
-
}(
|
|
1316
|
+
}(Se, Se.exports)), Se.exports;
|
|
1294
1317
|
}
|
|
1295
1318
|
var gn = fn();
|
|
1296
|
-
const Qe = /* @__PURE__ */ un(gn),
|
|
1319
|
+
const Qe = /* @__PURE__ */ un(gn), ni = 12, mn = {
|
|
1297
1320
|
candles: {
|
|
1298
1321
|
direction: "right",
|
|
1299
|
-
offset: `${Math.round(
|
|
1322
|
+
offset: `${Math.round(ni / 2)}px`,
|
|
1300
1323
|
style: "filled",
|
|
1301
1324
|
strokeWidth: 1,
|
|
1302
|
-
baseWidth:
|
|
1325
|
+
baseWidth: ni,
|
|
1303
1326
|
bodyRatio: 0.7,
|
|
1304
1327
|
zoomOnWheel: "both",
|
|
1305
1328
|
scaleSensitivity: 2e-3,
|
|
@@ -1340,7 +1363,7 @@ const Qe = /* @__PURE__ */ un(gn), si = 12, mn = {
|
|
|
1340
1363
|
showLabelButtons: !0
|
|
1341
1364
|
}
|
|
1342
1365
|
};
|
|
1343
|
-
class
|
|
1366
|
+
class pn {
|
|
1344
1367
|
constructor(e) {
|
|
1345
1368
|
f(this, "_candles");
|
|
1346
1369
|
f(this, "_xAxis");
|
|
@@ -1380,7 +1403,7 @@ class _n {
|
|
|
1380
1403
|
return this._trade;
|
|
1381
1404
|
}
|
|
1382
1405
|
}
|
|
1383
|
-
class
|
|
1406
|
+
class X {
|
|
1384
1407
|
constructor(e) {
|
|
1385
1408
|
f(this, "x");
|
|
1386
1409
|
f(this, "y");
|
|
@@ -1421,34 +1444,34 @@ class W {
|
|
|
1421
1444
|
return this.y + this.height;
|
|
1422
1445
|
}
|
|
1423
1446
|
}
|
|
1424
|
-
class
|
|
1447
|
+
class _n {
|
|
1425
1448
|
constructor(e, t) {
|
|
1426
|
-
f(this, "_chart", new
|
|
1427
|
-
f(this, "_area", new
|
|
1428
|
-
f(this, "_xAxis", new
|
|
1429
|
-
f(this, "_yAxis", new
|
|
1430
|
-
f(this, "_axisIntersection", new
|
|
1449
|
+
f(this, "_chart", new X());
|
|
1450
|
+
f(this, "_area", new X());
|
|
1451
|
+
f(this, "_xAxis", new X());
|
|
1452
|
+
f(this, "_yAxis", new X());
|
|
1453
|
+
f(this, "_axisIntersection", new X());
|
|
1431
1454
|
const { xAxis: s, yAxis: n } = t;
|
|
1432
|
-
this._chart = new
|
|
1455
|
+
this._chart = new X(e), this._calc(s, n);
|
|
1433
1456
|
}
|
|
1434
1457
|
_calc(e, t) {
|
|
1435
1458
|
const s = e.isShow ? e.height : 0, n = t.isShow ? t.width : 0, a = this._chart.height - s, r = this._chart.width - n;
|
|
1436
|
-
this._area = new
|
|
1459
|
+
this._area = new X({
|
|
1437
1460
|
x: t.position === "left" ? n : 0,
|
|
1438
1461
|
y: e.position === "top" ? s : 0,
|
|
1439
1462
|
width: r,
|
|
1440
1463
|
height: a
|
|
1441
|
-
}), this._xAxis = new
|
|
1464
|
+
}), this._xAxis = new X({
|
|
1442
1465
|
y: e.position === "top" ? 0 : a,
|
|
1443
1466
|
x: t.position === "left" ? n : 0,
|
|
1444
1467
|
height: s,
|
|
1445
1468
|
width: r
|
|
1446
|
-
}), this._yAxis = new
|
|
1469
|
+
}), this._yAxis = new X({
|
|
1447
1470
|
y: e.position === "top" ? s : 0,
|
|
1448
1471
|
x: t.position === "left" ? 0 : r,
|
|
1449
1472
|
width: n,
|
|
1450
1473
|
height: a
|
|
1451
|
-
}), this._axisIntersection = new
|
|
1474
|
+
}), this._axisIntersection = new X({
|
|
1452
1475
|
y: e.position === "top" ? 0 : a,
|
|
1453
1476
|
x: t.position === "left" ? 0 : r,
|
|
1454
1477
|
width: n,
|
|
@@ -1461,7 +1484,7 @@ class pn {
|
|
|
1461
1484
|
}
|
|
1462
1485
|
update(e) {
|
|
1463
1486
|
const { xAxis: t, yAxis: s } = e.config;
|
|
1464
|
-
this._chart = new
|
|
1487
|
+
this._chart = new X(e.container), this._calc(t, s);
|
|
1465
1488
|
}
|
|
1466
1489
|
get area() {
|
|
1467
1490
|
return this._area;
|
|
@@ -1487,14 +1510,14 @@ function bn(i, e) {
|
|
|
1487
1510
|
const n = i[s].close_time.getTime(), a = i[s].open_time.getTime(), o = new Date(i[s + 1].open_time).getTime() - n;
|
|
1488
1511
|
if (o >= e) {
|
|
1489
1512
|
const c = Math.floor(o / e), h = [];
|
|
1490
|
-
for (let
|
|
1491
|
-
h.push(a +
|
|
1513
|
+
for (let d = 1; d <= c; d++)
|
|
1514
|
+
h.push(a + d * e);
|
|
1492
1515
|
h.length > 0 && t.push(h);
|
|
1493
1516
|
}
|
|
1494
1517
|
}
|
|
1495
1518
|
return t;
|
|
1496
1519
|
}
|
|
1497
|
-
function
|
|
1520
|
+
function ai(i, e) {
|
|
1498
1521
|
const t = vn(i[0]), s = bn(i, t), n = [];
|
|
1499
1522
|
return s.forEach((a) => {
|
|
1500
1523
|
if (a.length === 0) return;
|
|
@@ -1504,18 +1527,18 @@ function ni(i, e) {
|
|
|
1504
1527
|
if (!r || !o)
|
|
1505
1528
|
throw new Error("[CS_Data] error while creating missing data");
|
|
1506
1529
|
const c = r.close, h = o.open;
|
|
1507
|
-
let
|
|
1508
|
-
a.forEach((g,
|
|
1509
|
-
const
|
|
1510
|
-
let v =
|
|
1530
|
+
let d = c;
|
|
1531
|
+
a.forEach((g, _) => {
|
|
1532
|
+
const p = (h - d) / a.length;
|
|
1533
|
+
let v = d + p * _, b = v + p;
|
|
1511
1534
|
const w = Math.abs(v - b);
|
|
1512
1535
|
let x = Math.max(v, b) + w / 2, y = Math.min(v, b) - w / 2;
|
|
1513
1536
|
if (e.trade) {
|
|
1514
|
-
const
|
|
1515
|
-
const
|
|
1516
|
-
return
|
|
1537
|
+
const M = [...e.trade.entries, ...e.trade.exits].find((S) => {
|
|
1538
|
+
const N = S.time.getTime();
|
|
1539
|
+
return N >= g && N < g + t;
|
|
1517
1540
|
});
|
|
1518
|
-
|
|
1541
|
+
M && (M.type === "buy" ? (y = M.price, b = Math.max(y, b), v = b + w, x = Math.max(v, b) + w / 2, d = v) : M.type === "sell" && (x = M.price, b = Math.min(x, b), v = b - w, y = Math.min(v, b) - w / 2, d = v));
|
|
1519
1542
|
}
|
|
1520
1543
|
const C = {
|
|
1521
1544
|
open_time: new Date(g),
|
|
@@ -1529,7 +1552,7 @@ function ni(i, e) {
|
|
|
1529
1552
|
});
|
|
1530
1553
|
}), n;
|
|
1531
1554
|
}
|
|
1532
|
-
class
|
|
1555
|
+
class Dt {
|
|
1533
1556
|
constructor(e, t) {
|
|
1534
1557
|
f(this, "_initialData", []);
|
|
1535
1558
|
f(this, "_preparedData", []);
|
|
@@ -1543,10 +1566,10 @@ class Tt {
|
|
|
1543
1566
|
return e.map((t) => ({ ...t, open_time: new Date(t.open_time), close_time: new Date(t.close_time) })).sort((t, s) => t.open_time.getTime() - s.open_time.getTime());
|
|
1544
1567
|
}
|
|
1545
1568
|
update(e) {
|
|
1546
|
-
this._initialData = e, this._preparedData = this._prepare(e), this._missingData =
|
|
1569
|
+
this._initialData = e, this._preparedData = this._prepare(e), this._missingData = ai(this._preparedData, this._model), this._count = this._preparedData.length + this._missingData.length, this._interval = new Date(e[0].close_time).getTime() - new Date(e[0].open_time).getTime();
|
|
1547
1570
|
}
|
|
1548
1571
|
updateMissingCandles() {
|
|
1549
|
-
this._missingData =
|
|
1572
|
+
this._missingData = ai(this._preparedData, this._model);
|
|
1550
1573
|
}
|
|
1551
1574
|
get initialData() {
|
|
1552
1575
|
return this._initialData;
|
|
@@ -1589,7 +1612,7 @@ class yn {
|
|
|
1589
1612
|
});
|
|
1590
1613
|
}
|
|
1591
1614
|
}
|
|
1592
|
-
class
|
|
1615
|
+
class vi {
|
|
1593
1616
|
constructor() {
|
|
1594
1617
|
f(this, "_scale");
|
|
1595
1618
|
}
|
|
@@ -1625,17 +1648,17 @@ class pi {
|
|
|
1625
1648
|
return this._scale(e);
|
|
1626
1649
|
}
|
|
1627
1650
|
}
|
|
1628
|
-
class
|
|
1651
|
+
class bi extends vi {
|
|
1629
1652
|
constructor() {
|
|
1630
|
-
super(), this._scale =
|
|
1653
|
+
super(), this._scale = L.scaleTime();
|
|
1631
1654
|
}
|
|
1632
1655
|
}
|
|
1633
|
-
class wn extends
|
|
1656
|
+
class wn extends vi {
|
|
1634
1657
|
constructor() {
|
|
1635
|
-
super(), this._scale =
|
|
1658
|
+
super(), this._scale = L.scaleLinear();
|
|
1636
1659
|
}
|
|
1637
1660
|
}
|
|
1638
|
-
const
|
|
1661
|
+
const ri = { x: 0.2, y: 0.2 }, oi = 1e-3, xn = {
|
|
1639
1662
|
s: 1e3,
|
|
1640
1663
|
M: 1e3 * 60,
|
|
1641
1664
|
h: 1e3 * 60 * 60,
|
|
@@ -1645,32 +1668,32 @@ const ai = { x: 0.2, y: 0.2 }, ri = 1e-3, xn = {
|
|
|
1645
1668
|
const e = i.match(/^(\d+)([a-zA-Z]+)$/);
|
|
1646
1669
|
if (!e) throw new Error(`Invalid offset format: "${i}"`);
|
|
1647
1670
|
return [parseInt(e[1]), e[2]];
|
|
1648
|
-
},
|
|
1671
|
+
}, Tn = (i, e) => {
|
|
1649
1672
|
const [t, s] = e.domain().map((o) => o.getTime()), n = i.filter((o) => {
|
|
1650
1673
|
const c = o.open_time.getTime();
|
|
1651
1674
|
return c >= t && c <= s;
|
|
1652
|
-
}), a =
|
|
1675
|
+
}), a = L.min(n, (o) => o.low), r = L.max(n, (o) => o.high);
|
|
1653
1676
|
if (a == null || r == null) throw new Error("Invalid Y data");
|
|
1654
1677
|
return [a, r];
|
|
1655
1678
|
};
|
|
1656
|
-
class
|
|
1679
|
+
class An {
|
|
1657
1680
|
constructor(e) {
|
|
1658
1681
|
this.model = e;
|
|
1659
1682
|
}
|
|
1660
1683
|
initX(e) {
|
|
1661
|
-
const t = this.model.candles.preparedData, s =
|
|
1684
|
+
const t = this.model.candles.preparedData, s = L.extent(t, (n) => new Date(n.open_time));
|
|
1662
1685
|
if (!s[0] || !s[1]) throw new Error("Invalid x data");
|
|
1663
1686
|
e.setDomain(s), this.setRange(e, this.model.layout.xAxis), this.setDefaultXDomain(e), this.applyOffset(e);
|
|
1664
1687
|
}
|
|
1665
1688
|
initY(e, t) {
|
|
1666
|
-
const s =
|
|
1689
|
+
const s = Tn(this.model.candles.preparedData, t);
|
|
1667
1690
|
e.setDomain(s), this.setRange(e, this.model.layout.yAxis);
|
|
1668
1691
|
}
|
|
1669
1692
|
init(e) {
|
|
1670
1693
|
this.initX(e.x), this.initY(e.y, e.x);
|
|
1671
1694
|
}
|
|
1672
1695
|
setRange(e, { x: t, y: s, width: n, height: a }) {
|
|
1673
|
-
e instanceof
|
|
1696
|
+
e instanceof bi ? e.setRange([t, t + n]) : e.setRange([s + a, s]);
|
|
1674
1697
|
}
|
|
1675
1698
|
setDefaultXDomain(e) {
|
|
1676
1699
|
const {
|
|
@@ -1679,8 +1702,8 @@ class Mn {
|
|
|
1679
1702
|
config: {
|
|
1680
1703
|
candles: { baseWidth: n, bodyRatio: a, direction: r }
|
|
1681
1704
|
}
|
|
1682
|
-
} = this.model, [o, c] = e.domain().map((
|
|
1683
|
-
e.setDomain(
|
|
1705
|
+
} = this.model, [o, c] = e.domain().map((p) => p.getTime()), h = c - o, d = n / a * t, g = h * (s.width / d), _ = r === "left" ? [new Date(o), new Date(o + g)] : [new Date(c - g), new Date(c)];
|
|
1706
|
+
e.setDomain(_);
|
|
1684
1707
|
}
|
|
1685
1708
|
applyOffset(e) {
|
|
1686
1709
|
const {
|
|
@@ -1688,11 +1711,11 @@ class Mn {
|
|
|
1688
1711
|
candles: { offset: t, direction: s }
|
|
1689
1712
|
},
|
|
1690
1713
|
layout: { xAxis: n }
|
|
1691
|
-
} = this.model, [a, r] = Cn(t), o = r === "px" ? e.invert(n.x + a).getTime() - e.invert(n.x).getTime() : xn[r] * a, c = s === "left" ? -o : o, [h,
|
|
1692
|
-
e.setDomain([new Date(h.getTime() + c), new Date(
|
|
1714
|
+
} = this.model, [a, r] = Cn(t), o = r === "px" ? e.invert(n.x + a).getTime() - e.invert(n.x).getTime() : xn[r] * a, c = s === "left" ? -o : o, [h, d] = e.domain();
|
|
1715
|
+
e.setDomain([new Date(h.getTime() + c), new Date(d.getTime() + c)]);
|
|
1693
1716
|
}
|
|
1694
1717
|
}
|
|
1695
|
-
class
|
|
1718
|
+
class Mn {
|
|
1696
1719
|
constructor(e) {
|
|
1697
1720
|
f(this, "_model");
|
|
1698
1721
|
f(this, "_scaleX");
|
|
@@ -1704,7 +1727,7 @@ class Sn {
|
|
|
1704
1727
|
});
|
|
1705
1728
|
f(this, "scaleFactor", { x: 1, y: 1 });
|
|
1706
1729
|
f(this, "panOffset", { x: 0, y: 0 });
|
|
1707
|
-
this._model = e, this._scaleX = new
|
|
1730
|
+
this._model = e, this._scaleX = new bi(), this._scaleY = new wn(), this._initializer = new An(e), this._initializer.init({ x: this._scaleX, y: this._scaleY }), this._baseDomain = {
|
|
1708
1731
|
x: this._scaleX.domain(),
|
|
1709
1732
|
y: this._scaleY.domain()
|
|
1710
1733
|
};
|
|
@@ -1740,17 +1763,17 @@ class Sn {
|
|
|
1740
1763
|
if (o === 0) return;
|
|
1741
1764
|
const c = this._baseDomain.y;
|
|
1742
1765
|
this.scale("y", (c[1] - c[0]) / o, "absolute");
|
|
1743
|
-
const h = this._scaleY.convert((a + r) / 2),
|
|
1744
|
-
this.pan("y",
|
|
1766
|
+
const h = this._scaleY.convert((a + r) / 2), d = this._scaleY.convert((c[0] + c[1]) / 2);
|
|
1767
|
+
this.pan("y", d - h, "absolute");
|
|
1745
1768
|
}
|
|
1746
1769
|
scale(e, t, s = "delta") {
|
|
1747
1770
|
if (s === "absolute") {
|
|
1748
|
-
const n = Math.max(
|
|
1749
|
-
if (Math.abs(n - this.scaleFactor[e]) <
|
|
1771
|
+
const n = Math.max(ri[e], t);
|
|
1772
|
+
if (Math.abs(n - this.scaleFactor[e]) < oi) return;
|
|
1750
1773
|
this.scaleFactor[e] = n;
|
|
1751
1774
|
} else {
|
|
1752
1775
|
const n = this.scaleFactor[e], a = n + t * this._model.config.candles.scaleSensitivity;
|
|
1753
|
-
if (a <
|
|
1776
|
+
if (a < ri[e] || Math.abs(a - n) < oi) return;
|
|
1754
1777
|
this.scaleFactor[e] = a;
|
|
1755
1778
|
}
|
|
1756
1779
|
this._updateDomain(e);
|
|
@@ -1761,22 +1784,22 @@ class Sn {
|
|
|
1761
1784
|
_updateDomain(e) {
|
|
1762
1785
|
const t = this._baseDomain[e], s = this.scaleFactor[e], n = this.panOffset[e];
|
|
1763
1786
|
if (e === "x") {
|
|
1764
|
-
const [a, r] = t, o = r.getTime() - a.getTime(), c = o / s, h = a.getTime() + o / 2,
|
|
1787
|
+
const [a, r] = t, o = r.getTime() - a.getTime(), c = o / s, h = a.getTime() + o / 2, d = this._scaleX.invert(0 - n).getTime() - this._scaleX.invert(0).getTime();
|
|
1765
1788
|
this._scaleX.setDomain([
|
|
1766
|
-
new Date(h - c / 2 +
|
|
1767
|
-
new Date(h + c / 2 +
|
|
1789
|
+
new Date(h - c / 2 + d),
|
|
1790
|
+
new Date(h + c / 2 + d)
|
|
1768
1791
|
]);
|
|
1769
1792
|
} else {
|
|
1770
|
-
const [a, r] = t, o = r - a, c = o / s, h = a + o / 2,
|
|
1793
|
+
const [a, r] = t, o = r - a, c = o / s, h = a + o / 2, d = this._scaleY.invert(0 - n) - this._scaleY.invert(0);
|
|
1771
1794
|
this._scaleY.setDomain([
|
|
1772
|
-
h - c / 2 +
|
|
1773
|
-
h + c / 2 +
|
|
1795
|
+
h - c / 2 + d,
|
|
1796
|
+
h + c / 2 + d
|
|
1774
1797
|
]);
|
|
1775
1798
|
}
|
|
1776
1799
|
this._model.eventBus.emit("scale_event");
|
|
1777
1800
|
}
|
|
1778
1801
|
}
|
|
1779
|
-
class
|
|
1802
|
+
class Sn {
|
|
1780
1803
|
constructor(e, { entry: t = [], exit: s = [] }) {
|
|
1781
1804
|
f(this, "_model");
|
|
1782
1805
|
f(this, "_rawEntry");
|
|
@@ -1864,7 +1887,7 @@ class Tn {
|
|
|
1864
1887
|
return Math.abs(this.entryMinTime - this.exitMaxTime);
|
|
1865
1888
|
}
|
|
1866
1889
|
}
|
|
1867
|
-
class
|
|
1890
|
+
class Dn {
|
|
1868
1891
|
constructor(e, t) {
|
|
1869
1892
|
f(this, "_rawMarkers");
|
|
1870
1893
|
f(this, "_markers", []);
|
|
@@ -1894,7 +1917,7 @@ class kn {
|
|
|
1894
1917
|
mainColor: n.mainColor ?? s.main,
|
|
1895
1918
|
textColor: n.textColor ?? s.text,
|
|
1896
1919
|
lineColor: n.lineColor ?? s.line
|
|
1897
|
-
}, r = t.convert(n.value), c = (n.formatter ?? ((h = this._defaults.formatter) == null ? void 0 : h.horizontal) ?? ((
|
|
1920
|
+
}, r = t.convert(n.value), c = (n.formatter ?? ((h = this._defaults.formatter) == null ? void 0 : h.horizontal) ?? ((d) => d.toString()))(n.value);
|
|
1898
1921
|
return {
|
|
1899
1922
|
value: n.value,
|
|
1900
1923
|
text: c,
|
|
@@ -1912,7 +1935,7 @@ class kn {
|
|
|
1912
1935
|
return this._markers;
|
|
1913
1936
|
}
|
|
1914
1937
|
}
|
|
1915
|
-
const
|
|
1938
|
+
const kn = {
|
|
1916
1939
|
bg: "#FFFFFF",
|
|
1917
1940
|
axisIntersection: "#FFFFFF",
|
|
1918
1941
|
xAxis: {
|
|
@@ -1976,10 +1999,10 @@ const Dn = {
|
|
|
1976
1999
|
}
|
|
1977
2000
|
}
|
|
1978
2001
|
};
|
|
1979
|
-
class
|
|
2002
|
+
class Ln {
|
|
1980
2003
|
constructor(e) {
|
|
1981
2004
|
f(this, "_scheme");
|
|
1982
|
-
this._scheme = Qe({},
|
|
2005
|
+
this._scheme = Qe({}, kn, e), Object.keys(this._scheme).forEach((t) => {
|
|
1983
2006
|
Object.defineProperty(this, t, {
|
|
1984
2007
|
get: () => this._scheme[t],
|
|
1985
2008
|
enumerable: !0
|
|
@@ -1990,7 +2013,7 @@ class En {
|
|
|
1990
2013
|
this._scheme = Qe({}, this._scheme, e);
|
|
1991
2014
|
}
|
|
1992
2015
|
}
|
|
1993
|
-
class
|
|
2016
|
+
class En {
|
|
1994
2017
|
constructor(e, t) {
|
|
1995
2018
|
f(this, "_data");
|
|
1996
2019
|
f(this, "_callbacks", {
|
|
@@ -2008,7 +2031,7 @@ class Ln {
|
|
|
2008
2031
|
_updateGroups() {
|
|
2009
2032
|
this._grouped = {};
|
|
2010
2033
|
for (const e of this._data) {
|
|
2011
|
-
const t =
|
|
2034
|
+
const t = Dt.findByDate(new Date(e.date), this._model.candles.allData);
|
|
2012
2035
|
if (!t) continue;
|
|
2013
2036
|
const s = t.open_time.getTime();
|
|
2014
2037
|
this._grouped[s] || (this._grouped[s] = []), this._grouped[s].push({ ...e, candle: t });
|
|
@@ -2055,7 +2078,7 @@ class Nn {
|
|
|
2055
2078
|
f(this, "trade");
|
|
2056
2079
|
f(this, "userMarkers");
|
|
2057
2080
|
f(this, "comments");
|
|
2058
|
-
this.chartId = e, this.container = t, this.candles = new
|
|
2081
|
+
this.chartId = e, this.container = t, this.candles = new Dt(s, this), this.config = new pn(n), this.colorScheme = new Ln(o), this.layout = new _n(t, this.config), this.scales = new Mn(this), this.trade = new Sn(this, a), this.candles.updateMissingCandles(), this.trade.recalculate(), this.userMarkers = new Dn(this, r), this.comments = new En(c, this);
|
|
2059
2082
|
}
|
|
2060
2083
|
init() {
|
|
2061
2084
|
this.eventBus.emit("init_model");
|
|
@@ -2124,7 +2147,7 @@ class k {
|
|
|
2124
2147
|
this.node.style.opacity = e ? "1" : "0", this.node.style.visibility = e ? "visible" : "hidden";
|
|
2125
2148
|
}
|
|
2126
2149
|
}
|
|
2127
|
-
class
|
|
2150
|
+
class Ee extends k {
|
|
2128
2151
|
constructor({ className: t, id: s, width: n, height: a, isMain: r }) {
|
|
2129
2152
|
super({
|
|
2130
2153
|
tag: "canvas",
|
|
@@ -2163,10 +2186,10 @@ function Hn(i, e) {
|
|
|
2163
2186
|
colorScheme: { xAxis: s },
|
|
2164
2187
|
config: { xAxis: n },
|
|
2165
2188
|
scales: a
|
|
2166
|
-
} = e, r = a.x.ticks(Fn), o = (
|
|
2167
|
-
i.save(), i.fillStyle = s.bg, i.fillRect(t.x, t.y, t.width, t.height), i.restore(), i.fillStyle = s.text, i.font = `${n.text.fontSize} ${n.text.font}`, i.textAlign = "center", i.textBaseline = "middle", r.forEach((
|
|
2168
|
-
const g = a.x.convert(
|
|
2169
|
-
i.fillText(
|
|
2189
|
+
} = e, r = a.x.ticks(Fn), o = (d) => d.getHours() === 0 && d.getMinutes() === 0, c = L.timeFormat("%d %b"), h = L.timeFormat("%H:%M");
|
|
2190
|
+
i.save(), i.fillStyle = s.bg, i.fillRect(t.x, t.y, t.width, t.height), i.restore(), i.fillStyle = s.text, i.font = `${n.text.fontSize} ${n.text.font}`, i.textAlign = "center", i.textBaseline = "middle", r.forEach((d) => {
|
|
2191
|
+
const g = a.x.convert(d), _ = o(d) ? c(d) : h(d);
|
|
2192
|
+
i.fillText(_, g, t.y + t.height / 2);
|
|
2170
2193
|
});
|
|
2171
2194
|
}
|
|
2172
2195
|
function Bn(i, e) {
|
|
@@ -2177,8 +2200,8 @@ function Bn(i, e) {
|
|
|
2177
2200
|
scales: a
|
|
2178
2201
|
} = e, r = a.y.ticks(6), o = a.y.tickFormat(6);
|
|
2179
2202
|
i.save(), i.fillStyle = s.bg, i.fillRect(t.x, t.y, t.width, t.height), i.restore(), i.fillStyle = s.text, i.font = `${n.text.fontSize} ${n.text.font}`, i.textAlign = "center", i.textBaseline = "middle", r.forEach((c) => {
|
|
2180
|
-
const h = a.y.convert(c),
|
|
2181
|
-
i.fillText(
|
|
2203
|
+
const h = a.y.convert(c), d = o(c);
|
|
2204
|
+
i.fillText(d, t.x + t.width / 2, h);
|
|
2182
2205
|
});
|
|
2183
2206
|
}
|
|
2184
2207
|
const In = (i, e) => {
|
|
@@ -2235,13 +2258,13 @@ function Ke(i) {
|
|
|
2235
2258
|
return i * 0.1875;
|
|
2236
2259
|
}
|
|
2237
2260
|
const $n = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2238
|
-
const g = r / 16,
|
|
2239
|
-
i.save(), i.translate(
|
|
2261
|
+
const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
|
|
2262
|
+
i.save(), i.translate(p, v), i.scale(g, g), i.beginPath(), i.moveTo(7.85696, 0.288512), i.lineTo(4.53377, 3.11938), i.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), i.lineTo(11.2275, 4), i.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), i.lineTo(8.52156, 0.302869), i.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), i.closePath(), i.fillStyle = e, i.fill(), i.beginPath(), i.moveTo(0, 7), i.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), i.lineTo(12, 3), i.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), i.lineTo(16, 15), i.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), i.lineTo(4, 19), i.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), i.lineTo(0, 7), i.closePath(), i.fillStyle = e, i.fill(), i.restore(), i.save(), i.font = `bold ${o}px sans-serif`, i.textAlign = "center", i.textBaseline = "top", i.textAlign = "center", i.textBaseline = "middle";
|
|
2240
2263
|
const b = a + g * 3 + 0.5, w = g * 16, x = b + w / 2;
|
|
2241
2264
|
i.fillStyle = t, i.fillText(s, n, x), i.restore();
|
|
2242
2265
|
}, On = (i, { mainColor: e, textColor: t, symbol: s, x: n, y: a, size: r, fontSize: o }) => {
|
|
2243
|
-
const g = r / 16,
|
|
2244
|
-
i.save(), i.translate(
|
|
2266
|
+
const g = r / 16, _ = 16 * g, p = n - _ / 2, v = a;
|
|
2267
|
+
i.save(), i.translate(p, v), i.scale(g, -g), i.beginPath(), i.moveTo(7.85696, 0.288512), i.lineTo(4.53377, 3.11938), i.bezierCurveTo(4.17982, 3.42089, 4.39305, 4, 4.85801, 4), i.lineTo(11.2275, 4), i.bezierCurveTo(11.6818, 4, 11.9006, 3.44302, 11.5678, 3.13374), i.lineTo(8.52156, 0.302869), i.bezierCurveTo(8.33575, 0.130189, 8.05007, 0.124018, 7.85696, 0.288512), i.closePath(), i.fillStyle = e, i.fill(), i.beginPath(), i.moveTo(0, 7), i.bezierCurveTo(0, 4.79086, 1.79086, 3, 4, 3), i.lineTo(12, 3), i.bezierCurveTo(14.2091, 3, 16, 4.79086, 16, 7), i.lineTo(16, 15), i.bezierCurveTo(16, 17.2091, 14.2091, 19, 12, 19), i.lineTo(4, 19), i.bezierCurveTo(1.79086, 19, 0, 17.2091, 0, 15), i.lineTo(0, 7), i.closePath(), i.fillStyle = e, i.fill(), i.restore(), i.save(), i.font = `bold ${o}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle";
|
|
2245
2268
|
const b = g * 16, w = a - g * 19 + b / 2;
|
|
2246
2269
|
i.fillStyle = t, i.fillText(s, n, w), i.restore();
|
|
2247
2270
|
};
|
|
@@ -2254,15 +2277,15 @@ function et(i) {
|
|
|
2254
2277
|
}, et(i);
|
|
2255
2278
|
}
|
|
2256
2279
|
var Pn = /^\s+/, zn = /\s+$/;
|
|
2257
|
-
function
|
|
2258
|
-
if (i = i || "", e = e || {}, i instanceof
|
|
2280
|
+
function A(i, e) {
|
|
2281
|
+
if (i = i || "", e = e || {}, i instanceof A)
|
|
2259
2282
|
return i;
|
|
2260
|
-
if (!(this instanceof
|
|
2261
|
-
return new
|
|
2283
|
+
if (!(this instanceof A))
|
|
2284
|
+
return new A(i, e);
|
|
2262
2285
|
var t = Vn(i);
|
|
2263
2286
|
this._originalInput = i, this._r = t.r, this._g = t.g, this._b = t.b, this._a = t.a, this._roundA = Math.round(100 * this._a) / 100, this._format = e.format || t.format, this._gradientType = e.gradientType, this._r < 1 && (this._r = Math.round(this._r)), this._g < 1 && (this._g = Math.round(this._g)), this._b < 1 && (this._b = Math.round(this._b)), this._ok = t.ok;
|
|
2264
2287
|
}
|
|
2265
|
-
|
|
2288
|
+
A.prototype = {
|
|
2266
2289
|
isDark: function() {
|
|
2267
2290
|
return this.getBrightness() < 128;
|
|
2268
2291
|
},
|
|
@@ -2290,10 +2313,10 @@ M.prototype = {
|
|
|
2290
2313
|
return t = e.r / 255, s = e.g / 255, n = e.b / 255, t <= 0.03928 ? a = t / 12.92 : a = Math.pow((t + 0.055) / 1.055, 2.4), s <= 0.03928 ? r = s / 12.92 : r = Math.pow((s + 0.055) / 1.055, 2.4), n <= 0.03928 ? o = n / 12.92 : o = Math.pow((n + 0.055) / 1.055, 2.4), 0.2126 * a + 0.7152 * r + 0.0722 * o;
|
|
2291
2314
|
},
|
|
2292
2315
|
setAlpha: function(e) {
|
|
2293
|
-
return this._a =
|
|
2316
|
+
return this._a = yi(e), this._roundA = Math.round(100 * this._a) / 100, this;
|
|
2294
2317
|
},
|
|
2295
2318
|
toHsv: function() {
|
|
2296
|
-
var e =
|
|
2319
|
+
var e = ci(this._r, this._g, this._b);
|
|
2297
2320
|
return {
|
|
2298
2321
|
h: e.h * 360,
|
|
2299
2322
|
s: e.s,
|
|
@@ -2302,11 +2325,11 @@ M.prototype = {
|
|
|
2302
2325
|
};
|
|
2303
2326
|
},
|
|
2304
2327
|
toHsvString: function() {
|
|
2305
|
-
var e =
|
|
2328
|
+
var e = ci(this._r, this._g, this._b), t = Math.round(e.h * 360), s = Math.round(e.s * 100), n = Math.round(e.v * 100);
|
|
2306
2329
|
return this._a == 1 ? "hsv(" + t + ", " + s + "%, " + n + "%)" : "hsva(" + t + ", " + s + "%, " + n + "%, " + this._roundA + ")";
|
|
2307
2330
|
},
|
|
2308
2331
|
toHsl: function() {
|
|
2309
|
-
var e =
|
|
2332
|
+
var e = li(this._r, this._g, this._b);
|
|
2310
2333
|
return {
|
|
2311
2334
|
h: e.h * 360,
|
|
2312
2335
|
s: e.s,
|
|
@@ -2315,11 +2338,11 @@ M.prototype = {
|
|
|
2315
2338
|
};
|
|
2316
2339
|
},
|
|
2317
2340
|
toHslString: function() {
|
|
2318
|
-
var e =
|
|
2341
|
+
var e = li(this._r, this._g, this._b), t = Math.round(e.h * 360), s = Math.round(e.s * 100), n = Math.round(e.l * 100);
|
|
2319
2342
|
return this._a == 1 ? "hsl(" + t + ", " + s + "%, " + n + "%)" : "hsla(" + t + ", " + s + "%, " + n + "%, " + this._roundA + ")";
|
|
2320
2343
|
},
|
|
2321
2344
|
toHex: function(e) {
|
|
2322
|
-
return
|
|
2345
|
+
return hi(this._r, this._g, this._b, e);
|
|
2323
2346
|
},
|
|
2324
2347
|
toHexString: function(e) {
|
|
2325
2348
|
return "#" + this.toHex(e);
|
|
@@ -2353,13 +2376,13 @@ M.prototype = {
|
|
|
2353
2376
|
return this._a == 1 ? "rgb(" + Math.round(R(this._r, 255) * 100) + "%, " + Math.round(R(this._g, 255) * 100) + "%, " + Math.round(R(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(R(this._r, 255) * 100) + "%, " + Math.round(R(this._g, 255) * 100) + "%, " + Math.round(R(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
2354
2377
|
},
|
|
2355
2378
|
toName: function() {
|
|
2356
|
-
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : na[
|
|
2379
|
+
return this._a === 0 ? "transparent" : this._a < 1 ? !1 : na[hi(this._r, this._g, this._b, !0)] || !1;
|
|
2357
2380
|
},
|
|
2358
2381
|
toFilter: function(e) {
|
|
2359
|
-
var t = "#" +
|
|
2382
|
+
var t = "#" + di(this._r, this._g, this._b, this._a), s = t, n = this._gradientType ? "GradientType = 1, " : "";
|
|
2360
2383
|
if (e) {
|
|
2361
|
-
var a =
|
|
2362
|
-
s = "#" +
|
|
2384
|
+
var a = A(e);
|
|
2385
|
+
s = "#" + di(a._r, a._g, a._b, a._a);
|
|
2363
2386
|
}
|
|
2364
2387
|
return "progid:DXImageTransform.Microsoft.gradient(" + n + "startColorstr=" + t + ",endColorstr=" + s + ")";
|
|
2365
2388
|
},
|
|
@@ -2370,7 +2393,7 @@ M.prototype = {
|
|
|
2370
2393
|
return a ? e === "name" && this._a === 0 ? this.toName() : this.toRgbString() : (e === "rgb" && (s = this.toRgbString()), e === "prgb" && (s = this.toPercentageRgbString()), (e === "hex" || e === "hex6") && (s = this.toHexString()), e === "hex3" && (s = this.toHexString(!0)), e === "hex4" && (s = this.toHex8String(!0)), e === "hex8" && (s = this.toHex8String()), e === "name" && (s = this.toName()), e === "hsl" && (s = this.toHslString()), e === "hsv" && (s = this.toHsvString()), s || this.toHexString());
|
|
2371
2394
|
},
|
|
2372
2395
|
clone: function() {
|
|
2373
|
-
return
|
|
2396
|
+
return A(this.toString());
|
|
2374
2397
|
},
|
|
2375
2398
|
_applyModification: function(e, t) {
|
|
2376
2399
|
var s = e.apply(null, [this].concat([].slice.call(t)));
|
|
@@ -2417,20 +2440,20 @@ M.prototype = {
|
|
|
2417
2440
|
// return this._applyCombination(polyad, [number]);
|
|
2418
2441
|
// },
|
|
2419
2442
|
triad: function() {
|
|
2420
|
-
return this._applyCombination(
|
|
2443
|
+
return this._applyCombination(ui, [3]);
|
|
2421
2444
|
},
|
|
2422
2445
|
tetrad: function() {
|
|
2423
|
-
return this._applyCombination(
|
|
2446
|
+
return this._applyCombination(ui, [4]);
|
|
2424
2447
|
}
|
|
2425
2448
|
};
|
|
2426
|
-
|
|
2449
|
+
A.fromRatio = function(i, e) {
|
|
2427
2450
|
if (et(i) == "object") {
|
|
2428
2451
|
var t = {};
|
|
2429
2452
|
for (var s in i)
|
|
2430
|
-
i.hasOwnProperty(s) && (s === "a" ? t[s] = i[s] : t[s] =
|
|
2453
|
+
i.hasOwnProperty(s) && (s === "a" ? t[s] = i[s] : t[s] = De(i[s]));
|
|
2431
2454
|
i = t;
|
|
2432
2455
|
}
|
|
2433
|
-
return
|
|
2456
|
+
return A(i, e);
|
|
2434
2457
|
};
|
|
2435
2458
|
function Vn(i) {
|
|
2436
2459
|
var e = {
|
|
@@ -2438,7 +2461,7 @@ function Vn(i) {
|
|
|
2438
2461
|
g: 0,
|
|
2439
2462
|
b: 0
|
|
2440
2463
|
}, t = 1, s = null, n = null, a = null, r = !1, o = !1;
|
|
2441
|
-
return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e = Yn(i.r, i.g, i.b), r = !0, o = String(i.r).substr(-1) === "%" ? "prgb" : "rgb") : ie(i.h) && ie(i.s) && ie(i.v) ? (s =
|
|
2464
|
+
return typeof i == "string" && (i = la(i)), et(i) == "object" && (ie(i.r) && ie(i.g) && ie(i.b) ? (e = Yn(i.r, i.g, i.b), r = !0, o = String(i.r).substr(-1) === "%" ? "prgb" : "rgb") : ie(i.h) && ie(i.s) && ie(i.v) ? (s = De(i.s), n = De(i.v), e = jn(i.h, s, n), r = !0, o = "hsv") : ie(i.h) && ie(i.s) && ie(i.l) && (s = De(i.s), a = De(i.l), e = Wn(i.h, s, a), r = !0, o = "hsl"), i.hasOwnProperty("a") && (t = i.a)), t = yi(t), {
|
|
2442
2465
|
ok: r,
|
|
2443
2466
|
format: i.format || o,
|
|
2444
2467
|
r: Math.min(255, Math.max(e.r, 0)),
|
|
@@ -2454,7 +2477,7 @@ function Yn(i, e, t) {
|
|
|
2454
2477
|
b: R(t, 255) * 255
|
|
2455
2478
|
};
|
|
2456
2479
|
}
|
|
2457
|
-
function
|
|
2480
|
+
function li(i, e, t) {
|
|
2458
2481
|
i = R(i, 255), e = R(e, 255), t = R(t, 255);
|
|
2459
2482
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = (s + n) / 2;
|
|
2460
2483
|
if (s == n)
|
|
@@ -2483,8 +2506,8 @@ function oi(i, e, t) {
|
|
|
2483
2506
|
function Wn(i, e, t) {
|
|
2484
2507
|
var s, n, a;
|
|
2485
2508
|
i = R(i, 360), e = R(e, 100), t = R(t, 100);
|
|
2486
|
-
function r(h,
|
|
2487
|
-
return g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ? h + (
|
|
2509
|
+
function r(h, d, g) {
|
|
2510
|
+
return g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ? h + (d - h) * 6 * g : g < 1 / 2 ? d : g < 2 / 3 ? h + (d - h) * (2 / 3 - g) * 6 : h;
|
|
2488
2511
|
}
|
|
2489
2512
|
if (e === 0)
|
|
2490
2513
|
s = n = a = t;
|
|
@@ -2498,7 +2521,7 @@ function Wn(i, e, t) {
|
|
|
2498
2521
|
b: a * 255
|
|
2499
2522
|
};
|
|
2500
2523
|
}
|
|
2501
|
-
function
|
|
2524
|
+
function ci(i, e, t) {
|
|
2502
2525
|
i = R(i, 255), e = R(e, 255), t = R(t, 255);
|
|
2503
2526
|
var s = Math.max(i, e, t), n = Math.min(i, e, t), a, r, o = s, c = s - n;
|
|
2504
2527
|
if (r = s === 0 ? 0 : c / s, s == n)
|
|
@@ -2525,30 +2548,30 @@ function li(i, e, t) {
|
|
|
2525
2548
|
}
|
|
2526
2549
|
function jn(i, e, t) {
|
|
2527
2550
|
i = R(i, 360) * 6, e = R(e, 100), t = R(t, 100);
|
|
2528
|
-
var s = Math.floor(i), n = i - s, a = t * (1 - e), r = t * (1 - n * e), o = t * (1 - (1 - n) * e), c = s % 6, h = [t, r, a, a, o, t][c],
|
|
2551
|
+
var s = Math.floor(i), n = i - s, a = t * (1 - e), r = t * (1 - n * e), o = t * (1 - (1 - n) * e), c = s % 6, h = [t, r, a, a, o, t][c], d = [o, t, t, r, a, a][c], g = [a, a, o, t, t, r][c];
|
|
2529
2552
|
return {
|
|
2530
2553
|
r: h * 255,
|
|
2531
|
-
g:
|
|
2554
|
+
g: d * 255,
|
|
2532
2555
|
b: g * 255
|
|
2533
2556
|
};
|
|
2534
2557
|
}
|
|
2535
|
-
function
|
|
2558
|
+
function hi(i, e, t, s) {
|
|
2536
2559
|
var n = [K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16))];
|
|
2537
2560
|
return s && 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("");
|
|
2538
2561
|
}
|
|
2539
2562
|
function Xn(i, e, t, s, n) {
|
|
2540
|
-
var a = [K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16)), K(
|
|
2563
|
+
var a = [K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16)), K(wi(s))];
|
|
2541
2564
|
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("");
|
|
2542
2565
|
}
|
|
2543
|
-
function
|
|
2544
|
-
var n = [K(
|
|
2566
|
+
function di(i, e, t, s) {
|
|
2567
|
+
var n = [K(wi(s)), K(Math.round(i).toString(16)), K(Math.round(e).toString(16)), K(Math.round(t).toString(16))];
|
|
2545
2568
|
return n.join("");
|
|
2546
2569
|
}
|
|
2547
|
-
|
|
2548
|
-
return !i || !e ? !1 :
|
|
2570
|
+
A.equals = function(i, e) {
|
|
2571
|
+
return !i || !e ? !1 : A(i).toRgbString() == A(e).toRgbString();
|
|
2549
2572
|
};
|
|
2550
|
-
|
|
2551
|
-
return
|
|
2573
|
+
A.random = function() {
|
|
2574
|
+
return A.fromRatio({
|
|
2552
2575
|
r: Math.random(),
|
|
2553
2576
|
g: Math.random(),
|
|
2554
2577
|
b: Math.random()
|
|
@@ -2556,45 +2579,45 @@ M.random = function() {
|
|
|
2556
2579
|
};
|
|
2557
2580
|
function Un(i, e) {
|
|
2558
2581
|
e = e === 0 ? 0 : e || 10;
|
|
2559
|
-
var t =
|
|
2560
|
-
return t.s -= e / 100, t.s = it(t.s),
|
|
2582
|
+
var t = A(i).toHsl();
|
|
2583
|
+
return t.s -= e / 100, t.s = it(t.s), A(t);
|
|
2561
2584
|
}
|
|
2562
2585
|
function Gn(i, e) {
|
|
2563
2586
|
e = e === 0 ? 0 : e || 10;
|
|
2564
|
-
var t =
|
|
2565
|
-
return t.s += e / 100, t.s = it(t.s),
|
|
2587
|
+
var t = A(i).toHsl();
|
|
2588
|
+
return t.s += e / 100, t.s = it(t.s), A(t);
|
|
2566
2589
|
}
|
|
2567
2590
|
function Zn(i) {
|
|
2568
|
-
return
|
|
2591
|
+
return A(i).desaturate(100);
|
|
2569
2592
|
}
|
|
2570
2593
|
function qn(i, e) {
|
|
2571
2594
|
e = e === 0 ? 0 : e || 10;
|
|
2572
|
-
var t =
|
|
2573
|
-
return t.l += e / 100, t.l = it(t.l),
|
|
2595
|
+
var t = A(i).toHsl();
|
|
2596
|
+
return t.l += e / 100, t.l = it(t.l), A(t);
|
|
2574
2597
|
}
|
|
2575
2598
|
function Jn(i, e) {
|
|
2576
2599
|
e = e === 0 ? 0 : e || 10;
|
|
2577
|
-
var t =
|
|
2578
|
-
return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))),
|
|
2600
|
+
var t = A(i).toRgb();
|
|
2601
|
+
return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(e / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(e / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(e / 100)))), A(t);
|
|
2579
2602
|
}
|
|
2580
2603
|
function Qn(i, e) {
|
|
2581
2604
|
e = e === 0 ? 0 : e || 10;
|
|
2582
|
-
var t =
|
|
2583
|
-
return t.l -= e / 100, t.l = it(t.l),
|
|
2605
|
+
var t = A(i).toHsl();
|
|
2606
|
+
return t.l -= e / 100, t.l = it(t.l), A(t);
|
|
2584
2607
|
}
|
|
2585
2608
|
function Kn(i, e) {
|
|
2586
|
-
var t =
|
|
2587
|
-
return t.h = s < 0 ? 360 + s : s,
|
|
2609
|
+
var t = A(i).toHsl(), s = (t.h + e) % 360;
|
|
2610
|
+
return t.h = s < 0 ? 360 + s : s, A(t);
|
|
2588
2611
|
}
|
|
2589
2612
|
function ea(i) {
|
|
2590
|
-
var e =
|
|
2591
|
-
return e.h = (e.h + 180) % 360,
|
|
2613
|
+
var e = A(i).toHsl();
|
|
2614
|
+
return e.h = (e.h + 180) % 360, A(e);
|
|
2592
2615
|
}
|
|
2593
|
-
function
|
|
2616
|
+
function ui(i, e) {
|
|
2594
2617
|
if (isNaN(e) || e <= 0)
|
|
2595
2618
|
throw new Error("Argument to polyad must be a positive number");
|
|
2596
|
-
for (var t =
|
|
2597
|
-
s.push(
|
|
2619
|
+
for (var t = A(i).toHsl(), s = [A(i)], n = 360 / e, a = 1; a < e; a++)
|
|
2620
|
+
s.push(A({
|
|
2598
2621
|
h: (t.h + a * n) % 360,
|
|
2599
2622
|
s: t.s,
|
|
2600
2623
|
l: t.l
|
|
@@ -2602,12 +2625,12 @@ function di(i, e) {
|
|
|
2602
2625
|
return s;
|
|
2603
2626
|
}
|
|
2604
2627
|
function ta(i) {
|
|
2605
|
-
var e =
|
|
2606
|
-
return [
|
|
2628
|
+
var e = A(i).toHsl(), t = e.h;
|
|
2629
|
+
return [A(i), A({
|
|
2607
2630
|
h: (t + 72) % 360,
|
|
2608
2631
|
s: e.s,
|
|
2609
2632
|
l: e.l
|
|
2610
|
-
}),
|
|
2633
|
+
}), A({
|
|
2611
2634
|
h: (t + 216) % 360,
|
|
2612
2635
|
s: e.s,
|
|
2613
2636
|
l: e.l
|
|
@@ -2615,37 +2638,37 @@ function ta(i) {
|
|
|
2615
2638
|
}
|
|
2616
2639
|
function ia(i, e, t) {
|
|
2617
2640
|
e = e || 6, t = t || 30;
|
|
2618
|
-
var s =
|
|
2641
|
+
var s = A(i).toHsl(), n = 360 / t, a = [A(i)];
|
|
2619
2642
|
for (s.h = (s.h - (n * e >> 1) + 720) % 360; --e; )
|
|
2620
|
-
s.h = (s.h + n) % 360, a.push(
|
|
2643
|
+
s.h = (s.h + n) % 360, a.push(A(s));
|
|
2621
2644
|
return a;
|
|
2622
2645
|
}
|
|
2623
2646
|
function sa(i, e) {
|
|
2624
2647
|
e = e || 6;
|
|
2625
|
-
for (var t =
|
|
2626
|
-
r.push(
|
|
2648
|
+
for (var t = A(i).toHsv(), s = t.h, n = t.s, a = t.v, r = [], o = 1 / e; e--; )
|
|
2649
|
+
r.push(A({
|
|
2627
2650
|
h: s,
|
|
2628
2651
|
s: n,
|
|
2629
2652
|
v: a
|
|
2630
2653
|
})), a = (a + o) % 1;
|
|
2631
2654
|
return r;
|
|
2632
2655
|
}
|
|
2633
|
-
|
|
2656
|
+
A.mix = function(i, e, t) {
|
|
2634
2657
|
t = t === 0 ? 0 : t || 50;
|
|
2635
|
-
var s =
|
|
2658
|
+
var s = A(i).toRgb(), n = A(e).toRgb(), a = t / 100, r = {
|
|
2636
2659
|
r: (n.r - s.r) * a + s.r,
|
|
2637
2660
|
g: (n.g - s.g) * a + s.g,
|
|
2638
2661
|
b: (n.b - s.b) * a + s.b,
|
|
2639
2662
|
a: (n.a - s.a) * a + s.a
|
|
2640
2663
|
};
|
|
2641
|
-
return
|
|
2664
|
+
return A(r);
|
|
2642
2665
|
};
|
|
2643
|
-
|
|
2644
|
-
var t =
|
|
2666
|
+
A.readability = function(i, e) {
|
|
2667
|
+
var t = A(i), s = A(e);
|
|
2645
2668
|
return (Math.max(t.getLuminance(), s.getLuminance()) + 0.05) / (Math.min(t.getLuminance(), s.getLuminance()) + 0.05);
|
|
2646
2669
|
};
|
|
2647
|
-
|
|
2648
|
-
var s =
|
|
2670
|
+
A.isReadable = function(i, e, t) {
|
|
2671
|
+
var s = A.readability(i, e), n, a;
|
|
2649
2672
|
switch (a = !1, n = ca(t), n.level + n.size) {
|
|
2650
2673
|
case "AAsmall":
|
|
2651
2674
|
case "AAAlarge":
|
|
@@ -2660,17 +2683,17 @@ M.isReadable = function(i, e, t) {
|
|
|
2660
2683
|
}
|
|
2661
2684
|
return a;
|
|
2662
2685
|
};
|
|
2663
|
-
|
|
2686
|
+
A.mostReadable = function(i, e, t) {
|
|
2664
2687
|
var s = null, n = 0, a, r, o, c;
|
|
2665
2688
|
t = t || {}, r = t.includeFallbackColors, o = t.level, c = t.size;
|
|
2666
2689
|
for (var h = 0; h < e.length; h++)
|
|
2667
|
-
a =
|
|
2668
|
-
return
|
|
2690
|
+
a = A.readability(i, e[h]), a > n && (n = a, s = A(e[h]));
|
|
2691
|
+
return A.isReadable(i, s, {
|
|
2669
2692
|
level: o,
|
|
2670
2693
|
size: c
|
|
2671
|
-
}) || !r ? s : (t.includeFallbackColors = !1,
|
|
2694
|
+
}) || !r ? s : (t.includeFallbackColors = !1, A.mostReadable(i, ["#fff", "#000"], t));
|
|
2672
2695
|
};
|
|
2673
|
-
var
|
|
2696
|
+
var Tt = A.names = {
|
|
2674
2697
|
aliceblue: "f0f8ff",
|
|
2675
2698
|
antiquewhite: "faebd7",
|
|
2676
2699
|
aqua: "0ff",
|
|
@@ -2820,14 +2843,14 @@ var At = M.names = {
|
|
|
2820
2843
|
whitesmoke: "f5f5f5",
|
|
2821
2844
|
yellow: "ff0",
|
|
2822
2845
|
yellowgreen: "9acd32"
|
|
2823
|
-
}, na =
|
|
2846
|
+
}, na = A.hexNames = aa(Tt);
|
|
2824
2847
|
function aa(i) {
|
|
2825
2848
|
var e = {};
|
|
2826
2849
|
for (var t in i)
|
|
2827
2850
|
i.hasOwnProperty(t) && (e[i[t]] = t);
|
|
2828
2851
|
return e;
|
|
2829
2852
|
}
|
|
2830
|
-
function
|
|
2853
|
+
function yi(i) {
|
|
2831
2854
|
return i = parseFloat(i), (isNaN(i) || i < 0 || i > 1) && (i = 1), i;
|
|
2832
2855
|
}
|
|
2833
2856
|
function R(i, e) {
|
|
@@ -2838,7 +2861,7 @@ function R(i, e) {
|
|
|
2838
2861
|
function it(i) {
|
|
2839
2862
|
return Math.min(1, Math.max(0, i));
|
|
2840
2863
|
}
|
|
2841
|
-
function
|
|
2864
|
+
function j(i) {
|
|
2842
2865
|
return parseInt(i, 16);
|
|
2843
2866
|
}
|
|
2844
2867
|
function ra(i) {
|
|
@@ -2850,14 +2873,14 @@ function oa(i) {
|
|
|
2850
2873
|
function K(i) {
|
|
2851
2874
|
return i.length == 1 ? "0" + i : "" + i;
|
|
2852
2875
|
}
|
|
2853
|
-
function
|
|
2876
|
+
function De(i) {
|
|
2854
2877
|
return i <= 1 && (i = i * 100 + "%"), i;
|
|
2855
2878
|
}
|
|
2856
|
-
function
|
|
2879
|
+
function wi(i) {
|
|
2857
2880
|
return Math.round(parseFloat(i) * 255).toString(16);
|
|
2858
2881
|
}
|
|
2859
|
-
function
|
|
2860
|
-
return
|
|
2882
|
+
function fi(i) {
|
|
2883
|
+
return j(i) / 255;
|
|
2861
2884
|
}
|
|
2862
2885
|
var Q = function() {
|
|
2863
2886
|
var i = "[-\\+]?\\d+%?", e = "[-\\+]?\\d*\\.\\d+%?", t = "(?:" + e + ")|(?:" + i + ")", s = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?", n = "[\\s|\\(]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")[,|\\s]+(" + t + ")\\s*\\)?";
|
|
@@ -2881,8 +2904,8 @@ function ie(i) {
|
|
|
2881
2904
|
function la(i) {
|
|
2882
2905
|
i = i.replace(Pn, "").replace(zn, "").toLowerCase();
|
|
2883
2906
|
var e = !1;
|
|
2884
|
-
if (
|
|
2885
|
-
i =
|
|
2907
|
+
if (Tt[i])
|
|
2908
|
+
i = Tt[i], e = !0;
|
|
2886
2909
|
else if (i == "transparent")
|
|
2887
2910
|
return {
|
|
2888
2911
|
r: 0,
|
|
@@ -2920,26 +2943,26 @@ function la(i) {
|
|
|
2920
2943
|
v: t[3],
|
|
2921
2944
|
a: t[4]
|
|
2922
2945
|
} : (t = Q.hex8.exec(i)) ? {
|
|
2923
|
-
r:
|
|
2924
|
-
g:
|
|
2925
|
-
b:
|
|
2926
|
-
a:
|
|
2946
|
+
r: j(t[1]),
|
|
2947
|
+
g: j(t[2]),
|
|
2948
|
+
b: j(t[3]),
|
|
2949
|
+
a: fi(t[4]),
|
|
2927
2950
|
format: e ? "name" : "hex8"
|
|
2928
2951
|
} : (t = Q.hex6.exec(i)) ? {
|
|
2929
|
-
r:
|
|
2930
|
-
g:
|
|
2931
|
-
b:
|
|
2952
|
+
r: j(t[1]),
|
|
2953
|
+
g: j(t[2]),
|
|
2954
|
+
b: j(t[3]),
|
|
2932
2955
|
format: e ? "name" : "hex"
|
|
2933
2956
|
} : (t = Q.hex4.exec(i)) ? {
|
|
2934
|
-
r:
|
|
2935
|
-
g:
|
|
2936
|
-
b:
|
|
2937
|
-
a:
|
|
2957
|
+
r: j(t[1] + "" + t[1]),
|
|
2958
|
+
g: j(t[2] + "" + t[2]),
|
|
2959
|
+
b: j(t[3] + "" + t[3]),
|
|
2960
|
+
a: fi(t[4] + "" + t[4]),
|
|
2938
2961
|
format: e ? "name" : "hex8"
|
|
2939
2962
|
} : (t = Q.hex3.exec(i)) ? {
|
|
2940
|
-
r:
|
|
2941
|
-
g:
|
|
2942
|
-
b:
|
|
2963
|
+
r: j(t[1] + "" + t[1]),
|
|
2964
|
+
g: j(t[2] + "" + t[2]),
|
|
2965
|
+
b: j(t[3] + "" + t[3]),
|
|
2943
2966
|
format: e ? "name" : "hex"
|
|
2944
2967
|
} : !1;
|
|
2945
2968
|
}
|
|
@@ -2964,16 +2987,16 @@ function ha(i, e) {
|
|
|
2964
2987
|
} = e;
|
|
2965
2988
|
if (!r) return;
|
|
2966
2989
|
const { trade: o } = a, c = 4;
|
|
2967
|
-
t.forEach(({ isHovered: h, isActive:
|
|
2968
|
-
const
|
|
2969
|
-
|
|
2990
|
+
t.forEach(({ isHovered: h, isActive: d, candle: g, trades: _ }) => {
|
|
2991
|
+
const p = s.convert(g.open_time);
|
|
2992
|
+
_.forEach((v) => {
|
|
2970
2993
|
const b = v.type === "buy", w = b ? o.buyLabel.text : o.sellLabel.text, x = b ? "B" : "S", y = b ? n.convert(g.low) + c : n.convert(g.high) - c, C = b ? $n : On;
|
|
2971
|
-
let
|
|
2972
|
-
h && h[1] && h[0] === v.type && (
|
|
2973
|
-
x:
|
|
2994
|
+
let M = b ? o.buyLabel.main : o.sellLabel.main;
|
|
2995
|
+
h && h[1] && h[0] === v.type && (M = A.mix(M, a.bg, 20).toString()), d && d[1] && d[0] === v.type && (M = o.activeLabel), C(i, {
|
|
2996
|
+
x: p,
|
|
2974
2997
|
y,
|
|
2975
2998
|
symbol: x,
|
|
2976
|
-
mainColor:
|
|
2999
|
+
mainColor: M,
|
|
2977
3000
|
textColor: w,
|
|
2978
3001
|
size: 16,
|
|
2979
3002
|
fontSize: 12
|
|
@@ -2990,14 +3013,14 @@ function da(i, e) {
|
|
|
2990
3013
|
colorScheme: { trade: h }
|
|
2991
3014
|
} = e;
|
|
2992
3015
|
if (a.length === 0) return;
|
|
2993
|
-
const
|
|
3016
|
+
const d = a.map((_) => _.candle).sort((_, p) => _.open_time.getTime() - p.open_time.getTime()), g = c.baseWidth / 2 * s + c.strokeWidth / 2;
|
|
2994
3017
|
if (i.save(), i.lineWidth = 1, i.strokeStyle = h.tradeBorders, o.length) {
|
|
2995
|
-
const
|
|
2996
|
-
i.beginPath(), i.moveTo(
|
|
3018
|
+
const _ = t.convert(d[0].open_time) - g;
|
|
3019
|
+
i.beginPath(), i.moveTo(_, n.y), i.lineTo(_, n.y + n.height), i.stroke();
|
|
2997
3020
|
}
|
|
2998
3021
|
if (r.length) {
|
|
2999
|
-
const
|
|
3000
|
-
i.beginPath(), i.moveTo(
|
|
3022
|
+
const _ = t.convert(d[d.length - 1].open_time) + g;
|
|
3023
|
+
i.beginPath(), i.moveTo(_, n.y), i.lineTo(_, n.y + n.height), i.stroke();
|
|
3001
3024
|
}
|
|
3002
3025
|
i.restore();
|
|
3003
3026
|
}
|
|
@@ -3012,29 +3035,29 @@ const ua = (i, e) => {
|
|
|
3012
3035
|
} = e;
|
|
3013
3036
|
if (i.save(), !c) return;
|
|
3014
3037
|
const h = (g) => {
|
|
3015
|
-
var
|
|
3016
|
-
return (
|
|
3017
|
-
(
|
|
3018
|
-
)) == null ? void 0 :
|
|
3019
|
-
},
|
|
3020
|
-
const
|
|
3021
|
-
if (!
|
|
3022
|
-
const b = t.convert(
|
|
3038
|
+
var _;
|
|
3039
|
+
return (_ = n.find(
|
|
3040
|
+
(p) => g.getTime() >= p.candle.open_time.getTime() && g.getTime() < p.candle.close_time.getTime()
|
|
3041
|
+
)) == null ? void 0 : _.candle;
|
|
3042
|
+
}, d = (g, _) => {
|
|
3043
|
+
const p = h(g.time), v = h(_.time);
|
|
3044
|
+
if (!p || !v) return;
|
|
3045
|
+
const b = t.convert(p.open_time), w = t.convert(v.open_time);
|
|
3023
3046
|
let x, y;
|
|
3024
|
-
g.type === "buy" ? (x = s.convert(
|
|
3047
|
+
g.type === "buy" ? (x = s.convert(p.low), y = s.convert(v.high)) : (x = s.convert(p.high), y = s.convert(v.low)), i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.connectionLine, i.moveTo(b, x), i.lineTo(w, y), i.stroke(), i.setLineDash([]);
|
|
3025
3048
|
};
|
|
3026
3049
|
if (a.length === 1 && r.length > 1)
|
|
3027
|
-
r.forEach((g) =>
|
|
3050
|
+
r.forEach((g) => d(a[0], g));
|
|
3028
3051
|
else if (r.length === 1 && a.length > 1)
|
|
3029
|
-
a.forEach((g) =>
|
|
3052
|
+
a.forEach((g) => d(g, r[0]));
|
|
3030
3053
|
else if (a.length === 1 && r.length === 1)
|
|
3031
|
-
|
|
3054
|
+
d(a[0], r[0]);
|
|
3032
3055
|
else if (a.length > 0 && r.length > 0) {
|
|
3033
|
-
const g = a.reduce((
|
|
3034
|
-
|
|
3056
|
+
const g = a.reduce((p, v) => p.time < v.time ? p : v), _ = r.reduce((p, v) => p.time > v.time ? p : v);
|
|
3057
|
+
d(g, _);
|
|
3035
3058
|
}
|
|
3036
3059
|
i.restore();
|
|
3037
|
-
},
|
|
3060
|
+
}, xi = (i, e) => {
|
|
3038
3061
|
const {
|
|
3039
3062
|
radius: t,
|
|
3040
3063
|
coords: { x: s, y: n },
|
|
@@ -3070,8 +3093,8 @@ function ga(i) {
|
|
|
3070
3093
|
}
|
|
3071
3094
|
return s.length ? s.join(" ") : "0s";
|
|
3072
3095
|
}
|
|
3073
|
-
const ma = 10,
|
|
3074
|
-
var
|
|
3096
|
+
const ma = 10, pa = 6, _a = 4, va = 12, ba = (i, e) => {
|
|
3097
|
+
var V;
|
|
3075
3098
|
const {
|
|
3076
3099
|
scales: { x: t, y: s },
|
|
3077
3100
|
trade: { entries: n, exits: a, holdTime: r },
|
|
@@ -3079,33 +3102,33 @@ const ma = 10, _a = 6, pa = 4, va = 12, ba = (i, e) => {
|
|
|
3079
3102
|
trade: { hold: o }
|
|
3080
3103
|
},
|
|
3081
3104
|
config: {
|
|
3082
|
-
trade: { showHoldTime: c, holdTimeContent: h, holdTimeDates:
|
|
3105
|
+
trade: { showHoldTime: c, holdTimeContent: h, holdTimeDates: d, holdTimePrice: g }
|
|
3083
3106
|
}
|
|
3084
3107
|
} = e;
|
|
3085
3108
|
if (!c) return;
|
|
3086
|
-
const
|
|
3087
|
-
if (!
|
|
3088
|
-
const v = (
|
|
3109
|
+
const _ = n.at(0), p = a.at(-1);
|
|
3110
|
+
if (!_ || !p) return;
|
|
3111
|
+
const v = (Y) => Y ? Y instanceof Date ? Y : new Date(Y) : null, b = t.convert(v(d == null ? void 0 : d[0]) || _.candle.open_time), w = t.convert(v(d == null ? void 0 : d[1]) || p.candle.open_time), x = s.convert(g || (((V = n.at(0)) == null ? void 0 : V.price) ?? 0));
|
|
3089
3112
|
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(b, x), i.lineTo(w, x), i.stroke(), i.setLineDash([]);
|
|
3090
|
-
const y = (b + w) / 2, C = h || `Hold: ${ga(r)}`,
|
|
3113
|
+
const y = (b + w) / 2, C = h || `Hold: ${ga(r)}`, S = getComputedStyle(
|
|
3091
3114
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3092
3115
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3093
|
-
i.font = `600 ${ma}px ${
|
|
3094
|
-
const
|
|
3095
|
-
|
|
3116
|
+
i.font = `600 ${ma}px ${S}`;
|
|
3117
|
+
const $ = i.measureText(C).width + pa * 2, z = va + _a * 2;
|
|
3118
|
+
xi(i, {
|
|
3096
3119
|
radius: 4,
|
|
3097
3120
|
coords: {
|
|
3098
|
-
x: y -
|
|
3099
|
-
y: x -
|
|
3121
|
+
x: y - $ / 2,
|
|
3122
|
+
y: x - z / 2
|
|
3100
3123
|
},
|
|
3101
|
-
width:
|
|
3102
|
-
height:
|
|
3124
|
+
width: $,
|
|
3125
|
+
height: z,
|
|
3103
3126
|
fillColor: o.main
|
|
3104
3127
|
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(C, y, x), i.restore();
|
|
3105
3128
|
};
|
|
3106
3129
|
class Ne {
|
|
3107
3130
|
constructor(e, t, {
|
|
3108
|
-
CanvasClass: s =
|
|
3131
|
+
CanvasClass: s = Ee,
|
|
3109
3132
|
noCanvas: n = !1,
|
|
3110
3133
|
noDOM: a = !1
|
|
3111
3134
|
} = {}) {
|
|
@@ -3135,22 +3158,22 @@ const ya = {
|
|
|
3135
3158
|
offset: n = 8
|
|
3136
3159
|
}) => {
|
|
3137
3160
|
const { width: a, height: r } = i, o = e.right - e.left, c = e.bottom - e.top, h = (y) => {
|
|
3138
|
-
const { dx: C, dy:
|
|
3139
|
-
return { x:
|
|
3140
|
-
},
|
|
3141
|
-
const y = t.y < 0, C = t.y + r > c,
|
|
3142
|
-
return
|
|
3143
|
-
},
|
|
3161
|
+
const { dx: C, dy: M } = ya[y], S = t.x + (C === 1 ? n : -a - n), N = t.y + (M === 1 ? n : -r - n);
|
|
3162
|
+
return { x: S, y: N, side: y };
|
|
3163
|
+
}, d = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + a <= o && C + r <= c, g = () => {
|
|
3164
|
+
const y = t.y < 0, C = t.y + r > c, M = t.x < 0, S = t.x + a > o;
|
|
3165
|
+
return M && y ? "right-bottom" : M && C ? "right-top" : S && y ? "left-bottom" : S && C ? "left-top" : M ? "right-bottom" : S ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
|
|
3166
|
+
}, p = [
|
|
3144
3167
|
s,
|
|
3145
3168
|
"right-bottom",
|
|
3146
3169
|
"right-top",
|
|
3147
3170
|
"left-bottom",
|
|
3148
3171
|
"left-top"
|
|
3149
|
-
].filter((y, C,
|
|
3172
|
+
].filter((y, C, M) => M.indexOf(y) === C), v = g();
|
|
3150
3173
|
let b = null;
|
|
3151
|
-
for (const y of [v, ...
|
|
3174
|
+
for (const y of [v, ...p]) {
|
|
3152
3175
|
const C = h(y);
|
|
3153
|
-
if (
|
|
3176
|
+
if (d(C)) {
|
|
3154
3177
|
b = C;
|
|
3155
3178
|
break;
|
|
3156
3179
|
}
|
|
@@ -3215,7 +3238,7 @@ class wa extends se {
|
|
|
3215
3238
|
}), this.oneBox = new k({
|
|
3216
3239
|
tag: "div",
|
|
3217
3240
|
className: this.clsx("box_one")
|
|
3218
|
-
}), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent:
|
|
3241
|
+
}), t.dom.append(this.title.node, this.oneBox.node, this.manyBox.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() };
|
|
3219
3242
|
}
|
|
3220
3243
|
_createLineNodes(t, s) {
|
|
3221
3244
|
const n = [];
|
|
@@ -3293,7 +3316,7 @@ class xa extends Ne {
|
|
|
3293
3316
|
function Ca(i, { color: e = "#000000", lineWidth: t = 1, dashed: s, coords: n }) {
|
|
3294
3317
|
i.strokeStyle = e, i.lineWidth = t, s && i.setLineDash(s), i.beginPath(), i.moveTo(n.x1, n.y1), i.lineTo(n.x2, n.y2), i.stroke();
|
|
3295
3318
|
}
|
|
3296
|
-
const
|
|
3319
|
+
const Ta = { text: "#FFFFFF", bg: "#000000" }, Aa = (i, e) => {
|
|
3297
3320
|
const {
|
|
3298
3321
|
coords: t,
|
|
3299
3322
|
text: s,
|
|
@@ -3303,28 +3326,28 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3303
3326
|
padding: o = { x: 0, y: 0 },
|
|
3304
3327
|
borderRadius: c = 0,
|
|
3305
3328
|
colors: h,
|
|
3306
|
-
align:
|
|
3307
|
-
} = e, g = { ...
|
|
3329
|
+
align: d = { x: "left", y: "top" }
|
|
3330
|
+
} = e, g = { ...Ta, ...h }, p = getComputedStyle(
|
|
3308
3331
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3309
3332
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3310
|
-
i.font = `${a} ${n}px ${
|
|
3333
|
+
i.font = `${a} ${n}px ${p}`;
|
|
3311
3334
|
const b = i.measureText(s).width + o.x * 2, w = r + o.y * 2;
|
|
3312
3335
|
let x = t.x, y = t.y;
|
|
3313
|
-
|
|
3336
|
+
d.x === "middle" ? x -= b / 2 : d.x === "right" && (x -= b), d.y === "middle" ? y -= w / 2 : d.y === "bottom" && (y -= w), xi(i, {
|
|
3314
3337
|
radius: c,
|
|
3315
3338
|
coords: { x, y },
|
|
3316
3339
|
width: b,
|
|
3317
3340
|
height: w,
|
|
3318
3341
|
fillColor: g.bg
|
|
3319
3342
|
}), i.fillStyle = g.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(s, x + b / 2, y + w / 2);
|
|
3320
|
-
},
|
|
3343
|
+
}, gi = {
|
|
3321
3344
|
line: "#000000",
|
|
3322
3345
|
text: "#ffffff",
|
|
3323
3346
|
main: "#000000"
|
|
3324
|
-
},
|
|
3347
|
+
}, Ci = (i, { text: e, startLineCoords: t, side: s, colors: n = gi, dir: a = "h", endMarkerCoords: r }) => {
|
|
3325
3348
|
if (a === "h" && (s === "bottom" || s === "top"))
|
|
3326
3349
|
throw new Error("[drawMarker util]: Incorrect side or dir for this marker");
|
|
3327
|
-
const o = { ...
|
|
3350
|
+
const o = { ...gi, ...n };
|
|
3328
3351
|
i.save(), Ca(i, {
|
|
3329
3352
|
color: o.line,
|
|
3330
3353
|
lineWidth: 1,
|
|
@@ -3335,7 +3358,7 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3335
3358
|
x2: r.x,
|
|
3336
3359
|
y2: r.y
|
|
3337
3360
|
}
|
|
3338
|
-
}),
|
|
3361
|
+
}), Aa(i, {
|
|
3339
3362
|
text: e,
|
|
3340
3363
|
coords: r,
|
|
3341
3364
|
padding: { x: 6, y: 4 },
|
|
@@ -3352,17 +3375,17 @@ const Aa = { text: "#FFFFFF", bg: "#000000" }, Ma = (i, e) => {
|
|
|
3352
3375
|
}
|
|
3353
3376
|
}), i.restore();
|
|
3354
3377
|
};
|
|
3355
|
-
class
|
|
3378
|
+
class Ma extends Ee {
|
|
3356
3379
|
constructor(e) {
|
|
3357
3380
|
super(e);
|
|
3358
3381
|
}
|
|
3359
3382
|
drawMarker(e) {
|
|
3360
|
-
|
|
3383
|
+
Ci(this.ctx, e);
|
|
3361
3384
|
}
|
|
3362
3385
|
}
|
|
3363
|
-
class
|
|
3386
|
+
class Sa extends Ne {
|
|
3364
3387
|
constructor(e) {
|
|
3365
|
-
if (super("user-markers", e, { CanvasClass:
|
|
3388
|
+
if (super("user-markers", e, { CanvasClass: Ma, noDOM: !0 }), !this.canvas) throw new Error("[CS_V_UserMarkers] this.canvas must be defined");
|
|
3366
3389
|
}
|
|
3367
3390
|
render(e) {
|
|
3368
3391
|
this.canvas.clear();
|
|
@@ -3390,18 +3413,18 @@ class Ta extends Ne {
|
|
|
3390
3413
|
this.canvas.clear();
|
|
3391
3414
|
}
|
|
3392
3415
|
}
|
|
3393
|
-
const
|
|
3416
|
+
const Da = "sc-charts-cs";
|
|
3394
3417
|
class ae {
|
|
3395
3418
|
constructor(e) {
|
|
3396
3419
|
f(this, "block");
|
|
3397
3420
|
this.block = e;
|
|
3398
3421
|
}
|
|
3399
3422
|
gen(e) {
|
|
3400
|
-
return `${
|
|
3423
|
+
return `${Da}__${this.block}${e ? "-" + e : ""}`;
|
|
3401
3424
|
}
|
|
3402
3425
|
}
|
|
3403
3426
|
const yt = new ae("comment-actions");
|
|
3404
|
-
class
|
|
3427
|
+
class ka extends k {
|
|
3405
3428
|
constructor({ onDelete: e, onUpdate: t }) {
|
|
3406
3429
|
super({ className: yt.gen() });
|
|
3407
3430
|
const s = new k({ tag: "button", className: yt.gen("edit"), textContent: "Edit" }), n = new k({
|
|
@@ -3416,7 +3439,7 @@ class Da extends k {
|
|
|
3416
3439
|
}), this.append(s.node, n.node);
|
|
3417
3440
|
}
|
|
3418
3441
|
}
|
|
3419
|
-
function
|
|
3442
|
+
function Lt(i, e) {
|
|
3420
3443
|
var n;
|
|
3421
3444
|
const t = (a) => {
|
|
3422
3445
|
if (!document.contains(i.node)) return;
|
|
@@ -3433,7 +3456,7 @@ function Dt(i, e) {
|
|
|
3433
3456
|
document.removeEventListener("mousedown", t), s == null || s();
|
|
3434
3457
|
}, i;
|
|
3435
3458
|
}
|
|
3436
|
-
class
|
|
3459
|
+
class La {
|
|
3437
3460
|
constructor() {
|
|
3438
3461
|
f(this, "node");
|
|
3439
3462
|
const e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg");
|
|
@@ -3471,31 +3494,31 @@ class Ea {
|
|
|
3471
3494
|
this.node = t;
|
|
3472
3495
|
}
|
|
3473
3496
|
}
|
|
3474
|
-
const
|
|
3475
|
-
class
|
|
3497
|
+
const Me = new ae("comment-list");
|
|
3498
|
+
class Ea extends k {
|
|
3476
3499
|
constructor({ onDelete: t, onOpenEditor: s, comment: n, layout: a }) {
|
|
3477
|
-
super({ className:
|
|
3500
|
+
super({ className: Me.gen("item") });
|
|
3478
3501
|
f(this, "actionTooltip");
|
|
3479
3502
|
f(this, "actionsTrigger");
|
|
3480
|
-
const r = new k({ className:
|
|
3481
|
-
className:
|
|
3503
|
+
const r = new k({ className: Me.gen("text"), textContent: n.text }), o = new k({
|
|
3504
|
+
className: Me.gen("created-at"),
|
|
3482
3505
|
textContent: fa(new Date(n.createdAt))
|
|
3483
3506
|
});
|
|
3484
3507
|
this.actionsTrigger = new k({
|
|
3485
3508
|
tag: "button",
|
|
3486
|
-
className:
|
|
3509
|
+
className: Me.gen("action-trigger")
|
|
3487
3510
|
});
|
|
3488
|
-
const c = new
|
|
3511
|
+
const c = new ka({
|
|
3489
3512
|
onDelete: t,
|
|
3490
3513
|
onUpdate: s
|
|
3491
3514
|
});
|
|
3492
|
-
this.actionTooltip =
|
|
3515
|
+
this.actionTooltip = Lt(c, () => {
|
|
3493
3516
|
this.actionTooltip.setVisible(!1);
|
|
3494
3517
|
}), this.actionsTrigger.node.addEventListener("click", () => {
|
|
3495
3518
|
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);
|
|
3496
3519
|
});
|
|
3497
|
-
const h = new k({ className:
|
|
3498
|
-
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new
|
|
3520
|
+
const h = new k({ className: Me.gen("text-wrap") });
|
|
3521
|
+
this.actionTooltip.node.setAttribute("id", `ac-${n.id}`), h.append(r.node, this.actionsTrigger.node), this.actionsTrigger.append(new La().node), this.append(h.node, o.node);
|
|
3499
3522
|
}
|
|
3500
3523
|
}
|
|
3501
3524
|
class Na {
|
|
@@ -3580,7 +3603,7 @@ class Ia extends se {
|
|
|
3580
3603
|
},
|
|
3581
3604
|
initialValue: t.text
|
|
3582
3605
|
});
|
|
3583
|
-
const s = new
|
|
3606
|
+
const s = new Ea({
|
|
3584
3607
|
onDelete: () => {
|
|
3585
3608
|
this._model.comments.remove(t.id), s.actionTooltip.setVisible(!1);
|
|
3586
3609
|
},
|
|
@@ -3609,7 +3632,7 @@ class Ra {
|
|
|
3609
3632
|
}
|
|
3610
3633
|
}
|
|
3611
3634
|
const Je = new ae(""), wt = new ae("add-field");
|
|
3612
|
-
class
|
|
3635
|
+
class Ti extends se {
|
|
3613
3636
|
constructor({ onAdd: t, blockName: s }) {
|
|
3614
3637
|
Je.block = s;
|
|
3615
3638
|
super({ className: Je.gen() + " " + wt.gen() });
|
|
@@ -3650,7 +3673,7 @@ class Oa extends se {
|
|
|
3650
3673
|
f(this, "_size", null);
|
|
3651
3674
|
f(this, "_model");
|
|
3652
3675
|
f(this, "_prevIsShow", !1);
|
|
3653
|
-
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ia(t, s, n), this._addField = new
|
|
3676
|
+
this._model = s, this.state = { isShow: !1, comments: t }, this._list = new Ia(t, s, n), this._addField = new Ti({
|
|
3654
3677
|
blockName: "list-tooltip-add",
|
|
3655
3678
|
onAdd: (a) => {
|
|
3656
3679
|
const r = t[0].date, o = t[0].price, c = {
|
|
@@ -3703,10 +3726,10 @@ class za extends se {
|
|
|
3703
3726
|
this.node.style.backgroundColor = this._colors[`bg${a}`], this.node.style.color = this._colors[`icon${a}`];
|
|
3704
3727
|
}
|
|
3705
3728
|
}
|
|
3706
|
-
const
|
|
3729
|
+
const mi = new ae("comment-box");
|
|
3707
3730
|
class Va extends se {
|
|
3708
3731
|
constructor({ boxId: t, model: s, view: n, comments: a, coords: r, onBoxActivate: o, onBoxDeactivate: c }) {
|
|
3709
|
-
super({ className:
|
|
3732
|
+
super({ className: mi.gen() });
|
|
3710
3733
|
f(this, "pointer", new k({ className: "sc-charts-cs__comments-pointer" }));
|
|
3711
3734
|
f(this, "tooltip");
|
|
3712
3735
|
f(this, "anchor");
|
|
@@ -3717,10 +3740,10 @@ class Va extends se {
|
|
|
3717
3740
|
isActive: !1,
|
|
3718
3741
|
comments: a,
|
|
3719
3742
|
coords: r
|
|
3720
|
-
}, this.pointer.position(r), this.anchor = new za({ x: r.x, className:
|
|
3743
|
+
}, this.pointer.position(r), this.anchor = new za({ x: r.x, className: mi.gen("anchor") }, s), this.anchor.node.addEventListener("click", () => {
|
|
3721
3744
|
const h = !this.state.isActive;
|
|
3722
3745
|
h ? this._onBoxActivate(this._boxId) : this._onBoxDeactivate(this._boxId), this.setState({ isActive: h });
|
|
3723
|
-
}), this.tooltip =
|
|
3746
|
+
}), this.tooltip = Lt(new Oa(a, s, n), (h) => {
|
|
3724
3747
|
this.state.isActive && (this.anchor.node.contains(h.target) || (this._onBoxDeactivate(this._boxId), this.setState({ isActive: !1 })));
|
|
3725
3748
|
}), this.append(this.pointer.node, this.anchor.node, this.tooltip.node), this.render();
|
|
3726
3749
|
}
|
|
@@ -3731,8 +3754,8 @@ class Va extends se {
|
|
|
3731
3754
|
}
|
|
3732
3755
|
class Ya {
|
|
3733
3756
|
static animateTo(e, t, s, n) {
|
|
3734
|
-
const a = e.scales.panOffsetX + (e.layout.area.width / 2 - t), r = e.scales.panOffsetY + (e.layout.area.height / 2 - s), o = 300, c = performance.now(), h = e.scales.panOffsetX,
|
|
3735
|
-
const
|
|
3757
|
+
const a = e.scales.panOffsetX + (e.layout.area.width / 2 - t), r = e.scales.panOffsetY + (e.layout.area.height / 2 - s), o = 300, c = performance.now(), h = e.scales.panOffsetX, d = e.scales.panOffsetY, g = (_) => {
|
|
3758
|
+
const p = _ - c, v = Math.min(p / o, 1), b = v * v * (3 - 2 * v), w = h + (a - h) * b, x = d + (r - d) * b;
|
|
3736
3759
|
e.scales.pan("x", w, "absolute"), e.scales.pan("y", x, "absolute"), v < 1 ? requestAnimationFrame(g) : n == null || n();
|
|
3737
3760
|
};
|
|
3738
3761
|
requestAnimationFrame(g);
|
|
@@ -3752,9 +3775,9 @@ class Wa extends se {
|
|
|
3752
3775
|
f(this, "_size", null);
|
|
3753
3776
|
f(this, "_model", null);
|
|
3754
3777
|
f(this, "_candle", null);
|
|
3755
|
-
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }),
|
|
3778
|
+
this.state = { candle: null, isShow: !1, model: null }, this.pointer = new k({ className: Ct.gen("pointer") }), this.menu = new k({ className: Ct.gen("menu") }), Lt(this.menu, () => {
|
|
3756
3779
|
this.setState({ isShow: !1 });
|
|
3757
|
-
}), this.addField = new
|
|
3780
|
+
}), this.addField = new Ti({
|
|
3758
3781
|
blockName: "context-add",
|
|
3759
3782
|
onAdd: (t) => {
|
|
3760
3783
|
!this._model || !this._candle || (this._model.comments.add({
|
|
@@ -3829,12 +3852,12 @@ class ja extends Ne {
|
|
|
3829
3852
|
});
|
|
3830
3853
|
}
|
|
3831
3854
|
}
|
|
3832
|
-
class Xa extends
|
|
3855
|
+
class Xa extends Ee {
|
|
3833
3856
|
constructor(e) {
|
|
3834
3857
|
super(e);
|
|
3835
3858
|
}
|
|
3836
3859
|
drawMarker({ text: e, startLineCoords: t, endMarkerCoords: s, colors: n, type: a, side: r }) {
|
|
3837
|
-
|
|
3860
|
+
Ci(this.ctx, {
|
|
3838
3861
|
text: e,
|
|
3839
3862
|
colors: n,
|
|
3840
3863
|
startLineCoords: t,
|
|
@@ -3863,7 +3886,7 @@ class Ua extends Ne {
|
|
|
3863
3886
|
if (e.config.guides.isShowX) {
|
|
3864
3887
|
const n = e.config.xAxis.position;
|
|
3865
3888
|
this.canvas.drawMarker({
|
|
3866
|
-
text:
|
|
3889
|
+
text: L.timeFormat("%a %d, %b %y %H:%M")(e.scales.x.invert(t)),
|
|
3867
3890
|
startLineCoords: { x: t, y: 0 },
|
|
3868
3891
|
endMarkerCoords: { x: t, y: e.layout.xAxis[n] },
|
|
3869
3892
|
side: n,
|
|
@@ -3878,7 +3901,7 @@ class Ga extends se {
|
|
|
3878
3901
|
super({ className: t });
|
|
3879
3902
|
f(this, "_isFirstShow", !1);
|
|
3880
3903
|
const s = new k({ tag: "p" });
|
|
3881
|
-
s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent:
|
|
3904
|
+
s.node.textContent = "No data from broker", this.append(s.node), this.state = { isShow: !1, x: 0, y: 0, parent: X.empty() }, this.render();
|
|
3882
3905
|
}
|
|
3883
3906
|
render() {
|
|
3884
3907
|
const { isShow: t, x: s, y: n, parent: a } = this.state;
|
|
@@ -3891,7 +3914,7 @@ class Ga extends se {
|
|
|
3891
3914
|
this.position(r.x, r.y);
|
|
3892
3915
|
}
|
|
3893
3916
|
}
|
|
3894
|
-
class Za extends
|
|
3917
|
+
class Za extends Ee {
|
|
3895
3918
|
constructor(t) {
|
|
3896
3919
|
super(t);
|
|
3897
3920
|
f(this, "domain", null);
|
|
@@ -3903,8 +3926,8 @@ class Za extends Le {
|
|
|
3903
3926
|
}
|
|
3904
3927
|
drawSingleCandle({ x: t, y: s, strokeWidth: n, width: a, colors: r, isDim: o }) {
|
|
3905
3928
|
this.ctx.fillStyle = this._mix(r.fill, r.bg, o), this.ctx.strokeStyle = this._mix(r.stroke, r.bg, o), this.ctx.lineWidth = n, this.ctx.beginPath(), this.ctx.moveTo(t, s.high), this.ctx.lineTo(t, s.low), this.ctx.stroke();
|
|
3906
|
-
const c = Math.min(s.open, s.close), h = Math.abs(s.close - s.open),
|
|
3907
|
-
this.ctx.fillRect(
|
|
3929
|
+
const c = Math.min(s.open, s.close), h = Math.abs(s.close - s.open), d = t - a / 2;
|
|
3930
|
+
this.ctx.fillRect(d, c, a, h), this.ctx.strokeRect(d, c, a, h);
|
|
3908
3931
|
}
|
|
3909
3932
|
drawCandles(t) {
|
|
3910
3933
|
const {
|
|
@@ -3915,23 +3938,23 @@ class Za extends Le {
|
|
|
3915
3938
|
candles: { hideMissingData: c }
|
|
3916
3939
|
}
|
|
3917
3940
|
} = t, h = t.config.candles.style === "filled";
|
|
3918
|
-
this.domain = t.scales.x.domain(), c || this._getVisible(r).forEach((
|
|
3919
|
-
const
|
|
3941
|
+
this.domain = t.scales.x.domain(), c || this._getVisible(r).forEach((d, g) => {
|
|
3942
|
+
const _ = s.noDataFill[g % s.noDataFill.length], p = h ? _ : s.noDataStroke;
|
|
3920
3943
|
this.drawSingleCandle({
|
|
3921
|
-
...this._getBasicCandleProps(t,
|
|
3922
|
-
colors: { fill:
|
|
3944
|
+
...this._getBasicCandleProps(t, d),
|
|
3945
|
+
colors: { fill: _, stroke: p, bg: n }
|
|
3923
3946
|
});
|
|
3924
|
-
}), this._getVisible(o).forEach((
|
|
3925
|
-
const g =
|
|
3947
|
+
}), this._getVisible(o).forEach((d) => {
|
|
3948
|
+
const g = d.close >= d.open ? "rising" : "falling", _ = s[`${g}Fill`], p = s[`${g}${h ? "Fill" : "Stroke"}`];
|
|
3926
3949
|
this.drawSingleCandle({
|
|
3927
|
-
...this._getBasicCandleProps(t,
|
|
3928
|
-
colors: { fill:
|
|
3929
|
-
isDim: !!(a.length && !a.includes(
|
|
3950
|
+
...this._getBasicCandleProps(t, d),
|
|
3951
|
+
colors: { fill: _, stroke: p, bg: n },
|
|
3952
|
+
isDim: !!(a.length && !a.includes(d.open_time.getTime()))
|
|
3930
3953
|
});
|
|
3931
3954
|
});
|
|
3932
3955
|
}
|
|
3933
3956
|
_mix(t, s, n) {
|
|
3934
|
-
return n ?
|
|
3957
|
+
return n ? A.mix(t, s).toString() : t;
|
|
3935
3958
|
}
|
|
3936
3959
|
_getBasicCandleProps(t, s) {
|
|
3937
3960
|
return {
|
|
@@ -3989,12 +4012,12 @@ class Ja {
|
|
|
3989
4012
|
f(this, "candles");
|
|
3990
4013
|
this.container = e, this.wrapper = new k({ tag: "div", className: "sc-charts-cs" }), e.append(this.wrapper.node);
|
|
3991
4014
|
const { width: t, height: s } = e.getBoundingClientRect();
|
|
3992
|
-
this.width = t, this.height = s, this.mainCanvas = new
|
|
4015
|
+
this.width = t, this.height = s, this.mainCanvas = new Ee({
|
|
3993
4016
|
className: "sc-charts-cs__canvas-main",
|
|
3994
4017
|
width: t,
|
|
3995
4018
|
height: s,
|
|
3996
4019
|
isMain: !0
|
|
3997
|
-
}), this.domElements = new k({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new k({ tag: "div", className: "sc-charts-cs__canvases" }), this.canvasesContainer.append(this.mainCanvas.node), this.wrapper.append(this.canvasesContainer.node, this.domElements.node), this.mainCanvas.updateAbsolutePosition(), this.binding = new Rn(this.mainCanvas.node), this.comments = new ja(this), this.candles = new qa(this), this.trade = new xa(this), this.guideMarkers = new Ua(this), this.userMarkers = new
|
|
4020
|
+
}), this.domElements = new k({ tag: "div", className: "sc-charts-cs__dom-elements" }), this.canvasesContainer = new k({ tag: "div", className: "sc-charts-cs__canvases" }), this.canvasesContainer.append(this.mainCanvas.node), this.wrapper.append(this.canvasesContainer.node, this.domElements.node), this.mainCanvas.updateAbsolutePosition(), this.binding = new Rn(this.mainCanvas.node), this.comments = new ja(this), this.candles = new qa(this), this.trade = new xa(this), this.guideMarkers = new Ua(this), this.userMarkers = new Sa(this);
|
|
3998
4021
|
}
|
|
3999
4022
|
renderAll(e) {
|
|
4000
4023
|
this.mainCanvas.clear(), this.candles.render(e), bt.xAxis(this.mainCanvas.ctx, e), bt.yAxis(this.mainCanvas.ctx, e), bt.intersection(this.mainCanvas.ctx, e), this.trade.renderAll(e), this.userMarkers.render(e), this.comments.render(e);
|
|
@@ -4085,7 +4108,7 @@ class Ka {
|
|
|
4085
4108
|
});
|
|
4086
4109
|
}
|
|
4087
4110
|
}
|
|
4088
|
-
class
|
|
4111
|
+
class pi {
|
|
4089
4112
|
constructor() {
|
|
4090
4113
|
f(this, "_map", /* @__PURE__ */ new Map());
|
|
4091
4114
|
}
|
|
@@ -4119,7 +4142,7 @@ class mi {
|
|
|
4119
4142
|
class er {
|
|
4120
4143
|
constructor() {
|
|
4121
4144
|
f(this, "_elements", []);
|
|
4122
|
-
f(this, "_listeners", new
|
|
4145
|
+
f(this, "_listeners", new pi());
|
|
4123
4146
|
f(this, "_lastHovered", /* @__PURE__ */ new Set());
|
|
4124
4147
|
f(this, "_dragContext", null);
|
|
4125
4148
|
}
|
|
@@ -4133,7 +4156,7 @@ class er {
|
|
|
4133
4156
|
this._elements = this._elements.filter((t) => t !== e), this._listeners.removeAll(e), this._lastHovered.delete(e);
|
|
4134
4157
|
}
|
|
4135
4158
|
clear() {
|
|
4136
|
-
this._elements = [], this._listeners = new
|
|
4159
|
+
this._elements = [], this._listeners = new pi(), this._lastHovered.clear();
|
|
4137
4160
|
}
|
|
4138
4161
|
on(e, t, s) {
|
|
4139
4162
|
this._listeners.add(e, t, s);
|
|
@@ -4275,8 +4298,8 @@ class tr {
|
|
|
4275
4298
|
}
|
|
4276
4299
|
} = this.model;
|
|
4277
4300
|
for (const o of s) {
|
|
4278
|
-
const c = n.convert(o.open_time), h = a.convert(o.high),
|
|
4279
|
-
if (e >= g && e <=
|
|
4301
|
+
const c = n.convert(o.open_time), h = a.convert(o.high), d = a.convert(o.low), g = c - r / 2, _ = c + r / 2, p = Math.min(h, d), v = Math.max(h, d);
|
|
4302
|
+
if (e >= g && e <= _ && t >= p && t <= v)
|
|
4280
4303
|
return {
|
|
4281
4304
|
target: this,
|
|
4282
4305
|
x: e,
|
|
@@ -4313,11 +4336,11 @@ class sr {
|
|
|
4313
4336
|
hitTest(e, t) {
|
|
4314
4337
|
const { tradedCandles: s } = this.model.trade, { x: n, y: a } = this.model.scales, r = 16, o = 4;
|
|
4315
4338
|
for (const { candle: c, trades: h } of s) {
|
|
4316
|
-
const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2,
|
|
4339
|
+
const g = n.convert(c.open_time) + this.model.config.candles.baseWidth / 2, _ = r, p = r;
|
|
4317
4340
|
for (const v of ["buy", "sell"]) {
|
|
4318
4341
|
const b = h.filter((C) => C.type === v);
|
|
4319
4342
|
if (!b.length) continue;
|
|
4320
|
-
const w = v === "buy" ? a.convert(c.low) + o + Ke(r) : a.convert(c.high) - o - r - Ke(r), x = e >= g -
|
|
4343
|
+
const w = v === "buy" ? a.convert(c.low) + o + Ke(r) : a.convert(c.high) - o - r - Ke(r), x = e >= g - _ / 2 && e <= g + _ / 2, y = t >= w && t <= w + p;
|
|
4321
4344
|
if (x && y)
|
|
4322
4345
|
return {
|
|
4323
4346
|
target: this,
|
|
@@ -4423,11 +4446,11 @@ function cr(i, e) {
|
|
|
4423
4446
|
}));
|
|
4424
4447
|
};
|
|
4425
4448
|
}
|
|
4426
|
-
function
|
|
4449
|
+
function At(i, e) {
|
|
4427
4450
|
const { width: t } = e.candles.limiter.absolutePosition, s = i.config.candles.baseWidth, n = i.config.candles.limiterOffset.left + i.config.candles.limiterOffset.right, r = i.scales.x.convert(i.candles.allData[0].open_time) - t - s / 2 - n;
|
|
4428
4451
|
r > 0 && i.scales.pan("x", -r);
|
|
4429
4452
|
}
|
|
4430
|
-
function
|
|
4453
|
+
function Mt(i) {
|
|
4431
4454
|
return i.candles.limiter.absolutePosition.width > 0;
|
|
4432
4455
|
}
|
|
4433
4456
|
class Et {
|
|
@@ -4447,7 +4470,7 @@ class hr extends Et {
|
|
|
4447
4470
|
register() {
|
|
4448
4471
|
this._hitManager.on(this._hit, "drag", (t) => {
|
|
4449
4472
|
const s = t.x - (t.prevX ?? t.x);
|
|
4450
|
-
this._model.scales.scale("x", -s), this._view &&
|
|
4473
|
+
this._model.scales.scale("x", -s), this._view && Mt(this._view) && At(this._model, this._view);
|
|
4451
4474
|
}), this._hitManager.on(this._hit, "dblclick", () => {
|
|
4452
4475
|
this._model.scales.scale("x", 1, "absolute"), this._model.scales.pan("x", 0, "absolute");
|
|
4453
4476
|
});
|
|
@@ -4485,16 +4508,16 @@ class ur extends Et {
|
|
|
4485
4508
|
this._hit,
|
|
4486
4509
|
"drag",
|
|
4487
4510
|
cr(1, (t) => {
|
|
4488
|
-
this._model.scales.pan("x", t.x - (t.prevX ?? t.x)),
|
|
4511
|
+
this._model.scales.pan("x", t.x - (t.prevX ?? t.x)), Mt(this._view) && At(this._model, this._view), this._model.scales.pan("y", t.y - (t.prevY ?? t.y)), this._view.guideMarkers.render(this._model, { x: t.x, y: t.y });
|
|
4489
4512
|
})
|
|
4490
4513
|
), this._hitManager.on(this._hit, "contextmenu", ({ x: t }) => {
|
|
4491
|
-
const s = this._model.scales.x.invert(t), n =
|
|
4514
|
+
const s = this._model.scales.x.invert(t), n = Dt.findByDate(s, this._model.candles.allData);
|
|
4492
4515
|
n && (this._view.comments.contextMenu.setState({ isShow: !0, candle: n }), this._view.comments.render(this._model));
|
|
4493
4516
|
}), this._hitManager.on(this._hit, "wheel", (t) => {
|
|
4494
4517
|
var a, r;
|
|
4495
4518
|
if (!t.deltaY) return;
|
|
4496
4519
|
const s = -t.deltaY, n = (r = (a = this._model.config) == null ? void 0 : a.candles) == null ? void 0 : r.zoomOnWheel;
|
|
4497
|
-
["x", "both"].includes(n) && (this._model.scales.scale("x", s),
|
|
4520
|
+
["x", "both"].includes(n) && (this._model.scales.scale("x", s), Mt(this._view) && At(this._model, this._view)), ["y", "both"].includes(n) && this._model.scales.scale("y", s);
|
|
4498
4521
|
});
|
|
4499
4522
|
}
|
|
4500
4523
|
}
|
|
@@ -4579,14 +4602,14 @@ class gr {
|
|
|
4579
4602
|
e.preventDefault(), this._hitManager.dispatchWheel(e.offsetX, e.offsetY, e.deltaX, e.deltaY, e.deltaZ);
|
|
4580
4603
|
}
|
|
4581
4604
|
}
|
|
4582
|
-
class
|
|
4605
|
+
class _r {
|
|
4583
4606
|
constructor(e, { chartId: t, candles: s, config: n, trade: a, userMarkers: r, colorScheme: o, comments: c, renderLimiter: h }) {
|
|
4584
4607
|
f(this, "_model");
|
|
4585
4608
|
f(this, "_view");
|
|
4586
4609
|
f(this, "_controller");
|
|
4587
4610
|
f(this, "_candlesLimiterClean");
|
|
4588
|
-
const
|
|
4589
|
-
if (!
|
|
4611
|
+
const d = document.querySelector(e);
|
|
4612
|
+
if (!d) throw new Error(`Element with selector "${e}" not found!`);
|
|
4590
4613
|
if (!t || !/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(t))
|
|
4591
4614
|
throw new Error(
|
|
4592
4615
|
"chartId is required and must be a valid id (only letters, numbers or underscores. The first character must be a letter)"
|
|
@@ -4595,12 +4618,12 @@ class pr {
|
|
|
4595
4618
|
chartId: t,
|
|
4596
4619
|
candles: s,
|
|
4597
4620
|
config: n,
|
|
4598
|
-
container:
|
|
4621
|
+
container: d,
|
|
4599
4622
|
trade: a,
|
|
4600
4623
|
userMarkers: r,
|
|
4601
4624
|
colorScheme: o,
|
|
4602
4625
|
comments: c
|
|
4603
|
-
}), this._view = new Ja(
|
|
4626
|
+
}), this._view = new Ja(d), this._controller = new gr(this._model, this._view), h) {
|
|
4604
4627
|
const g = h(this._view.candles.limiter.node);
|
|
4605
4628
|
this._view.candles.limiter.updateAbsolutePosition(), typeof g == "function" && (this._candlesLimiterClean = g);
|
|
4606
4629
|
}
|
|
@@ -4631,7 +4654,7 @@ class pr {
|
|
|
4631
4654
|
async _drawHeader(e, t, s, n = !1) {
|
|
4632
4655
|
const a = 48 * s, r = 12 * s, o = 20 * s, c = 103 * s;
|
|
4633
4656
|
e.fillStyle = n ? "#101011" : "#FFFFFF", e.fillRect(0, 0, t, a), e.strokeStyle = n ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * s, e.beginPath(), e.moveTo(0, a), e.lineTo(t, a), e.stroke();
|
|
4634
|
-
const h = n ? "#FFFFFF" : "#1C2026",
|
|
4657
|
+
const h = n ? "#FFFFFF" : "#1C2026", d = `<svg width="103" height="20" viewBox="0 0 103 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4635
4658
|
<path d="M92.6267 1.50666H93.0475C93.3792 1.50666 93.6025 1.31028 93.6025 1.02537C93.6025 0.740457 93.4034 0.561783 93.0426 0.561783C92.706 0.561783 92.4827 0.759773 92.4633 1.06239H91.795C91.8209 0.423351 92.3225 0.00805664 93.075 0.00805664C93.8274 0.00805664 94.2886 0.376671 94.2886 0.928788C94.2886 1.35213 93.9973 1.65797 93.5717 1.73523V1.74972C94.0895 1.79318 94.4229 2.10385 94.4229 2.58192C94.4229 3.20164 93.8581 3.61372 93.0572 3.61372C92.2562 3.61372 91.761 3.18555 91.7271 2.54973H92.4212C92.4423 2.84108 92.6834 3.03263 93.0652 3.03263C93.4471 3.03263 93.6834 2.82981 93.6834 2.53685C93.6834 2.22135 93.4455 2.0298 93.0539 2.0298H92.6251V1.50827L92.6267 1.50666Z" fill="${h}"/>
|
|
4636
4659
|
<path d="M95.1182 2.97623C94.9256 2.68488 94.8269 2.29373 94.8269 1.83498C94.8269 0.692113 95.3852 0.00317383 96.2816 0.00317383C96.9434 0.00317383 97.4596 0.392714 97.5567 0.957708H96.8431C96.7735 0.727525 96.5502 0.574607 96.2784 0.574607C95.7945 0.574607 95.5017 1.03658 95.5178 1.81566H95.5324C95.6716 1.47763 96.013 1.25389 96.4564 1.25389C97.1149 1.25389 97.6036 1.73679 97.6036 2.39192C97.6036 3.10179 97.0486 3.61205 96.2719 3.61205C95.7735 3.61205 95.3625 3.3867 95.1198 2.97623H95.1182ZM96.8949 2.41446C96.8949 2.05872 96.6279 1.79796 96.2654 1.79796C95.903 1.79796 95.6311 2.05872 95.6311 2.40802C95.6311 2.75732 95.9078 3.0374 96.2638 3.0374C96.6198 3.0374 96.8965 2.76215 96.8965 2.41607L96.8949 2.41446Z" fill="${h}"/>
|
|
4637
4660
|
<path d="M97.998 1.79961C97.998 0.68411 98.5336 0 99.4026 0C100.272 0 100.804 0.6825 100.804 1.79639C100.804 2.91028 100.275 3.60727 99.4026 3.60727C98.5304 3.60727 97.998 2.91672 97.998 1.798V1.79961ZM100.066 1.79961C100.066 1.01892 99.8136 0.579481 99.4026 0.579481C98.9916 0.579481 98.7359 1.02214 98.7359 1.79961C98.7359 2.57708 98.9883 3.0294 99.4026 3.0294C99.8168 3.0294 100.066 2.58674 100.066 1.79961Z" fill="${h}"/>
|
|
@@ -4643,15 +4666,15 @@ class pr {
|
|
|
4643
4666
|
<path d="M62.7358 0.0372542C60.1921 0.0372542 58.1743 0.925792 56.7875 2.29562C56.4283 1.16563 55.4364 0.462207 54.0917 0.462207H52.2471V3.14875H53.951V20.0004H56.9364V12.8792C58.3151 14.1782 60.273 15.0233 62.739 15.0233C67.485 15.0233 70.7536 11.9408 70.7536 7.5013C70.7536 3.06182 67.4802 0.0356445 62.7342 0.0356445L62.7358 0.0372542ZM62.3652 12.2756C59.1241 12.2756 56.9364 10.3247 56.9364 7.4691C56.9364 4.61355 59.1241 2.7753 62.3652 2.7753C65.6064 2.7753 67.7099 4.66989 67.7099 7.4691C67.7067 10.3311 65.464 12.2756 62.3652 12.2756Z" fill="${h}"/>
|
|
4644
4667
|
</svg>`;
|
|
4645
4668
|
try {
|
|
4646
|
-
const g = await this._loadSvgAsImage(
|
|
4669
|
+
const g = await this._loadSvgAsImage(d);
|
|
4647
4670
|
g && e.drawImage(g, r, (a - o) / 2, c, o);
|
|
4648
4671
|
} catch (g) {
|
|
4649
4672
|
console.warn("Failed to load logo SVG:", g);
|
|
4650
4673
|
}
|
|
4651
4674
|
}
|
|
4652
4675
|
_drawHeaderSecondLine(e, t, s, n, a, r, o = !1) {
|
|
4653
|
-
const c = 20 * r, h = 12 * r,
|
|
4654
|
-
e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, a, n, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, a + c), e.lineTo(n, a + c), e.stroke(), e.fillStyle = o ? "#C3C3C5" : "#1C2026", e.font = `500 ${
|
|
4676
|
+
const c = 20 * r, h = 12 * r, d = 8 * r;
|
|
4677
|
+
e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, a, n, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, a + c), e.lineTo(n, a + c), e.stroke(), e.fillStyle = o ? "#C3C3C5" : "#1C2026", e.font = `500 ${d}px Geist, Arial, sans-serif`, e.textBaseline = "middle", e.textAlign = "left";
|
|
4655
4678
|
const g = t ? `${t} created with Scope360, ${s}` : `Scope360, ${s}`;
|
|
4656
4679
|
e.fillText(g, h, a + c / 2);
|
|
4657
4680
|
}
|
|
@@ -4666,24 +4689,24 @@ class pr {
|
|
|
4666
4689
|
});
|
|
4667
4690
|
}
|
|
4668
4691
|
_drawFooter(e, t, s, n, a, r, o = !1) {
|
|
4669
|
-
const c = 32 * r, h = 12 * r,
|
|
4670
|
-
e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0,
|
|
4671
|
-
const
|
|
4672
|
-
if (t.pair &&
|
|
4692
|
+
const c = 32 * r, h = 12 * r, d = 12 * r, g = 4 * r, _ = n + a;
|
|
4693
|
+
e.fillStyle = o ? "#292929" : "#FFFFFF", e.fillRect(0, _, s, c), e.strokeStyle = o ? "#3E3E3E" : "#EDEDED", e.lineWidth = 1 * r, e.beginPath(), e.moveTo(0, _), e.lineTo(s, _), e.stroke(), e.textBaseline = "middle", e.textAlign = "left";
|
|
4694
|
+
const p = [];
|
|
4695
|
+
if (t.pair && p.push({ label: "", value: t.pair }), t.net_pnl !== void 0) {
|
|
4673
4696
|
const C = t.net_pnl.startsWith("+");
|
|
4674
|
-
|
|
4697
|
+
p.push({ label: "Net P&L", value: t.net_pnl, valueColor: C ? "#56B683" : "#F18169" });
|
|
4675
4698
|
}
|
|
4676
|
-
t.type &&
|
|
4677
|
-
const v =
|
|
4678
|
-
if (
|
|
4679
|
-
e.font = `500 ${
|
|
4699
|
+
t.type && p.push({ label: "Type", value: t.type }), t.entry_price && p.push({ label: "Entry", value: t.entry_price }), t.exit_price && p.push({ label: "Exit", value: t.exit_price }), t.open_date && p.push({ label: "Open date", value: t.open_date }), t.close_date && p.push({ label: "Close date", value: t.close_date }), t.holdtime && p.push({ label: "Holdtime", value: t.holdtime }), t.rr && p.push({ label: "RR", value: t.rr }), t.volume && p.push({ label: "Volume", value: t.volume });
|
|
4700
|
+
const v = _ + c / 2, b = 24 * r;
|
|
4701
|
+
if (p.length === 0) return;
|
|
4702
|
+
e.font = `500 ${d}px Geist, Arial, sans-serif`;
|
|
4680
4703
|
const w = o ? "#878788" : "#8E8E93", x = o ? "#FAFAFA" : "#1C2026";
|
|
4681
4704
|
let y = h;
|
|
4682
|
-
|
|
4683
|
-
const
|
|
4684
|
-
e.fillStyle = w, e.font = `500 ${
|
|
4685
|
-
const
|
|
4686
|
-
e.fillStyle = C.valueColor || x, e.font = `500 ${
|
|
4705
|
+
p.forEach((C) => {
|
|
4706
|
+
const M = e.measureText(C.label).width, S = e.measureText(C.value).width, N = M + g + S;
|
|
4707
|
+
e.fillStyle = w, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.label, y, v);
|
|
4708
|
+
const $ = y + M + g;
|
|
4709
|
+
e.fillStyle = C.valueColor || x, e.font = `500 ${d}px Geist, Arial, sans-serif`, e.fillText(C.value, $, v), y += N + b;
|
|
4687
4710
|
});
|
|
4688
4711
|
}
|
|
4689
4712
|
async captureScreenshot(e = {}) {
|
|
@@ -4694,43 +4717,43 @@ class pr {
|
|
|
4694
4717
|
hour: "2-digit",
|
|
4695
4718
|
minute: "2-digit",
|
|
4696
4719
|
timeZoneName: "short"
|
|
4697
|
-
}), a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1,
|
|
4720
|
+
}), a = typeof e == "object" ? e : {}, r = a.createdBy, o = a.createdAt || n, c = a.trade, h = a.isDark || !1, d = a.download || !1, { canvasesContainer: g, width: _, height: p } = this._view, v = Array.from(
|
|
4698
4721
|
g.node.querySelectorAll("canvas")
|
|
4699
4722
|
);
|
|
4700
4723
|
if (v.length === 0) {
|
|
4701
4724
|
console.warn("No canvas elements found for screenshot");
|
|
4702
4725
|
return;
|
|
4703
4726
|
}
|
|
4704
|
-
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0,
|
|
4705
|
-
let
|
|
4706
|
-
|
|
4707
|
-
const
|
|
4708
|
-
|
|
4709
|
-
const G =
|
|
4727
|
+
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, M = w - x - y - C, S = b, N = _ / p, $ = S / M;
|
|
4728
|
+
let z, V, Y = 0, re = 0;
|
|
4729
|
+
N > $ ? (V = M, z = V * N, Y = 0, re = 0) : (z = S, V = z / N, re = (M - V) / 2);
|
|
4730
|
+
const P = window.devicePixelRatio || 1, U = document.createElement("canvas");
|
|
4731
|
+
U.width = b * P, U.height = w * P;
|
|
4732
|
+
const G = U.getContext("2d");
|
|
4710
4733
|
if (!G) {
|
|
4711
4734
|
console.error("Failed to get 2D context for merged canvas");
|
|
4712
4735
|
return;
|
|
4713
4736
|
}
|
|
4714
|
-
G.fillStyle = h ? "#101011" : "#ffffff", G.fillRect(0, 0,
|
|
4715
|
-
const Fe = x *
|
|
4716
|
-
await this._drawHeader(G,
|
|
4737
|
+
G.fillStyle = h ? "#101011" : "#ffffff", G.fillRect(0, 0, U.width, U.height);
|
|
4738
|
+
const Fe = x * P, st = y * P, oe = M * P, ve = S * P, be = Fe + st;
|
|
4739
|
+
await this._drawHeader(G, U.width, P, h), this._drawHeaderSecondLine(G, r, o, U.width, Fe, P, h);
|
|
4717
4740
|
const He = this._view.mainCanvas;
|
|
4718
|
-
He.background && (G.fillStyle = He.background, G.fillRect(0, be,
|
|
4719
|
-
const Be =
|
|
4720
|
-
v.forEach((
|
|
4721
|
-
let ee = 0, Z = 0, q =
|
|
4722
|
-
if (
|
|
4723
|
-
const le = Ie /
|
|
4724
|
-
ce > ve && (ee = (ce - ve) / le, q =
|
|
4741
|
+
He.background && (G.fillStyle = He.background, G.fillRect(0, be, U.width, oe));
|
|
4742
|
+
const Be = z * P, Ie = V * P, F = Y * P, Re = re * P;
|
|
4743
|
+
v.forEach((O) => {
|
|
4744
|
+
let ee = 0, Z = 0, q = O.width, ge = O.height, ye = Be, we = Ie, Oe = F, Pe = Re;
|
|
4745
|
+
if (N > $) {
|
|
4746
|
+
const le = Ie / O.height, ce = O.width * le;
|
|
4747
|
+
ce > ve && (ee = (ce - ve) / le, q = O.width - ee, ye = ve, Oe = 0);
|
|
4725
4748
|
} else {
|
|
4726
|
-
const le = Be /
|
|
4749
|
+
const le = Be / O.width, ce = O.height * le;
|
|
4727
4750
|
if (ce > oe) {
|
|
4728
4751
|
const xe = (ce - oe) / le;
|
|
4729
|
-
Z = xe / 2, ge =
|
|
4752
|
+
Z = xe / 2, ge = O.height - xe, we = oe, Pe = 0;
|
|
4730
4753
|
}
|
|
4731
4754
|
}
|
|
4732
4755
|
G.drawImage(
|
|
4733
|
-
|
|
4756
|
+
O,
|
|
4734
4757
|
ee,
|
|
4735
4758
|
Z,
|
|
4736
4759
|
q,
|
|
@@ -4740,28 +4763,28 @@ class pr {
|
|
|
4740
4763
|
ye,
|
|
4741
4764
|
we
|
|
4742
4765
|
);
|
|
4743
|
-
}), c && this._drawFooter(G, c,
|
|
4744
|
-
const $e = (
|
|
4745
|
-
const Z = URL.createObjectURL(
|
|
4766
|
+
}), c && this._drawFooter(G, c, U.width, be, oe, P, h);
|
|
4767
|
+
const $e = (O, ee) => {
|
|
4768
|
+
const Z = URL.createObjectURL(O), q = document.createElement("a");
|
|
4746
4769
|
q.href = Z, q.download = ee, document.body.appendChild(q), q.click(), document.body.removeChild(q), URL.revokeObjectURL(Z);
|
|
4747
4770
|
};
|
|
4748
|
-
|
|
4749
|
-
async (
|
|
4750
|
-
if (
|
|
4771
|
+
U.toBlob(
|
|
4772
|
+
async (O) => {
|
|
4773
|
+
if (!O) {
|
|
4751
4774
|
console.error("Failed to create blob from canvas");
|
|
4752
4775
|
return;
|
|
4753
4776
|
}
|
|
4754
|
-
if (
|
|
4755
|
-
$e(
|
|
4777
|
+
if (d)
|
|
4778
|
+
$e(O, t);
|
|
4756
4779
|
else
|
|
4757
4780
|
try {
|
|
4758
4781
|
await navigator.clipboard.write([
|
|
4759
4782
|
new ClipboardItem({
|
|
4760
|
-
"image/png":
|
|
4783
|
+
"image/png": O
|
|
4761
4784
|
})
|
|
4762
4785
|
]);
|
|
4763
4786
|
} catch (ee) {
|
|
4764
|
-
console.error("Failed to copy to clipboard:", ee), $e(
|
|
4787
|
+
console.error("Failed to copy to clipboard:", ee), $e(O, t);
|
|
4765
4788
|
}
|
|
4766
4789
|
},
|
|
4767
4790
|
"image/png",
|
|
@@ -4770,7 +4793,7 @@ class pr {
|
|
|
4770
4793
|
}
|
|
4771
4794
|
}
|
|
4772
4795
|
export {
|
|
4773
|
-
|
|
4774
|
-
|
|
4796
|
+
_r as CandlestickChart,
|
|
4797
|
+
pr as createLineChart
|
|
4775
4798
|
};
|
|
4776
4799
|
//# sourceMappingURL=charts-core.js.map
|