@silurus/ooxml 0.78.1 → 0.79.0
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/README.md +39 -1
- package/THIRD_PARTY_NOTICES.md +13 -0
- package/dist/{canvas-viewer-mechanics-B4K_t5X_.js → canvas-viewer-mechanics-D9tsuHnG.js} +1 -1
- package/dist/chart-number-format-tjYUR9eS.js +435 -0
- package/dist/dash-Cyc-sevN.js +786 -0
- package/dist/{document-pull-client-5AakVD6e.js → document-pull-client-YiU8M4LO.js} +2119 -2113
- package/dist/{docx-bjhRwb2u.js → docx-a1UpmRf8.js} +65 -56
- package/dist/docx.mjs +4 -4
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/index.mjs +3 -3
- package/dist/{line-distribute-BVFW1-Hs.js → line-distribute-pDqovJpT.js} +1 -1
- package/dist/{line-metrics-DS0NS2Iq.js → line-metrics-DjKxiIUD.js} +4089 -3210
- package/dist/math.mjs +1 -1
- package/dist/node.mjs +322 -322
- package/dist/{pptx-D1rCrHGR.js → pptx-t5ABdzfd.js} +192 -183
- package/dist/pptx.mjs +5 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/region-map.mjs +12708 -0
- package/dist/{render-DhlT5jxZ.js → render-BjIEuFIG.js} +1 -1
- package/dist/render-worker-host-BB320snY.js +27 -0
- package/dist/render-worker-host-BjEPZBwf.js +27 -0
- package/dist/render-worker-host-hZ0o4OD7.js +27 -0
- package/dist/{resource-measurement-BA-4Q-II.js → resource-measurement-D8EiTm_E.js} +1 -1
- package/dist/{session-C_HGxbRD.js → session-Bhe_eY-s.js} +10 -10
- package/dist/{slide-pull-client-BiC4sVGi.js → slide-pull-client-BQ8gJPTq.js} +584 -583
- package/dist/three-d.mjs +2158 -0
- package/dist/types/docx.d.ts +185 -16
- package/dist/types/index.d.ts +196 -20
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +157 -1
- package/dist/types/pptx.d.ts +187 -16
- package/dist/types/region-map.d.ts +520 -0
- package/dist/types/three-d.d.ts +520 -0
- package/dist/types/xlsx.d.ts +186 -16
- package/dist/{worksheet-pull-client-BnvgeqfG.js → worksheet-pull-client-T0EzdEEQ.js} +13 -13
- package/dist/{xlsx-BG_WYSc0.js → xlsx-CsDDMJIK.js} +442 -414
- package/dist/xlsx.mjs +5 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +13 -1
- package/dist/render-worker-host-CtJo7hc9.js +0 -27
- package/dist/render-worker-host-D8vv-Asx.js +0 -27
- package/dist/render-worker-host-DAjG9nmw.js +0 -27
- /package/dist/{highlight-rect-CAkCWJ37.js → highlight-rect-cCvVU-MW.js} +0 -0
- /package/dist/{mathjax-CMjda8Ip.js → mathjax-Dqo857oC.js} +0 -0
- /package/dist/{transfer-DCu4c2BL.js → transfer-3QEJrsJa.js} +0 -0
- /package/dist/{visible-index-CgyJLAS_.js → visible-index-CKvgpUrf.js} +0 -0
package/dist/three-d.mjs
ADDED
|
@@ -0,0 +1,2158 @@
|
|
|
1
|
+
import { S as e, b as t, c as n, d as r, g as i, h as a, l as o, m as s, r as c, t as l, u, v as d, x as f } from "./chart-number-format-tjYUR9eS.js";
|
|
2
|
+
import { T as p, b as m, c as h, d as g, f as _, h as v, l as y, n as b, s as x, u as S } from "./dash-Cyc-sevN.js";
|
|
3
|
+
//#region packages/core/src/chart/three-d.ts
|
|
4
|
+
function C(e, t, n, r, i) {
|
|
5
|
+
let a = Number.isFinite(e) && e > 0 ? e : 0, o = Number.isFinite(t) ? D(t, 0, 500) : 150, s = Math.max(1, Math.trunc(r)), c = D(Math.trunc(n), 0, s - 1), l = i ? 1 : s, u = a / (l + o / 100);
|
|
6
|
+
return {
|
|
7
|
+
offset: (a - u * l) / 2 + (i ? 0 : c * u),
|
|
8
|
+
size: u
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function w(e, t, n) {
|
|
12
|
+
if (![
|
|
13
|
+
e,
|
|
14
|
+
t,
|
|
15
|
+
n
|
|
16
|
+
].every(Number.isFinite)) return 1;
|
|
17
|
+
let r = e >= 0 ? n : t;
|
|
18
|
+
return 1 - Math.min(1, Math.abs(e) / Math.max(Number.MIN_VALUE, Math.abs(r)));
|
|
19
|
+
}
|
|
20
|
+
function T(e, t, n, r = .06) {
|
|
21
|
+
if (!t.length || t.length > 1e5 || ![
|
|
22
|
+
n.x,
|
|
23
|
+
n.y,
|
|
24
|
+
n.w,
|
|
25
|
+
n.h
|
|
26
|
+
].every(Number.isFinite) || n.w <= 0 || n.h <= 0) return e;
|
|
27
|
+
let i = t.map((t) => e.project(t.x, t.y, t.depth));
|
|
28
|
+
if (!i.every((e) => Number.isFinite(e.x) && Number.isFinite(e.y))) return e;
|
|
29
|
+
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
|
|
30
|
+
for (let e of i) a = Math.min(a, e.x), o = Math.max(o, e.x), s = Math.min(s, e.y), c = Math.max(c, e.y);
|
|
31
|
+
let l = o - a, u = c - s;
|
|
32
|
+
if (!(l > 2 ** -52) || !(u > 2 ** -52)) return e;
|
|
33
|
+
let d = D(E(r, .06), 0, .45), f = n.w * (1 - 2 * d), p = n.h * (1 - 2 * d), m = Math.min(f / l, p / u);
|
|
34
|
+
if (!(m > 0) || !Number.isFinite(m)) return e;
|
|
35
|
+
let h = {
|
|
36
|
+
x: (a + o) / 2,
|
|
37
|
+
y: (s + c) / 2
|
|
38
|
+
}, g = {
|
|
39
|
+
x: n.x + n.w / 2,
|
|
40
|
+
y: n.y + n.h / 2
|
|
41
|
+
}, _ = e.project, v = (e, t, n) => {
|
|
42
|
+
let r = _(e, t, n);
|
|
43
|
+
return {
|
|
44
|
+
x: g.x + (r.x - h.x) * m,
|
|
45
|
+
y: g.y + (r.y - h.y) * m
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
...e,
|
|
50
|
+
project: v,
|
|
51
|
+
depthX: e.depthX * m,
|
|
52
|
+
depthY: e.depthY * m
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var E = (e, t) => typeof e == "number" && Number.isFinite(e) ? e : t, D = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
56
|
+
function O(e, t, n = {}) {
|
|
57
|
+
if (![
|
|
58
|
+
t.x,
|
|
59
|
+
t.y,
|
|
60
|
+
t.w,
|
|
61
|
+
t.h
|
|
62
|
+
].every(Number.isFinite) || t.w <= 0 || t.h <= 0) return null;
|
|
63
|
+
let r = D(E(e.rotationX, 15), -90, 90), i = (D(E(e.rotationY, 20), 0, 360) + 180) % 360 - 180, a = D(E(e.depthPercent, 100), 20, 2e3), o = D(E(e.perspective, 30), 0, 240), s = D(E(e.gapDepthPercent, 150), 0, 500), c = e.heightPercent != null && Number.isFinite(e.heightPercent) ? D(e.heightPercent, 5, 500) : null, l = n.sceneHeightScale != null && Number.isFinite(n.sceneHeightScale) ? D(n.sceneHeightScale * 100, 5, 500) : null, u = c ?? l, d = t;
|
|
64
|
+
if (u != null) {
|
|
65
|
+
let e = u / 100, n = Math.min(t.w, t.h / e), r = n * e;
|
|
66
|
+
d = {
|
|
67
|
+
x: t.x + (t.w - n) / 2,
|
|
68
|
+
y: t.y + (t.h - r) / 2,
|
|
69
|
+
w: n,
|
|
70
|
+
h: r
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
let f = Math.PI / 180, p = D(E(n.sceneDepthScale, .1), .01, 2), m = d.w * p * (a / 100), h = d.x + d.w / 2, g = d.y + d.h / 2, _ = -i * f, v = r * f, y = Math.cos(_), b = Math.sin(_), x = Math.cos(v), S = Math.sin(v), C = e.rightAngleAxes !== !0 && o > 0, w = D(o * .25, .25, 60) * f, T = Math.atan(2 * Math.tan(w)), O = Math.hypot(d.w, d.h, m), k = C ? O * .5 / Math.tan(T) : Infinity, A = (e, t, n) => {
|
|
74
|
+
let r = e - h, i = g - t, a = (.5 - D(Number.isFinite(n) ? n : 0, 0, 1)) * m, o = y * r + b * a, s = -b * r + y * a;
|
|
75
|
+
return {
|
|
76
|
+
x: o,
|
|
77
|
+
y: x * i - S * s,
|
|
78
|
+
z: S * i + x * s
|
|
79
|
+
};
|
|
80
|
+
}, j = (e) => {
|
|
81
|
+
if (e.length < 3) return null;
|
|
82
|
+
let t = e.map((e) => A(e.x, e.y, e.depth)), n = t[0], r = null;
|
|
83
|
+
for (let e = 1; e + 1 < t.length && !r; e++) for (let i = e + 1; i < t.length; i++) {
|
|
84
|
+
let a = t[e], o = t[i], s = {
|
|
85
|
+
x: a.x - n.x,
|
|
86
|
+
y: a.y - n.y,
|
|
87
|
+
z: a.z - n.z
|
|
88
|
+
}, c = {
|
|
89
|
+
x: o.x - n.x,
|
|
90
|
+
y: o.y - n.y,
|
|
91
|
+
z: o.z - n.z
|
|
92
|
+
}, l = {
|
|
93
|
+
x: s.y * c.z - s.z * c.y,
|
|
94
|
+
y: s.z * c.x - s.x * c.z,
|
|
95
|
+
z: s.x * c.y - s.y * c.x
|
|
96
|
+
}, u = Math.hypot(l.x, l.y, l.z);
|
|
97
|
+
if (u > 2 ** -52) {
|
|
98
|
+
r = {
|
|
99
|
+
x: l.x / u,
|
|
100
|
+
y: l.y / u,
|
|
101
|
+
z: l.z / u
|
|
102
|
+
};
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return r ? {
|
|
107
|
+
normal: r,
|
|
108
|
+
centroid: t.reduce((e, n) => ({
|
|
109
|
+
x: e.x + n.x / t.length,
|
|
110
|
+
y: e.y + n.y / t.length,
|
|
111
|
+
z: e.z + n.z / t.length
|
|
112
|
+
}), {
|
|
113
|
+
x: 0,
|
|
114
|
+
y: 0,
|
|
115
|
+
z: 0
|
|
116
|
+
})
|
|
117
|
+
} : null;
|
|
118
|
+
}, M = -Infinity;
|
|
119
|
+
for (let e of [d.x, d.x + d.w]) for (let t of [d.y, d.y + d.h]) for (let n of [0, 1]) M = Math.max(M, A(e, t, n).z);
|
|
120
|
+
let N = C ? Math.max(k, M + O * .01) : Infinity, P = (e, t, n) => {
|
|
121
|
+
let r = A(e, t, n);
|
|
122
|
+
if (!C) return {
|
|
123
|
+
x: r.x,
|
|
124
|
+
y: -r.y
|
|
125
|
+
};
|
|
126
|
+
let i = N / Math.max(N * 1e-9, N - r.z);
|
|
127
|
+
return {
|
|
128
|
+
x: r.x * i,
|
|
129
|
+
y: -r.y * i
|
|
130
|
+
};
|
|
131
|
+
}, F = [];
|
|
132
|
+
for (let e of [d.x, d.x + d.w]) for (let t of [d.y, d.y + d.h]) for (let n of [0, 1]) F.push(P(e, t, n));
|
|
133
|
+
let I = Math.min(...F.map((e) => e.x)), L = Math.max(...F.map((e) => e.x)), R = Math.min(...F.map((e) => e.y)), z = Math.max(...F.map((e) => e.y)), B = Math.max(Number.MIN_VALUE, L - I), V = Math.max(Number.MIN_VALUE, z - R), H = Math.min(t.w / B, t.h / V) * .94, U = t.x + (t.w - B * H) / 2 - I * H, W = t.y + (t.h - V * H) / 2 - R * H, G = (e, t, n) => {
|
|
134
|
+
let r = P(e, t, n);
|
|
135
|
+
return {
|
|
136
|
+
x: U + r.x * H,
|
|
137
|
+
y: W + r.y * H
|
|
138
|
+
};
|
|
139
|
+
}, K = { ...d }, q = G(h, g, 0), J = G(h, g, 1), ee = J.x - q.x, te = J.y - q.y, Y = (e, t) => A(e === "x" ? t === "min" ? d.x : d.x + d.w : h, e === "y" ? t === "min" ? d.y : d.y + d.h : g, e === "depth" ? t === "min" ? 0 : 1 : .5).z, ne = Y("x", "min") <= Y("x", "max") ? "min" : "max", re = Y("y", "min") <= Y("y", "max") ? "min" : "max", X = Y("depth", "min") >= Y("depth", "max") ? 0 : 1, ie = +(X === 0), ae = (e) => {
|
|
140
|
+
let t = e === "min" ? d.x : d.x + d.w, n = G(t, d.y, X), r = G(t, d.y + d.h, X);
|
|
141
|
+
return (n.x + r.x) / 2;
|
|
142
|
+
}, oe = (e) => {
|
|
143
|
+
let t = e === "min" ? d.y : d.y + d.h, n = G(d.x, t, X), r = G(d.x + d.w, t, X);
|
|
144
|
+
return (n.y + r.y) / 2;
|
|
145
|
+
}, se = ae("min") <= ae("max") ? "min" : "max", ce = oe("min") >= oe("max") ? "min" : "max", le = (e) => 1 / Math.max(1, Math.trunc(e)) / (1 + s / 100), Z = (e, t, n = !1) => n || t <= 1 ? .5 : (D(Math.trunc(e), 0, Math.max(0, t - 1)) + .5) / t;
|
|
146
|
+
return {
|
|
147
|
+
scene: d,
|
|
148
|
+
front: K,
|
|
149
|
+
depthX: ee,
|
|
150
|
+
depthY: te,
|
|
151
|
+
modelDepth: m,
|
|
152
|
+
pieScaleY: D(Math.sin(Math.max(1, Math.abs(r)) * f) ** 1.15, .2, 1),
|
|
153
|
+
pieThicknessFraction: .3 * Math.max(0, Math.cos(Math.abs(r) * f)),
|
|
154
|
+
project: G,
|
|
155
|
+
cameraDepth(e, t, n) {
|
|
156
|
+
return A(e, t, n).z;
|
|
157
|
+
},
|
|
158
|
+
cameraProjectionWeight(e, t, n) {
|
|
159
|
+
if (!C) return 1;
|
|
160
|
+
let r = A(e, t, n).z;
|
|
161
|
+
return 1 / Math.max(N * 1e-9, N - r);
|
|
162
|
+
},
|
|
163
|
+
cameraFacing(e) {
|
|
164
|
+
let t = j(e);
|
|
165
|
+
if (!t) return !1;
|
|
166
|
+
let { normal: n, centroid: r } = t, i = C ? {
|
|
167
|
+
x: -r.x,
|
|
168
|
+
y: -r.y,
|
|
169
|
+
z: N - r.z
|
|
170
|
+
} : {
|
|
171
|
+
x: 0,
|
|
172
|
+
y: 0,
|
|
173
|
+
z: 1
|
|
174
|
+
}, a = n.x * i.x + n.y * i.y + n.z * i.z, o = Math.hypot(i.x, i.y, i.z);
|
|
175
|
+
return o > 0 && a > o * 1e-10;
|
|
176
|
+
},
|
|
177
|
+
cameraNormal(e) {
|
|
178
|
+
return j(e)?.normal ?? null;
|
|
179
|
+
},
|
|
180
|
+
topology: {
|
|
181
|
+
farX: ne,
|
|
182
|
+
farY: re,
|
|
183
|
+
axisX: se,
|
|
184
|
+
axisY: ce,
|
|
185
|
+
nearDepth: X,
|
|
186
|
+
farDepth: ie
|
|
187
|
+
},
|
|
188
|
+
seriesDepth: Z,
|
|
189
|
+
prismDepth: le,
|
|
190
|
+
prismInterval(e, t, n = !1) {
|
|
191
|
+
let r = Z(e, t, n), i = le(n ? 1 : t) / 2;
|
|
192
|
+
return {
|
|
193
|
+
near: D(r - i, 0, 1),
|
|
194
|
+
far: D(r + i, 0, 1)
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function k(e) {
|
|
200
|
+
switch (e) {
|
|
201
|
+
case "cylinder":
|
|
202
|
+
case "cone":
|
|
203
|
+
case "coneToMax":
|
|
204
|
+
case "pyramid":
|
|
205
|
+
case "pyramidToMax": return e;
|
|
206
|
+
default: return "box";
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
var A = (e) => Math.max(0, Math.min(1, e));
|
|
210
|
+
function j(e, t) {
|
|
211
|
+
if (t.length < 3) return null;
|
|
212
|
+
let n = e[t[0]];
|
|
213
|
+
for (let r = 1; r + 1 < t.length; r++) for (let i = r + 1; i < t.length; i++) {
|
|
214
|
+
let a = e[t[r]], o = e[t[i]], s = {
|
|
215
|
+
x: a.x - n.x,
|
|
216
|
+
y: a.y - n.y,
|
|
217
|
+
depth: a.depth - n.depth
|
|
218
|
+
}, c = {
|
|
219
|
+
x: o.x - n.x,
|
|
220
|
+
y: o.y - n.y,
|
|
221
|
+
depth: o.depth - n.depth
|
|
222
|
+
}, l = {
|
|
223
|
+
x: s.y * c.depth - s.depth * c.y,
|
|
224
|
+
y: s.depth * c.x - s.x * c.depth,
|
|
225
|
+
depth: s.x * c.y - s.y * c.x
|
|
226
|
+
}, u = Math.hypot(l.x, l.y, l.depth);
|
|
227
|
+
if (u > 2 ** -52) return {
|
|
228
|
+
x: l.x / u,
|
|
229
|
+
y: l.y / u,
|
|
230
|
+
depth: l.depth / u
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
function M(e, t) {
|
|
236
|
+
let n = e.reduce((t, n) => ({
|
|
237
|
+
x: t.x + n.x / e.length,
|
|
238
|
+
y: t.y + n.y / e.length,
|
|
239
|
+
depth: t.depth + n.depth / e.length
|
|
240
|
+
}), {
|
|
241
|
+
x: 0,
|
|
242
|
+
y: 0,
|
|
243
|
+
depth: 0
|
|
244
|
+
});
|
|
245
|
+
return t.map((t) => {
|
|
246
|
+
let r = j(e, t.indices);
|
|
247
|
+
if (!r) return t;
|
|
248
|
+
let i = t.indices.reduce((n, r) => ({
|
|
249
|
+
x: n.x + e[r].x / t.indices.length,
|
|
250
|
+
y: n.y + e[r].y / t.indices.length,
|
|
251
|
+
depth: n.depth + e[r].depth / t.indices.length
|
|
252
|
+
}), {
|
|
253
|
+
x: 0,
|
|
254
|
+
y: 0,
|
|
255
|
+
depth: 0
|
|
256
|
+
}), a = {
|
|
257
|
+
x: i.x - n.x,
|
|
258
|
+
y: i.y - n.y,
|
|
259
|
+
depth: i.depth - n.depth
|
|
260
|
+
};
|
|
261
|
+
return r.x * a.x + r.y * a.y + r.depth * a.depth >= 0 ? t : {
|
|
262
|
+
...t,
|
|
263
|
+
indices: [...t.indices].reverse()
|
|
264
|
+
};
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function N(e) {
|
|
268
|
+
let { horizontal: t, crossStart: n, crossSize: r, baseCoord: i, endCoord: a, nearDepth: o, farDepth: s } = e;
|
|
269
|
+
if (![
|
|
270
|
+
n,
|
|
271
|
+
r,
|
|
272
|
+
i,
|
|
273
|
+
a,
|
|
274
|
+
o,
|
|
275
|
+
s
|
|
276
|
+
].every(Number.isFinite) || r <= 0 || i === a || o === s) return null;
|
|
277
|
+
let c = k(e.shape), l = c === "cylinder" || c === "cone" || c === "coneToMax", u = c !== "box" && c !== "cylinder", d = c === "coneToMax" || c === "pyramidToMax", f = l ? Math.max(8, Math.min(64, Math.trunc(e.roundSegments ?? 32))) : 4, p = A(e.baseScale ?? (d ? e.toMaxBaseScale ?? 1 : 1)), m = A(e.endScale ?? (u ? d ? e.toMaxEndScale ?? 0 : 0 : 1));
|
|
278
|
+
if (p === 0 && m === 0) return null;
|
|
279
|
+
let h = n + r / 2, g = r / 2, _ = (o + s) / 2, v = Math.abs(s - o) / 2, y = [], b = (e, n) => {
|
|
280
|
+
if (n === 0) {
|
|
281
|
+
let n = y.length;
|
|
282
|
+
return y.push(t ? {
|
|
283
|
+
x: e,
|
|
284
|
+
y: h,
|
|
285
|
+
depth: _
|
|
286
|
+
} : {
|
|
287
|
+
x: h,
|
|
288
|
+
y: e,
|
|
289
|
+
depth: _
|
|
290
|
+
}), [n];
|
|
291
|
+
}
|
|
292
|
+
let r = [];
|
|
293
|
+
for (let i = 0; i < f; i++) {
|
|
294
|
+
let a = l ? i / f * Math.PI * 2 : Math.PI / 4 + i / f * Math.PI * 2, o = l ? 1 : Math.SQRT2, s = h + Math.cos(a) * g * n * o, c = _ + Math.sin(a) * v * n * o;
|
|
295
|
+
r.push(y.length), y.push(t ? {
|
|
296
|
+
x: e,
|
|
297
|
+
y: s,
|
|
298
|
+
depth: c
|
|
299
|
+
} : {
|
|
300
|
+
x: s,
|
|
301
|
+
y: e,
|
|
302
|
+
depth: c
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
return r;
|
|
306
|
+
}, x = b(i, p), S = b(a, m), C = l, w = [];
|
|
307
|
+
x.length > 1 && e.omitBaseCap !== !0 && w.push({
|
|
308
|
+
indices: x,
|
|
309
|
+
role: "baseCap",
|
|
310
|
+
smoothSurface: C
|
|
311
|
+
}), S.length > 1 && e.omitEndCap !== !0 && w.push({
|
|
312
|
+
indices: S,
|
|
313
|
+
role: "endCap",
|
|
314
|
+
smoothSurface: C
|
|
315
|
+
});
|
|
316
|
+
let T = [], E = Math.max(x.length, S.length);
|
|
317
|
+
for (let e = 0; e < E; e++) {
|
|
318
|
+
let t = (e + 1) % E, n = x.length === 1 ? x[0] : x[e], r = x.length === 1 ? x[0] : x[t], i = S.length === 1 ? S[0] : S[e], a = S.length === 1 ? S[0] : S[t], o = x.length === 1 ? [
|
|
319
|
+
n,
|
|
320
|
+
a,
|
|
321
|
+
i
|
|
322
|
+
] : S.length === 1 ? [
|
|
323
|
+
n,
|
|
324
|
+
r,
|
|
325
|
+
i
|
|
326
|
+
] : [
|
|
327
|
+
n,
|
|
328
|
+
r,
|
|
329
|
+
a,
|
|
330
|
+
i
|
|
331
|
+
];
|
|
332
|
+
w.push({
|
|
333
|
+
indices: o,
|
|
334
|
+
role: "side",
|
|
335
|
+
smoothSurface: C,
|
|
336
|
+
segmentIndex: e,
|
|
337
|
+
baseRimEdge: x.length > 1 ? [n, r] : void 0,
|
|
338
|
+
endRimEdge: S.length > 1 ? [i, a] : void 0
|
|
339
|
+
}), T.push([n, i]);
|
|
340
|
+
}
|
|
341
|
+
return {
|
|
342
|
+
shape: c,
|
|
343
|
+
vertices: y,
|
|
344
|
+
faces: M(y, w),
|
|
345
|
+
silhouetteEdges: T
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function P(e) {
|
|
349
|
+
let { x0: t, x1: n, lower0: r, lower1: i, upper0: a, upper1: o, nearDepth: s, farDepth: c, capStart: l, capEnd: u } = e;
|
|
350
|
+
if (![
|
|
351
|
+
t,
|
|
352
|
+
n,
|
|
353
|
+
r,
|
|
354
|
+
i,
|
|
355
|
+
a,
|
|
356
|
+
o,
|
|
357
|
+
s,
|
|
358
|
+
c
|
|
359
|
+
].every(Number.isFinite) || t === n || s === c) return null;
|
|
360
|
+
n < t && ([t, n] = [n, t], [r, i] = [i, r], [a, o] = [o, a], [l, u] = [u, l]);
|
|
361
|
+
let d = Math.min(s, c), f = Math.max(s, c), p = Math.min(r, a), m = Math.min(i, o), h = Math.max(r, a), g = Math.max(i, o);
|
|
362
|
+
if (Math.max(h - p, g - m) < 1e-9) return null;
|
|
363
|
+
let _ = [
|
|
364
|
+
{
|
|
365
|
+
x: t,
|
|
366
|
+
y: p,
|
|
367
|
+
depth: d
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
x: n,
|
|
371
|
+
y: m,
|
|
372
|
+
depth: d
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
x: n,
|
|
376
|
+
y: g,
|
|
377
|
+
depth: d
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
x: t,
|
|
381
|
+
y: h,
|
|
382
|
+
depth: d
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
x: t,
|
|
386
|
+
y: p,
|
|
387
|
+
depth: f
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
x: n,
|
|
391
|
+
y: m,
|
|
392
|
+
depth: f
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
x: n,
|
|
396
|
+
y: g,
|
|
397
|
+
depth: f
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
x: t,
|
|
401
|
+
y: h,
|
|
402
|
+
depth: f
|
|
403
|
+
}
|
|
404
|
+
];
|
|
405
|
+
return {
|
|
406
|
+
shape: "areaStrip",
|
|
407
|
+
vertices: _,
|
|
408
|
+
faces: M(_, [
|
|
409
|
+
{
|
|
410
|
+
indices: [
|
|
411
|
+
0,
|
|
412
|
+
3,
|
|
413
|
+
2,
|
|
414
|
+
1
|
|
415
|
+
],
|
|
416
|
+
role: "side",
|
|
417
|
+
smoothSurface: !1
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
indices: [
|
|
421
|
+
4,
|
|
422
|
+
5,
|
|
423
|
+
6,
|
|
424
|
+
7
|
|
425
|
+
],
|
|
426
|
+
role: "side",
|
|
427
|
+
smoothSurface: !1
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
indices: [
|
|
431
|
+
0,
|
|
432
|
+
4,
|
|
433
|
+
7,
|
|
434
|
+
3
|
|
435
|
+
],
|
|
436
|
+
role: "baseCap",
|
|
437
|
+
smoothSurface: !1
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
indices: [
|
|
441
|
+
1,
|
|
442
|
+
2,
|
|
443
|
+
6,
|
|
444
|
+
5
|
|
445
|
+
],
|
|
446
|
+
role: "endCap",
|
|
447
|
+
smoothSurface: !1
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
indices: [
|
|
451
|
+
0,
|
|
452
|
+
1,
|
|
453
|
+
5,
|
|
454
|
+
4
|
|
455
|
+
],
|
|
456
|
+
role: "side",
|
|
457
|
+
smoothSurface: !1
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
indices: [
|
|
461
|
+
3,
|
|
462
|
+
7,
|
|
463
|
+
6,
|
|
464
|
+
2
|
|
465
|
+
],
|
|
466
|
+
role: "side",
|
|
467
|
+
smoothSurface: !1
|
|
468
|
+
}
|
|
469
|
+
].filter((e) => (e.role !== "baseCap" || l) && (e.role !== "endCap" || u))),
|
|
470
|
+
silhouetteEdges: []
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
function F(e) {
|
|
474
|
+
let t = e.upper0 - e.lower0, n = e.upper1 - e.lower1;
|
|
475
|
+
if (Number.isFinite(t) && Number.isFinite(n) && t * n < 0) {
|
|
476
|
+
let r = t / (t - n), i = e.x0 + (e.x1 - e.x0) * r, a = e.lower0 + (e.lower1 - e.lower0) * r;
|
|
477
|
+
return [P({
|
|
478
|
+
...e,
|
|
479
|
+
x1: i,
|
|
480
|
+
lower1: a,
|
|
481
|
+
upper1: a,
|
|
482
|
+
capEnd: !1
|
|
483
|
+
}), P({
|
|
484
|
+
...e,
|
|
485
|
+
x0: i,
|
|
486
|
+
lower0: a,
|
|
487
|
+
upper0: a,
|
|
488
|
+
capStart: !1
|
|
489
|
+
})].filter((e) => e != null);
|
|
490
|
+
}
|
|
491
|
+
let r = P(e);
|
|
492
|
+
return r ? [r] : [];
|
|
493
|
+
}
|
|
494
|
+
function I(e) {
|
|
495
|
+
let { centerX: t, centerY: n, centerDepth: r, radius: i, modelDepth: a, thickness: o, startAngle: s, endAngle: c } = e;
|
|
496
|
+
if (![
|
|
497
|
+
t,
|
|
498
|
+
n,
|
|
499
|
+
r,
|
|
500
|
+
i,
|
|
501
|
+
a,
|
|
502
|
+
o,
|
|
503
|
+
s,
|
|
504
|
+
c
|
|
505
|
+
].every(Number.isFinite) || !(i > 0) || !(a > 0) || !(o > 0) || !(c > s)) return null;
|
|
506
|
+
let l = Math.min(Math.PI * 2, c - s), u = l >= Math.PI * 2 - 1e-9, d = Math.max(2, Math.min(64, Math.trunc(e.segments ?? Math.ceil(32 * l / (Math.PI * 2))))), f = n - o / 2, p = n + o / 2, m = [{
|
|
507
|
+
x: t,
|
|
508
|
+
y: f,
|
|
509
|
+
depth: r
|
|
510
|
+
}, {
|
|
511
|
+
x: t,
|
|
512
|
+
y: p,
|
|
513
|
+
depth: r
|
|
514
|
+
}], h = [], g = [], _ = u ? d : d + 1;
|
|
515
|
+
for (let e = 0; e < _; e++) {
|
|
516
|
+
let n = s + l * e / d, o = t + Math.cos(n) * i, c = r + Math.sin(n) * i / a;
|
|
517
|
+
h.push(m.length), m.push({
|
|
518
|
+
x: o,
|
|
519
|
+
y: f,
|
|
520
|
+
depth: c
|
|
521
|
+
}), g.push(m.length), m.push({
|
|
522
|
+
x: o,
|
|
523
|
+
y: p,
|
|
524
|
+
depth: c
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
let v = u ? [{
|
|
528
|
+
indices: [...h],
|
|
529
|
+
role: "baseCap",
|
|
530
|
+
smoothSurface: !0
|
|
531
|
+
}, {
|
|
532
|
+
indices: [...g],
|
|
533
|
+
role: "endCap",
|
|
534
|
+
smoothSurface: !0
|
|
535
|
+
}] : [
|
|
536
|
+
{
|
|
537
|
+
indices: [0, ...h],
|
|
538
|
+
role: "baseCap",
|
|
539
|
+
smoothSurface: !0
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
indices: [1, ...g],
|
|
543
|
+
role: "endCap",
|
|
544
|
+
smoothSurface: !0
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
indices: [
|
|
548
|
+
0,
|
|
549
|
+
1,
|
|
550
|
+
g[0],
|
|
551
|
+
h[0]
|
|
552
|
+
],
|
|
553
|
+
role: "baseCap",
|
|
554
|
+
smoothSurface: !1
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
indices: [
|
|
558
|
+
0,
|
|
559
|
+
h.at(-1),
|
|
560
|
+
g.at(-1),
|
|
561
|
+
1
|
|
562
|
+
],
|
|
563
|
+
role: "endCap",
|
|
564
|
+
smoothSurface: !1
|
|
565
|
+
}
|
|
566
|
+
];
|
|
567
|
+
for (let e = 0; e < d; e++) {
|
|
568
|
+
let t = u ? (e + 1) % d : e + 1;
|
|
569
|
+
v.push({
|
|
570
|
+
indices: [
|
|
571
|
+
h[e],
|
|
572
|
+
g[e],
|
|
573
|
+
g[t],
|
|
574
|
+
h[t]
|
|
575
|
+
],
|
|
576
|
+
role: "side",
|
|
577
|
+
smoothSurface: !0,
|
|
578
|
+
segmentIndex: e,
|
|
579
|
+
baseRimEdge: [h[e], h[t]],
|
|
580
|
+
endRimEdge: [g[e], g[t]]
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
return {
|
|
584
|
+
shape: "pieSector",
|
|
585
|
+
vertices: m,
|
|
586
|
+
faces: M(m, v),
|
|
587
|
+
silhouetteEdges: h.slice(0, u ? void 0 : -1).map((e, t) => [e, g[t]])
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
//#endregion
|
|
591
|
+
//#region packages/core/src/chart/three-d-scene.ts
|
|
592
|
+
function L(e, t) {
|
|
593
|
+
if (![e, t].every(Number.isFinite)) return null;
|
|
594
|
+
let n = t - e;
|
|
595
|
+
if (n === 0) return e >= 0 && e <= 1 ? {
|
|
596
|
+
startT: 0,
|
|
597
|
+
endT: 1
|
|
598
|
+
} : null;
|
|
599
|
+
let r = -e / n, i = (1 - e) / n, a = Math.max(0, Math.min(r, i)), o = Math.min(1, Math.max(r, i));
|
|
600
|
+
return a <= o ? {
|
|
601
|
+
startT: a,
|
|
602
|
+
endT: o
|
|
603
|
+
} : null;
|
|
604
|
+
}
|
|
605
|
+
function R(e, t, n, r) {
|
|
606
|
+
if (![
|
|
607
|
+
e,
|
|
608
|
+
t,
|
|
609
|
+
n,
|
|
610
|
+
r
|
|
611
|
+
].every(Number.isFinite)) return [];
|
|
612
|
+
let i = [0, 1], a = (e, t) => {
|
|
613
|
+
let n = t - e;
|
|
614
|
+
if (n !== 0) for (let t of [0, 1]) {
|
|
615
|
+
let r = (t - e) / n;
|
|
616
|
+
r > 0 && r < 1 && Number.isFinite(r) && i.push(r);
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
a(e, t), a(n, r), i.sort((e, t) => e - t);
|
|
620
|
+
let o = i.filter((e, t) => t === 0 || Math.abs(e - i[t - 1]) > 1e-12), s = (e, t, n) => e + (t - e) * n, c = (e) => Math.max(0, Math.min(1, e)), l = [];
|
|
621
|
+
for (let i = 0; i + 1 < o.length; i++) {
|
|
622
|
+
let a = o[i], u = o[i + 1], d = (a + u) / 2, f = c(s(e, t, d)), p = c(s(n, r, d));
|
|
623
|
+
Math.abs(p - f) <= 1e-12 || l.push({
|
|
624
|
+
startT: a,
|
|
625
|
+
endT: u,
|
|
626
|
+
lowerStart: c(s(e, t, a)),
|
|
627
|
+
lowerEnd: c(s(e, t, u)),
|
|
628
|
+
upperStart: c(s(n, r, a)),
|
|
629
|
+
upperEnd: c(s(n, r, u))
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
return l;
|
|
633
|
+
}
|
|
634
|
+
var z = (e) => ({
|
|
635
|
+
minX: Math.min(...e.map((e) => e.x)),
|
|
636
|
+
maxX: Math.max(...e.map((e) => e.x)),
|
|
637
|
+
minY: Math.min(...e.map((e) => e.y)),
|
|
638
|
+
maxY: Math.max(...e.map((e) => e.y))
|
|
639
|
+
}), B = (e, t) => {
|
|
640
|
+
let n = !1;
|
|
641
|
+
for (let r = 0, i = e.length - 1; r < e.length; i = r++) {
|
|
642
|
+
let a = e[r], o = e[i], s = (a.x - t.x) * (o.y - t.y) - (a.y - t.y) * (o.x - t.x), c = Math.max(1, Math.abs(a.x), Math.abs(a.y), Math.abs(o.x), Math.abs(o.y));
|
|
643
|
+
if (Math.abs(s) <= c * 1e-9 && t.x >= Math.min(a.x, o.x) - 1e-9 && t.x <= Math.max(a.x, o.x) + 1e-9 && t.y >= Math.min(a.y, o.y) - 1e-9 && t.y <= Math.max(a.y, o.y) + 1e-9) return !0;
|
|
644
|
+
a.y > t.y != o.y > t.y && t.x < (o.x - a.x) * (t.y - a.y) / (o.y - a.y) + a.x && (n = !n);
|
|
645
|
+
}
|
|
646
|
+
return n;
|
|
647
|
+
}, V = (e, t, n, r) => {
|
|
648
|
+
let i = {
|
|
649
|
+
x: t.x - e.x,
|
|
650
|
+
y: t.y - e.y
|
|
651
|
+
}, a = {
|
|
652
|
+
x: r.x - n.x,
|
|
653
|
+
y: r.y - n.y
|
|
654
|
+
}, o = i.x * a.y - i.y * a.x;
|
|
655
|
+
if (Math.abs(o) < 1e-12) return null;
|
|
656
|
+
let s = {
|
|
657
|
+
x: n.x - e.x,
|
|
658
|
+
y: n.y - e.y
|
|
659
|
+
}, c = (s.x * a.y - s.y * a.x) / o, l = (s.x * i.y - s.y * i.x) / o;
|
|
660
|
+
return c < -1e-9 || c > 1.000000001 || l < -1e-9 || l > 1.000000001 ? null : {
|
|
661
|
+
x: e.x + i.x * c,
|
|
662
|
+
y: e.y + i.y * c
|
|
663
|
+
};
|
|
664
|
+
};
|
|
665
|
+
function H(e, t, n, r) {
|
|
666
|
+
let i = [], a = (e) => {
|
|
667
|
+
i.length >= 12 || i.some((t) => Math.hypot(t.x - e.x, t.y - e.y) < 1e-7) || i.push(e);
|
|
668
|
+
}, o = {
|
|
669
|
+
x: (Math.max(n.minX, r.minX) + Math.min(n.maxX, r.maxX)) / 2,
|
|
670
|
+
y: (Math.max(n.minY, r.minY) + Math.min(n.maxY, r.maxY)) / 2
|
|
671
|
+
};
|
|
672
|
+
B(e, o) && B(t, o) && a(o);
|
|
673
|
+
for (let n of e) B(t, n) && a(n);
|
|
674
|
+
for (let n of t) B(e, n) && a(n);
|
|
675
|
+
for (let n = 0; n < e.length && i.length < 12; n++) for (let r = 0; r < t.length && i.length < 12; r++) {
|
|
676
|
+
let i = V(e[n], e[(n + 1) % e.length], t[r], t[(r + 1) % t.length]);
|
|
677
|
+
i && a(i);
|
|
678
|
+
}
|
|
679
|
+
return i;
|
|
680
|
+
}
|
|
681
|
+
function U(e, t) {
|
|
682
|
+
let n = e.cameraDepths;
|
|
683
|
+
if (!n || n.length !== e.points.length || e.points.length < 3) return e.cameraDepth;
|
|
684
|
+
let r = e.cameraWeights?.length === e.points.length ? e.cameraWeights : e.points.map(() => 1), i = e.points[0];
|
|
685
|
+
for (let a = 1; a + 1 < e.points.length; a++) {
|
|
686
|
+
let o = e.points[a], s = e.points[a + 1], c = (o.y - s.y) * (i.x - s.x) + (s.x - o.x) * (i.y - s.y);
|
|
687
|
+
if (Math.abs(c) < 1e-12) continue;
|
|
688
|
+
let l = ((o.y - s.y) * (t.x - s.x) + (s.x - o.x) * (t.y - s.y)) / c, u = ((s.y - i.y) * (t.x - s.x) + (i.x - s.x) * (t.y - s.y)) / c, d = 1 - l - u;
|
|
689
|
+
if (Math.min(l, u, d) < -1e-7) continue;
|
|
690
|
+
let f = l * r[0] + u * r[a] + d * r[a + 1];
|
|
691
|
+
if (Math.abs(f) > 2 ** -52) return (l * n[0] * r[0] + u * n[a] * r[a] + d * n[a + 1] * r[a + 1]) / f;
|
|
692
|
+
}
|
|
693
|
+
return e.cameraDepth;
|
|
694
|
+
}
|
|
695
|
+
function W(e) {
|
|
696
|
+
if (e.length < 2) return [...e];
|
|
697
|
+
let t = [...e.keys()].sort((t, n) => e[t].cameraDepth - e[n].cameraDepth || t - n), n = e.map((e) => z(e.points)), r = [...e.keys()].sort((e, t) => n[e].minX - n[t].minX || e - t), i = e.map(() => /* @__PURE__ */ new Set()), a = e.map(() => 0), o = [], s = 0;
|
|
698
|
+
for (let c of r) {
|
|
699
|
+
for (let e = o.length - 1; e >= 0; e--) n[o[e]].maxX < n[c].minX - 1e-9 && o.splice(e, 1);
|
|
700
|
+
for (let r of o) {
|
|
701
|
+
if (++s > 2e5) return t.map((t) => e[t]);
|
|
702
|
+
if (n[r].maxY < n[c].minY - 1e-9 || n[c].maxY < n[r].minY - 1e-9) continue;
|
|
703
|
+
let o = H(e[r].points, e[c].points, n[r], n[c]), l = 0;
|
|
704
|
+
for (let t of o) {
|
|
705
|
+
let n = U(e[r], t) - U(e[c], t), i = 1e-8 * Math.max(1, Math.abs(e[r].cameraDepth), Math.abs(e[c].cameraDepth));
|
|
706
|
+
if (Math.abs(n) <= i) continue;
|
|
707
|
+
let a = n < 0 ? -1 : 1;
|
|
708
|
+
if (l !== 0 && l !== a) {
|
|
709
|
+
l = 0;
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
l = a;
|
|
713
|
+
}
|
|
714
|
+
if (l === 0) continue;
|
|
715
|
+
let u = l < 0 ? r : c, d = l < 0 ? c : r;
|
|
716
|
+
i[u].has(d) || (i[u].add(d), a[d]++);
|
|
717
|
+
}
|
|
718
|
+
o.push(c);
|
|
719
|
+
}
|
|
720
|
+
let c = new Set(e.keys()), l = [];
|
|
721
|
+
for (; c.size;) {
|
|
722
|
+
let n = t.find((e) => c.has(e) && a[e] === 0);
|
|
723
|
+
if (n ??= t.find((e) => c.has(e)), n == null) break;
|
|
724
|
+
c.delete(n), l.push(e[n]);
|
|
725
|
+
for (let e of i[n]) a[e]--;
|
|
726
|
+
}
|
|
727
|
+
return l;
|
|
728
|
+
}
|
|
729
|
+
//#endregion
|
|
730
|
+
//#region packages/core/src/chart/three-d-stroke.ts
|
|
731
|
+
var G = 1e-9, K = 1e4, q = (e, t, n) => ({
|
|
732
|
+
x: e.x + (t.x - e.x) * n,
|
|
733
|
+
y: e.y + (t.y - e.y) * n,
|
|
734
|
+
cameraDepth: e.cameraDepth + (t.cameraDepth - e.cameraDepth) * n,
|
|
735
|
+
cameraWeight: (e.cameraWeight ?? 1) + ((t.cameraWeight ?? 1) - (e.cameraWeight ?? 1)) * n
|
|
736
|
+
}), J = (e, t) => Math.hypot(e.x - t.x, e.y - t.y) <= G;
|
|
737
|
+
function ee(e, t, n = 0) {
|
|
738
|
+
let r = t.filter((e) => Number.isFinite(e) && e > G);
|
|
739
|
+
if (r.length === 0) return e.length >= 2 ? [[...e]] : [];
|
|
740
|
+
r.length % 2 == 1 && r.push(...r);
|
|
741
|
+
let i = [], a = 0, o = r[0], s = !0, c = r.reduce((e, t) => e + t, 0), l = c > G && Number.isFinite(n) ? (n % c + c) % c : 0;
|
|
742
|
+
for (; l > G;) {
|
|
743
|
+
let e = Math.min(l, o);
|
|
744
|
+
l -= e, o -= e, o <= G && (a = (a + 1) % r.length, o = r[a], s = a % 2 == 0);
|
|
745
|
+
}
|
|
746
|
+
let u = null;
|
|
747
|
+
for (let t = 0; t + 1 < e.length; t++) {
|
|
748
|
+
let n = e[t], c = e[t + 1], l = Math.hypot(c.x - n.x, c.y - n.y);
|
|
749
|
+
if (!(l > G)) continue;
|
|
750
|
+
let d = 0;
|
|
751
|
+
for (; d < l - G;) {
|
|
752
|
+
let e = Math.min(o, l - d), t = q(n, c, d / l), f = q(n, c, (d + e) / l);
|
|
753
|
+
if (s && (u ??= [], (u.length === 0 || !J(u.at(-1), t)) && u.push(t), u.push(f)), d += e, o -= e, o <= G) {
|
|
754
|
+
if (s && u && u.length >= 2) {
|
|
755
|
+
if (i.length >= 1e4) return null;
|
|
756
|
+
i.push(u);
|
|
757
|
+
}
|
|
758
|
+
u = null, a = (a + 1) % r.length, o = r[a], s = a % 2 == 0;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
if (s && u && u.length >= 2) {
|
|
763
|
+
if (i.length >= 1e4) return null;
|
|
764
|
+
i.push(u);
|
|
765
|
+
}
|
|
766
|
+
if (i.length > 1 && J(e[0], e.at(-1)) && J(i[0][0], e[0]) && J(i.at(-1).at(-1), e.at(-1))) {
|
|
767
|
+
let e = i.shift(), t = i.pop();
|
|
768
|
+
i.unshift([...t, ...e.slice(1)]);
|
|
769
|
+
}
|
|
770
|
+
return i;
|
|
771
|
+
}
|
|
772
|
+
var te = (e, t) => ({
|
|
773
|
+
kind: e,
|
|
774
|
+
points: t.map(({ x: e, y: t }) => ({
|
|
775
|
+
x: e,
|
|
776
|
+
y: t
|
|
777
|
+
})),
|
|
778
|
+
cameraDepths: t.map((e) => e.cameraDepth),
|
|
779
|
+
cameraWeights: t.map((e) => e.cameraWeight ?? 1),
|
|
780
|
+
cameraDepth: t.reduce((e, t) => e + t.cameraDepth, 0) / t.length
|
|
781
|
+
}), Y = (e, t, n) => {
|
|
782
|
+
let r = [];
|
|
783
|
+
for (let n = 0; n < 12; n++) {
|
|
784
|
+
let i = Math.PI * 2 * n / 12;
|
|
785
|
+
r.push({
|
|
786
|
+
...e,
|
|
787
|
+
x: e.x + Math.cos(i) * t,
|
|
788
|
+
y: e.y + Math.sin(i) * t
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
return te(n, r);
|
|
792
|
+
}, ne = (e, t, n, r) => {
|
|
793
|
+
let i = t.x * r.y - t.y * r.x;
|
|
794
|
+
if (Math.abs(i) <= G) return null;
|
|
795
|
+
let a = {
|
|
796
|
+
x: n.x - e.x,
|
|
797
|
+
y: n.y - e.y
|
|
798
|
+
}, o = (a.x * r.y - a.y * r.x) / i;
|
|
799
|
+
return {
|
|
800
|
+
x: e.x + t.x * o,
|
|
801
|
+
y: e.y + t.y * o
|
|
802
|
+
};
|
|
803
|
+
};
|
|
804
|
+
function re(e, t) {
|
|
805
|
+
let n = Number.isFinite(t.width) ? Math.max(0, t.width) : 0;
|
|
806
|
+
if (!(n > G) || e.length < 2) return [];
|
|
807
|
+
let r = n / 2, i = t.lineCap ?? "butt", a = t.lineJoin ?? "miter", o = Math.max(1, t.miterLimit ?? 10), s = [], c = ee(e, t.dash ?? [], t.dashOffset);
|
|
808
|
+
if (c == null) return null;
|
|
809
|
+
let l = (e) => s.length >= 1e4 ? !1 : (s.push(e), !0);
|
|
810
|
+
for (let n = 0; n < c.length; n++) {
|
|
811
|
+
let s = c[n], u = s.length > 2 && J(s[0], s.at(-1)), d = n === 0 && J(s[0], e[0]) ? t.startCap ?? i : i, f = n + 1 === c.length && J(s.at(-1), e.at(-1)) ? t.endCap ?? i : i, p = [];
|
|
812
|
+
for (let e = 0; e + 1 < s.length; e++) {
|
|
813
|
+
let t = s[e], n = s[e + 1], r = Math.hypot(n.x - t.x, n.y - t.y);
|
|
814
|
+
p.push(r > G ? {
|
|
815
|
+
x: (n.x - t.x) / r,
|
|
816
|
+
y: (n.y - t.y) / r
|
|
817
|
+
} : null);
|
|
818
|
+
}
|
|
819
|
+
for (let e = 0; e + 1 < s.length; e++) {
|
|
820
|
+
let t = p[e];
|
|
821
|
+
if (!t) continue;
|
|
822
|
+
let n = {
|
|
823
|
+
x: -t.y * r,
|
|
824
|
+
y: t.x * r
|
|
825
|
+
}, i = e === 0, a = e + 2 === s.length, o = !u && i && d === "square" ? r : 0, c = !u && a && f === "square" ? r : 0, m = {
|
|
826
|
+
...s[e],
|
|
827
|
+
x: s[e].x - t.x * o,
|
|
828
|
+
y: s[e].y - t.y * o
|
|
829
|
+
}, h = {
|
|
830
|
+
...s[e + 1],
|
|
831
|
+
x: s[e + 1].x + t.x * c,
|
|
832
|
+
y: s[e + 1].y + t.y * c
|
|
833
|
+
};
|
|
834
|
+
if (!l(te("segment", [
|
|
835
|
+
{
|
|
836
|
+
...m,
|
|
837
|
+
x: m.x + n.x,
|
|
838
|
+
y: m.y + n.y
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
...h,
|
|
842
|
+
x: h.x + n.x,
|
|
843
|
+
y: h.y + n.y
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
...h,
|
|
847
|
+
x: h.x - n.x,
|
|
848
|
+
y: h.y - n.y
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
...m,
|
|
852
|
+
x: m.x - n.x,
|
|
853
|
+
y: m.y - n.y
|
|
854
|
+
}
|
|
855
|
+
]))) return null;
|
|
856
|
+
}
|
|
857
|
+
if (!u && d === "round" && !l(Y(s[0], r, "cap")) || !u && f === "round" && !l(Y(s.at(-1), r, "cap"))) return null;
|
|
858
|
+
let m = (e, t, n) => {
|
|
859
|
+
if (!t || !n) return !0;
|
|
860
|
+
let i = t.x * n.y - t.y * n.x;
|
|
861
|
+
if (Math.abs(i) <= G) return !0;
|
|
862
|
+
if (a === "round") return l(Y(e, r, "join"));
|
|
863
|
+
let s = i > 0 ? -1 : 1, c = {
|
|
864
|
+
...e,
|
|
865
|
+
x: e.x + -t.y * r * s,
|
|
866
|
+
y: e.y + t.x * r * s
|
|
867
|
+
}, u = {
|
|
868
|
+
...e,
|
|
869
|
+
x: e.x + -n.y * r * s,
|
|
870
|
+
y: e.y + n.x * r * s
|
|
871
|
+
};
|
|
872
|
+
if (a === "miter") {
|
|
873
|
+
let i = ne(c, t, u, n);
|
|
874
|
+
if (i && Math.hypot(i.x - e.x, i.y - e.y) <= r * o) return !!l(te("join", [
|
|
875
|
+
c,
|
|
876
|
+
{
|
|
877
|
+
...e,
|
|
878
|
+
...i
|
|
879
|
+
},
|
|
880
|
+
u
|
|
881
|
+
]));
|
|
882
|
+
}
|
|
883
|
+
return l(te("join", [
|
|
884
|
+
c,
|
|
885
|
+
e,
|
|
886
|
+
u
|
|
887
|
+
]));
|
|
888
|
+
};
|
|
889
|
+
for (let e = 1; e + 1 < s.length; e++) if (!m(s[e], p[e - 1], p[e])) return null;
|
|
890
|
+
if (u && !m(s[0], p.at(-1) ?? null, p[0] ?? null)) return null;
|
|
891
|
+
}
|
|
892
|
+
return s;
|
|
893
|
+
}
|
|
894
|
+
//#endregion
|
|
895
|
+
//#region packages/core/src/chart/three-d-outline.ts
|
|
896
|
+
var X = 1e-9, ie = (e, t) => Math.hypot(e.x - t.x, e.y - t.y, e.depth - t.depth) <= X, ae = (e, t) => e.x - t.x || e.y - t.y || e.depth - t.depth, oe = (e, t) => {
|
|
897
|
+
let n = Math.min(e.length, t.length);
|
|
898
|
+
for (let r = 0; r < n; r++) {
|
|
899
|
+
let n = ae(e[r], t[r]);
|
|
900
|
+
if (n !== 0) return n;
|
|
901
|
+
}
|
|
902
|
+
return e.length - t.length;
|
|
903
|
+
};
|
|
904
|
+
function se(e) {
|
|
905
|
+
let t = [...e].reverse();
|
|
906
|
+
return oe(e, t) <= 0 ? e : t;
|
|
907
|
+
}
|
|
908
|
+
function ce(e) {
|
|
909
|
+
let t = ie(e[0], e.at(-1)) ? e.slice(0, -1) : [...e];
|
|
910
|
+
if (t.length === 0) return [];
|
|
911
|
+
let n = 0;
|
|
912
|
+
for (let e = 1; e < t.length; e++) ae(t[e], t[n]) < 0 && (n = e);
|
|
913
|
+
let r = t.map((e, r) => t[(n + r) % t.length]), i = t.map((e, r) => t[(n - r + t.length) % t.length]), a = oe(r, i) <= 0 ? r : i;
|
|
914
|
+
return [...a, a[0]];
|
|
915
|
+
}
|
|
916
|
+
function le(e) {
|
|
917
|
+
let t = [], n = (e) => {
|
|
918
|
+
let n = t.find((t) => ie(t.point, e));
|
|
919
|
+
if (n) return ae(e, n.point) < 0 && (n.point = e), n;
|
|
920
|
+
let r = {
|
|
921
|
+
point: e,
|
|
922
|
+
edges: [],
|
|
923
|
+
order: -1
|
|
924
|
+
};
|
|
925
|
+
return t.push(r), r;
|
|
926
|
+
}, r = [];
|
|
927
|
+
for (let [t, i] of e) {
|
|
928
|
+
if (ie(t, i)) continue;
|
|
929
|
+
let e = n(t), a = n(i);
|
|
930
|
+
e !== a && r.push([e, a]);
|
|
931
|
+
}
|
|
932
|
+
t.sort((e, t) => ae(e.point, t.point)), t.forEach((e, t) => {
|
|
933
|
+
e.order = t;
|
|
934
|
+
});
|
|
935
|
+
let i = [], a = /* @__PURE__ */ new Set();
|
|
936
|
+
for (let [e, t] of r) {
|
|
937
|
+
let n = e.order < t.order ? e : t, r = e.order < t.order ? t : e, o = `${n.order}:${r.order}`;
|
|
938
|
+
a.has(o) || (a.add(o), i.push({
|
|
939
|
+
first: n,
|
|
940
|
+
second: r,
|
|
941
|
+
key: o
|
|
942
|
+
}));
|
|
943
|
+
}
|
|
944
|
+
i.sort((e, t) => e.key.localeCompare(t.key)), i.forEach((e, t) => {
|
|
945
|
+
e.first.edges.push(t), e.second.edges.push(t);
|
|
946
|
+
});
|
|
947
|
+
for (let e of t) e.edges.sort((e, t) => e - t);
|
|
948
|
+
let o = /* @__PURE__ */ new Set(), s = (e, t) => {
|
|
949
|
+
let n = [e.point], r = e, a = t;
|
|
950
|
+
for (; !o.has(a);) {
|
|
951
|
+
o.add(a);
|
|
952
|
+
let e = i[a], t = e.first === r ? e.second : e.first;
|
|
953
|
+
if (n.push(t.point), t.edges.length !== 2) break;
|
|
954
|
+
let s = t.edges.find((e) => !o.has(e));
|
|
955
|
+
if (s === void 0) break;
|
|
956
|
+
r = t, a = s;
|
|
957
|
+
}
|
|
958
|
+
return n;
|
|
959
|
+
}, c = [];
|
|
960
|
+
for (let e of t) if (e.edges.length !== 2) for (let t of e.edges) o.has(t) || c.push(se(s(e, t)));
|
|
961
|
+
for (let e = 0; e < i.length; e++) {
|
|
962
|
+
if (o.has(e)) continue;
|
|
963
|
+
let t = i[e], n = t.first.order <= t.second.order ? t.first : t.second;
|
|
964
|
+
c.push(ce(s(n, e)));
|
|
965
|
+
}
|
|
966
|
+
return c.sort(oe);
|
|
967
|
+
}
|
|
968
|
+
//#endregion
|
|
969
|
+
//#region packages/core/src/chart/three-d-renderer.ts
|
|
970
|
+
var Z = [
|
|
971
|
+
"4472C4",
|
|
972
|
+
"ED7D31",
|
|
973
|
+
"70AD47",
|
|
974
|
+
"A5A5A5",
|
|
975
|
+
"FFC000",
|
|
976
|
+
"5B9BD5"
|
|
977
|
+
], ue = new Set([
|
|
978
|
+
"line",
|
|
979
|
+
"stackedLine",
|
|
980
|
+
"stackedLinePct",
|
|
981
|
+
"area",
|
|
982
|
+
"stackedArea",
|
|
983
|
+
"stackedAreaPct",
|
|
984
|
+
"clusteredBar",
|
|
985
|
+
"clusteredBarH",
|
|
986
|
+
"stackedBar",
|
|
987
|
+
"stackedBarH",
|
|
988
|
+
"stackedBarPct",
|
|
989
|
+
"stackedBarHPct"
|
|
990
|
+
]);
|
|
991
|
+
function de(e, t) {
|
|
992
|
+
let n = Number.isSafeInteger(t) && t > 0 ? t : 0, r = Array.from({ length: n }, () => []);
|
|
993
|
+
for (let t of e) {
|
|
994
|
+
let e = t.categoryIndex;
|
|
995
|
+
Number.isSafeInteger(e) && e >= 0 && e < n && r[e].push(t);
|
|
996
|
+
}
|
|
997
|
+
return r;
|
|
998
|
+
}
|
|
999
|
+
var fe = (e, t) => `#${t?.color ?? Z[e % Z.length]}`;
|
|
1000
|
+
function pe(e, t) {
|
|
1001
|
+
if (t?.lineHidden != null || t?.lineColor != null || t?.lineWidthEmu != null || t?.lineDash != null) return t.lineHidden !== !0;
|
|
1002
|
+
let n = e.chartexStyle;
|
|
1003
|
+
return (e.lineHidden != null || e.lineColor != null || e.lineWidthEmu != null || n?.lineHidden != null || n?.lineNoStyle != null || n?.lineColors != null || n?.lineWidthEmu != null || n?.lineDash != null || n?.lineCap != null || n?.lineJoin != null) && e.lineHidden !== !0 && n?.lineHidden !== !0;
|
|
1004
|
+
}
|
|
1005
|
+
function me(e, t) {
|
|
1006
|
+
let n = e.replace(/^#/, "");
|
|
1007
|
+
if (!/^[0-9a-f]{6}$/i.test(n)) return e;
|
|
1008
|
+
let r = (e) => Math.max(0, Math.min(255, Math.round(parseInt(n.slice(e, e + 2), 16) * t))).toString(16).padStart(2, "0");
|
|
1009
|
+
return `#${r(0)}${r(2)}${r(4)}`;
|
|
1010
|
+
}
|
|
1011
|
+
function he(e, t) {
|
|
1012
|
+
let n = e.cameraNormal(t);
|
|
1013
|
+
if (!n) return 1;
|
|
1014
|
+
let r = {
|
|
1015
|
+
x: -.2,
|
|
1016
|
+
y: .25,
|
|
1017
|
+
z: 1
|
|
1018
|
+
}, i = Math.hypot(r.x, r.y, r.z), a = Math.max(0, (n.x * r.x + n.y * r.y + n.z * r.z) / i);
|
|
1019
|
+
return Math.max(.78, Math.min(1, .78 + .24 * a));
|
|
1020
|
+
}
|
|
1021
|
+
var ge = (e) => `"${e && !e.startsWith("+") ? e.replace(/["\\]/g, "") : "Arial"}"`, Q = (e, t, n = "minor") => ge((t?.startsWith("+mj-") ? e.themeMajorFontLatin : t?.startsWith("+mn-") ? e.themeMinorFontLatin : t) ?? (n === "major" ? e.themeMajorFontLatin : e.themeMinorFontLatin));
|
|
1022
|
+
function _e(e, t) {
|
|
1023
|
+
if (t.length) {
|
|
1024
|
+
e.beginPath(), e.moveTo(t[0].x, t[0].y);
|
|
1025
|
+
for (let n = 1; n < t.length; n++) e.lineTo(t[n].x, t[n].y);
|
|
1026
|
+
e.closePath();
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
var ve = (e) => e === "transparent" || e === "#00000000" || e === "rgba(0,0,0,0)";
|
|
1030
|
+
function ye(e, t, n, r) {
|
|
1031
|
+
ve(n) || (_e(e, t), e.fillStyle = n, e.fill(), r > 0 && (_e(e, t), e.fillStyle = `rgba(0,0,0,${r})`, e.fill()));
|
|
1032
|
+
}
|
|
1033
|
+
function be(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
1034
|
+
return F({
|
|
1035
|
+
x0: t,
|
|
1036
|
+
x1: n,
|
|
1037
|
+
lower0: r,
|
|
1038
|
+
lower1: i,
|
|
1039
|
+
upper0: a,
|
|
1040
|
+
upper1: o,
|
|
1041
|
+
nearDepth: s,
|
|
1042
|
+
farDepth: c,
|
|
1043
|
+
capStart: u,
|
|
1044
|
+
capEnd: d
|
|
1045
|
+
}).flatMap((t) => Se(e, t, l).map((e) => ({
|
|
1046
|
+
...e,
|
|
1047
|
+
outline: !1,
|
|
1048
|
+
outlineSegments: void 0
|
|
1049
|
+
})));
|
|
1050
|
+
}
|
|
1051
|
+
function xe(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m = !1, h = !1, g, _) {
|
|
1052
|
+
if (![
|
|
1053
|
+
r,
|
|
1054
|
+
i,
|
|
1055
|
+
a,
|
|
1056
|
+
o,
|
|
1057
|
+
s,
|
|
1058
|
+
c,
|
|
1059
|
+
l,
|
|
1060
|
+
u
|
|
1061
|
+
].every(Number.isFinite) || a <= 0 || o <= 0 || s === c) return [];
|
|
1062
|
+
let v = N({
|
|
1063
|
+
shape: t,
|
|
1064
|
+
horizontal: n,
|
|
1065
|
+
crossStart: n ? i : r,
|
|
1066
|
+
crossSize: n ? o : a,
|
|
1067
|
+
baseCoord: s,
|
|
1068
|
+
endCoord: c,
|
|
1069
|
+
nearDepth: l,
|
|
1070
|
+
farDepth: u,
|
|
1071
|
+
baseScale: f,
|
|
1072
|
+
endScale: p,
|
|
1073
|
+
omitBaseCap: m,
|
|
1074
|
+
omitEndCap: h
|
|
1075
|
+
});
|
|
1076
|
+
return v ? Se(e, v, d, g, _) : [];
|
|
1077
|
+
}
|
|
1078
|
+
function Se(e, t, n, r, i) {
|
|
1079
|
+
if (i?.exceeded) return [];
|
|
1080
|
+
let a = t.faces.map((r) => {
|
|
1081
|
+
let i = r.indices.map((e) => t.vertices[e]), a = e.cameraFacing(i);
|
|
1082
|
+
if (!a) return {
|
|
1083
|
+
meshFace: r,
|
|
1084
|
+
facing: a,
|
|
1085
|
+
face: null
|
|
1086
|
+
};
|
|
1087
|
+
let o = i.map((t) => e.project(t.x, t.y, t.depth)), s = o.reduce((e, t, n) => {
|
|
1088
|
+
let r = o[(n + 1) % o.length];
|
|
1089
|
+
return e + t.x * r.y - t.y * r.x;
|
|
1090
|
+
}, 0);
|
|
1091
|
+
return !Number.isFinite(s) || Math.abs(s) < 1e-7 ? {
|
|
1092
|
+
meshFace: r,
|
|
1093
|
+
facing: a,
|
|
1094
|
+
face: null
|
|
1095
|
+
} : {
|
|
1096
|
+
meshFace: r,
|
|
1097
|
+
facing: a,
|
|
1098
|
+
face: {
|
|
1099
|
+
points: o,
|
|
1100
|
+
color: me(n, he(e, i)),
|
|
1101
|
+
shade: 0,
|
|
1102
|
+
cameraDepth: i.reduce((t, n) => t + e.cameraDepth(n.x, n.y, n.depth), 0) / i.length,
|
|
1103
|
+
cameraDepths: i.map((t) => e.cameraDepth(t.x, t.y, t.depth)),
|
|
1104
|
+
cameraWeights: i.map((t) => e.cameraProjectionWeight(t.x, t.y, t.depth)),
|
|
1105
|
+
outline: !1
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
}), o = a.map((e) => e.face).filter((e) => e != null);
|
|
1109
|
+
if (i) {
|
|
1110
|
+
if (o.length > i.remaining) return i.exceeded = !0, [];
|
|
1111
|
+
i.remaining -= o.length;
|
|
1112
|
+
}
|
|
1113
|
+
let s = /* @__PURE__ */ new Map(), c = (e, t) => {
|
|
1114
|
+
if (e === t) return;
|
|
1115
|
+
let n = e < t ? `${e}:${t}` : `${t}:${e}`;
|
|
1116
|
+
s.has(n) || s.set(n, [e, t]);
|
|
1117
|
+
};
|
|
1118
|
+
for (let e of a) {
|
|
1119
|
+
if (!e.facing || !e.face) continue;
|
|
1120
|
+
let { indices: t, smoothSurface: n, role: r } = e.meshFace;
|
|
1121
|
+
if (!(n && r === "side")) for (let e = 0; e < t.length; e++) c(t[e], t[(e + 1) % t.length]);
|
|
1122
|
+
}
|
|
1123
|
+
let l = a.filter((e) => e.meshFace.role === "side").sort((e, t) => (e.meshFace.segmentIndex ?? 0) - (t.meshFace.segmentIndex ?? 0));
|
|
1124
|
+
if (t.silhouetteEdges.length === l.length && l.length > 0) for (let e = 0; e < l.length; e++) {
|
|
1125
|
+
let n = l[(e + l.length - 1) % l.length], r = l[e];
|
|
1126
|
+
if (n.facing === r.facing || !(r.facing ? r.face : n.face)) continue;
|
|
1127
|
+
let [i, a] = t.silhouetteEdges[e];
|
|
1128
|
+
c(i, a);
|
|
1129
|
+
}
|
|
1130
|
+
let u = a.some((e) => e.meshFace.role === "baseCap" && e.facing && e.face != null), d = a.some((e) => e.meshFace.role === "endCap" && e.facing && e.face != null);
|
|
1131
|
+
for (let e of l) {
|
|
1132
|
+
if (!e.facing || !e.face) continue;
|
|
1133
|
+
let t = [u ? void 0 : e.meshFace.baseRimEdge, d ? void 0 : e.meshFace.endRimEdge].filter((e) => e != null);
|
|
1134
|
+
for (let [e, n] of t) c(e, n);
|
|
1135
|
+
}
|
|
1136
|
+
let f = le([...s.values()].map(([e, n]) => [t.vertices[e], t.vertices[n]]));
|
|
1137
|
+
if (!r) return o;
|
|
1138
|
+
for (let t of f) {
|
|
1139
|
+
let n = t.map((t) => e.project(t.x, t.y, t.depth)), a = t.map((t) => e.cameraDepth(t.x, t.y, t.depth)), s = t.map((t) => e.cameraProjectionWeight(t.x, t.y, t.depth)), c = re(n.map((e, t) => ({
|
|
1140
|
+
...e,
|
|
1141
|
+
cameraDepth: a[t],
|
|
1142
|
+
cameraWeight: s[t]
|
|
1143
|
+
})), {
|
|
1144
|
+
width: r.width,
|
|
1145
|
+
dash: r.dash,
|
|
1146
|
+
lineCap: r.cap,
|
|
1147
|
+
lineJoin: r.join
|
|
1148
|
+
});
|
|
1149
|
+
if (!c || i && c.length > i.remaining) return i && (i.exceeded = !0), [];
|
|
1150
|
+
i && (i.remaining -= c.length), o.push(...c.map((e) => ({
|
|
1151
|
+
points: e.points,
|
|
1152
|
+
color: r.color,
|
|
1153
|
+
shade: 0,
|
|
1154
|
+
cameraDepth: e.cameraDepth,
|
|
1155
|
+
cameraDepths: e.cameraDepths,
|
|
1156
|
+
cameraWeights: e.cameraWeights,
|
|
1157
|
+
outline: !1
|
|
1158
|
+
})));
|
|
1159
|
+
}
|
|
1160
|
+
return o;
|
|
1161
|
+
}
|
|
1162
|
+
function Ce(e, t) {
|
|
1163
|
+
ye(e, t.points, t.color, t.shade), t.outline && (e.strokeStyle = t.outlineColor ?? "rgba(0,0,0,0.42)", e.lineWidth = t.outlineWidth ?? .75, e.setLineDash(b(t.outlineDash ?? "solid", e.lineWidth)), e.lineCap = t.outlineCap ?? "butt", e.lineJoin = t.outlineJoin ?? "miter", t.outline && (_e(e, t.points), e.stroke()), e.setLineDash([]));
|
|
1164
|
+
}
|
|
1165
|
+
function we(e, t, n) {
|
|
1166
|
+
t.points.length < 3 || ve(n) || (_e(e, t.points), e.fillStyle = n, e.fill());
|
|
1167
|
+
}
|
|
1168
|
+
function Te(e, t) {
|
|
1169
|
+
e.fillStyle = "#888", e.font = "12px sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText("(too many data points)", t.x + t.w / 2, t.y + t.h / 2);
|
|
1170
|
+
}
|
|
1171
|
+
function $(e, t, n, r = !1) {
|
|
1172
|
+
let i = Math.max(0, t - 1), a = Number.isFinite(e) ? Math.max(0, Math.min(i, e)) : 0, o = n ? (a + .5) / Math.max(1, t) : t === 1 ? .5 : a / i;
|
|
1173
|
+
return r ? 1 - o : o;
|
|
1174
|
+
}
|
|
1175
|
+
function Ee(e) {
|
|
1176
|
+
let t = e.catAxisLabelRotation;
|
|
1177
|
+
return t == null ? null : !Number.isFinite(t) || Math.abs(t) > 54e5 ? 0 : t / 6e4 * Math.PI / 180;
|
|
1178
|
+
}
|
|
1179
|
+
function De(e, t, n, r, i, a = 1) {
|
|
1180
|
+
if (i || r === 0) {
|
|
1181
|
+
e.textAlign = i ? "right" : "center", e.textBaseline = i ? "middle" : a < 0 ? "bottom" : "top", e.fillText(t, n.x + (i ? -6 : 0), n.y + (i ? 0 : a * 6));
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
e.save(), e.translate(n.x, n.y + a * 6), e.rotate(r), e.textAlign = a < 0 ? "left" : "right", e.textBaseline = "middle", e.fillText(t, 0, 0), e.restore();
|
|
1185
|
+
}
|
|
1186
|
+
function Oe(e, t, n, r, i, a, o) {
|
|
1187
|
+
if (!(r > 0) || !Number.isFinite(t.x) || !Number.isFinite(t.y)) return;
|
|
1188
|
+
let s = r / 2;
|
|
1189
|
+
switch (e.beginPath(), n) {
|
|
1190
|
+
case "square":
|
|
1191
|
+
e.rect(t.x - s, t.y - s, r, r);
|
|
1192
|
+
break;
|
|
1193
|
+
case "diamond":
|
|
1194
|
+
e.moveTo(t.x, t.y - s), e.lineTo(t.x + s, t.y), e.lineTo(t.x, t.y + s), e.lineTo(t.x - s, t.y), e.closePath();
|
|
1195
|
+
break;
|
|
1196
|
+
case "triangle":
|
|
1197
|
+
e.moveTo(t.x, t.y - s), e.lineTo(t.x + s, t.y + s), e.lineTo(t.x - s, t.y + s), e.closePath();
|
|
1198
|
+
break;
|
|
1199
|
+
case "x":
|
|
1200
|
+
case "plus":
|
|
1201
|
+
case "dash": {
|
|
1202
|
+
if (n === "dash") {
|
|
1203
|
+
e.moveTo(t.x - s, t.y), e.lineTo(t.x + s, t.y), e.strokeStyle = a, e.lineWidth = o, e.stroke();
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
let r = n === "x";
|
|
1207
|
+
e.moveTo(t.x - s, t.y + (r ? -s : 0)), e.lineTo(t.x + s, t.y + (r ? s : 0)), e.moveTo(t.x + (r ? -s : 0), t.y + s), e.lineTo(t.x + (r ? s : 0), t.y - s), e.strokeStyle = a, e.lineWidth = o, e.stroke();
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
1210
|
+
case "star":
|
|
1211
|
+
for (let n = 0; n < 10; n++) {
|
|
1212
|
+
let r = -Math.PI / 2 + n * Math.PI / 5, i = n % 2 == 0 ? s : s * .4, a = t.x + Math.cos(r) * i, o = t.y + Math.sin(r) * i;
|
|
1213
|
+
n ? e.lineTo(a, o) : e.moveTo(a, o);
|
|
1214
|
+
}
|
|
1215
|
+
e.closePath();
|
|
1216
|
+
break;
|
|
1217
|
+
case "dot":
|
|
1218
|
+
e.arc(t.x, t.y, Math.max(1, s * .35), 0, Math.PI * 2);
|
|
1219
|
+
break;
|
|
1220
|
+
case "picture": return;
|
|
1221
|
+
default:
|
|
1222
|
+
e.arc(t.x, t.y, s, 0, Math.PI * 2);
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
i !== "transparent" && (e.fillStyle = i, e.fill()), e.strokeStyle = a, e.lineWidth = o, e.stroke();
|
|
1226
|
+
}
|
|
1227
|
+
function ke(e, t, n, r, i, a, o, s, c, l = 0, u, f, p = "t", m = o, _ = !0) {
|
|
1228
|
+
let b = f;
|
|
1229
|
+
if (b?.deleted) return;
|
|
1230
|
+
let C = n.seriesDataLabels, w = b?.showVal ?? C?.showVal ?? t.showDataLabels, T = b?.showCatName ?? C?.showCatName ?? !1, E = b?.showSerName ?? C?.showSerName ?? !1, D = b?.showPercent ?? C?.showPercent ?? !1, O = b?.text, k = y({
|
|
1231
|
+
customText: O,
|
|
1232
|
+
showCategory: T,
|
|
1233
|
+
showSeries: E,
|
|
1234
|
+
showValue: w,
|
|
1235
|
+
showPercent: D,
|
|
1236
|
+
category: n.categories?.[i] ?? t.categories[i] ?? `${i + 1}`,
|
|
1237
|
+
seriesName: n.name || `Series ${r + 1}`,
|
|
1238
|
+
sourceValue: a,
|
|
1239
|
+
percentRatio: u != null && Number.isFinite(u) ? u : void 0,
|
|
1240
|
+
formatCode: b?.formatCode ?? C?.formatCode ?? t.dataLabelFormatCode ?? n.valFormatCode,
|
|
1241
|
+
percentFormatCode: b?.formatCode ?? C?.formatCode ?? t.dataLabelFormatCode ?? "0%",
|
|
1242
|
+
date1904: t.date1904,
|
|
1243
|
+
separator: b?.separator ?? C?.separator
|
|
1244
|
+
});
|
|
1245
|
+
if (!k) return;
|
|
1246
|
+
let A = d(b?.fontSizeHpt ?? C?.fontSizeHpt ?? t.dataLabelFontSizeHpt, c) ?? 9 * c, j = b?.fontBold ?? C?.fontBold ?? t.dataLabelFontBold ?? !1, M = Q(t, t.dataLabelFontFace);
|
|
1247
|
+
e.font = `${j ? "bold " : ""}${A}px ${M}`;
|
|
1248
|
+
let N = `#${b?.fontColor ?? C?.fontColor ?? n.labelColor ?? t.dataLabelFontColor ?? "111111"}`, P = O && b?.richRuns?.length ? g(e, {
|
|
1249
|
+
runs: b.richRuns,
|
|
1250
|
+
ptToPx: c,
|
|
1251
|
+
fontFamily: M,
|
|
1252
|
+
fallbackBold: j,
|
|
1253
|
+
fontFamilyForFace: (e) => Q(t, e)
|
|
1254
|
+
}, A, N) : null, F = P ? [] : x(k, Math.max(A, s.w * .45), Math.max(A * 1.2, s.h * .35), A * 1.2, (t) => e.measureText(t).width);
|
|
1255
|
+
if (!P && !F.length) return;
|
|
1256
|
+
let I = P?.width ?? Math.max(...F.map((t) => e.measureText(t).width)), L = P?.height ?? F.length * A * 1.2, R = h({
|
|
1257
|
+
kind: "point",
|
|
1258
|
+
x: o.x,
|
|
1259
|
+
y: o.y,
|
|
1260
|
+
position: b?.position ?? C?.position ?? t.dataLabelPosition ?? p,
|
|
1261
|
+
markerGap: l
|
|
1262
|
+
}, s, {
|
|
1263
|
+
w: I,
|
|
1264
|
+
h: L
|
|
1265
|
+
}, A, b?.manualLayout, s);
|
|
1266
|
+
if (!R) return;
|
|
1267
|
+
let z = b?.labelBox ?? C?.labelBox;
|
|
1268
|
+
if (C?.showLeaderLines && _ && (e.beginPath(), e.moveTo(m.x, m.y), e.lineTo(Math.max(R.rect.x, Math.min(m.x, R.rect.x + R.rect.w)), Math.max(R.rect.y, Math.min(m.y, R.rect.y + R.rect.h))), e.strokeStyle = `#${C.leaderLineColor ?? "808080"}`, e.lineWidth = C.leaderLineWidthEmu == null ? .75 * c : Math.max(.25, C.leaderLineWidthEmu / v * c), e.stroke()), z && (z.fill && (e.fillStyle = `#${z.fill}`, e.fillRect(R.rect.x, R.rect.y, R.rect.w, R.rect.h)), z.borderColor && (e.strokeStyle = `#${z.borderColor}`, e.lineWidth = z.borderWidthEmu == null ? .75 * c : Math.max(.25, z.borderWidthEmu / v * c), e.strokeRect(R.rect.x, R.rect.y, R.rect.w, R.rect.h))), e.save(), e.beginPath(), e.rect(R.clip.x, R.clip.y, R.clip.w, R.clip.h), e.clip(), P) {
|
|
1269
|
+
S(e, P, R.x, R.y, R.textAlign, R.textBaseline), e.restore();
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
e.fillStyle = N, e.textAlign = R.textAlign, e.textBaseline = "middle";
|
|
1273
|
+
let B = A * 1.2, V = R.y - (F.length - 1) * B / 2;
|
|
1274
|
+
F.forEach((t, n) => e.fillText(t, R.x, V + n * B)), e.restore();
|
|
1275
|
+
}
|
|
1276
|
+
function Ae(e, t, n) {
|
|
1277
|
+
if (n?.deleted) return !1;
|
|
1278
|
+
if (n?.text) return !0;
|
|
1279
|
+
let r = t.seriesDataLabels;
|
|
1280
|
+
return (n?.showVal ?? r?.showVal ?? e.showDataLabels) || (n?.showCatName ?? r?.showCatName ?? !1) || (n?.showSerName ?? r?.showSerName ?? !1) || (n?.showPercent ?? r?.showPercent ?? !1);
|
|
1281
|
+
}
|
|
1282
|
+
function je(n, c, l, u, f) {
|
|
1283
|
+
let p = r(c, l.h, u);
|
|
1284
|
+
if (c.title) {
|
|
1285
|
+
n.font = `${c.titleFontBold === !1 ? "" : "bold "}${p.fontPx}px ${ge(c.titleFontFace)}`, n.fillStyle = c.titleFontColor ? `#${c.titleFontColor}` : "#111111", n.textAlign = "center", n.textBaseline = "top";
|
|
1286
|
+
let t = n.measureText(c.title).width, r = {
|
|
1287
|
+
x: l.x + (l.w - t) / 2,
|
|
1288
|
+
y: l.y + p.topPad,
|
|
1289
|
+
w: t,
|
|
1290
|
+
h: Math.max(1, p.fontPx)
|
|
1291
|
+
}, i = c.titleManualLayout ? e({
|
|
1292
|
+
...c.titleManualLayout,
|
|
1293
|
+
w: void 0,
|
|
1294
|
+
h: void 0
|
|
1295
|
+
}, l, r) : null;
|
|
1296
|
+
n.fillText(c.title, i ? i.x + i.w / 2 : l.x + l.w / 2, i?.y ?? r.y);
|
|
1297
|
+
}
|
|
1298
|
+
let m = d(c.legendFontSizeHpt, u) ?? 9 * u;
|
|
1299
|
+
n.save(), n.font = `${c.legendFontBold ? "bold " : ""}${m}px ${ge(c.legendFontFace)}`;
|
|
1300
|
+
let h = c.chartType === "pie" ? c.series[0]?.categories?.length ? c.series[0].categories : c.categories : c.series.map((e, t) => e.name || `Series ${t + 1}`), g = i(c, l.w, l.h, .23, {
|
|
1301
|
+
itemWidths: h.map((e) => 7 * u + 4 + n.measureText(e).width),
|
|
1302
|
+
rowHeight: Math.max(m * 1.45, 12),
|
|
1303
|
+
itemGap: 12,
|
|
1304
|
+
horizontalPadding: 8,
|
|
1305
|
+
verticalPadding: 4
|
|
1306
|
+
});
|
|
1307
|
+
n.restore();
|
|
1308
|
+
let _ = a(g), v = s(c, l.w, l.h, u), y = f === "horizontal" ? c.catAxisTitle ? v.catFontPx + o(l.w) + 4 : 0 : f === "vertical" ? v.valBandW : 0, b = f === "horizontal" ? c.valAxisTitle ? v.valFontPx + o(l.h) + 4 : 0 : f === "vertical" ? v.catBandH : 0, x = t(c, l.x, l.y, l.w, l.h, u, {
|
|
1309
|
+
titleBand: p,
|
|
1310
|
+
legendSideReserveFrac: .23,
|
|
1311
|
+
legendReserve: g,
|
|
1312
|
+
pad: {
|
|
1313
|
+
t: p.bandH + _.legTopH + l.h * .04,
|
|
1314
|
+
r: _.legRightW + l.w * .05,
|
|
1315
|
+
b: _.legBottomH + l.h * .19 + b,
|
|
1316
|
+
l: _.legLeftW + l.w * .13 + y
|
|
1317
|
+
},
|
|
1318
|
+
honorPlotAreaManualLayout: !0,
|
|
1319
|
+
manualOuterInsets: {
|
|
1320
|
+
t: p.bandH,
|
|
1321
|
+
r: _.legRightW,
|
|
1322
|
+
b: _.legBottomH + b,
|
|
1323
|
+
l: _.legLeftW + y
|
|
1324
|
+
}
|
|
1325
|
+
}), S = {
|
|
1326
|
+
x: x.plotRect.px0,
|
|
1327
|
+
y: x.plotRect.py0,
|
|
1328
|
+
w: Math.max(1, x.plotRect.pw),
|
|
1329
|
+
h: Math.max(1, x.plotRect.ph)
|
|
1330
|
+
}, C = g ? g.side === "r" ? {
|
|
1331
|
+
x: l.x + l.w - g.reserveW,
|
|
1332
|
+
y: S.y,
|
|
1333
|
+
w: g.reserveW,
|
|
1334
|
+
h: S.h
|
|
1335
|
+
} : g.side === "l" ? {
|
|
1336
|
+
x: l.x,
|
|
1337
|
+
y: S.y,
|
|
1338
|
+
w: g.reserveW,
|
|
1339
|
+
h: S.h
|
|
1340
|
+
} : g.side === "t" ? {
|
|
1341
|
+
x: l.x + 4,
|
|
1342
|
+
y: l.y + p.bandH,
|
|
1343
|
+
w: Math.max(1, l.w - 8),
|
|
1344
|
+
h: g.reserveH
|
|
1345
|
+
} : {
|
|
1346
|
+
x: l.x + 4,
|
|
1347
|
+
y: l.y + l.h - g.reserveH,
|
|
1348
|
+
w: Math.max(1, l.w - 8),
|
|
1349
|
+
h: g.reserveH
|
|
1350
|
+
} : null;
|
|
1351
|
+
return {
|
|
1352
|
+
plot: S,
|
|
1353
|
+
legend: (C && c.legendManualLayout ? e(c.legendManualLayout, l, C) : null) ?? C
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
function Me(t, n, r, i, a, o, s, c, l, d, f, p, m, h) {
|
|
1357
|
+
t.save(), t.font = `${d ? "italic " : ""}${l ? "bold " : ""}${o}px ${s}`, t.fillStyle = c ? `#${c}` : "#555";
|
|
1358
|
+
let g = m ? n : _(t, n, h), v = u(a, f, p), y = i;
|
|
1359
|
+
if (m) {
|
|
1360
|
+
let n = t.measureText(g).width, a = Math.abs(Math.cos(v)), s = Math.abs(Math.sin(v)), c = {
|
|
1361
|
+
x: i.x - (n * a + o * s) / 2,
|
|
1362
|
+
y: i.y - (n * s + o * a) / 2,
|
|
1363
|
+
w: n * a + o * s,
|
|
1364
|
+
h: n * s + o * a
|
|
1365
|
+
}, l = e({
|
|
1366
|
+
...m,
|
|
1367
|
+
w: void 0,
|
|
1368
|
+
h: void 0
|
|
1369
|
+
}, r, c);
|
|
1370
|
+
l && (y = {
|
|
1371
|
+
x: l.x + l.w / 2,
|
|
1372
|
+
y: l.y + l.h / 2
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
t.translate(y.x, y.y), v && t.rotate(v), t.textAlign = "center", t.textBaseline = "middle", t.fillText(g, 0, 0), t.restore();
|
|
1376
|
+
}
|
|
1377
|
+
function Ne(e, t, r, i, a, s) {
|
|
1378
|
+
if (t.valAxisTitle) {
|
|
1379
|
+
let c = n(t.valAxisTitleFontSizeHpt, s), l = a ? "horizontal" : "left";
|
|
1380
|
+
Me(e, t.valAxisTitle, r, a ? {
|
|
1381
|
+
x: i.x + i.w / 2,
|
|
1382
|
+
y: i.y + i.h + o(r.h) + c / 2
|
|
1383
|
+
} : {
|
|
1384
|
+
x: i.x - o(r.w) - c / 2,
|
|
1385
|
+
y: i.y + i.h / 2
|
|
1386
|
+
}, l, c, Q(t, t.valAxisTitleFontFace, "major"), t.valAxisTitleFontColor, t.valAxisTitleFontBold ?? !0, t.valAxisTitleFontItalic ?? !1, t.valAxisTitleRotation, t.valAxisTitleVerticalMode, t.valAxisTitleManualLayout, a ? i.w : i.h);
|
|
1387
|
+
}
|
|
1388
|
+
if (t.catAxisTitle) {
|
|
1389
|
+
let c = n(t.catAxisTitleFontSizeHpt, s), l = a ? "left" : "horizontal";
|
|
1390
|
+
Me(e, t.catAxisTitle, r, a ? {
|
|
1391
|
+
x: i.x - o(r.w) - c / 2,
|
|
1392
|
+
y: i.y + i.h / 2
|
|
1393
|
+
} : {
|
|
1394
|
+
x: i.x + i.w / 2,
|
|
1395
|
+
y: i.y + i.h + o(r.h) + c / 2
|
|
1396
|
+
}, l, c, Q(t, t.catAxisTitleFontFace, "major"), t.catAxisTitleFontColor, t.catAxisTitleFontBold ?? !0, t.catAxisTitleFontItalic ?? !1, t.catAxisTitleRotation, t.catAxisTitleVerticalMode, t.catAxisTitleManualLayout, a ? i.h : i.w);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
function Pe(e, t, n, r, i = !1) {
|
|
1400
|
+
if (!n) return;
|
|
1401
|
+
let a = new Map(t.series[0]?.dataPointOverrides?.map((e) => [e.idx, e]) ?? []), o = i ? (t.series[0]?.categories?.length ? t.series[0].categories : t.categories).map((e, n) => {
|
|
1402
|
+
let r = t.series[0]?.dataPointColors?.[n];
|
|
1403
|
+
return {
|
|
1404
|
+
label: e,
|
|
1405
|
+
color: r === "00000000" ? "transparent" : r ? `#${r}` : fe(n),
|
|
1406
|
+
series: t.series[0],
|
|
1407
|
+
point: a.get(n)
|
|
1408
|
+
};
|
|
1409
|
+
}) : t.series.map((e, t) => ({
|
|
1410
|
+
label: e.name || `Series ${t + 1}`,
|
|
1411
|
+
color: fe(t, e),
|
|
1412
|
+
series: e,
|
|
1413
|
+
point: void 0
|
|
1414
|
+
})), s = d(t.legendFontSizeHpt, r) ?? 9 * r;
|
|
1415
|
+
e.font = `${t.legendFontBold ? "bold " : ""}${s}px ${ge(t.legendFontFace)}`, e.textAlign = "left", e.textBaseline = "middle";
|
|
1416
|
+
let c = Math.max(s * 1.45, 12), l = Math.min(7 * r, c * .7);
|
|
1417
|
+
if (t.legendPos === "t" || t.legendPos === "b" || t.legendManualLayout != null && n.w >= n.h) {
|
|
1418
|
+
let a = o.map((t) => l + 4 + e.measureText(t.label).width), s = f(a, Math.max(1, n.w - 8), 12).slice(0, Math.max(0, Math.floor((n.h - 4 + 1e-6) / c))), u = n.y + 2 + c / 2;
|
|
1419
|
+
for (let d of s) {
|
|
1420
|
+
let s = d.map((e) => Math.min(n.w, a[e])), f = s.reduce((e, t) => e + t, 0) + Math.max(0, d.length - 1) * 12, p = n.x + Math.max(4, (n.w - f) / 2);
|
|
1421
|
+
for (let n = 0; n < d.length; n++) {
|
|
1422
|
+
let a = o[d[n]], c = Math.max(0, s[n] - l - 4);
|
|
1423
|
+
if (!i && t.chartType.toLowerCase().includes("line") && a.series?.lineHidden !== !0) {
|
|
1424
|
+
let t = a.series?.lineWidthEmu == null ? Math.max(1, 2 * r) : Math.max(.5, a.series.lineWidthEmu / v * r);
|
|
1425
|
+
e.beginPath(), e.moveTo(p, u), e.lineTo(p + l, u), e.strokeStyle = a.series?.lineColor ? `#${a.series.lineColor}` : me(a.color, .7), e.lineWidth = t, e.setLineDash(b(a.series?.chartexStyle?.lineDash ?? "solid", t)), e.stroke(), e.setLineDash([]);
|
|
1426
|
+
} else {
|
|
1427
|
+
a.color !== "transparent" && (e.fillStyle = a.color, e.fillRect(p, u - l / 2, l, l));
|
|
1428
|
+
let t = a.point?.lineHidden ?? a.series?.lineHidden, n = a.point?.lineColor ?? a.series?.lineColor;
|
|
1429
|
+
t !== !0 && n && (e.strokeStyle = `#${n}`, e.lineWidth = (a.point?.lineWidthEmu ?? a.series?.lineWidthEmu) == null ? .75 * r : Math.max(.25, (a.point?.lineWidthEmu ?? a.series?.lineWidthEmu ?? 0) / v * r), e.setLineDash(b(a.point?.lineDash ?? a.series?.chartexStyle?.lineDash ?? "solid", e.lineWidth)), e.strokeRect(p, u - l / 2, l, l), e.setLineDash([]));
|
|
1430
|
+
}
|
|
1431
|
+
e.fillStyle = t.legendFontColor ? `#${t.legendFontColor}` : "#595959", e.fillText(_(e, a.label, c), p + l + 4, u), p += s[n] + 12;
|
|
1432
|
+
}
|
|
1433
|
+
u += c;
|
|
1434
|
+
}
|
|
1435
|
+
return;
|
|
1436
|
+
}
|
|
1437
|
+
let u = n.y;
|
|
1438
|
+
for (let a = 0; a < o.length; a++) {
|
|
1439
|
+
let d = o[a], f = n.x + 8 + l, p = Math.max(0, n.x + n.w - 4 - f), m = Math.max(s * 1.2, 10), h = x(d.label, p, m * (i ? 1 : 2), m, (t) => e.measureText(t).width);
|
|
1440
|
+
if (h.length === 0) continue;
|
|
1441
|
+
let g = Math.max(c, h.length * m + 2);
|
|
1442
|
+
if (u + g > n.y + n.h + 1e-6) break;
|
|
1443
|
+
let _ = u + g / 2;
|
|
1444
|
+
if (!i && t.chartType.toLowerCase().includes("line")) {
|
|
1445
|
+
let t = d.series?.lineWidthEmu == null ? Math.max(1, 2 * r) : Math.max(.5, d.series.lineWidthEmu / v * r);
|
|
1446
|
+
d.series?.lineHidden !== !0 && (e.beginPath(), e.moveTo(n.x + 4, _), e.lineTo(n.x + 4 + l, _), e.strokeStyle = d.series?.lineColor ? `#${d.series.lineColor}` : me(d.color, .7), e.lineWidth = t, e.setLineDash(b(d.series?.chartexStyle?.lineDash ?? "solid", t)), e.stroke(), e.setLineDash([]));
|
|
1447
|
+
} else {
|
|
1448
|
+
d.color !== "transparent" && (e.fillStyle = d.color, e.fillRect(n.x + 4, _ - l / 2, l, l));
|
|
1449
|
+
let t = d.point?.lineHidden ?? d.series?.lineHidden, i = d.point?.lineColor ?? d.series?.lineColor;
|
|
1450
|
+
t !== !0 && i && (e.strokeStyle = `#${i}`, e.lineWidth = (d.point?.lineWidthEmu ?? d.series?.lineWidthEmu) == null ? .75 * r : Math.max(.25, (d.point?.lineWidthEmu ?? d.series?.lineWidthEmu ?? 0) / v * r), e.setLineDash(b(d.point?.lineDash ?? d.series?.chartexStyle?.lineDash ?? "solid", e.lineWidth)), e.strokeRect(n.x + 4, _ - l / 2, l, l), e.setLineDash([]));
|
|
1451
|
+
}
|
|
1452
|
+
e.fillStyle = t.legendFontColor ? `#${t.legendFontColor}` : "#595959";
|
|
1453
|
+
let y = _ - (h.length - 1) * m / 2;
|
|
1454
|
+
h.forEach((t, n) => e.fillText(t, f, y + n * m)), u += g;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
function Fe(e, t, n, r, i, a) {
|
|
1458
|
+
let o = i ? 100 : 1;
|
|
1459
|
+
return p({
|
|
1460
|
+
dataMin: t,
|
|
1461
|
+
dataMax: n,
|
|
1462
|
+
explicitMin: e.valMin == null ? i ? t : null : e.valMin * o,
|
|
1463
|
+
explicitMax: e.valMax == null ? i ? n : null : e.valMax * o,
|
|
1464
|
+
majorUnit: e.valAxisMajorUnit == null ? null : e.valAxisMajorUnit * o,
|
|
1465
|
+
minorUnit: e.valAxisMinorUnit == null ? null : e.valAxisMinorUnit * o,
|
|
1466
|
+
axisLenPt: r,
|
|
1467
|
+
axisOrientation: a,
|
|
1468
|
+
logBase: e.valAxisLogBase,
|
|
1469
|
+
reversed: e.valAxisOrientation === "maxMin",
|
|
1470
|
+
needMinor: e.valAxisMinorGridlines === !0 || e.valAxisMinorTickMark != null && e.valAxisMinorTickMark !== "none"
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
function Ie(e, t, n, r, i = "A6A6A6", a = .75) {
|
|
1474
|
+
let o = t != null && Number.isFinite(t) && t >= 0 ? Math.max(.25, t / v * r) : a * r;
|
|
1475
|
+
return {
|
|
1476
|
+
color: `#${e ?? i}`,
|
|
1477
|
+
width: o,
|
|
1478
|
+
dash: b(n ?? "solid", o)
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
function Le(e, t) {
|
|
1482
|
+
e.strokeStyle = t.color, e.lineWidth = t.width, e.setLineDash(t.dash);
|
|
1483
|
+
}
|
|
1484
|
+
function Re(e, t, n, r, i, a, o, s, c) {
|
|
1485
|
+
let { front: l } = n, u = n.topology.farX === "min" ? l.x : l.x + l.w, d = n.topology.axisY === "min" ? l.y : l.y + l.h, f = d === l.y ? l.y + l.h : l.y, p = l.x, m = l.x + l.w, h = n.topology.farDepth, g = n.topology.nearDepth, _ = n.project(p, d, g), v = n.project(m, d, g), y = n.project(m, d, h), b = n.project(p, d, h), x = n.project(p, f, h), S = n.project(m, f, h);
|
|
1486
|
+
ye(e, [
|
|
1487
|
+
_,
|
|
1488
|
+
v,
|
|
1489
|
+
y,
|
|
1490
|
+
b
|
|
1491
|
+
], "#F2F2F2", 0), ye(e, [
|
|
1492
|
+
b,
|
|
1493
|
+
y,
|
|
1494
|
+
S,
|
|
1495
|
+
x
|
|
1496
|
+
], "#F7F7F7", 0);
|
|
1497
|
+
let C = (t, a) => {
|
|
1498
|
+
Le(e, a);
|
|
1499
|
+
for (let a of t) if (i === "horizontal") {
|
|
1500
|
+
let t = l.x + r.fraction(a) * l.w, i = n.project(t, d, h), o = n.project(t, f, h);
|
|
1501
|
+
e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(o.x, o.y), e.stroke();
|
|
1502
|
+
} else {
|
|
1503
|
+
let t = l.y + l.h - r.fraction(a) * l.h, i = n.project(u, t, g), o = n.project(u, t, h), s = n.project(u === p ? m : p, t, h);
|
|
1504
|
+
e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(o.x, o.y), e.stroke(), e.beginPath(), e.moveTo(o.x, o.y), e.lineTo(s.x, s.y), e.stroke();
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
t.valAxisMinorGridlines === !0 && C(r.minorTicks, Ie(t.valAxisMinorGridlineColor, t.valAxisMinorGridlineWidthEmu, t.valAxisMinorGridlineDash, c, "D9D9D9", .5)), t.valAxisMajorGridlines !== !1 && C(r.majorTicks, Ie(t.valAxisGridlineColor, t.valAxisGridlineWidthEmu, t.valAxisGridlineDash, c, "898989", 1)), Le(e, Ie(null, null, null, c, "898989", 1));
|
|
1508
|
+
for (let t = 0; t < a; t++) if (i === "vertical") {
|
|
1509
|
+
let r = l.x + $(t, a, o, s) * l.w, i = n.project(r, d, g), c = n.project(r, d, h);
|
|
1510
|
+
e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(c.x, c.y), e.stroke();
|
|
1511
|
+
} else {
|
|
1512
|
+
let r = l.y + $(t, a, o, s) * l.h, i = n.project(u, r, g), c = n.project(u, r, h);
|
|
1513
|
+
e.beginPath(), e.moveTo(i.x, i.y), e.lineTo(c.x, c.y), e.stroke();
|
|
1514
|
+
}
|
|
1515
|
+
for (let [t, n] of [
|
|
1516
|
+
[_, v],
|
|
1517
|
+
[v, y],
|
|
1518
|
+
[y, S],
|
|
1519
|
+
[S, x],
|
|
1520
|
+
[x, b],
|
|
1521
|
+
[b, _]
|
|
1522
|
+
]) e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(n.x, n.y), e.stroke();
|
|
1523
|
+
e.setLineDash([]);
|
|
1524
|
+
}
|
|
1525
|
+
function ze(e, t, n, r, i, a, o, s, c) {
|
|
1526
|
+
let l = He(t, n, r, i, a, o, c), u = c === "vertical" ? !t.catAxisHidden && !t.catAxisLineHidden : !t.valAxisHidden && !t.valAxisLineHidden, d = c === "vertical" ? !t.valAxisHidden && !t.valAxisLineHidden : !t.catAxisHidden && !t.catAxisLineHidden;
|
|
1527
|
+
u && (Le(e, Ie(c === "vertical" ? t.catAxisLineColor : t.valAxisLineColor, c === "vertical" ? t.catAxisLineWidthEmu : t.valAxisLineWidthEmu, null, s, "898989", 1)), e.beginPath(), e.moveTo(l.horizontalStart.x, l.horizontalStart.y), e.lineTo(l.horizontalEnd.x, l.horizontalEnd.y), e.stroke()), d && (Le(e, Ie(c === "vertical" ? t.valAxisLineColor : t.catAxisLineColor, c === "vertical" ? t.valAxisLineWidthEmu : t.catAxisLineWidthEmu, null, s, "898989", 1)), e.beginPath(), e.moveTo(l.verticalStart.x, l.verticalStart.y), e.lineTo(l.verticalEnd.x, l.verticalEnd.y), e.stroke()), e.setLineDash([]);
|
|
1528
|
+
}
|
|
1529
|
+
function Be(e, t, n, r) {
|
|
1530
|
+
let i = {
|
|
1531
|
+
x: (e.x + t.x) / 2,
|
|
1532
|
+
y: (e.y + t.y) / 2
|
|
1533
|
+
};
|
|
1534
|
+
return r === "horizontal" ? {
|
|
1535
|
+
x: i.x <= n.x ? -1 : 1,
|
|
1536
|
+
y: 0
|
|
1537
|
+
} : {
|
|
1538
|
+
x: 0,
|
|
1539
|
+
y: i.y <= n.y ? -1 : 1
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
function Ve(e, t, n, r, i, a, o, s, c) {
|
|
1543
|
+
if (!t || t === "none") return;
|
|
1544
|
+
let l = Be(r, i, a, o), u = (s === "minor" ? 4 : 6) * c, d = t === "cross" ? u / 2 : u, f = t === "out" || t === "cross" ? d : 0, p = t === "in" || t === "cross" ? d : 0;
|
|
1545
|
+
e.beginPath(), e.moveTo(n.x + l.x * f, n.y + l.y * f), e.lineTo(n.x - l.x * p, n.y - l.y * p), e.stroke();
|
|
1546
|
+
}
|
|
1547
|
+
function He(e, t, n, r, i, a, o) {
|
|
1548
|
+
let { front: s } = t, c = (e) => Math.max(0, Math.min(1, e)), l = t.topology.axisX === "min" ? s.x : s.x + s.w, u = t.topology.axisY === "min" ? s.y : s.y + s.h, d = () => {
|
|
1549
|
+
if (e.catAxisCrossesAt != null && Number.isFinite(e.catAxisCrossesAt)) {
|
|
1550
|
+
let t = e.chartType.endsWith("Pct") ? e.catAxisCrossesAt * 100 : e.catAxisCrossesAt;
|
|
1551
|
+
return c(n.fraction(t));
|
|
1552
|
+
}
|
|
1553
|
+
let t = e.catAxisCrosses ?? "autoZero";
|
|
1554
|
+
return c(t === "min" ? n.fraction(n.min) : t === "max" ? n.fraction(n.max) : n.fraction(0));
|
|
1555
|
+
}, f = () => {
|
|
1556
|
+
let t = e.valAxisCrossesAt;
|
|
1557
|
+
if (t != null && Number.isFinite(t)) return $(t - 1, r, i, a);
|
|
1558
|
+
let n = e.valAxisCrosses;
|
|
1559
|
+
if (n !== "min" && n !== "max") return null;
|
|
1560
|
+
let o = +(n === "max");
|
|
1561
|
+
return a ? 1 - o : o;
|
|
1562
|
+
}, p = d(), m = f(), h = o === "horizontal" ? s.x + p * s.w : m == null ? l : s.x + m * s.w, g = o === "vertical" ? s.y + s.h - p * s.h : m == null ? u : s.y + m * s.h, _ = t.topology.nearDepth;
|
|
1563
|
+
return {
|
|
1564
|
+
axisX: h,
|
|
1565
|
+
axisY: g,
|
|
1566
|
+
depth: _,
|
|
1567
|
+
horizontalStart: t.project(s.x, g, _),
|
|
1568
|
+
horizontalEnd: t.project(s.x + s.w, g, _),
|
|
1569
|
+
verticalStart: t.project(h, s.y + s.h, _),
|
|
1570
|
+
verticalEnd: t.project(h, s.y, _)
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
function Ue(e, t, n, r, i, a, o, s, c) {
|
|
1574
|
+
let { front: l } = n, u = He(t, n, r, i, a, o, s), { axisX: d, axisY: f, depth: p } = u, m = n.project(l.x + l.w / 2, l.y + l.h / 2, p);
|
|
1575
|
+
if (!t.valAxisHidden && !t.valAxisLineHidden) {
|
|
1576
|
+
Le(e, Ie(t.valAxisLineColor, t.valAxisLineWidthEmu, null, c, "898989", 1));
|
|
1577
|
+
let i = (e) => s === "horizontal" ? n.project(l.x + r.fraction(e) * l.w, f, p) : n.project(d, l.y + l.h - r.fraction(e) * l.h, p), a = s === "horizontal" ? u.horizontalStart : u.verticalStart, o = s === "horizontal" ? u.horizontalEnd : u.verticalEnd;
|
|
1578
|
+
for (let n of r.majorTicks) Ve(e, t.valAxisMajorTickMark, i(n), a, o, m, s === "vertical" ? "horizontal" : "vertical", "major", c);
|
|
1579
|
+
for (let n of r.minorTicks) Ve(e, t.valAxisMinorTickMark, i(n), a, o, m, s === "vertical" ? "horizontal" : "vertical", "minor", c);
|
|
1580
|
+
}
|
|
1581
|
+
if (!t.catAxisHidden && !t.catAxisLineHidden) {
|
|
1582
|
+
Le(e, Ie(t.catAxisLineColor, t.catAxisLineWidthEmu, null, c, "898989", 1));
|
|
1583
|
+
let r = s === "vertical" ? u.horizontalStart : u.verticalStart, h = s === "vertical" ? u.horizontalEnd : u.verticalEnd, g = Math.max(1, Math.floor(t.catAxisTickMarkSkip ?? 1));
|
|
1584
|
+
for (let u = 0; u < i; u += g) {
|
|
1585
|
+
let g = $(u, i, a, o), _ = s === "vertical" ? n.project(l.x + g * l.w, f, p) : n.project(d, l.y + g * l.h, p);
|
|
1586
|
+
Ve(e, t.catAxisMajorTickMark, _, r, h, m, s === "vertical" ? "vertical" : "horizontal", "major", c);
|
|
1587
|
+
}
|
|
1588
|
+
let _ = t.catAxisMinorUnit;
|
|
1589
|
+
if (t.catAxisMinorTickMark && t.catAxisMinorTickMark !== "none" && _ != null && Number.isFinite(_) && _ > 0) {
|
|
1590
|
+
let u = t.catAxisMajorUnit != null && Number.isFinite(t.catAxisMajorUnit) && t.catAxisMajorUnit > 0 ? t.catAxisMajorUnit : g, v = Math.min(512, Math.ceil(i / _));
|
|
1591
|
+
for (let g = 1; g < v; g++) {
|
|
1592
|
+
let v = g * _;
|
|
1593
|
+
if (!(v < i)) break;
|
|
1594
|
+
if (Math.abs(v / u - Math.round(v / u)) < 1e-9) continue;
|
|
1595
|
+
let y = $(v, i, a, o), b = s === "vertical" ? n.project(l.x + y * l.w, f, p) : n.project(d, l.y + y * l.h, p);
|
|
1596
|
+
Ve(e, t.catAxisMinorTickMark, b, r, h, m, s === "vertical" ? "vertical" : "horizontal", "minor", c);
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
e.setLineDash([]);
|
|
1601
|
+
}
|
|
1602
|
+
function We(e, t, n, r) {
|
|
1603
|
+
if (!t.threeD) return !1;
|
|
1604
|
+
let i = t.chartType === "clusteredBar" || t.chartType === "clusteredBarH" || t.chartType.startsWith("stackedBar"), a = t.chartType.endsWith("H") || t.chartType.includes("BarH"), { plot: o, legend: s } = je(e, t, n, r, a ? "horizontal" : "vertical"), u = O(t.threeD, o, { sceneDepthScale: i ? .1 : .4 });
|
|
1605
|
+
if (!u) return !0;
|
|
1606
|
+
let f = t.chartType.startsWith("stacked"), p = t.chartType.endsWith("Pct"), h = t.series.find((e) => (e.categories?.length ?? 0) > 0)?.categories ?? t.categories, g = Math.max(1, h.length, ...t.series.map((e) => e.values.length)), _ = t.catAxisOrientation === "maxMin", y = t.catAxisCrossBetween === "between", x = t.dispBlanksAs ?? "gap", S = t.valAxisLogBase != null && Number.isFinite(t.valAxisLogBase) && t.valAxisLogBase >= 2, T = (e, n) => {
|
|
1607
|
+
let r = t.series[e]?.values[n];
|
|
1608
|
+
return r != null && Number.isFinite(r) && (!S || r > 0) || r == null && (f || x === "zero");
|
|
1609
|
+
}, E = (e, n) => {
|
|
1610
|
+
let r = t.series[e]?.values[n] ?? 0;
|
|
1611
|
+
if (!Number.isFinite(r)) return 0;
|
|
1612
|
+
if (!p) return r;
|
|
1613
|
+
let i = 0;
|
|
1614
|
+
for (let e of t.series) {
|
|
1615
|
+
let t = e.values[n];
|
|
1616
|
+
t != null && Number.isFinite(t) && (i = Math.max(i, Math.abs(t)));
|
|
1617
|
+
}
|
|
1618
|
+
if (!(i > 0)) return 0;
|
|
1619
|
+
let a = 0;
|
|
1620
|
+
for (let e of t.series) {
|
|
1621
|
+
let t = e.values[n];
|
|
1622
|
+
t != null && Number.isFinite(t) && (a += Math.abs(t) / i);
|
|
1623
|
+
}
|
|
1624
|
+
return a > 0 ? r / i / a * 100 : 0;
|
|
1625
|
+
}, D = (e, t) => {
|
|
1626
|
+
let n = e + t;
|
|
1627
|
+
return Number.isFinite(n) ? n : t < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE;
|
|
1628
|
+
}, k = 0, A = 0;
|
|
1629
|
+
if (f) {
|
|
1630
|
+
for (let e = 0; e < g; e++) {
|
|
1631
|
+
let n = 0, r = 0;
|
|
1632
|
+
for (let i = 0; i < t.series.length; i++) {
|
|
1633
|
+
let t = E(i, e);
|
|
1634
|
+
t >= 0 ? n = D(n, t) : r = D(r, t);
|
|
1635
|
+
}
|
|
1636
|
+
k = Math.min(k, r), A = Math.max(A, n);
|
|
1637
|
+
}
|
|
1638
|
+
p && (k = k < 0 ? -100 : 0, A = A > 0 ? 100 : 0, k === 0 && A === 0 && (A = 1));
|
|
1639
|
+
} else {
|
|
1640
|
+
let e = m(t.series.flatMap((e) => e.values).filter((e) => e != null && Number.isFinite(e) && (!S || e > 0)), S ? {
|
|
1641
|
+
min: 1,
|
|
1642
|
+
max: 10
|
|
1643
|
+
} : {
|
|
1644
|
+
min: 0,
|
|
1645
|
+
max: 1
|
|
1646
|
+
});
|
|
1647
|
+
k = S ? e.min : Math.min(0, e.min), A = S ? e.max : Math.max(0, e.max);
|
|
1648
|
+
}
|
|
1649
|
+
let j = Fe(t, k, A, (a ? u.front.w : u.front.h) / r, p, a ? "horizontal" : "vertical"), M = (e) => Number.isFinite(e) ? Math.max(j.min, Math.min(j.max, e)) : j.min;
|
|
1650
|
+
Re(e, t, u, j, a ? "horizontal" : "vertical", g, y, _, r);
|
|
1651
|
+
let { front: N } = u, P = Math.max(1, t.series.length), F = [], I = t.series.map((e) => new Map(e.dataPointOverrides?.map((e) => [e.idx, e]) ?? [])), z = t.series.map((e) => new Map(e.dataLabelOverrides?.map((e) => [e.idx, e]) ?? []));
|
|
1652
|
+
if (i) {
|
|
1653
|
+
let i = u.prismInterval(0, 1, !0), o = [], s = Array(g).fill(0), c = Array(g).fill(0), l = (a ? N.h : N.w) / g, d = t.barGapWidth != null && Number.isFinite(t.barGapWidth) && t.barGapWidth >= 0 ? t.barGapWidth : 150;
|
|
1654
|
+
for (let e = 0; e < t.series.length; e++) {
|
|
1655
|
+
let n = t.series[e], u = i, m = C(l, d, e, P, f);
|
|
1656
|
+
for (let i = 0; i < g; i++) {
|
|
1657
|
+
if (!T(e, i)) continue;
|
|
1658
|
+
let d = E(e, i), h = I[e].get(i), y = h?.fillHidden === !0 ? "transparent" : h?.color ?? n.dataPointColors?.[i], b = y === "00000000" ? "transparent" : y ? `#${y}` : n.color === "00000000" ? "transparent" : fe(e, n), x = pe(n, h), C = h?.lineColor ?? n.lineColor, O = h?.lineWidthEmu ?? n.lineWidthEmu, k = h?.lineDash ?? n.chartexStyle?.lineDash ?? "solid", A = n.chartexStyle?.lineCap === "rnd" ? "round" : n.chartexStyle?.lineCap === "sq" ? "square" : "butt", P = n.chartexStyle?.lineJoin === "round" || n.chartexStyle?.lineJoin === "bevel" ? n.chartexStyle.lineJoin : "miter", F = f ? d >= 0 ? s[i] : c[i] : 0, L = D(F, d);
|
|
1659
|
+
f && (d >= 0 ? s[i] = L : c[i] = L);
|
|
1660
|
+
let R = M(F), z = M(L), B = n.threeDShape ?? t.threeD.shape ?? "box", V = B === "cone" || B === "pyramid", H = B === "coneToMax" || B === "pyramidToMax", U = (e) => {
|
|
1661
|
+
if (!V) return 1;
|
|
1662
|
+
let t = S && !(F > 0) ? j.min : F, n = j.fraction(t), r = j.fraction(L), i = j.fraction(e), a = r - n;
|
|
1663
|
+
return a === 0 || !Number.isFinite(a) || !Number.isFinite(i - n) ? +(e === t) : Math.max(0, Math.min(1, 1 - (i - n) / a));
|
|
1664
|
+
}, W = (e) => {
|
|
1665
|
+
if (!H) return 1;
|
|
1666
|
+
let t = L >= F ? j.max : j.min, n = S ? j.min : 0, r = j.fraction(t), i = j.fraction(n), a = j.fraction(e), o = Math.abs(r - i);
|
|
1667
|
+
return !(o > 0) || ![
|
|
1668
|
+
r,
|
|
1669
|
+
i,
|
|
1670
|
+
a
|
|
1671
|
+
].every(Number.isFinite) ? w(e, j.min, j.max) : Math.max(0, Math.min(1, Math.abs(r - a) / o));
|
|
1672
|
+
}, G = H ? W(R) : U(R), K = H ? W(z) : U(z);
|
|
1673
|
+
if (a) {
|
|
1674
|
+
let t = N.x + j.fraction(R) * N.w, n = N.x + j.fraction(z) * N.w, a = _ ? g - 1 - i : i, s = N.y + a * l + m.offset;
|
|
1675
|
+
o.push({
|
|
1676
|
+
x: Math.min(t, n),
|
|
1677
|
+
y: s,
|
|
1678
|
+
width: Math.abs(n - t),
|
|
1679
|
+
height: m.size,
|
|
1680
|
+
nearDepth: u.near,
|
|
1681
|
+
farDepth: u.far,
|
|
1682
|
+
categoryIndex: i,
|
|
1683
|
+
seriesIndex: e,
|
|
1684
|
+
color: b,
|
|
1685
|
+
shape: B,
|
|
1686
|
+
baseCoord: t,
|
|
1687
|
+
endCoord: n,
|
|
1688
|
+
baseScale: G,
|
|
1689
|
+
endScale: K,
|
|
1690
|
+
omitBaseCap: !1,
|
|
1691
|
+
omitEndCap: !1,
|
|
1692
|
+
outline: x,
|
|
1693
|
+
outlineColor: C ? `#${C}` : "rgba(0,0,0,0.42)",
|
|
1694
|
+
outlineWidth: O == null ? .75 : Math.max(.25, O / v * r),
|
|
1695
|
+
outlineDash: k,
|
|
1696
|
+
outlineCap: A,
|
|
1697
|
+
outlineJoin: P,
|
|
1698
|
+
labelValue: p ? d / 100 : d
|
|
1699
|
+
});
|
|
1700
|
+
} else {
|
|
1701
|
+
let t = N.y + N.h - j.fraction(R) * N.h, n = N.y + N.h - j.fraction(z) * N.h, a = _ ? g - 1 - i : i, s = N.x + a * l + m.offset;
|
|
1702
|
+
o.push({
|
|
1703
|
+
x: s,
|
|
1704
|
+
y: Math.min(t, n),
|
|
1705
|
+
width: m.size,
|
|
1706
|
+
height: Math.abs(n - t),
|
|
1707
|
+
nearDepth: u.near,
|
|
1708
|
+
farDepth: u.far,
|
|
1709
|
+
categoryIndex: i,
|
|
1710
|
+
seriesIndex: e,
|
|
1711
|
+
color: b,
|
|
1712
|
+
shape: B,
|
|
1713
|
+
baseCoord: t,
|
|
1714
|
+
endCoord: n,
|
|
1715
|
+
baseScale: G,
|
|
1716
|
+
endScale: K,
|
|
1717
|
+
omitBaseCap: !1,
|
|
1718
|
+
omitEndCap: !1,
|
|
1719
|
+
outline: x,
|
|
1720
|
+
outlineColor: C ? `#${C}` : "rgba(0,0,0,0.42)",
|
|
1721
|
+
outlineWidth: O == null ? .75 : Math.max(.25, O / v * r),
|
|
1722
|
+
outlineDash: k,
|
|
1723
|
+
outlineCap: A,
|
|
1724
|
+
outlineJoin: P,
|
|
1725
|
+
labelValue: p ? d / 100 : d
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
if (f) {
|
|
1731
|
+
let e = de(o, g);
|
|
1732
|
+
for (let t = 0; t < g; t++) {
|
|
1733
|
+
let n = e[t];
|
|
1734
|
+
for (let e of [-1, 1]) {
|
|
1735
|
+
let t = n.filter((t) => Math.sign(t.labelValue) === e && !ve(t.color) && Math.abs(t.endCoord - t.baseCoord) > 1e-9).sort((e, t) => e.seriesIndex - t.seriesIndex);
|
|
1736
|
+
for (let e = 0; e + 1 < t.length; e++) {
|
|
1737
|
+
let n = t[e], r = t[e + 1], i = 1e-8 * Math.max(1, Math.abs(n.endCoord), Math.abs(r.baseCoord));
|
|
1738
|
+
n.shape !== r.shape || Math.abs(n.endCoord - r.baseCoord) > i || Math.abs(n.endScale - r.baseScale) > 1e-9 || n.nearDepth !== r.nearDepth || n.farDepth !== r.farDepth || (n.omitEndCap = !0, r.omitBaseCap = !0);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
let r = n.find((e) => e.labelValue > 0 && !ve(e.color)), i = n.find((e) => e.labelValue < 0 && !ve(e.color));
|
|
1742
|
+
if (r && i) {
|
|
1743
|
+
let e = 1e-8 * Math.max(1, Math.abs(r.baseCoord), Math.abs(i.baseCoord));
|
|
1744
|
+
r.shape === i.shape && Math.abs(r.baseCoord - i.baseCoord) <= e && Math.abs(r.baseScale - i.baseScale) <= 1e-9 && r.nearDepth === i.nearDepth && r.farDepth === i.farDepth && (r.omitBaseCap = !0, i.omitBaseCap = !0);
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
let m = {
|
|
1749
|
+
remaining: K,
|
|
1750
|
+
exceeded: !1
|
|
1751
|
+
}, h = o.flatMap((e) => xe(u, e.shape, a, e.x, e.y, e.width, e.height, e.baseCoord, e.endCoord, e.nearDepth, e.farDepth, e.color, e.baseScale, e.endScale, e.omitBaseCap, e.omitEndCap, e.outline && e.outlineColor ? {
|
|
1752
|
+
color: e.outlineColor,
|
|
1753
|
+
width: e.outlineWidth,
|
|
1754
|
+
dash: b(e.outlineDash, e.outlineWidth),
|
|
1755
|
+
cap: e.outlineCap,
|
|
1756
|
+
join: e.outlineJoin
|
|
1757
|
+
} : void 0, m));
|
|
1758
|
+
if (m.exceeded) return Te(e, n), !0;
|
|
1759
|
+
for (let t of W(h)) Ce(e, t);
|
|
1760
|
+
for (let i of o) {
|
|
1761
|
+
let o = t.series[i.seriesIndex], s = a ? u.project(i.endCoord, i.y + i.height / 2, (i.nearDepth + i.farDepth) / 2) : u.project(i.x + i.width / 2, i.endCoord, (i.nearDepth + i.farDepth) / 2), c = z[i.seriesIndex].get(i.categoryIndex);
|
|
1762
|
+
Ae(t, o, c) && F.push(() => ke(e, t, o, i.seriesIndex, i.categoryIndex, i.labelValue, s, n, r, 0, void 0, c));
|
|
1763
|
+
}
|
|
1764
|
+
} else {
|
|
1765
|
+
let i = t.series.map(() => Array(g).fill(0)), a = t.series.map(() => Array(g).fill(0));
|
|
1766
|
+
if (f) {
|
|
1767
|
+
let e = Array(g).fill(0), n = Array(g).fill(0);
|
|
1768
|
+
for (let r = 0; r < t.series.length; r++) for (let t = 0; t < g; t++) {
|
|
1769
|
+
let o = E(r, t), s = o >= 0 ? e[t] : n[t];
|
|
1770
|
+
i[r][t] = s, a[r][t] = D(s, o), o >= 0 ? e[t] = D(e[t], o) : n[t] = D(n[t], o);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
let o = (e) => {
|
|
1774
|
+
let t = u.seriesDepth(e, P, f), n = 0, r = 0;
|
|
1775
|
+
for (let i = 0; i < g; i++) {
|
|
1776
|
+
if (!T(e, i)) continue;
|
|
1777
|
+
let o = f ? a[e][i] : E(e, i), s = N.x + $(i, g, y, _) * N.w, c = N.y + N.h - j.fraction(M(o)) * N.h;
|
|
1778
|
+
n += u.cameraDepth(s, c, t), r++;
|
|
1779
|
+
}
|
|
1780
|
+
return r > 0 ? n / r : -Infinity;
|
|
1781
|
+
}, s = t.series.map((e, t) => t).sort((e, t) => o(e) - o(t) || t - e), c = [], l = [], d = !1;
|
|
1782
|
+
for (let o of s) {
|
|
1783
|
+
if (d) break;
|
|
1784
|
+
let s = t.series[o], m = fe(o, s), h = f ? u.prismInterval(0, 1, !0) : u.prismInterval(o, P, !1), S = N.x + N.w / 2, C = N.y + N.h / 2, w = u.cameraDepth(S, C, h.near) >= u.cameraDepth(S, C, h.far) ? h.near : h.far, D = [], O = [], k = [], A = [], M = [], B = [], V = [], H = [], U = [], W = [];
|
|
1785
|
+
for (let e = 0; e < g; e++) {
|
|
1786
|
+
if (!T(o, e)) {
|
|
1787
|
+
D.push(null), O.push(null), k.push(null), A.push(null), M.push(null), B.push(null), V.push(null), H.push(null), U.push(null), W.push(null);
|
|
1788
|
+
continue;
|
|
1789
|
+
}
|
|
1790
|
+
let n = f ? a[o][e] : E(o, e), r = f ? i[o][e] : 0, s = N.x + $(e, g, y, _) * N.w, c = j.fraction(n), l = j.fraction(r), d = Number.isFinite(l) ? l : r <= j.min ? 0 : 1, p = Number.isFinite(c) && c >= 0 && c <= 1, m = Number.isFinite(c) ? Math.max(0, Math.min(1, c)) : n <= j.min ? 0 : 1, h = N.y + N.h - m * N.h, v = N.y + N.h - Math.max(0, Math.min(1, d)) * N.h;
|
|
1791
|
+
D.push(t.chartType.toLowerCase().includes("area") || p ? u.project(s, h, w) : null), O.push(u.project(s, v, w)), k.push(p ? u.cameraDepth(s, h, w) : null), A.push(u.cameraDepth(s, v, w)), M.push(n), B.push(s), V.push(h), H.push(v), U.push(c), W.push(d);
|
|
1792
|
+
}
|
|
1793
|
+
let G = [], K = null;
|
|
1794
|
+
for (let e = 0; e < D.length; e++) {
|
|
1795
|
+
let t = D[e], n = O[e];
|
|
1796
|
+
if (!t || !n) {
|
|
1797
|
+
x === "gap" && (K && G.push(K), K = null);
|
|
1798
|
+
continue;
|
|
1799
|
+
}
|
|
1800
|
+
K ??= {
|
|
1801
|
+
upper: [],
|
|
1802
|
+
lower: [],
|
|
1803
|
+
upperDepths: [],
|
|
1804
|
+
lowerDepths: [],
|
|
1805
|
+
indices: [],
|
|
1806
|
+
sceneXs: [],
|
|
1807
|
+
upperYs: [],
|
|
1808
|
+
lowerYs: [],
|
|
1809
|
+
upperFractions: [],
|
|
1810
|
+
lowerFractions: []
|
|
1811
|
+
}, K.upper.push(t), K.lower.push(n), K.upperDepths.push(k[e] ?? 0), K.lowerDepths.push(A[e] ?? 0), K.indices.push(e), K.sceneXs.push(B[e] ?? 0), K.upperYs.push(V[e] ?? 0), K.lowerYs.push(H[e] ?? 0), K.upperFractions.push(U[e] ?? 0), K.lowerFractions.push(W[e] ?? 0);
|
|
1812
|
+
}
|
|
1813
|
+
K && G.push(K);
|
|
1814
|
+
let q = [];
|
|
1815
|
+
if (t.chartType.toLowerCase().includes("area")) for (let t of G) {
|
|
1816
|
+
let n = null;
|
|
1817
|
+
for (let r = 0; r + 1 < t.upper.length; r++) {
|
|
1818
|
+
let i = R(t.lowerFractions[r], t.lowerFractions[r + 1], t.upperFractions[r], t.upperFractions[r + 1]);
|
|
1819
|
+
for (let a = 0; a < i.length; a++) {
|
|
1820
|
+
let o = i[a], s = t.sceneXs[r] + (t.sceneXs[r + 1] - t.sceneXs[r]) * o.startT, l = t.sceneXs[r] + (t.sceneXs[r + 1] - t.sceneXs[r]) * o.endT, f = N.y + N.h - o.lowerStart * N.h, p = N.y + N.h - o.lowerEnd * N.h, g = N.y + N.h - o.upperStart * N.h, _ = N.y + N.h - o.upperEnd * N.h, v = {
|
|
1821
|
+
...u.project(s, g, w),
|
|
1822
|
+
cameraDepth: u.cameraDepth(s, g, w),
|
|
1823
|
+
cameraWeight: u.cameraProjectionWeight(s, g, w)
|
|
1824
|
+
}, y = {
|
|
1825
|
+
...u.project(l, _, w),
|
|
1826
|
+
cameraDepth: u.cameraDepth(l, _, w),
|
|
1827
|
+
cameraWeight: u.cameraProjectionWeight(l, _, w)
|
|
1828
|
+
};
|
|
1829
|
+
n != null && Math.hypot(n.at(-1).x - v.x, n.at(-1).y - v.y) <= 1e-8 ? n.push(y) : (n && n.length >= 2 && q.push(n), n = [v, y]);
|
|
1830
|
+
let b = be(u, s, l, f, p, g, _, h.near, h.far, m, r === 0 && a === 0 && o.startT === 0, r + 2 === t.upper.length && a + 1 === i.length && o.endT === 1);
|
|
1831
|
+
for (let t of b) {
|
|
1832
|
+
if (c.length >= 1e4) {
|
|
1833
|
+
d = !0;
|
|
1834
|
+
break;
|
|
1835
|
+
}
|
|
1836
|
+
c.push({
|
|
1837
|
+
points: t.points,
|
|
1838
|
+
cameraDepth: t.cameraDepth,
|
|
1839
|
+
cameraDepths: t.cameraDepths,
|
|
1840
|
+
cameraWeights: t.cameraWeights,
|
|
1841
|
+
layer: 0,
|
|
1842
|
+
paint: () => Ce(e, t)
|
|
1843
|
+
});
|
|
1844
|
+
}
|
|
1845
|
+
if (d) break;
|
|
1846
|
+
}
|
|
1847
|
+
if (d) break;
|
|
1848
|
+
}
|
|
1849
|
+
if (n && n.length >= 2 && q.push(n), d) break;
|
|
1850
|
+
}
|
|
1851
|
+
let J = [];
|
|
1852
|
+
if (!t.chartType.toLowerCase().includes("area")) {
|
|
1853
|
+
let e = [], t = null;
|
|
1854
|
+
for (let n = 0; n < g; n++) {
|
|
1855
|
+
let r = M[n], i = r == null ? NaN : j.fraction(r);
|
|
1856
|
+
if (r == null || !Number.isFinite(i)) {
|
|
1857
|
+
x === "gap" && t && (e.push(t), t = null);
|
|
1858
|
+
continue;
|
|
1859
|
+
}
|
|
1860
|
+
t ??= [], t.push({
|
|
1861
|
+
x: N.x + $(n, g, y, _) * N.w,
|
|
1862
|
+
fraction: i
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
t && e.push(t);
|
|
1866
|
+
let n = (e) => {
|
|
1867
|
+
let t = Math.max(0, Math.min(1, e.fraction)), n = N.y + N.h - t * N.h;
|
|
1868
|
+
return {
|
|
1869
|
+
...u.project(e.x, n, w),
|
|
1870
|
+
cameraDepth: u.cameraDepth(e.x, n, w),
|
|
1871
|
+
cameraWeight: u.cameraProjectionWeight(e.x, n, w)
|
|
1872
|
+
};
|
|
1873
|
+
}, r = (e) => {
|
|
1874
|
+
e && e.path.length >= 2 && J.push(e);
|
|
1875
|
+
};
|
|
1876
|
+
for (let t of e) {
|
|
1877
|
+
if (t.length < 2) continue;
|
|
1878
|
+
let e = [t[0]];
|
|
1879
|
+
for (let n = 0; n + 1 < t.length; n++) {
|
|
1880
|
+
let r = t[n - 1] ?? t[n], i = t[n], a = t[n + 1], o = t[n + 2] ?? a;
|
|
1881
|
+
if (s.smooth !== !0 || t.length < 3) {
|
|
1882
|
+
e.push(a);
|
|
1883
|
+
continue;
|
|
1884
|
+
}
|
|
1885
|
+
let c = {
|
|
1886
|
+
x: i.x + (a.x - r.x) / 6,
|
|
1887
|
+
fraction: i.fraction + (a.fraction - r.fraction) / 6
|
|
1888
|
+
}, l = {
|
|
1889
|
+
x: a.x - (o.x - i.x) / 6,
|
|
1890
|
+
fraction: a.fraction - (o.fraction - i.fraction) / 6
|
|
1891
|
+
};
|
|
1892
|
+
for (let t = 1; t <= 12; t++) {
|
|
1893
|
+
let n = t / 12, r = 1 - n;
|
|
1894
|
+
e.push({
|
|
1895
|
+
x: r * r * r * i.x + 3 * r * r * n * c.x + 3 * r * n * n * l.x + n * n * n * a.x,
|
|
1896
|
+
fraction: r * r * r * i.fraction + 3 * r * r * n * c.fraction + 3 * r * n * n * l.fraction + n * n * n * a.fraction
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
let i = null, a = 0;
|
|
1901
|
+
for (let t = 0; t + 1 < e.length; t++) {
|
|
1902
|
+
let o = e[t], s = e[t + 1], c = (e) => u.project(e.x, N.y + N.h - e.fraction * N.h, w), l = c(o), d = c(s), f = Math.hypot(d.x - l.x, d.y - l.y), p = Number.isFinite(f) ? f : Math.hypot(s.x - o.x, (s.fraction - o.fraction) * N.h), m = L(o.fraction, s.fraction);
|
|
1903
|
+
if (!m || m.endT - m.startT <= 1e-12) {
|
|
1904
|
+
r(i), i = null, a += p;
|
|
1905
|
+
continue;
|
|
1906
|
+
}
|
|
1907
|
+
let h = (e) => ({
|
|
1908
|
+
x: o.x + (s.x - o.x) * e,
|
|
1909
|
+
fraction: o.fraction + (s.fraction - o.fraction) * e
|
|
1910
|
+
}), g = c(h(m.startT)), _ = Math.hypot(g.x - l.x, g.y - l.y), v = n(h(m.startT)), y = n(h(m.endT));
|
|
1911
|
+
i != null && Math.hypot(i.path.at(-1).x - v.x, i.path.at(-1).y - v.y) <= 1e-8 ? (i.path.push(y), i.endClipped = t + 1 < e.length - 1 || m.endT < 1) : (r(i), i = {
|
|
1912
|
+
path: [v, y],
|
|
1913
|
+
startClipped: t > 0 || m.startT > 0,
|
|
1914
|
+
endClipped: t + 1 < e.length - 1 || m.endT < 1,
|
|
1915
|
+
dashOffset: a + (Number.isFinite(_) ? _ : p * m.startT)
|
|
1916
|
+
}), a += p;
|
|
1917
|
+
}
|
|
1918
|
+
r(i);
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
let ee = t.chartType.toLowerCase().includes("area"), te = s.lineHidden != null || s.lineColor != null || s.lineWidthEmu != null || s.chartexStyle?.lineHidden != null || s.chartexStyle?.lineColors?.some(Boolean) || s.chartexStyle?.lineWidthEmu != null || s.chartexStyle?.lineDash != null || s.chartexStyle?.lineCap != null || s.chartexStyle?.lineJoin != null;
|
|
1922
|
+
if (s.lineHidden !== !0 && (!ee || te)) {
|
|
1923
|
+
let t = s.lineColor ? `#${s.lineColor}` : me(m, .7), n = s.lineWidthEmu ? Math.max(.5, s.lineWidthEmu / v) * r : ee ? .75 * r : Math.max(1, 2 * r), i = b(s.chartexStyle?.lineDash ?? "solid", n), a = s.chartexStyle?.lineCap === "rnd" ? "round" : s.chartexStyle?.lineCap === "sq" ? "square" : "butt", o = s.chartexStyle?.lineJoin === "round" || s.chartexStyle?.lineJoin === "bevel" ? s.chartexStyle.lineJoin : "miter", l = (r, s, l = s, u = 0) => {
|
|
1924
|
+
let f = re(r, {
|
|
1925
|
+
width: n,
|
|
1926
|
+
dash: i,
|
|
1927
|
+
dashOffset: u,
|
|
1928
|
+
lineCap: a,
|
|
1929
|
+
startCap: s,
|
|
1930
|
+
endCap: l,
|
|
1931
|
+
lineJoin: o
|
|
1932
|
+
});
|
|
1933
|
+
if (f == null) {
|
|
1934
|
+
d = !0;
|
|
1935
|
+
return;
|
|
1936
|
+
}
|
|
1937
|
+
if (c.length + f.length > 1e4) {
|
|
1938
|
+
d = !0;
|
|
1939
|
+
return;
|
|
1940
|
+
}
|
|
1941
|
+
for (let n of f) c.push({
|
|
1942
|
+
points: n.points,
|
|
1943
|
+
cameraDepth: n.cameraDepth,
|
|
1944
|
+
cameraDepths: n.cameraDepths,
|
|
1945
|
+
cameraWeights: n.cameraWeights,
|
|
1946
|
+
layer: 1,
|
|
1947
|
+
paint: () => we(e, n, t)
|
|
1948
|
+
});
|
|
1949
|
+
};
|
|
1950
|
+
if (ee) for (let e of q) l(e, a);
|
|
1951
|
+
else for (let e of J) l(e.path, e.startClipped ? "butt" : a, e.endClipped ? "butt" : a, e.dashOffset);
|
|
1952
|
+
}
|
|
1953
|
+
let Y = s.dataPointOverrides?.some((e) => e.markerSymbol != null && e.markerSymbol !== "none") === !0;
|
|
1954
|
+
if (t.chartType.toLowerCase().includes("line") && (s.showMarker === !0 || Y)) for (let t = 0; t < D.length; t++) {
|
|
1955
|
+
let n = D[t];
|
|
1956
|
+
if (!n) continue;
|
|
1957
|
+
let i = I[o].get(t), a = i?.markerSymbol ?? (s.showMarker === !0 ? s.markerSymbol ?? "circle" : "none");
|
|
1958
|
+
if (a === "none") continue;
|
|
1959
|
+
let c = i?.markerSize ?? s.markerSize ?? 5, u = i?.markerFill ?? s.markerFill ?? s.color ?? Z[o % Z.length], d = i?.markerLine ?? s.markerLine ?? s.lineColor ?? s.color ?? Z[o % Z.length], f = (i?.markerLineWidthEmu ?? s.markerLineWidthEmu) == null ? Math.max(.75, s.lineWidthEmu == null ? r : s.lineWidthEmu / v * r) : Math.max(.25, (i?.markerLineWidthEmu ?? s.markerLineWidthEmu ?? 0) / v * r);
|
|
1960
|
+
l.push(() => Oe(e, n, a, Math.max(2, c) * r, u === "00000000" ? "transparent" : `#${u}`, `#${d}`, f));
|
|
1961
|
+
}
|
|
1962
|
+
for (let i = 0; i < D.length; i++) {
|
|
1963
|
+
let a = D[i];
|
|
1964
|
+
if (!a) continue;
|
|
1965
|
+
let c = E(o, i), l = I[o].get(i), u = l?.markerSize ?? s.markerSize ?? 5, d = z[o].get(i);
|
|
1966
|
+
Ae(t, s, d) && F.push(() => ke(e, t, s, o, i, p ? c / 100 : c, a, n, r, s.showMarker === !0 || l?.markerSymbol != null ? u * r / 2 : 0, void 0, d));
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
if (d) return Te(e, n), !0;
|
|
1970
|
+
for (let e of W(c)) e.paint();
|
|
1971
|
+
for (let e of l) e();
|
|
1972
|
+
}
|
|
1973
|
+
ze(e, t, u, j, g, y, _, r, a ? "horizontal" : "vertical"), Ue(e, t, u, j, g, y, _, a ? "horizontal" : "vertical", r);
|
|
1974
|
+
let B = He(t, u, j, g, y, _, a ? "horizontal" : "vertical"), V = (e, t) => {
|
|
1975
|
+
if (t !== "low" && t !== "high") return B;
|
|
1976
|
+
let n = u.topology.nearDepth, r = B.axisX, i = B.axisY;
|
|
1977
|
+
if (e === "value" === a) {
|
|
1978
|
+
let e = N.y, r = N.y + N.h, a = u.project(N.x + N.w / 2, e, n), o = u.project(N.x + N.w / 2, r, n), s = a.y >= o.y ? e : r;
|
|
1979
|
+
i = t === "low" ? s : s === e ? r : e;
|
|
1980
|
+
} else {
|
|
1981
|
+
let e = N.x, i = N.x + N.w, a = u.project(e, N.y + N.h / 2, n), o = u.project(i, N.y + N.h / 2, n), s = a.x <= o.x ? e : i;
|
|
1982
|
+
r = t === "low" ? s : s === e ? i : e;
|
|
1983
|
+
}
|
|
1984
|
+
return {
|
|
1985
|
+
axisX: r,
|
|
1986
|
+
axisY: i,
|
|
1987
|
+
depth: n,
|
|
1988
|
+
horizontalStart: u.project(N.x, i, n),
|
|
1989
|
+
horizontalEnd: u.project(N.x + N.w, i, n),
|
|
1990
|
+
verticalStart: u.project(r, N.y + N.h, n),
|
|
1991
|
+
verticalEnd: u.project(r, N.y, n)
|
|
1992
|
+
};
|
|
1993
|
+
}, H = V("value", t.valAxisTickLabelPos), U = V("category", t.catAxisTickLabelPos), G = d(t.valAxisFontSizeHpt, r) ?? 9 * r;
|
|
1994
|
+
if (e.font = `${t.valAxisFontItalic ? "italic " : ""}${t.valAxisFontBold ? "bold " : ""}${G}px ${ge(t.valAxisFontFace)}`, e.fillStyle = t.valAxisFontColor ? `#${t.valAxisFontColor}` : "#595959", e.textAlign = a ? "center" : "right", e.textBaseline = a ? "top" : "middle", !t.valAxisHidden && t.valAxisTickLabelPos !== "none") {
|
|
1995
|
+
let { axisX: n, axisY: r, depth: i } = H, o = u.project(N.x + N.w / 2, N.y + N.h / 2, i), s = Be(a ? H.horizontalStart : H.verticalStart, a ? H.horizontalEnd : H.verticalEnd, o, a ? "vertical" : "horizontal");
|
|
1996
|
+
e.textAlign = Math.abs(s.x) < .2 ? "center" : s.x < 0 ? "right" : "left", e.textBaseline = Math.abs(s.y) < .2 ? "middle" : s.y < 0 ? "bottom" : "top";
|
|
1997
|
+
for (let o of j.majorTicks) {
|
|
1998
|
+
let l = a ? u.project(N.x + j.fraction(o) * N.w, r, i) : u.project(n, N.y + N.h - j.fraction(o) * N.h, i);
|
|
1999
|
+
e.fillText(c(p ? o / 100 : o, p ? t.valAxisFormatCode ?? "0%" : t.valAxisFormatCode, t.date1904), l.x + s.x * 5, l.y + s.y * 5);
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
let q = d(t.catAxisFontSizeHpt, r) ?? 9 * r;
|
|
2003
|
+
if (e.font = `${t.catAxisFontItalic ? "italic " : ""}${t.catAxisFontBold ? "bold " : ""}${q}px ${ge(t.catAxisFontFace)}`, e.fillStyle = t.catAxisFontColor ? `#${t.catAxisFontColor}` : "#595959", !t.catAxisHidden && t.catAxisTickLabelPos !== "none") {
|
|
2004
|
+
let n = Array.from({ length: g }, (e, n) => l(String(h[n] ?? n + 1), t.catAxisFormatCode, t.date1904)), r = Ee(t);
|
|
2005
|
+
if (r == null && (r = 0, !a && g > 1)) {
|
|
2006
|
+
let t = Infinity, i = null, a = U.axisY;
|
|
2007
|
+
for (let e = 0; e < g; e++) {
|
|
2008
|
+
let n = $(e, g, y, _), r = u.project(N.x + n * N.w, a, u.topology.nearDepth);
|
|
2009
|
+
i && (t = Math.min(t, Math.hypot(r.x - i.x, r.y - i.y))), i = r;
|
|
2010
|
+
}
|
|
2011
|
+
Math.max(0, ...n.map((t) => e.measureText(t).width)) > t * .9 && (r = -Math.PI / 4);
|
|
2012
|
+
}
|
|
2013
|
+
let i = Math.max(1, Math.floor(t.catAxisTickLabelSkip ?? 1));
|
|
2014
|
+
for (let t = 0; t < g; t += i) {
|
|
2015
|
+
let i = $(t, g, y, _), { axisX: o, axisY: s, depth: c } = U, l = a ? u.project(o, N.y + $(t, g, y, _) * N.h, c) : u.project(N.x + i * N.w, s, c);
|
|
2016
|
+
if (a) {
|
|
2017
|
+
let r = u.project(o, N.y + N.h / 2, c), i = u.project(N.x + N.w / 2, N.y + N.h / 2, c), a = r.x <= i.x;
|
|
2018
|
+
e.textAlign = a ? "right" : "left", e.textBaseline = "middle", e.fillText(n[t], l.x + (a ? -6 : 6), l.y);
|
|
2019
|
+
} else {
|
|
2020
|
+
let i = u.project(N.x + N.w / 2, N.y + N.h / 2, c), o = Be(U.horizontalStart, U.horizontalEnd, i, "vertical");
|
|
2021
|
+
De(e, n[t], l, r, a, o.y < 0 ? -1 : 1);
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
Ne(e, t, n, o, a, r);
|
|
2026
|
+
for (let e of F) e();
|
|
2027
|
+
return Pe(e, t, s, r), !0;
|
|
2028
|
+
}
|
|
2029
|
+
function Ge(e, t, n, r) {
|
|
2030
|
+
if (!t.threeD || t.chartType !== "pie") return !1;
|
|
2031
|
+
let i = t.series[0];
|
|
2032
|
+
if (!i) return !0;
|
|
2033
|
+
let a = i.values.flatMap((e, t) => e != null && Number.isFinite(e) ? [{
|
|
2034
|
+
index: t,
|
|
2035
|
+
value: Math.abs(e)
|
|
2036
|
+
}] : []), o = 0;
|
|
2037
|
+
for (let e of a) o = Math.max(o, e.value);
|
|
2038
|
+
if (!(o > 0)) return !0;
|
|
2039
|
+
let s = a.reduce((e, t) => e + t.value / o, 0);
|
|
2040
|
+
if (!(s > 0) || !Number.isFinite(s)) return !0;
|
|
2041
|
+
let { plot: c, legend: l } = je(e, t, n, r, "radial"), u = O({
|
|
2042
|
+
...t.threeD,
|
|
2043
|
+
depthPercent: 100
|
|
2044
|
+
}, c, {
|
|
2045
|
+
sceneDepthScale: 1,
|
|
2046
|
+
sceneHeightScale: .15
|
|
2047
|
+
});
|
|
2048
|
+
if (!u) return !0;
|
|
2049
|
+
let f = new Map(i.dataPointOverrides?.map((e) => [e.idx, e]) ?? []), p = 0;
|
|
2050
|
+
for (let e of f.values()) e.explosion != null && Number.isFinite(e.explosion) && (p = Math.max(p, Math.max(0, Math.min(100, e.explosion)) / 100));
|
|
2051
|
+
let { scene: m } = u, h = Math.min(m.w * .45 / (1 + p), u.modelDepth * .45 / (1 + p), m.h / .45);
|
|
2052
|
+
if (!(h > 0)) return !0;
|
|
2053
|
+
let _ = m.x + m.w / 2, x = m.y + m.h / 2, S = h * .3, C = -Math.PI / 2 + ((t.firstSliceAngle != null && Number.isFinite(t.firstSliceAngle) ? t.firstSliceAngle : 0) % 360 + 360) % 360 * Math.PI / 180, w = [], E = new Map(i.dataLabelOverrides?.map((e) => [e.idx, e]) ?? []);
|
|
2054
|
+
for (let e of a) {
|
|
2055
|
+
let t = e.value / o / s, n = C + t * Math.PI * 2, r = f.get(e.index), a = r?.fillHidden === !0 ? "00000000" : r?.color ?? i.dataPointColors?.[e.index] ?? i.color, c = (C + n) / 2, l = r?.explosion != null && Number.isFinite(r.explosion) ? Math.max(0, Math.min(100, r.explosion)) / 100 : 0, d = _ + Math.cos(c) * h * l, p = .5 + Math.sin(c) * h * l / u.modelDepth, m = I({
|
|
2056
|
+
centerX: d,
|
|
2057
|
+
centerY: x,
|
|
2058
|
+
centerDepth: p,
|
|
2059
|
+
radius: h,
|
|
2060
|
+
modelDepth: u.modelDepth,
|
|
2061
|
+
thickness: S,
|
|
2062
|
+
startAngle: C,
|
|
2063
|
+
endAngle: n
|
|
2064
|
+
});
|
|
2065
|
+
if (!m) {
|
|
2066
|
+
C = n;
|
|
2067
|
+
continue;
|
|
2068
|
+
}
|
|
2069
|
+
w.push({
|
|
2070
|
+
index: e.index,
|
|
2071
|
+
start: C,
|
|
2072
|
+
end: n,
|
|
2073
|
+
color: a === "00000000" ? "transparent" : a ? `#${a}` : fe(e.index),
|
|
2074
|
+
value: e.value,
|
|
2075
|
+
percentValue: t,
|
|
2076
|
+
centerX: d,
|
|
2077
|
+
centerDepth: p,
|
|
2078
|
+
mesh: m,
|
|
2079
|
+
lineHidden: r?.lineHidden ?? i.lineHidden ?? !1,
|
|
2080
|
+
lineColor: r?.lineColor ?? i.lineColor ?? null,
|
|
2081
|
+
lineWidthEmu: r?.lineWidthEmu ?? i.lineWidthEmu ?? null,
|
|
2082
|
+
lineDash: r?.lineDash ?? i.chartexStyle?.lineDash ?? "solid",
|
|
2083
|
+
lineCap: i.chartexStyle?.lineCap === "rnd" ? "round" : i.chartexStyle?.lineCap === "sq" ? "square" : "butt",
|
|
2084
|
+
lineJoin: i.chartexStyle?.lineJoin === "round" || i.chartexStyle?.lineJoin === "bevel" ? i.chartexStyle.lineJoin : "miter"
|
|
2085
|
+
}), C = n;
|
|
2086
|
+
}
|
|
2087
|
+
u = T(u, w.flatMap((e) => e.mesh.vertices), c, .08);
|
|
2088
|
+
let D = [], k = {
|
|
2089
|
+
remaining: K,
|
|
2090
|
+
exceeded: !1
|
|
2091
|
+
}, A = w.flatMap((e) => {
|
|
2092
|
+
let t = e.lineWidthEmu == null ? .75 * r : Math.max(.25, e.lineWidthEmu / v * r);
|
|
2093
|
+
return Se(u, e.mesh, e.color, !e.lineHidden && e.lineColor ? {
|
|
2094
|
+
color: `#${e.lineColor}`,
|
|
2095
|
+
width: t,
|
|
2096
|
+
dash: b(e.lineDash, t),
|
|
2097
|
+
cap: e.lineCap,
|
|
2098
|
+
join: e.lineJoin
|
|
2099
|
+
} : void 0, k);
|
|
2100
|
+
});
|
|
2101
|
+
if (k.exceeded) return Te(e, n), !0;
|
|
2102
|
+
for (let t of W(A)) Ce(e, t);
|
|
2103
|
+
for (let n of w) {
|
|
2104
|
+
let a = (n.start + n.end) / 2, o = E.get(n.index);
|
|
2105
|
+
if (Ae(t, i, o)) {
|
|
2106
|
+
let s = i.seriesDataLabels, l = d(o?.fontSizeHpt ?? s?.fontSizeHpt ?? t.dataLabelFontSizeHpt, r) ?? 9 * r;
|
|
2107
|
+
e.font = `${o?.fontBold ?? s?.fontBold ?? t.dataLabelFontBold ? "bold " : ""}${l}px ${Q(t, t.dataLabelFontFace)}`;
|
|
2108
|
+
let f = y({
|
|
2109
|
+
customText: o?.text,
|
|
2110
|
+
showCategory: o?.showCatName ?? s?.showCatName ?? !1,
|
|
2111
|
+
showSeries: o?.showSerName ?? s?.showSerName ?? !1,
|
|
2112
|
+
showValue: o?.showVal ?? s?.showVal ?? t.showDataLabels,
|
|
2113
|
+
showPercent: o?.showPercent ?? s?.showPercent ?? !1,
|
|
2114
|
+
category: i.categories?.[n.index] ?? t.categories[n.index] ?? `${n.index + 1}`,
|
|
2115
|
+
seriesName: i.name || "Series 1",
|
|
2116
|
+
sourceValue: n.value,
|
|
2117
|
+
percentRatio: n.percentValue,
|
|
2118
|
+
formatCode: o?.formatCode ?? s?.formatCode ?? t.dataLabelFormatCode ?? i.valFormatCode,
|
|
2119
|
+
separator: o?.separator ?? s?.separator,
|
|
2120
|
+
date1904: t.date1904
|
|
2121
|
+
}), p = Q(t, t.dataLabelFontFace), m = o?.text && o.richRuns?.length ? g(e, {
|
|
2122
|
+
runs: o.richRuns,
|
|
2123
|
+
ptToPx: r,
|
|
2124
|
+
fontFamily: p,
|
|
2125
|
+
fallbackBold: o.fontBold ?? s?.fontBold ?? t.dataLabelFontBold ?? !1,
|
|
2126
|
+
fontFamilyForFace: (e) => Q(t, e)
|
|
2127
|
+
}, l, `#${o.fontColor ?? s?.fontColor ?? i.labelColor ?? t.dataLabelFontColor ?? "111111"}`) : null, _ = o?.position ?? s?.position ?? t.dataLabelPosition, v = x - S / 2, b = x + S / 2, C = u.cameraDepth(n.centerX, v, n.centerDepth) >= u.cameraDepth(n.centerX, b, n.centerDepth) ? v : b, w = 0, T = null;
|
|
2128
|
+
for (let e = 0; e <= 12; e++) {
|
|
2129
|
+
let t = n.start + (n.end - n.start) * e / 12, r = u.project(n.centerX + Math.cos(t) * h * .64, C, n.centerDepth + Math.sin(t) * h * .64 / u.modelDepth);
|
|
2130
|
+
T && (w += Math.hypot(r.x - T.x, r.y - T.y)), T = r;
|
|
2131
|
+
}
|
|
2132
|
+
let E = (_ == null || _ === "bestFit") && (n.percentValue === 0 || w < (m?.width ?? e.measureText(f).width)) || _ === "outEnd", O = h * (E ? 1.12 : .64), k = u.project(n.centerX + Math.cos(a) * O, C, n.centerDepth + Math.sin(a) * O / u.modelDepth), A = u.project(n.centerX + Math.cos(a) * h, C, n.centerDepth + Math.sin(a) * h / u.modelDepth);
|
|
2133
|
+
D.push(() => ke(e, t, i, 0, n.index, n.value, k, c, r, 0, n.percentValue, o, "ctr", A, E));
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
for (let e of D) e();
|
|
2137
|
+
let j = i.categories?.length ? i.categories : t.categories, M = Array.from({ length: j.length }, (e, t) => {
|
|
2138
|
+
let n = f.get(t), r = n?.fillHidden === !0 ? "00000000" : n?.color ?? i.dataPointColors?.[t] ?? i.color;
|
|
2139
|
+
return r === "00000000" ? "00000000" : me(r ? `#${r}` : fe(t), .8).replace(/^#/, "");
|
|
2140
|
+
});
|
|
2141
|
+
return Pe(e, {
|
|
2142
|
+
...t,
|
|
2143
|
+
categories: j,
|
|
2144
|
+
series: [{
|
|
2145
|
+
...i,
|
|
2146
|
+
categories: j,
|
|
2147
|
+
dataPointColors: M
|
|
2148
|
+
}]
|
|
2149
|
+
}, l, r, !0), !0;
|
|
2150
|
+
}
|
|
2151
|
+
function Ke(e, t, n, r) {
|
|
2152
|
+
return t.threeD ? Ge(e, t, n, r) ? !0 : ue.has(t.chartType) ? We(e, t, n, r) : !1 : !1;
|
|
2153
|
+
}
|
|
2154
|
+
//#endregion
|
|
2155
|
+
//#region src/three-d.ts
|
|
2156
|
+
var qe = { render: Ke };
|
|
2157
|
+
//#endregion
|
|
2158
|
+
export { qe as threeD };
|