charts-core 1.1.60 → 1.1.61
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
CHANGED
|
@@ -20,8 +20,8 @@ const Bs = (i) => {
|
|
|
20
20
|
const v = m.nodes().map((w) => w.getBBox().width), b = Math.max(...v);
|
|
21
21
|
_.selectAll(".tick").each(function(w, x) {
|
|
22
22
|
var I;
|
|
23
|
-
const y = k.select(this), C = y.select("text"),
|
|
24
|
-
C.attr("x",
|
|
23
|
+
const y = k.select(this), C = y.select("text"), A = v[x], M = b - A, D = y.append("g").attr("transform", "translate(10, 0)");
|
|
24
|
+
C.attr("x", M), C.remove(), (I = D.node()) == null || I.appendChild(C.node());
|
|
25
25
|
});
|
|
26
26
|
}).attr("font-family", "inherit");
|
|
27
27
|
}, Rs = (i) => {
|
|
@@ -100,24 +100,24 @@ const ti = (i, { x1: t, x2: e, y1: s, y2: n }) => i.append("line").attr("x1", t)
|
|
|
100
100
|
}), h === "hovered-circles")) {
|
|
101
101
|
const m = n.range()[0], v = s(r[0].date), b = s(r[r.length - 1].date);
|
|
102
102
|
ti(t, { x1: v, x2: b, y1: m, y2: m });
|
|
103
|
-
const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Os(o), C = (
|
|
103
|
+
const { tooltipContainer: w, tooltip: x, tooltipArrow: y } = Os(o), C = (M) => {
|
|
104
104
|
if (!d) return;
|
|
105
|
-
bi(x), w.style.display = "block", x.append(d({ date:
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
s(
|
|
105
|
+
bi(x), w.style.display = "block", x.append(d({ date: M.date, value: M.value }));
|
|
106
|
+
const D = x.getBoundingClientRect(), I = zs(
|
|
107
|
+
D,
|
|
108
|
+
s(M.date),
|
|
109
109
|
i.config.margin.left - i.config.grid.tooltipArrowSize,
|
|
110
110
|
i.width - i.config.margin.right + i.config.grid.tooltipArrowSize
|
|
111
111
|
);
|
|
112
|
-
I !== null && (x.style.left = I + "px"), y.style.left = s(
|
|
113
|
-
},
|
|
112
|
+
I !== null && (x.style.left = I + "px"), y.style.left = s(M.date) + "px";
|
|
113
|
+
}, A = () => {
|
|
114
114
|
w.style.display = "none";
|
|
115
115
|
};
|
|
116
116
|
i.gridHoverTooltip = d ? {
|
|
117
|
-
show: (
|
|
118
|
-
hide:
|
|
119
|
-
} : null, r.forEach((
|
|
120
|
-
const I = s(
|
|
117
|
+
show: (M) => C(M),
|
|
118
|
+
hide: A
|
|
119
|
+
} : null, r.forEach((M, D) => {
|
|
120
|
+
const I = s(M.date), W = n(M.value), Z = r[D - 1], et = D > 0 && Z && M.value === Z.value;
|
|
121
121
|
et || ti(t, { x1: I, x2: I, y1: W, y2: m });
|
|
122
122
|
const K = Ps(t, et, {
|
|
123
123
|
x: I,
|
|
@@ -127,9 +127,9 @@ const ti = (i, { x1: t, x2: e, y1: s, y2: n }) => i.append("line").attr("x1", t)
|
|
|
127
127
|
});
|
|
128
128
|
d && K.on("mouseover", function() {
|
|
129
129
|
var O, V;
|
|
130
|
-
(V = (O = i.onGridCircleHoverRef) == null ? void 0 : O.current) == null || V.call(O, { date:
|
|
130
|
+
(V = (O = i.onGridCircleHoverRef) == null ? void 0 : O.current) == null || V.call(O, { date: M.date, value: M.value }), C({ date: M.date, value: et ? null : M.value });
|
|
131
131
|
}).on("mouseout", function() {
|
|
132
|
-
|
|
132
|
+
A();
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
}
|
|
@@ -292,10 +292,10 @@ const Gs = (i) => {
|
|
|
292
292
|
b = `${Xs(d)} (${x}%)`;
|
|
293
293
|
}
|
|
294
294
|
_ ? w = _({ left: n.date, right: a.date, direction: v }) : w = `${si(n.date)} to ${si(a.date)}`, e.textContent = b, s.textContent = w, requestAnimationFrame(() => {
|
|
295
|
-
const x = t.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date),
|
|
296
|
-
let
|
|
295
|
+
const x = t.getBoundingClientRect(), y = i.wrapperNode.getBoundingClientRect(), C = i.x(n.date), A = i.x(a.date);
|
|
296
|
+
let D = (C + A) / 2 - x.width / 2;
|
|
297
297
|
const I = 0, W = y.width - x.width;
|
|
298
|
-
|
|
298
|
+
D < I && (D = I), D > W && (D = W), t.style.left = `${D}px`, t.style.top = `${o}px`;
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
c !== void 0 && (t.style.display = c ? "none" : "block");
|
|
@@ -456,8 +456,8 @@ const Ks = (i) => {
|
|
|
456
456
|
className(y, C) {
|
|
457
457
|
y === "remove" ? x.classed(`${e}${C}`, !1) : x.classed(`${e}${C}`, !0);
|
|
458
458
|
},
|
|
459
|
-
update({ data: y, hidden: C, clip:
|
|
460
|
-
y !== void 0 && x.datum(y).attr("d", m), C !== void 0 && x.classed(`${e}_hidden`, C),
|
|
459
|
+
update({ data: y, hidden: C, clip: A }) {
|
|
460
|
+
y !== void 0 && x.datum(y).attr("d", m), C !== void 0 && x.classed(`${e}_hidden`, C), A !== void 0 && w.attr("x", A.x).attr("y", A.y).attr("width", A.width).attr("height", A.height);
|
|
461
461
|
},
|
|
462
462
|
destroy() {
|
|
463
463
|
x.remove();
|
|
@@ -482,8 +482,8 @@ const Ks = (i) => {
|
|
|
482
482
|
className(y, C) {
|
|
483
483
|
y === "remove" ? x.classed(`${c}${C}`, !1) : x.classed(`${c}${C}`, !0);
|
|
484
484
|
},
|
|
485
|
-
update({ data: y, clip: C, hidden:
|
|
486
|
-
y !== void 0 && x.datum(y).attr("d", m),
|
|
485
|
+
update({ data: y, clip: C, hidden: A }) {
|
|
486
|
+
y !== void 0 && x.datum(y).attr("d", m), A !== void 0 && x.classed(`${c}_hidden`, A), 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(k.easeLinear) : w.attr("x", C.x).attr("y", C.y).attr("width", C.width).attr("height", C.height));
|
|
487
487
|
},
|
|
488
488
|
destroy() {
|
|
489
489
|
x.remove();
|
|
@@ -808,9 +808,13 @@ const Ks = (i) => {
|
|
|
808
808
|
t.disabledResize || window.addEventListener("resize", d);
|
|
809
809
|
const g = (_, m = !1) => {
|
|
810
810
|
m && _.config && (c = ei(c, _.config)), m && _.data && (h = _.data);
|
|
811
|
-
const v = h.map((
|
|
811
|
+
const v = h.map((M) => ({ date: new Date(M.date), value: M.value })).sort((M, D) => M.date.getTime() - D.date.getTime()), b = un(v, c, r), w = fn(v, c, o);
|
|
812
812
|
s.attr("class", `sc-charts sc-charts__${c.theme}`), n.attr("preserveAspectRatio", "xMinYMin meet").attr("viewBox", `0 0 ${r} ${o}`).style("width", "100%").style("height", "100%").selectAll("*").remove();
|
|
813
|
-
const x =
|
|
813
|
+
const x = s.node(), y = n.node();
|
|
814
|
+
Array.from(x.children).forEach((M) => {
|
|
815
|
+
M !== y && M.remove();
|
|
816
|
+
});
|
|
817
|
+
const C = {
|
|
814
818
|
chartId: t.chartId,
|
|
815
819
|
svg: n,
|
|
816
820
|
wrapperNode: s.node(),
|
|
@@ -824,12 +828,12 @@ const Ks = (i) => {
|
|
|
824
828
|
gridHoverTooltip: null,
|
|
825
829
|
onGridCircleHoverRef: { current: null }
|
|
826
830
|
};
|
|
827
|
-
Ys(
|
|
828
|
-
const
|
|
829
|
-
...
|
|
830
|
-
elements: on(
|
|
831
|
+
Ys(C);
|
|
832
|
+
const A = {
|
|
833
|
+
...C,
|
|
834
|
+
elements: on(C)
|
|
831
835
|
};
|
|
832
|
-
dn(
|
|
836
|
+
dn(A);
|
|
833
837
|
};
|
|
834
838
|
return g(t), {
|
|
835
839
|
update: (_) => g(_, !0),
|
|
@@ -847,8 +851,8 @@ Dt.exports;
|
|
|
847
851
|
var ai;
|
|
848
852
|
function mn() {
|
|
849
853
|
return ai || (ai = 1, function(i, t) {
|
|
850
|
-
var e = 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]", m = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]",
|
|
851
|
-
F[K] = F[O] = F[V] = F[P] = F[ot] = F[se] = F[lt] = F[bt] = F[yt] = !0, F[o] = F[c] = F[Z] = F[d] = F[et] = F[g] = F[_] = F[m] = F[b] = F[w] = F[y] = F[
|
|
854
|
+
var e = 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]", m = "[object Function]", v = "[object GeneratorFunction]", b = "[object Map]", w = "[object Number]", x = "[object Null]", y = "[object Object]", C = "[object Proxy]", A = "[object RegExp]", M = "[object Set]", D = "[object String]", I = "[object Undefined]", W = "[object WeakMap]", Z = "[object ArrayBuffer]", et = "[object DataView]", K = "[object Float32Array]", O = "[object Float64Array]", V = "[object Int8Array]", P = "[object Int16Array]", ot = "[object Int32Array]", se = "[object Uint8Array]", lt = "[object Uint8ClampedArray]", bt = "[object Uint16Array]", yt = "[object Uint32Array]", Ht = /[\\^$.*+?()[\]{}|]/g, It = /^\[object .+?Constructor\]$/, Bt = /^(?:0|[1-9]\d*)$/, F = {};
|
|
855
|
+
F[K] = F[O] = F[V] = F[P] = F[ot] = F[se] = F[lt] = F[bt] = F[yt] = !0, F[o] = F[c] = F[Z] = F[d] = F[et] = F[g] = F[_] = F[m] = F[b] = F[w] = F[y] = F[A] = F[M] = F[D] = F[W] = !1;
|
|
852
856
|
var Rt = typeof Gt == "object" && Gt && Gt.Object === Object && Gt, ne = typeof self == "object" && self && self.Object === Object && self, z = Rt || ne || Function("return this")(), tt = t && !t.nodeType && t, Y = tt && !0 && i && !i.nodeType && i, j = Y && Y.exports === tt, mt = j && Rt.process, wt = function() {
|
|
853
857
|
try {
|
|
854
858
|
var l = Y && Y.require && Y.require("util").types;
|
|
@@ -1031,11 +1035,11 @@ function mn() {
|
|
|
1031
1035
|
}
|
|
1032
1036
|
pt.prototype.clear = qi, pt.prototype.delete = Ji, pt.prototype.get = Qi, pt.prototype.has = Ki, pt.prototype.set = ts;
|
|
1033
1037
|
function es(l, u) {
|
|
1034
|
-
var p = ue(l), T = !p && de(l),
|
|
1038
|
+
var p = ue(l), T = !p && de(l), E = !p && !T && Ge(l), H = !p && !T && !E && qe(l), B = p || T || E || H, N = B ? Ot(l.length, String) : [], R = N.length;
|
|
1035
1039
|
for (var q in l)
|
|
1036
1040
|
B && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1037
1041
|
(q == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1038
|
-
|
|
1042
|
+
E && (q == "offset" || q == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1039
1043
|
H && (q == "buffer" || q == "byteLength" || q == "byteOffset") || // Skip index properties.
|
|
1040
1044
|
Xe(q, R)) || N.push(q);
|
|
1041
1045
|
return N;
|
|
@@ -1085,17 +1089,17 @@ function mn() {
|
|
|
1085
1089
|
T == "constructor" && (u || !at.call(l, T)) || p.push(T);
|
|
1086
1090
|
return p;
|
|
1087
1091
|
}
|
|
1088
|
-
function je(l, u, p, T,
|
|
1092
|
+
function je(l, u, p, T, E) {
|
|
1089
1093
|
l !== u && ss(u, function(H, B) {
|
|
1090
|
-
if (
|
|
1091
|
-
os(l, u, B, p, je, T,
|
|
1094
|
+
if (E || (E = new pt()), ft(H))
|
|
1095
|
+
os(l, u, B, p, je, T, E);
|
|
1092
1096
|
else {
|
|
1093
|
-
var N = T ? T(he(l, B), H, B + "", l, u,
|
|
1097
|
+
var N = T ? T(he(l, B), H, B + "", l, u, E) : void 0;
|
|
1094
1098
|
N === void 0 && (N = H), oe(l, B, N);
|
|
1095
1099
|
}
|
|
1096
1100
|
}, Je);
|
|
1097
1101
|
}
|
|
1098
|
-
function os(l, u, p, T,
|
|
1102
|
+
function os(l, u, p, T, E, H, B) {
|
|
1099
1103
|
var N = he(l, p), R = he(u, p), q = B.get(R);
|
|
1100
1104
|
if (q) {
|
|
1101
1105
|
oe(l, p, q);
|
|
@@ -1106,7 +1110,7 @@ function mn() {
|
|
|
1106
1110
|
var me = ue(R), _e = !me && Ge(R), Ke = !me && !_e && qe(R);
|
|
1107
1111
|
X = R, me || _e || Ke ? ue(N) ? X = N : Ds(N) ? X = fs(N) : _e ? (Mt = !1, X = hs(R)) : Ke ? (Mt = !1, X = us(R)) : X = [] : Es(R) || de(R) ? (X = N, de(N) ? X = Ls(N) : (!ft(N) || ge(N)) && (X = vs(R))) : Mt = !1;
|
|
1108
1112
|
}
|
|
1109
|
-
Mt && (B.set(R, X),
|
|
1113
|
+
Mt && (B.set(R, X), E(X, R, T, H, B), B.delete(R)), oe(l, p, X);
|
|
1110
1114
|
}
|
|
1111
1115
|
function ls(l, u) {
|
|
1112
1116
|
return Ss(Ts(l, u, Qe), l + "");
|
|
@@ -1137,18 +1141,18 @@ function mn() {
|
|
|
1137
1141
|
return u;
|
|
1138
1142
|
}
|
|
1139
1143
|
function gs(l, u, p, T) {
|
|
1140
|
-
var
|
|
1144
|
+
var E = !p;
|
|
1141
1145
|
p || (p = {});
|
|
1142
1146
|
for (var H = -1, B = u.length; ++H < B; ) {
|
|
1143
1147
|
var N = u[H], R = void 0;
|
|
1144
|
-
R === void 0 && (R = l[N]),
|
|
1148
|
+
R === void 0 && (R = l[N]), E ? le(p, N, R) : is(p, N, R);
|
|
1145
1149
|
}
|
|
1146
1150
|
return p;
|
|
1147
1151
|
}
|
|
1148
1152
|
function ms(l) {
|
|
1149
1153
|
return ls(function(u, p) {
|
|
1150
|
-
var T = -1,
|
|
1151
|
-
for (H = l.length > 3 && typeof H == "function" ? (
|
|
1154
|
+
var T = -1, E = p.length, H = E > 1 ? p[E - 1] : void 0, B = E > 2 ? p[2] : void 0;
|
|
1155
|
+
for (H = l.length > 3 && typeof H == "function" ? (E--, H) : void 0, B && bs(p[0], p[1], B) && (H = E < 3 ? void 0 : H, E = 1), u = Object(u); ++T < E; ) {
|
|
1152
1156
|
var N = p[T];
|
|
1153
1157
|
N && l(u, N, T, H);
|
|
1154
1158
|
}
|
|
@@ -1157,8 +1161,8 @@ function mn() {
|
|
|
1157
1161
|
}
|
|
1158
1162
|
function _s(l) {
|
|
1159
1163
|
return function(u, p, T) {
|
|
1160
|
-
for (var
|
|
1161
|
-
var R = B[++
|
|
1164
|
+
for (var E = -1, H = Object(u), B = T(u), N = B.length; N--; ) {
|
|
1165
|
+
var R = B[++E];
|
|
1162
1166
|
if (p(H[R], R, H) === !1)
|
|
1163
1167
|
break;
|
|
1164
1168
|
}
|
|
@@ -1180,8 +1184,8 @@ function mn() {
|
|
|
1180
1184
|
var T = !0;
|
|
1181
1185
|
} catch {
|
|
1182
1186
|
}
|
|
1183
|
-
var
|
|
1184
|
-
return T && (u ? l[dt] = p : delete l[dt]),
|
|
1187
|
+
var E = Re.call(l);
|
|
1188
|
+
return T && (u ? l[dt] = p : delete l[dt]), E;
|
|
1185
1189
|
}
|
|
1186
1190
|
function vs(l) {
|
|
1187
1191
|
return typeof l.constructor == "function" && !Ue(l) ? Hi(Pe(l)) : {};
|
|
@@ -1219,11 +1223,11 @@ function mn() {
|
|
|
1219
1223
|
}
|
|
1220
1224
|
function Ts(l, u, p) {
|
|
1221
1225
|
return u = Ve(u === void 0 ? l.length - 1 : u, 0), function() {
|
|
1222
|
-
for (var T = arguments,
|
|
1223
|
-
B[
|
|
1224
|
-
|
|
1225
|
-
for (var N = Array(u + 1); ++
|
|
1226
|
-
N[
|
|
1226
|
+
for (var T = arguments, E = -1, H = Ve(T.length - u, 0), B = Array(H); ++E < H; )
|
|
1227
|
+
B[E] = T[u + E];
|
|
1228
|
+
E = -1;
|
|
1229
|
+
for (var N = Array(u + 1); ++E < u; )
|
|
1230
|
+
N[E] = T[E];
|
|
1227
1231
|
return N[u] = p(B), $t(l, this, N);
|
|
1228
1232
|
};
|
|
1229
1233
|
}
|
|
@@ -1235,8 +1239,8 @@ function mn() {
|
|
|
1235
1239
|
function Ms(l) {
|
|
1236
1240
|
var u = 0, p = 0;
|
|
1237
1241
|
return function() {
|
|
1238
|
-
var T = Fi(),
|
|
1239
|
-
if (p = T,
|
|
1242
|
+
var T = Fi(), E = a - (T - p);
|
|
1243
|
+
if (p = T, E > 0) {
|
|
1240
1244
|
if (++u >= n)
|
|
1241
1245
|
return arguments[0];
|
|
1242
1246
|
} else
|
|
@@ -1554,11 +1558,11 @@ function oi(i, t) {
|
|
|
1554
1558
|
const w = Math.abs(v - b);
|
|
1555
1559
|
let x = Math.max(v, b) + w / 2, y = Math.min(v, b) - w / 2;
|
|
1556
1560
|
if (t.trade) {
|
|
1557
|
-
const
|
|
1558
|
-
const
|
|
1559
|
-
return
|
|
1561
|
+
const A = [...t.trade.entries, ...t.trade.exits].find((M) => {
|
|
1562
|
+
const D = M.time.getTime();
|
|
1563
|
+
return D >= g && D < g + e;
|
|
1560
1564
|
});
|
|
1561
|
-
|
|
1565
|
+
A && (A.type === "buy" ? (y = A.price, b = Math.max(y, b), v = b + w, x = Math.max(v, b) + w / 2, d = v) : A.type === "sell" && (x = A.price, b = Math.min(x, b), v = b - w, y = Math.min(v, b) - w / 2, d = v));
|
|
1562
1566
|
}
|
|
1563
1567
|
const C = {
|
|
1564
1568
|
open_time: new Date(g),
|
|
@@ -3067,12 +3071,12 @@ function ga(i, t) {
|
|
|
3067
3071
|
const m = s.convert(g.open_time);
|
|
3068
3072
|
_.forEach((v) => {
|
|
3069
3073
|
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 ? Vn : Wn;
|
|
3070
|
-
let
|
|
3071
|
-
h && h[1] && h[0] === v.type && (
|
|
3074
|
+
let A = b ? o.buyLabel.main : o.sellLabel.main;
|
|
3075
|
+
h && h[1] && h[0] === v.type && (A = S.mix(A, a.bg, 20).toString()), d && d[1] && d[0] === v.type && (A = o.activeLabel), C(i, {
|
|
3072
3076
|
x: m,
|
|
3073
3077
|
y,
|
|
3074
3078
|
symbol: x,
|
|
3075
|
-
mainColor:
|
|
3079
|
+
mainColor: A,
|
|
3076
3080
|
textColor: w,
|
|
3077
3081
|
size: 16,
|
|
3078
3082
|
fontSize: 12
|
|
@@ -3186,9 +3190,9 @@ const ba = 10, ya = 6, wa = 4, xa = 12, Ca = (i, t) => {
|
|
|
3186
3190
|
if (!_ || !m) return;
|
|
3187
3191
|
const v = (P) => P ? P instanceof Date ? P : new Date(P) : null, b = v(d == null ? void 0 : d[0]) || _.candle.open_time, w = v(d == null ? void 0 : d[1]) || m.candle.close_time, x = e.convert(v(d == null ? void 0 : d[0]) || _.candle.open_time), y = e.convert(v(d == null ? void 0 : d[1]) || m.candle.open_time), C = t.candles.allData.filter(
|
|
3188
3192
|
(P) => P.open_time <= w && P.close_time >= b
|
|
3189
|
-
),
|
|
3190
|
-
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(x,
|
|
3191
|
-
const
|
|
3193
|
+
), A = C.length > 0 ? C.reduce((P, ot) => ot.low < P ? ot.low : P, C[0].low) : ((V = n.at(0)) == null ? void 0 : V.price) ?? 0, M = s.convert(g || A);
|
|
3194
|
+
i.beginPath(), i.setLineDash([4, 4]), i.strokeStyle = o.main, i.moveTo(x, M), i.lineTo(y, M), i.stroke(), i.setLineDash([]);
|
|
3195
|
+
const D = (x + y) / 2, I = h || `Hold: ${va(r)}`, Z = getComputedStyle(
|
|
3192
3196
|
document.querySelector(".sc-charts-cs") || document.body
|
|
3193
3197
|
).font.replace(/^\s*\S+/, "").trim();
|
|
3194
3198
|
i.font = `600 ${ba}px ${Z}`;
|
|
@@ -3196,13 +3200,13 @@ const ba = 10, ya = 6, wa = 4, xa = 12, Ca = (i, t) => {
|
|
|
3196
3200
|
Ti(i, {
|
|
3197
3201
|
radius: 4,
|
|
3198
3202
|
coords: {
|
|
3199
|
-
x:
|
|
3200
|
-
y:
|
|
3203
|
+
x: D - K / 2,
|
|
3204
|
+
y: M - O / 2
|
|
3201
3205
|
},
|
|
3202
3206
|
width: K,
|
|
3203
3207
|
height: O,
|
|
3204
3208
|
fillColor: o.main
|
|
3205
|
-
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(I,
|
|
3209
|
+
}), i.fillStyle = o.text, i.textBaseline = "middle", i.textAlign = "center", i.fillText(I, D, M), i.restore();
|
|
3206
3210
|
};
|
|
3207
3211
|
class Ft {
|
|
3208
3212
|
constructor(t, e, {
|
|
@@ -3236,18 +3240,18 @@ const Ta = {
|
|
|
3236
3240
|
offset: n = 8
|
|
3237
3241
|
}) => {
|
|
3238
3242
|
const { width: a, height: r } = i, o = t.right - t.left, c = t.bottom - t.top, h = (y) => {
|
|
3239
|
-
const { dx: C, dy:
|
|
3240
|
-
return { x:
|
|
3243
|
+
const { dx: C, dy: A } = Ta[y], M = e.x + (C === 1 ? n : -a - n), D = e.y + (A === 1 ? n : -r - n);
|
|
3244
|
+
return { x: M, y: D, side: y };
|
|
3241
3245
|
}, d = ({ x: y, y: C }) => y >= 0 && C >= 0 && y + a <= o && C + r <= c, g = () => {
|
|
3242
|
-
const y = e.y < 0, C = e.y + r > c,
|
|
3243
|
-
return
|
|
3246
|
+
const y = e.y < 0, C = e.y + r > c, A = e.x < 0, M = e.x + a > o;
|
|
3247
|
+
return A && y ? "right-bottom" : A && C ? "right-top" : M && y ? "left-bottom" : M && C ? "left-top" : A ? "right-bottom" : M ? "left-bottom" : y ? "right-bottom" : C ? "right-top" : s;
|
|
3244
3248
|
}, m = [
|
|
3245
3249
|
s,
|
|
3246
3250
|
"right-bottom",
|
|
3247
3251
|
"right-top",
|
|
3248
3252
|
"left-bottom",
|
|
3249
3253
|
"left-top"
|
|
3250
|
-
].filter((y, C,
|
|
3254
|
+
].filter((y, C, A) => A.indexOf(y) === C), v = g();
|
|
3251
3255
|
let b = null;
|
|
3252
3256
|
for (const y of [v, ...m]) {
|
|
3253
3257
|
const C = h(y);
|
|
@@ -4884,16 +4888,16 @@ class yr {
|
|
|
4884
4888
|
const v = _ + c / 2;
|
|
4885
4889
|
if (m.length === 0) return;
|
|
4886
4890
|
t.font = `500 ${d}px Geist, Arial, sans-serif`;
|
|
4887
|
-
const b = o ? "#878788" : "#8E8E93", w = o ? "#FAFAFA" : "#1C2026", x = m.reduce((
|
|
4888
|
-
const I = t.measureText(
|
|
4889
|
-
return
|
|
4891
|
+
const b = o ? "#878788" : "#8E8E93", w = o ? "#FAFAFA" : "#1C2026", x = m.reduce((M, D) => {
|
|
4892
|
+
const I = t.measureText(D.label).width, W = t.measureText(D.value).width;
|
|
4893
|
+
return M + I + g + W;
|
|
4890
4894
|
}, 0), y = s - h * 2, C = m.length > 1 ? (y - x) / (m.length - 1) : 0;
|
|
4891
|
-
let
|
|
4892
|
-
m.forEach((
|
|
4893
|
-
const
|
|
4894
|
-
t.fillStyle = b, t.fillText(
|
|
4895
|
-
const W =
|
|
4896
|
-
t.fillStyle =
|
|
4895
|
+
let A = h;
|
|
4896
|
+
m.forEach((M) => {
|
|
4897
|
+
const D = t.measureText(M.label).width, I = t.measureText(M.value).width;
|
|
4898
|
+
t.fillStyle = b, t.fillText(M.label, A, v);
|
|
4899
|
+
const W = A + D + g;
|
|
4900
|
+
t.fillStyle = M.valueColor || w, t.fillText(M.value, W, v), A += D + g + I + C;
|
|
4897
4901
|
});
|
|
4898
4902
|
}
|
|
4899
4903
|
getChartState() {
|
|
@@ -4921,9 +4925,9 @@ class yr {
|
|
|
4921
4925
|
console.warn("No canvas elements found for screenshot");
|
|
4922
4926
|
return;
|
|
4923
4927
|
}
|
|
4924
|
-
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0,
|
|
4928
|
+
const b = 1440, w = 900, x = 48, y = 20, C = c ? 32 : 0, A = w - x - y - C, M = b, D = _ / m, I = M / A;
|
|
4925
4929
|
let W, Z, et = 0, K = 0;
|
|
4926
|
-
|
|
4930
|
+
D > I ? (Z = A, W = Z * D, et = 0, K = 0) : (W = M, Z = W / D, K = (A - Z) / 2);
|
|
4927
4931
|
const O = window.devicePixelRatio || 1, V = document.createElement("canvas");
|
|
4928
4932
|
V.width = b * O, V.height = w * O;
|
|
4929
4933
|
const P = V.getContext("2d");
|
|
@@ -4932,7 +4936,7 @@ class yr {
|
|
|
4932
4936
|
return;
|
|
4933
4937
|
}
|
|
4934
4938
|
P.fillStyle = h ? "#101011" : "#ffffff", P.fillRect(0, 0, V.width, V.height);
|
|
4935
|
-
const ot = x * O, se = y * O, lt =
|
|
4939
|
+
const ot = x * O, se = y * O, lt = A * O, bt = M * O, yt = ot + se;
|
|
4936
4940
|
await this._drawHeader(P, V.width, O, h), this._drawHeaderSecondLine(
|
|
4937
4941
|
P,
|
|
4938
4942
|
r,
|
|
@@ -4947,7 +4951,7 @@ class yr {
|
|
|
4947
4951
|
const It = W * O, Bt = Z * O, F = et * O, Rt = K * O;
|
|
4948
4952
|
v.forEach((z) => {
|
|
4949
4953
|
let tt = 0, Y = 0, j = z.width, mt = z.height, wt = It, xt = Bt, $t = F, Ot = Rt;
|
|
4950
|
-
if (
|
|
4954
|
+
if (D > I) {
|
|
4951
4955
|
const ct = Bt / z.height, ht = z.width * ct;
|
|
4952
4956
|
ht > bt && (tt = (ht - bt) / ct, j = z.width - tt, wt = bt, $t = 0);
|
|
4953
4957
|
} else {
|