@silurus/ooxml 0.40.0 → 0.42.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.
@@ -0,0 +1,1021 @@
1
+ //#region packages/core/src/chart/axis-scale.ts
2
+ function e(e, t = 5) {
3
+ if (e === 0) return 1;
4
+ let n = e / t, r = 10 ** Math.floor(Math.log10(n)), i = n / r;
5
+ return (i < 1.5 ? 1 : i < 3.5 ? 2 : i < 7.5 ? 5 : 10) * r;
6
+ }
7
+ function t(e, t, n = 0) {
8
+ if (e <= 0) return t;
9
+ let r = e + (e - n) / 20;
10
+ return Math.ceil(r / t) * t;
11
+ }
12
+ function n(e, t) {
13
+ if (e >= 0) return 0;
14
+ let n = Math.floor(e / t) * t;
15
+ return Math.abs(n - e) < t * 1e-9 ? n - t : n;
16
+ }
17
+ //#endregion
18
+ //#region packages/core/src/chart/chart-number-format.ts
19
+ function r(e) {
20
+ return Number.isInteger(e) ? String(e) : e.toFixed(6).replace(/\.?0+$/, "");
21
+ }
22
+ function i(e, t) {
23
+ if (!t) return r(e);
24
+ if (a(t)) return o(e, t);
25
+ let n = s(t), i;
26
+ return i = e > 0 ? n[0] ?? t : e < 0 ? n[1] ?? n[0] ?? t : n[2] ?? n[0] ?? t, i === "" ? "" : (e < 0 && n.length < 2 ? "-" : "") + c(Math.abs(e), i);
27
+ }
28
+ function a(e) {
29
+ let t = !1;
30
+ for (let n = 0; n < e.length; n++) {
31
+ let r = e[n];
32
+ if (r === "\"") {
33
+ t = !t;
34
+ continue;
35
+ }
36
+ if (!t) {
37
+ if (r === "\\") {
38
+ n++;
39
+ continue;
40
+ }
41
+ if (r === "[") {
42
+ for (; n < e.length && e[n] !== "]";) n++;
43
+ continue;
44
+ }
45
+ if (r === "y" || r === "Y" || r === "d" || r === "D" || r === "m" || r === "M" || r === "h" || r === "H" || r === "s" || r === "S") return !0;
46
+ }
47
+ }
48
+ return !1;
49
+ }
50
+ function o(e, t) {
51
+ let n = Date.UTC(1899, 11, 30), r = e < 60 ? e + 1 : e, i = n + Math.floor(r) * 864e5, a = new Date(i), o = a.getUTCFullYear(), s = a.getUTCMonth() + 1, c = a.getUTCDate(), l = (e - Math.floor(e)) * 86400, u = Math.floor(l / 3600), d = Math.floor(l % 3600 / 60), f = Math.floor(l % 60), p = "", m = !1, h = 0;
52
+ for (; h < t.length;) {
53
+ let e = t[h];
54
+ if (e === "\"") {
55
+ m = !m, h++;
56
+ continue;
57
+ }
58
+ if (m) {
59
+ p += e, h++;
60
+ continue;
61
+ }
62
+ if (e === "\\" && h + 1 < t.length) {
63
+ p += t[h + 1], h += 2;
64
+ continue;
65
+ }
66
+ if (e === "[") {
67
+ for (; h < t.length && t[h] !== "]";) h++;
68
+ h < t.length && h++;
69
+ continue;
70
+ }
71
+ if (e === "y" || e === "Y") {
72
+ let e = 0;
73
+ for (; h < t.length && (t[h] === "y" || t[h] === "Y");) e++, h++;
74
+ p += e >= 3 ? String(o) : String(o % 100).padStart(2, "0");
75
+ continue;
76
+ }
77
+ if (e === "m" || e === "M") {
78
+ let e = 0;
79
+ for (; h < t.length && (t[h] === "m" || t[h] === "M");) e++, h++;
80
+ p.match(/[Hh]+\W*$/) ? p += e >= 2 ? String(d).padStart(2, "0") : String(d) : p += e >= 2 ? String(s).padStart(2, "0") : String(s);
81
+ continue;
82
+ }
83
+ if (e === "d" || e === "D") {
84
+ let e = 0;
85
+ for (; h < t.length && (t[h] === "d" || t[h] === "D");) e++, h++;
86
+ p += e >= 2 ? String(c).padStart(2, "0") : String(c);
87
+ continue;
88
+ }
89
+ if (e === "h" || e === "H") {
90
+ let e = 0;
91
+ for (; h < t.length && (t[h] === "h" || t[h] === "H");) e++, h++;
92
+ p += e >= 2 ? String(u).padStart(2, "0") : String(u);
93
+ continue;
94
+ }
95
+ if (e === "s" || e === "S") {
96
+ let e = 0;
97
+ for (; h < t.length && (t[h] === "s" || t[h] === "S");) e++, h++;
98
+ p += e >= 2 ? String(f).padStart(2, "0") : String(f);
99
+ continue;
100
+ }
101
+ p += e, h++;
102
+ }
103
+ return p;
104
+ }
105
+ function s(e) {
106
+ let t = [], n = "";
107
+ for (let r = 0; r < e.length; r++) {
108
+ let i = e[r];
109
+ if (i === "\\" && r + 1 < e.length) {
110
+ n += i + e[r + 1], r++;
111
+ continue;
112
+ }
113
+ if (i === "\"") {
114
+ for (n += i, r++; r < e.length && e[r] !== "\"";) n += e[r], r++;
115
+ r < e.length && (n += e[r]);
116
+ continue;
117
+ }
118
+ if (i === "[") {
119
+ for (n += i, r++; r < e.length && e[r] !== "]";) n += e[r], r++;
120
+ r < e.length && (n += e[r]);
121
+ continue;
122
+ }
123
+ if (i === ";") {
124
+ t.push(n), n = "";
125
+ continue;
126
+ }
127
+ n += i;
128
+ }
129
+ return t.push(n), t;
130
+ }
131
+ function c(e, t) {
132
+ let n = [], r = 0, i = !1, a = !1;
133
+ for (; r < t.length;) {
134
+ let e = t[r];
135
+ if (e === "\"") {
136
+ r++;
137
+ let e = "";
138
+ for (; r < t.length && t[r] !== "\"";) e += t[r], r++;
139
+ r < t.length && r++, n.push({
140
+ kind: "lit",
141
+ text: e
142
+ });
143
+ continue;
144
+ }
145
+ if (e === "\\" && r + 1 < t.length) {
146
+ n.push({
147
+ kind: "lit",
148
+ text: t[r + 1]
149
+ }), r += 2;
150
+ continue;
151
+ }
152
+ if (e === "_" && r + 1 < t.length) {
153
+ n.push({
154
+ kind: "lit",
155
+ text: " "
156
+ }), r += 2;
157
+ continue;
158
+ }
159
+ if (e === "*" && r + 1 < t.length) {
160
+ r += 2;
161
+ continue;
162
+ }
163
+ if (e === "[") {
164
+ for (r++; r < t.length && t[r] !== "]";) r++;
165
+ r < t.length && r++;
166
+ continue;
167
+ }
168
+ if (e === "%") {
169
+ a = !0, n.push({
170
+ kind: "lit",
171
+ text: "%"
172
+ }), r++;
173
+ continue;
174
+ }
175
+ if (e === "#" || e === "0" || e === "." || e === "," || e === "?") {
176
+ let e = "";
177
+ for (; r < t.length && (t[r] === "#" || t[r] === "0" || t[r] === "." || t[r] === "," || t[r] === "?");) e += t[r], r++;
178
+ n.push({
179
+ kind: "num",
180
+ text: e
181
+ }), i = !0;
182
+ continue;
183
+ }
184
+ n.push({
185
+ kind: "lit",
186
+ text: e
187
+ }), r++;
188
+ }
189
+ if (!i) return n.map((e) => e.text).join("");
190
+ let o = a ? e * 100 : e, s = "";
191
+ for (let e of n) e.kind === "num" && (s += e.text);
192
+ let c = l(o, s), u = !1;
193
+ return n.map((e) => e.kind === "lit" ? e.text : u ? "" : (u = !0, c)).join("");
194
+ }
195
+ function l(e, t) {
196
+ let n = t.indexOf("."), r = n >= 0 ? t.slice(0, n) : t, i = n >= 0 ? t.slice(n + 1) : "", a = /,/.test(r), o = (i.match(/[#0?]/g) ?? []).length, s = (r.replace(/,/g, "").match(/0/g) ?? []).length, [c, l = ""] = e.toFixed(o).split("."), u = c.padStart(s, "0"), d = a ? u.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : u;
197
+ return o === 0 ? d : `${d}.${l.padEnd(o, "0")}`;
198
+ }
199
+ //#endregion
200
+ //#region packages/core/src/chart/renderer.ts
201
+ var u = [
202
+ "4472C4",
203
+ "ED7D31",
204
+ "A9D18E",
205
+ "FF0000",
206
+ "70AD47",
207
+ "4BACC6",
208
+ "FFC000",
209
+ "9E480E",
210
+ "843C0C",
211
+ "636363",
212
+ "255E91",
213
+ "967300"
214
+ ];
215
+ function d(e, t) {
216
+ return t?.color ? `#${t.color}` : `#${u[e % u.length]}`;
217
+ }
218
+ function f(e, t) {
219
+ let n = t.dataPointColors?.[e];
220
+ return n ? `#${n}` : `#${u[e % u.length]}`;
221
+ }
222
+ function p(e, t) {
223
+ let n = e.startsWith("#") ? e.slice(1) : e;
224
+ return `rgba(${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)},${t})`;
225
+ }
226
+ function m(e, t, n, r, i, a, o, s) {
227
+ e.save(), e.font = `${s}px sans-serif`, e.fillStyle = "#555", o === "cat" ? (e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t.slice(0, 30), n + i / 2, r + a + s + 2)) : (e.translate(n - s - 4, r + a / 2), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", e.fillText(t.slice(0, 30), 0, 0)), e.restore();
228
+ }
229
+ function h(e) {
230
+ return e && (e === "line" || e === "stackedLine" || e === "stackedLinePct" || e === "radar" || e === "scatter") ? "line" : "fill";
231
+ }
232
+ function g(e, t, n, r, i, a, o) {
233
+ if (e.fillStyle = n, t === "line") {
234
+ e.strokeStyle = n;
235
+ let t = e.lineWidth;
236
+ e.lineWidth = Math.max(1.5, o * .15), e.beginPath();
237
+ let s = i + o / 2;
238
+ e.moveTo(r, s), e.lineTo(r + a, s), e.stroke(), e.lineWidth = t;
239
+ } else e.fillRect(r, i, a, o);
240
+ }
241
+ function _(e, t, n, r, i, a, o = "vertical", s) {
242
+ let c = h(s);
243
+ if (o === "horizontal") {
244
+ let o = Math.max(9, Math.min(12, a * .7));
245
+ e.font = `${o}px sans-serif`, e.textBaseline = "middle";
246
+ let s = t.map((e, t) => e.name || `Series ${t + 1}`), l = s.map((t) => 14 + e.measureText(t.slice(0, 30)).width), u = n + (i - (l.reduce((e, t) => e + t, 0) + 12 * Math.max(0, t.length - 1))) / 2, f = r + a / 2;
247
+ for (let n = 0; n < t.length; n++) g(e, c, d(n, t[n]), u, f - o / 2, 10, o), e.fillStyle = "#333", e.textAlign = "left", e.fillText(s[n].slice(0, 30), u + 10 + 4, f), u += l[n] + 12;
248
+ return;
249
+ }
250
+ let l = Math.max(9, Math.min(12, a / (t.length + 1)));
251
+ e.font = `${l}px sans-serif`, e.textBaseline = "middle";
252
+ let u = l + 4, f = r + (a - u * t.length) / 2;
253
+ for (let r = 0; r < t.length; r++) {
254
+ g(e, c, d(r, t[r]), n, f, 10, l), e.fillStyle = "#333", e.textAlign = "left";
255
+ let i = t[r].name || `Series ${r + 1}`;
256
+ e.fillText(i.slice(0, 20), n + 10 + 4, f + l / 2), f += u;
257
+ }
258
+ }
259
+ function v(e, t, n) {
260
+ if (!e.showLegend) return null;
261
+ let r = e.legendPos ?? "r", i = r === "l" ? "l" : r === "t" ? "t" : r === "b" ? "b" : "r";
262
+ return i === "r" || i === "l" ? {
263
+ side: i,
264
+ reserveW: Math.max(80, t * .22),
265
+ reserveH: 0
266
+ } : {
267
+ side: i,
268
+ reserveW: 0,
269
+ reserveH: Math.max(18, n * .08)
270
+ };
271
+ }
272
+ function y(e, t, n, r, i, a, o, s, c, l, u, d) {
273
+ if (!n) return;
274
+ let f = t.legendManualLayout;
275
+ if (f && f.xMode === "edge" && f.yMode === "edge" && f.w > 0 && f.h > 0) {
276
+ let n = r + f.x * a, s = i + f.y * o, c = f.w * a, l = f.h * o, u = c >= l ? "horizontal" : "vertical";
277
+ _(e, t.series, n, s, c, l, u, t.chartType);
278
+ return;
279
+ }
280
+ switch (n.side) {
281
+ case "r":
282
+ _(e, t.series, r + a - n.reserveW + 4, c, n.reserveW - 8, u, "vertical", t.chartType);
283
+ break;
284
+ case "l":
285
+ _(e, t.series, r + 4, c, n.reserveW - 8, u, "vertical", t.chartType);
286
+ break;
287
+ case "t":
288
+ _(e, t.series, s, i + d, l, n.reserveH, "horizontal", t.chartType);
289
+ break;
290
+ case "b":
291
+ _(e, t.series, s, i + o - n.reserveH, l, n.reserveH, "horizontal", t.chartType);
292
+ break;
293
+ }
294
+ }
295
+ function b(e, t, n, r, i, a, o) {
296
+ if (t === "none" || !t) return;
297
+ let s = o ? Math.max(4, o + 2) : 4, c = e.strokeStyle, l = e.lineWidth;
298
+ if (e.strokeStyle = a ?? "#888", e.lineWidth = o ?? 1, e.beginPath(), n === "val") {
299
+ let n = r, a = i, o = t === "out" || t === "cross" ? -s : 0, c = t === "in" || t === "cross" ? s : 0;
300
+ e.moveTo(n + o, a), e.lineTo(n + c, a);
301
+ } else {
302
+ let n = r, a = i, o = t === "out" || t === "cross" ? s : 0, c = t === "in" || t === "cross" ? -s : 0;
303
+ e.moveTo(a, n + o), e.lineTo(a, n + c);
304
+ }
305
+ e.stroke(), e.strokeStyle = c, e.lineWidth = l;
306
+ }
307
+ function x(e, t, n) {
308
+ return e.titleFontSizeHpt ? e.titleFontSizeHpt / 100 * n : Math.max(10, t * .085);
309
+ }
310
+ function S(e, t, n) {
311
+ return e ? e / 100 * n : Math.max(8, t * .045);
312
+ }
313
+ function C(e, t, n, r, i, a) {
314
+ t.title && (e.font = `bold ${a}px ${t.titleFontFace ? `"${t.titleFontFace}", Calibri, Arial, sans-serif` : "Calibri, Arial, sans-serif"}`, e.fillStyle = t.titleFontColor ? `#${t.titleFontColor}` : "#333", e.textAlign = "center", e.textBaseline = "top", e.fillText(t.title, n + i / 2, r));
315
+ }
316
+ function w(e) {
317
+ if (e.categories.length > 0) return e.categories;
318
+ let t = e.series[0];
319
+ if (t?.categories && t.categories.length > 0) return t.categories;
320
+ let n = 0;
321
+ for (let t of e.series) t.values.length > n && (n = t.values.length);
322
+ return n > 0 ? Array.from({ length: n }, (e, t) => String(t + 1)) : [];
323
+ }
324
+ function T(e, t, n, r, i, a, o, s, c) {
325
+ let l = s ?? "outEnd";
326
+ if (e.fillStyle = c ? `#${c}` : "#333", o === "vertical") {
327
+ let o = n + a / 2;
328
+ l === "inBase" ? (e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t, o, r + i - 2)) : l === "inEnd" ? (e.textAlign = "center", e.textBaseline = "top", e.fillText(t, o, r + 2)) : l === "ctr" ? (e.textAlign = "center", e.textBaseline = "middle", e.fillText(t, o, r + i / 2)) : (e.textAlign = "center", e.textBaseline = "bottom", e.fillText(t, o, r - 1));
329
+ } else {
330
+ let o = r + a / 2;
331
+ l === "inBase" ? (e.textAlign = "left", e.textBaseline = "middle", e.fillText(t, n + 4, o)) : l === "inEnd" ? (e.textAlign = "right", e.textBaseline = "middle", e.fillText(t, n + i - 4, o)) : l === "ctr" ? (e.textAlign = "center", e.textBaseline = "middle", e.fillText(t, n + i / 2, o)) : (e.textAlign = "left", e.textBaseline = "middle", e.fillText(t, n + i + 2, o));
332
+ }
333
+ }
334
+ function E(n, r, a, o) {
335
+ let { x: s, y: c, w: l, h: u } = a, f = r.chartType === "clusteredBarH" || r.chartType === "stackedBarH" || r.chartType === "stackedBarHPct", p = r.chartType.startsWith("stacked"), h = r.chartType === "stackedBarPct" || r.chartType === "stackedBarHPct", g = r.series.filter((e) => e.seriesType !== "line"), _ = r.series.filter((e) => e.seriesType === "line"), b = w(r), S = b.length;
336
+ if (S === 0) return;
337
+ let E = r.title ? x(r, u, o) : 0, D = r.title ? u * .02 : 0, O = r.title ? u * .025 : 0, k = r.title ? E + D + O : 0, A = v(r, l, u), j = A?.side === "r" ? A.reserveW : 0, M = A?.side === "l" ? A.reserveW : 0, N = A?.side === "t" ? A.reserveH : 0, P = A?.side === "b" ? A.reserveH : 0, F = Math.max(8, Math.min(10, u * .045)), I = r.catAxisTitle ? F + 4 : 0, L = r.valAxisTitle ? F + 4 : 0, R = {
338
+ t: k + N + u * .02,
339
+ r: j + l * .03,
340
+ b: u * .14 + I + P,
341
+ l: l * .12 + L + M
342
+ };
343
+ f && (R.l = (r.catAxisHidden ? l * .03 : l * .22) + L + M, R.b = (r.valAxisHidden ? u * .02 : u * .08) + I + P), C(n, r, s, c + D, l, E);
344
+ let z = r.plotAreaManualLayout, B, V, H, U;
345
+ if (z && z.w != null && z.h != null ? (B = s + z.x * l, V = c + z.y * u, H = z.w * l, U = z.h * u) : (B = s + R.l, V = c + R.t, H = l - R.l - R.r, U = u - R.t - R.b), H <= 0 || U <= 0) return;
346
+ r.plotAreaBg && (n.fillStyle = `#${r.plotAreaBg}`, n.fillRect(B, V, H, U));
347
+ let W = 0;
348
+ for (let e = 0; e < S; e++) {
349
+ let t = 0;
350
+ for (let n of g) {
351
+ let r = n.values[e] ?? 0;
352
+ p ? t += Math.abs(r) : W = Math.max(W, Math.abs(r));
353
+ }
354
+ p && (W = Math.max(W, t));
355
+ }
356
+ h && (W = 100), r.valMax != null && (W = r.valMax), W === 0 && (W = 1);
357
+ let G = e(W), K = r.valMax ?? t(W, G), q = "#e0e0e0", J = Math.round(K / G);
358
+ if (n.textBaseline = "middle", n.font = `${Math.max(8, Math.min(11, U / 20))}px sans-serif`, n.fillStyle = "#555", !r.valAxisHidden) for (let e = 0; e <= J; e++) {
359
+ let t = e * G, a = h ? `${Math.round(t)}%` : i(t, r.valAxisFormatCode);
360
+ if (f) {
361
+ let r = B + t / K * H;
362
+ n.strokeStyle = e === 0 ? "#aaa" : q, n.lineWidth = e === 0 ? 1 : .5, n.beginPath(), n.moveTo(r, V), n.lineTo(r, V + U), n.stroke(), n.textAlign = "center", n.fillText(a, r, V + U + 10);
363
+ } else {
364
+ let r = V + U - t / K * U;
365
+ n.strokeStyle = e === 0 ? "#aaa" : q, n.lineWidth = e === 0 ? 1 : .5, n.beginPath(), n.moveTo(B, r), n.lineTo(B + H, r), n.stroke(), n.textAlign = "right", n.fillText(a, B - 4, r);
366
+ }
367
+ }
368
+ n.strokeStyle = "#aaa", n.lineWidth = 1, f ? !r.valAxisHidden && !r.valAxisLineHidden && (n.beginPath(), n.moveTo(B, V), n.lineTo(B, V + U), n.stroke()) : !r.catAxisHidden && !r.catAxisLineHidden && (n.beginPath(), n.moveTo(B, V + U), n.lineTo(B + H, V + U), n.stroke());
369
+ let Y = f ? U / S : H / S, X = p ? 1 : Math.max(1, g.length), Z = p ? 0 : r.barOverlap ?? 0, Q = r.barGapWidth ?? 150, $ = Y / (1 + (X - 1) * (1 - Z / 100) + Q / 100), ee = p ? 0 : $ * (1 - Z / 100), te = (Y - ($ + (X - 1) * ee)) / 2;
370
+ for (let e = 0; e < S; e++) {
371
+ let t = 0, a = 0;
372
+ if (h) {
373
+ for (let t of g) a += Math.abs(t.values[e] ?? 0);
374
+ a === 0 && (a = 1);
375
+ }
376
+ for (let s = 0; s < g.length; s++) {
377
+ let c = g[s], l = c.values[e] ?? 0, u = h ? Math.abs(l) / a * 100 : Math.abs(l), m = d(s, c);
378
+ if (f) {
379
+ let a = p ? s : g.length - 1 - s, l = p ? V + (S - 1 - e) * Y + te : V + (S - 1 - e) * Y + te + a * ee, d = u / K * H, f = p ? B + t / K * H : B;
380
+ n.fillStyle = m, n.fillRect(f, l, d, $), r.showDataLabels && u > 0 && (n.font = `bold ${r.dataLabelFontSizeHpt ? r.dataLabelFontSizeHpt / 100 * o : Math.max(7, Math.min(11, $ * .6))}px sans-serif`, T(n, h ? `${Math.round(u)}%` : i(u, r.dataLabelFormatCode ?? c.valFormatCode ?? null), f, l, d, $, "horizontal", r.dataLabelPosition ?? null, c.labelColor ?? r.dataLabelFontColor ?? null));
381
+ } else {
382
+ let a = p ? B + e * Y + te : B + e * Y + te + s * ee, l = u / K * U, d = V + U - (p ? t + u : u) / K * U;
383
+ n.fillStyle = m, n.fillRect(a, d, $, l), r.showDataLabels && u > 0 && (n.font = `bold ${r.dataLabelFontSizeHpt ? r.dataLabelFontSizeHpt / 100 * o : Math.max(7, Math.min(11, $ * .6))}px sans-serif`, T(n, h ? `${Math.round(u)}%` : i(u, r.dataLabelFormatCode ?? c.valFormatCode ?? null), a, d, l, $, "vertical", r.dataLabelPosition ?? null, c.labelColor ?? r.dataLabelFontColor ?? null));
384
+ }
385
+ p && (t += u);
386
+ }
387
+ }
388
+ if (!r.catAxisHidden) {
389
+ n.fillStyle = "#555", n.font = `${Math.max(8, Math.min(11, Y * .5))}px sans-serif`;
390
+ for (let e = 0; e < S; e++) {
391
+ let t = (b[e] ?? "").toString().slice(0, 12);
392
+ if (f) {
393
+ let r = V + (S - 1 - e) * Y + Y / 2;
394
+ n.textAlign = "right", n.textBaseline = "middle", n.fillText(t, B - 4, r);
395
+ } else {
396
+ let r = B + e * Y + Y / 2;
397
+ n.textAlign = "center", n.textBaseline = "top", n.fillText(t, r, V + U + 3);
398
+ }
399
+ }
400
+ }
401
+ if (_.length > 0 && !f) for (let e = 0; e < _.length; e++) {
402
+ let t = _[e], r = d(g.length + e, t);
403
+ n.strokeStyle = r, n.lineWidth = 2, n.setLineDash([]), n.beginPath();
404
+ let i = !1;
405
+ for (let e = 0; e < S; e++) {
406
+ let r = t.values[e];
407
+ if (r == null) {
408
+ i = !1;
409
+ continue;
410
+ }
411
+ let a = B + e * Y + Y / 2, o = V + U - r / K * U;
412
+ i ? n.lineTo(a, o) : (n.moveTo(a, o), i = !0);
413
+ }
414
+ if (n.stroke(), t.showMarker !== !1) for (let e = 0; e < S; e++) {
415
+ let i = t.values[e];
416
+ if (i == null) continue;
417
+ let a = B + e * Y + Y / 2, o = V + U - i / K * U;
418
+ n.fillStyle = r, n.beginPath(), n.arc(a, o, 3, 0, Math.PI * 2), n.fill();
419
+ }
420
+ }
421
+ y(n, f && !p ? {
422
+ ...r,
423
+ series: [...r.series].reverse()
424
+ } : r, A, s, c, l, u, B, V, H, U, k + 2), r.catAxisTitle && m(n, r.catAxisTitle, B, V, H, U, "cat", F), r.valAxisTitle && m(n, r.valAxisTitle, B, V, H, U, "val", F);
425
+ }
426
+ function D(a, o, s, c) {
427
+ let { x: l, y: u, w: f, h: p } = s, h = w(o), g = h.length;
428
+ if (g === 0) return;
429
+ let _ = o.title ? x(o, p, c) : 0, T = o.title ? p * .045 : 0, E = o.title ? p * .035 : 0, D = o.title ? _ + T + E : 0, O = v(o, f, p), k = O?.side === "r" ? O.reserveW : 0, A = O?.side === "l" ? O.reserveW : 0, j = O?.side === "t" ? O.reserveH : 0, M = O?.side === "b" ? O.reserveH : 0, N = S(o.catAxisFontSizeHpt, p, c), P = S(o.valAxisFontSizeHpt, p, c), F = Math.max(N, P), I = o.catAxisTitle ? F + 4 : 0, L = o.valAxisTitle ? F + 4 : 0, R = {
430
+ t: D + j + P / 2 + 2,
431
+ r: k + f * .05,
432
+ b: N + 12 + I + M,
433
+ l: P * 2.2 + 10 + L + A
434
+ };
435
+ C(a, o, l, u + T, f, _);
436
+ let z = l + R.l, B = u + R.t, V = f - R.l - R.r, H = p - R.t - R.b;
437
+ if (V <= 0 || H <= 0) return;
438
+ o.plotAreaBg && (a.fillStyle = `#${o.plotAreaBg}`, a.fillRect(z, B, V, H));
439
+ let U = Infinity, W = -Infinity;
440
+ for (let e of o.series) for (let t of e.values) t != null && (U = Math.min(U, t), W = Math.max(W, t));
441
+ isFinite(U) || (U = 0, W = 1), o.valMin == null ? U > 0 && (U = 0) : U = o.valMin, o.valMax == null ? W < 0 && (W = 0) : W = o.valMax, W === U && (W = U + 1);
442
+ let G = e(W - U), K = o.valMin ?? n(U, G), q = o.valMax ?? t(W, G), J = q - K;
443
+ if (J === 0) return;
444
+ let Y = (e) => B + H - (e - K) / J * H, X = o.catAxisCrossBetween === "midCat" ? (e) => z + (g === 1 ? V / 2 : e / (g - 1) * V) : (e) => z + (e + .5) / g * V;
445
+ if (!o.valAxisHidden) {
446
+ let e = Math.round((q - K) / G);
447
+ a.font = `${P}px sans-serif`, a.textBaseline = "middle";
448
+ for (let t = 0; t <= e; t++) {
449
+ let e = K + t * G, n = Y(e);
450
+ a.strokeStyle = e === 0 ? "#aaa" : "#e0e0e0", a.lineWidth = e === 0 ? 1 : .5, a.beginPath(), a.moveTo(z, n), a.lineTo(z + V, n), a.stroke(), b(a, o.valAxisMajorTickMark, "val", z, n), a.fillStyle = "#555", a.textAlign = "right", a.fillText(i(e, o.valAxisFormatCode), z - 6, n);
451
+ }
452
+ }
453
+ a.strokeStyle = "#aaa", a.lineWidth = 1, !o.catAxisHidden && !o.catAxisLineHidden && (a.beginPath(), a.moveTo(z, B + H), a.lineTo(z + V, B + H), a.stroke()), !o.valAxisHidden && !o.valAxisLineHidden && (a.beginPath(), a.moveTo(z, B), a.lineTo(z, B + H), a.stroke());
454
+ let Z = Math.max(1, 2.25 * c), Q = Math.max(2, 2.5 * c), $ = S(o.dataLabelFontSizeHpt, p, c);
455
+ for (let e = 0; e < o.series.length; e++) {
456
+ let t = o.series[e], n = d(e, t);
457
+ a.strokeStyle = n, a.lineWidth = Z, a.setLineDash([]), a.beginPath();
458
+ let i = !1;
459
+ for (let e = 0; e < g; e++) {
460
+ let n = t.values[e];
461
+ if (n == null) {
462
+ i = !1;
463
+ continue;
464
+ }
465
+ let r = X(e), o = Y(n);
466
+ i ? a.lineTo(r, o) : (a.moveTo(r, o), i = !0);
467
+ }
468
+ a.stroke(), a.fillStyle = n;
469
+ let s = t.showMarker !== !1;
470
+ for (let e = 0; e < g; e++) {
471
+ let i = t.values[e];
472
+ if (i != null && (s && (a.beginPath(), a.arc(X(e), Y(i), Q, 0, Math.PI * 2), a.fill()), o.showDataLabels)) {
473
+ a.font = `${$}px sans-serif`, a.fillStyle = "#333", a.textAlign = "center", a.textBaseline = "bottom";
474
+ let t = s ? Q + 1 : 2;
475
+ a.fillText(r(i), X(e), Y(i) - t), a.fillStyle = n;
476
+ }
477
+ }
478
+ }
479
+ if (!o.catAxisHidden) {
480
+ let e = Math.max(1, Math.ceil(g / 8));
481
+ a.fillStyle = "#555", a.textAlign = "center", a.textBaseline = "top", a.font = `${N}px sans-serif`;
482
+ for (let t = 0; t < g; t += e) {
483
+ let e = X(t);
484
+ b(a, o.catAxisMajorTickMark, "cat", B + H, e), a.fillStyle = "#555", a.fillText((h[t] ?? "").toString().slice(0, 10), e, B + H + 5);
485
+ }
486
+ }
487
+ y(a, o, O, l, u, f, p, z, B, V, H, D + 2), o.catAxisTitle && m(a, o.catAxisTitle, z, B, V, H, "cat", F), o.valAxisTitle && m(a, o.valAxisTitle, z, B, V, H, "val", F);
488
+ }
489
+ function O(n, r, a, o) {
490
+ let { x: s, y: c, w: l, h: u } = a, f = w(r), h = f.length;
491
+ if (h === 0) return;
492
+ let g = r.chartType === "stackedArea" || r.chartType === "stackedAreaPct", _ = r.title ? x(r, u, o) : 0, b = r.title ? u * .035 : 0, S = r.title ? u * .035 : 0, T = r.title ? _ + b + S : 0, E = v(r, l, u), D = E?.side === "r" ? E.reserveW : 0, O = E?.side === "l" ? E.reserveW : 0, k = E?.side === "t" ? E.reserveH : 0, A = E?.side === "b" ? E.reserveH : 0, j = Math.max(8, Math.min(10, u * .045)), M = r.catAxisTitle ? j + 4 : 0, N = r.valAxisTitle ? j + 4 : 0, P = {
493
+ t: T + k + u * .02,
494
+ r: D + l * .05,
495
+ b: u * .14 + M + A,
496
+ l: l * .12 + N + O
497
+ };
498
+ C(n, r, s, c + b, l, _);
499
+ let F = s + P.l, I = c + P.t, L = l - P.l - P.r, R = u - P.t - P.b;
500
+ if (L <= 0 || R <= 0) return;
501
+ r.plotAreaBg && (n.fillStyle = `#${r.plotAreaBg}`, n.fillRect(F, I, L, R));
502
+ let z = 0;
503
+ for (let e = 0; e < h; e++) if (g) {
504
+ let t = 0;
505
+ for (let n of r.series) t += n.values[e] ?? 0;
506
+ z = Math.max(z, t);
507
+ } else for (let t of r.series) z = Math.max(z, t.values[e] ?? 0);
508
+ r.valMax != null && (z = r.valMax), z === 0 && (z = 1);
509
+ let B = e(z), V = r.valMax ?? t(z, B), H = (e) => F + (h === 1 ? L / 2 : e / (h - 1) * L), U = (e) => I + R - e / V * R;
510
+ if (!r.valAxisHidden) {
511
+ n.font = `${Math.max(8, Math.min(11, R / 20))}px sans-serif`, n.textBaseline = "middle";
512
+ let e = Math.round(V / B);
513
+ for (let t = 0; t <= e; t++) {
514
+ let e = t * B, a = U(e);
515
+ n.strokeStyle = t === 0 ? "#aaa" : "#e0e0e0", n.lineWidth = t === 0 ? 1 : .5, n.beginPath(), n.moveTo(F, a), n.lineTo(F + L, a), n.stroke(), n.fillStyle = "#555", n.textAlign = "right", n.fillText(i(e, r.valAxisFormatCode), F - 4, a);
516
+ }
517
+ }
518
+ !r.catAxisHidden && !r.catAxisLineHidden && (n.strokeStyle = "#aaa", n.lineWidth = 1, n.beginPath(), n.moveTo(F, I + R), n.lineTo(F + L, I + R), n.stroke());
519
+ let W = g ? Array(h).fill(0) : null;
520
+ for (let e = r.series.length - 1; e >= 0; e--) {
521
+ let t = r.series[e], i = d(e, t), a = I + R;
522
+ if (n.beginPath(), g && W) {
523
+ for (let e = 0; e < h; e++) {
524
+ let r = (t.values[e] ?? 0) + W[e], i = H(e), a = U(r);
525
+ e === 0 ? n.moveTo(i, a) : n.lineTo(i, a);
526
+ }
527
+ for (let e = h - 1; e >= 0; e--) n.lineTo(H(e), U(W[e]));
528
+ for (let e = 0; e < h; e++) W[e] += t.values[e] ?? 0;
529
+ } else {
530
+ n.moveTo(H(0), a);
531
+ for (let e = 0; e < h; e++) n.lineTo(H(e), U(t.values[e] ?? 0));
532
+ n.lineTo(H(h - 1), a);
533
+ }
534
+ n.closePath(), n.fillStyle = p(i, .6), n.fill(), n.strokeStyle = i, n.lineWidth = 1.5, n.setLineDash([]), n.stroke();
535
+ }
536
+ if (!r.catAxisHidden) {
537
+ let e = Math.max(1, Math.ceil(h / 8));
538
+ n.fillStyle = "#555", n.textAlign = "center", n.textBaseline = "top", n.font = `${Math.max(8, Math.min(11, L / h * .8))}px sans-serif`;
539
+ for (let t = 0; t < h; t += e) n.fillText((f[t] ?? "").toString().slice(0, 10), H(t), I + R + 3);
540
+ }
541
+ y(n, r, E, s, c, l, u, F, I, L, R, T + 2), r.catAxisTitle && m(n, r.catAxisTitle, F, I, L, R, "cat", j), r.valAxisTitle && m(n, r.valAxisTitle, F, I, L, R, "val", j);
542
+ }
543
+ function k(e, t, n, r, i) {
544
+ let { x: a, y: o, w: s, h: c } = n, l = t.series[0];
545
+ if (!l) return;
546
+ let d = l.categories && l.categories.length > 0 ? l.categories : t.categories, p = l.values.map((e) => Math.abs(e ?? 0)), m = p.reduce((e, t) => e + t, 0);
547
+ if (m === 0) return;
548
+ let h = t.title ? x(t, c, i) : 0, g = t.title ? c * .035 : 0, _ = t.title ? c * .035 : 0, v = t.title ? h + g + _ : 0;
549
+ C(e, t, a, o + g, s, h);
550
+ let b = t.showLegend ? (() => {
551
+ let e = t.legendPos ?? "r", n = e === "l" ? "l" : e === "t" ? "t" : e === "b" ? "b" : "r";
552
+ return n === "r" || n === "l" ? {
553
+ side: n,
554
+ reserveW: Math.max(80, s * .28),
555
+ reserveH: 0
556
+ } : {
557
+ side: n,
558
+ reserveW: 0,
559
+ reserveH: Math.max(18, c * .08)
560
+ };
561
+ })() : null, S = b?.side === "r" ? b.reserveW : 0, w = b?.side === "l" ? b.reserveW : 0, T = b?.side === "t" ? b.reserveH : 0, E = b?.side === "b" ? b.reserveH : 0, D = s - S - w, O = c - v - T - E - c * .02, k = a + w + D / 2, A = o + v + T + c * .02 + O / 2, j = Math.min(D, O) * .42, M = r ? j * .5 : 0, N = -Math.PI / 2;
562
+ for (let n = 0; n < p.length; n++) {
563
+ let i = p[n] / m * Math.PI * 2, a = f(n, l);
564
+ if (e.beginPath(), e.moveTo(k, A), e.arc(k, A, j, N, N + i), e.closePath(), e.fillStyle = a, e.fill(), e.strokeStyle = "#fff", e.lineWidth = 1, e.stroke(), t.showDataLabels && i > .15) {
565
+ let t = N + i / 2, a = j * (r ? .75 : .6), o = k + Math.cos(t) * a, s = A + Math.sin(t) * a, c = Math.round(p[n] / m * 100);
566
+ e.font = `bold ${Math.max(8, j * .1)}px sans-serif`, e.fillStyle = "#fff", e.textAlign = "center", e.textBaseline = "middle", e.fillText(`${c}%`, o, s);
567
+ }
568
+ N += i;
569
+ }
570
+ if (r && (e.beginPath(), e.arc(k, A, M, 0, Math.PI * 2), e.fillStyle = "#fff", e.fill()), b) {
571
+ let n = p.map((e, t) => ({
572
+ name: (d[t] ?? `Item ${t + 1}`).toString(),
573
+ color: l.dataPointColors?.[t] ?? l.color ?? u[t % u.length],
574
+ values: []
575
+ })), r = k - D / 2;
576
+ y(e, {
577
+ ...t,
578
+ series: n
579
+ }, b, a, o, s, c, r, A - O / 2, D, O, v + 2);
580
+ }
581
+ }
582
+ function A(n, i, a, o) {
583
+ let { x: s, y: c, w: l, h: u } = a, f = w(i), m = f.length;
584
+ if (m < 3) return;
585
+ let h = i.title ? x(i, u, o) : 0, g = i.title ? u * .035 : 0, _ = i.title ? u * .035 : 0, b = i.title ? h + g + _ : 0, T = v(i, l, u), E = T?.side === "r" ? T.reserveW : 0, D = T?.side === "l" ? T.reserveW : 0, O = T?.side === "t" ? T.reserveH : 0, k = T?.side === "b" ? T.reserveH : 0;
586
+ C(n, i, s, c + g, l, h);
587
+ let A = l - E - D, j = u - b - O - k - u * .02, M = s + D + A / 2, N = c + b + O + u * .02 + j / 2, P = Math.min(A, j) * .38, F = 0;
588
+ for (let e of i.series) for (let t of e.values) F = Math.max(F, t ?? 0);
589
+ i.valMax != null && (F = i.valMax), F === 0 && (F = 1);
590
+ let I = e(F), L = i.valMax ?? t(F, I), R = -Math.PI / 2, z = (e) => R + e / m * Math.PI * 2, B = Math.round(L / I);
591
+ n.strokeStyle = "#ddd", n.lineWidth = .5;
592
+ for (let e = 1; e <= B; e++) {
593
+ let t = e / B * P;
594
+ n.beginPath();
595
+ for (let e = 0; e < m; e++) {
596
+ let r = z(e), i = M + Math.cos(r) * t, a = N + Math.sin(r) * t;
597
+ e === 0 ? n.moveTo(i, a) : n.lineTo(i, a);
598
+ }
599
+ n.closePath(), n.stroke();
600
+ }
601
+ n.strokeStyle = "#bbb", n.lineWidth = .5;
602
+ for (let e = 0; e < m; e++) {
603
+ let t = z(e);
604
+ n.beginPath(), n.moveTo(M, N), n.lineTo(M + Math.cos(t) * P, N + Math.sin(t) * P), n.stroke();
605
+ }
606
+ if (!i.valAxisHidden) {
607
+ n.font = `${S(i.valAxisFontSizeHpt, u, o)}px sans-serif`, n.fillStyle = "#555", n.textAlign = "right", n.textBaseline = "middle";
608
+ for (let e = 1; e <= B; e++) {
609
+ let t = e / B * L, i = e / B * P;
610
+ n.fillText(r(t), M - 3, N - i);
611
+ }
612
+ }
613
+ n.font = `${Math.max(8, Math.min(11, P * .2))}px sans-serif`, n.fillStyle = "#444", n.textBaseline = "middle";
614
+ for (let e = 0; e < m; e++) {
615
+ let t = z(e), r = M + Math.cos(t) * (P + 12), i = N + Math.sin(t) * (P + 12);
616
+ n.textAlign = Math.cos(t) < -.1 ? "right" : Math.cos(t) > .1 ? "left" : "center", n.fillText((f[e] ?? "").toString().slice(0, 12), r, i);
617
+ }
618
+ let V = i.radarStyle === "filled", H = Math.max(2, P * .025);
619
+ for (let e = 0; e < i.series.length; e++) {
620
+ let t = i.series[e], r = d(e, t), a = [];
621
+ for (let e = 0; e < m; e++) {
622
+ let n = t.values[e];
623
+ if (n == null) {
624
+ a.push(null);
625
+ continue;
626
+ }
627
+ let r = n / L, i = z(e);
628
+ a.push([M + Math.cos(i) * P * r, N + Math.sin(i) * P * r]);
629
+ }
630
+ n.beginPath();
631
+ let o = !1;
632
+ for (let e of a) {
633
+ if (e == null) {
634
+ o = !1;
635
+ continue;
636
+ }
637
+ o ? n.lineTo(e[0], e[1]) : (n.moveTo(e[0], e[1]), o = !0);
638
+ }
639
+ let s = a.every((e) => e != null);
640
+ if (V && s ? (n.closePath(), n.fillStyle = p(r, .25), n.fill()) : s && n.closePath(), n.strokeStyle = r, n.lineWidth = 2, n.stroke(), !V && t.showMarker !== !1) {
641
+ n.fillStyle = r;
642
+ for (let e of a) e != null && (n.beginPath(), n.arc(e[0], e[1], H, 0, Math.PI * 2), n.fill());
643
+ }
644
+ }
645
+ y(n, i, T, s, c, l, u, M - A / 2, N - j / 2, A, j, b + 2);
646
+ }
647
+ function j(t, n, r, a) {
648
+ let { x: o, y: s, w: c, h: l } = r, u = n.title ? x(n, l, a) : 0, f = n.title ? l * .035 : 0, p = n.title ? l * .035 : 0, h = n.title ? u + f + p : 0, g = v(n, c, l), _ = g?.side === "r" ? g.reserveW : 0, S = g?.side === "l" ? g.reserveW : 0, w = g?.side === "t" ? g.reserveH : 0, T = g?.side === "b" ? g.reserveH : 0, E = Math.max(8, Math.min(10, l * .045)), D = n.catAxisTitle ? E + 4 : 0, O = n.valAxisTitle ? E + 4 : 0;
649
+ if (n.title) {
650
+ let e = n.titleManualLayout;
651
+ e && (e.x !== void 0 || e.y !== void 0) ? C(t, n, o + e.x * c, s + e.y * l, (e.w ?? .5) * c, u) : C(t, n, o, s + f, c, u);
652
+ }
653
+ let k = n.plotAreaManualLayout, A, j, F, L;
654
+ if (k && k.w != null && k.h != null) A = o + k.x * c, j = s + k.y * l, F = k.w * c, L = k.h * l;
655
+ else {
656
+ let e = {
657
+ t: h + w + l * .02,
658
+ r: _ + c * .05,
659
+ b: (n.catAxisHidden ? l * .04 : l * .12) + D + T,
660
+ l: (n.valAxisHidden ? c * .04 : c * .12) + O + S
661
+ };
662
+ A = o + e.l, j = s + e.t, F = c - e.l - e.r, L = l - e.t - e.b;
663
+ }
664
+ if (F <= 0 || L <= 0) return;
665
+ n.plotAreaBg && (t.fillStyle = `#${n.plotAreaBg}`, t.fillRect(A, j, F, L));
666
+ let R = [], z = [];
667
+ for (let e of n.series) {
668
+ let t = e.categories ?? [];
669
+ for (let e of t) {
670
+ let t = parseFloat(e);
671
+ isNaN(t) || R.push(t);
672
+ }
673
+ for (let t of e.values) t != null && z.push(t);
674
+ }
675
+ let B = R.length === 0;
676
+ if (B) {
677
+ let e = Math.max(...n.series.map((e) => e.values.length));
678
+ for (let t = 0; t < e; t++) R.push(t);
679
+ }
680
+ let V = Math.min(...R), H = Math.max(...R), U = Math.min(...z), W = Math.max(...z);
681
+ if (V === H && (--V, H += 1), U === W && (--U, W += 1), n.valMin == null ? U > 0 && (U = 0) : U = n.valMin, n.valMax != null && (W = n.valMax), n.catAxisMin != null && (V = n.catAxisMin), n.catAxisMax != null && (H = n.catAxisMax), n.catAxisMin == null || n.catAxisMax == null) {
682
+ let t = e(H - V);
683
+ t > 0 && (n.catAxisMin ?? (V = Math.floor(V / t) * t), n.catAxisMax ?? (H = Math.ceil(H / t) * t));
684
+ }
685
+ let G = (e) => A + (e - V) / (H - V) * F, K = (e) => j + L - (e - U) / (W - U) * L;
686
+ if (!n.valAxisHidden) {
687
+ let r = Math.max(8, Math.min(11, L / 20));
688
+ t.font = `${n.valAxisFontBold ? "bold " : ""}${r}px sans-serif`;
689
+ let a = e(W - U), o = Math.round((W - U) / a) + 1;
690
+ for (let e = 0; e < o; e++) {
691
+ let r = U + e * a;
692
+ if (r > W + a * .01) break;
693
+ let o = K(r);
694
+ t.strokeStyle = "#e0e0e0", t.lineWidth = .5, t.beginPath(), t.moveTo(A, o), t.lineTo(A + F, o), t.stroke(), t.fillStyle = "#555", t.textAlign = "right", t.textBaseline = "middle", t.fillText(i(r, n.valAxisFormatCode), A - 4, o);
695
+ let s = n.valAxisLineColor ? `#${n.valAxisLineColor}` : void 0, c = n.valAxisLineWidthEmu ? Math.max(.5, n.valAxisLineWidthEmu / 12700) : void 0;
696
+ b(t, n.valAxisMajorTickMark, "val", A, o, s, c);
697
+ }
698
+ }
699
+ let q = j + L;
700
+ if (n.catAxisCrossesAt != null) q = I(K(n.catAxisCrossesAt), j, j + L);
701
+ else {
702
+ let e = n.catAxisCrosses ?? "autoZero";
703
+ e === "autoZero" && U < 0 && W > 0 ? q = I(K(0), j, j + L) : e === "min" ? q = j + L : e === "max" && (q = j);
704
+ }
705
+ if (!n.catAxisHidden && !n.catAxisLineHidden && (t.save(), t.strokeStyle = n.catAxisLineColor ? `#${n.catAxisLineColor}` : "#888", t.lineWidth = n.catAxisLineWidthEmu ? Math.max(.5, n.catAxisLineWidthEmu / 12700) : 1, t.lineCap = "butt", t.beginPath(), t.moveTo(A, q), t.lineTo(A + F, q), t.stroke(), t.restore()), !n.valAxisHidden && !n.valAxisLineHidden && (t.save(), t.strokeStyle = n.valAxisLineColor ? `#${n.valAxisLineColor}` : "#888", t.lineWidth = n.valAxisLineWidthEmu ? Math.max(.5, n.valAxisLineWidthEmu / 12700) : 1, t.beginPath(), t.moveTo(A, j), t.lineTo(A, j + L), t.stroke(), t.restore()), !n.catAxisHidden) {
706
+ let r = Math.max(8, Math.min(11, L / 20));
707
+ t.font = `${n.catAxisFontBold ? "bold " : ""}${r}px sans-serif`;
708
+ let a = e(H - V), o = Math.round((H - V) / a) + 1;
709
+ t.fillStyle = "#555", t.textAlign = "center", t.textBaseline = "top";
710
+ for (let e = 0; e < o; e++) {
711
+ let r = V + e * a;
712
+ if (r > H + a * .01) break;
713
+ let o = G(r);
714
+ t.fillText(i(r, n.catAxisFormatCode), o, q + 4);
715
+ let s = n.catAxisLineColor ? `#${n.catAxisLineColor}` : void 0, c = n.catAxisLineWidthEmu ? Math.max(.5, n.catAxisLineWidthEmu / 12700) : void 0;
716
+ b(t, n.catAxisMajorTickMark, "cat", q, o, s, c);
717
+ }
718
+ }
719
+ let J = n.chartType === "bubble", Y = J ? "marker" : n.scatterStyle ?? "marker", X = Y === "line" || Y === "lineMarker" || Y === "lineNoMarker", Z = Y === "smooth" || Y === "smoothMarker" || Y === "smoothNoMarker", Q = Y === "lineNoMarker" || Y === "smoothNoMarker";
720
+ for (let e = 0; e < n.series.length; e++) {
721
+ let r = n.series[e], i = d(e, r), o = r.categories ?? [];
722
+ for (let e of r.errBars ?? []) N(t, r, e, o, B, G, K, i);
723
+ if (X || Z) {
724
+ let e = [];
725
+ for (let t = 0; t < r.values.length; t++) {
726
+ let n = r.values[t];
727
+ if (n == null) continue;
728
+ let i = B ? t : parseFloat(o[t] ?? "0");
729
+ isNaN(i) || e.push({
730
+ x: G(i),
731
+ y: K(n)
732
+ });
733
+ }
734
+ if (e.length >= 2) {
735
+ if (t.save(), t.strokeStyle = r.color ? `#${r.color}` : i, t.lineWidth = 1.5, t.beginPath(), t.moveTo(e[0].x, e[0].y), Z && e.length >= 3) for (let n = 0; n < e.length - 1; n++) {
736
+ let r = e[n - 1] ?? e[n], i = e[n], a = e[n + 1], o = e[n + 2] ?? a, s = i.x + (a.x - r.x) / 6, c = i.y + (a.y - r.y) / 6, l = a.x - (o.x - i.x) / 6, u = a.y - (o.y - i.y) / 6;
737
+ t.bezierCurveTo(s, c, l, u, a.x, a.y);
738
+ }
739
+ else for (let n = 1; n < e.length; n++) t.lineTo(e[n].x, e[n].y);
740
+ t.stroke(), t.restore();
741
+ }
742
+ }
743
+ if (!(Q || r.showMarker === !1 || typeof r.markerSymbol == "string" && r.markerSymbol === "none")) {
744
+ let e = 0;
745
+ if (J && r.bubbleSizes && r.bubbleSizes.length > 0) {
746
+ let t = Math.max(0, ...r.bubbleSizes.filter((e) => e != null));
747
+ t > 0 && (e = Math.min(F, L) / Math.max(8, r.values.length * 1.6) / Math.sqrt(t));
748
+ }
749
+ for (let n = 0; n < r.values.length; n++) {
750
+ let s = r.values[n];
751
+ if (s == null) continue;
752
+ let c = B ? n : parseFloat(o[n] ?? "0");
753
+ if (isNaN(c)) continue;
754
+ let l = (r.dataPointOverrides ?? []).find((e) => e.idx === n), u = l?.markerSymbol ?? r.markerSymbol ?? "circle", d = l?.markerSize ?? r.markerSize ?? 5;
755
+ if (J && e > 0) {
756
+ let t = r.bubbleSizes?.[n];
757
+ t != null && t > 0 && (d = Math.sqrt(t) * e * 2 / a);
758
+ }
759
+ let f = l?.markerFill ?? l?.color ?? r.markerFill ?? i, p = l?.markerLine ?? r.markerLine ?? null;
760
+ M(t, G(c), K(s), u, d, f, p, a);
761
+ }
762
+ }
763
+ P(t, r, o, B, G, K, L, a);
764
+ }
765
+ y(t, n, g, o, s, c, l, A, j, F, L, h + 2), n.catAxisTitle && m(t, n.catAxisTitle, A, j, F, L, "cat", E), n.valAxisTitle && m(t, n.valAxisTitle, A, j, F, L, "val", E);
766
+ }
767
+ function M(e, t, n, r, i, a, o, s) {
768
+ let c = Math.max(2, i * s), l = c / 2, u = a.startsWith("#") ? a : `#${a}`, d = o ? o.startsWith("#") ? o : `#${o}` : null;
769
+ switch (e.save(), e.fillStyle = u, d && (e.strokeStyle = d, e.lineWidth = 1), r) {
770
+ case "square":
771
+ e.fillRect(t - l, n - l, c, c), o && e.strokeRect(t - l, n - l, c, c);
772
+ break;
773
+ case "diamond":
774
+ e.beginPath(), e.moveTo(t, n - l), e.lineTo(t + l, n), e.lineTo(t, n + l), e.lineTo(t - l, n), e.closePath(), e.fill(), o && e.stroke();
775
+ break;
776
+ case "triangle":
777
+ e.beginPath(), e.moveTo(t, n - l), e.lineTo(t + l, n + l), e.lineTo(t - l, n + l), e.closePath(), e.fill(), o && e.stroke();
778
+ break;
779
+ case "x":
780
+ e.strokeStyle = u, e.lineWidth = Math.max(1, c * .18), e.beginPath(), e.moveTo(t - l, n - l), e.lineTo(t + l, n + l), e.moveTo(t - l, n + l), e.lineTo(t + l, n - l), e.stroke();
781
+ break;
782
+ case "plus":
783
+ e.strokeStyle = u, e.lineWidth = Math.max(1, c * .18), e.beginPath(), e.moveTo(t - l, n), e.lineTo(t + l, n), e.moveTo(t, n - l), e.lineTo(t, n + l), e.stroke();
784
+ break;
785
+ case "star":
786
+ e.beginPath();
787
+ for (let r = 0; r < 10; r++) {
788
+ let i = r % 2 == 0 ? l : l * .45, a = -Math.PI / 2 + r * Math.PI / 5, o = t + Math.cos(a) * i, s = n + Math.sin(a) * i;
789
+ r === 0 ? e.moveTo(o, s) : e.lineTo(o, s);
790
+ }
791
+ e.closePath(), e.fill(), o && e.stroke();
792
+ break;
793
+ case "dot":
794
+ e.beginPath(), e.arc(t, n, Math.max(1, c * .25), 0, Math.PI * 2), e.fill();
795
+ break;
796
+ case "dash": {
797
+ let r = Math.max(1, c * .25);
798
+ e.fillRect(t - l, n - r / 2, c, r);
799
+ break;
800
+ }
801
+ default:
802
+ e.beginPath(), e.arc(t, n, l, 0, Math.PI * 2), e.fill(), o && e.stroke();
803
+ break;
804
+ }
805
+ e.restore();
806
+ }
807
+ function N(e, t, n, r, i, a, o, s) {
808
+ e.save(), e.strokeStyle = n.color ? `#${n.color}` : s, e.lineWidth = n.lineWidthEmu ? Math.max(.5, n.lineWidthEmu / 12700) : 1, e.setLineDash(L(n.dash));
809
+ let c = n.barType === "plus" || n.barType === "both", l = n.barType === "minus" || n.barType === "both", u = n.dir === "x", d = e.lineWidth * 1.5;
810
+ for (let s = 0; s < t.values.length; s++) {
811
+ let f = t.values[s];
812
+ if (f == null) continue;
813
+ let p = i ? s : parseFloat(r[s] ?? "0");
814
+ if (isNaN(p)) continue;
815
+ let m = a(p), h = o(f), g = (t) => {
816
+ let r = m, i = h;
817
+ u ? r = a(p + t) : i = o(f + t), e.beginPath(), e.moveTo(m, h), e.lineTo(r, i), e.stroke(), n.noEndCap || (e.save(), e.setLineDash([]), e.beginPath(), u ? (e.moveTo(r, i - d), e.lineTo(r, i + d)) : (e.moveTo(r - d, i), e.lineTo(r + d, i)), e.stroke(), e.restore());
818
+ };
819
+ if (c) {
820
+ let e = n.plus[s];
821
+ e != null && g(e);
822
+ }
823
+ if (l) {
824
+ let e = n.minus[s];
825
+ e != null && g(-e);
826
+ }
827
+ }
828
+ e.restore();
829
+ }
830
+ function P(e, t, n, r, a, o, s, c) {
831
+ let l = t.dataLabelOverrides ?? [];
832
+ if (l.length === 0 && !t.seriesDataLabels) return;
833
+ let u = t.seriesDataLabels;
834
+ for (let d = 0; d < t.values.length; d++) {
835
+ let f = t.values[d];
836
+ if (f == null) continue;
837
+ let p = r ? d : parseFloat(n[d] ?? "0");
838
+ if (isNaN(p)) continue;
839
+ let m = l.find((e) => e.idx === d), h;
840
+ if (m) {
841
+ if (m.text === "") continue;
842
+ h = m.text;
843
+ } else if (u && (u.showVal || u.showSerName || u.showCatName)) {
844
+ let e = [];
845
+ if (u.showCatName && !r && e.push(n[d] ?? ""), u.showSerName && e.push(t.name), u.showVal && e.push(i(f, u.formatCode ?? null)), h = e.filter(Boolean).join(" "), !h) continue;
846
+ } else continue;
847
+ let g = m?.position ?? u?.position ?? "r", _ = m?.fontSizeHpt ?? u?.fontSizeHpt, v = _ ? _ / 100 * c : Math.max(9, Math.min(11, s / 25)), y = m?.fontColor ?? u?.fontColor, b = m?.fontBold ?? u?.fontBold ?? !1;
848
+ F(e, a(p), o(f), h, g, v, y, b);
849
+ }
850
+ }
851
+ function F(e, t, n, r, i, a, o, s) {
852
+ e.save(), e.font = `${s ? "bold " : ""}${a}px sans-serif`, e.fillStyle = o ? `#${o}` : "#333";
853
+ let c = a * .6, l = t, u = n;
854
+ switch (i) {
855
+ case "l":
856
+ e.textAlign = "right", e.textBaseline = "middle", l = t - c;
857
+ break;
858
+ case "r":
859
+ e.textAlign = "left", e.textBaseline = "middle", l = t + c;
860
+ break;
861
+ case "t":
862
+ e.textAlign = "center", e.textBaseline = "bottom", u = n - c;
863
+ break;
864
+ case "b":
865
+ e.textAlign = "center", e.textBaseline = "top", u = n + c;
866
+ break;
867
+ case "ctr":
868
+ e.textAlign = "center", e.textBaseline = "middle";
869
+ break;
870
+ default:
871
+ e.textAlign = "left", e.textBaseline = "middle", l = t + c;
872
+ break;
873
+ }
874
+ let d = r.split(/\r?\n/), f = a * 1.15, p = f * d.length, m = u;
875
+ e.textBaseline === "middle" ? m = u - (p - f) / 2 : e.textBaseline === "bottom" && (m = u - (p - f));
876
+ for (let t of d) e.fillText(t, l, m), m += f;
877
+ e.restore();
878
+ }
879
+ function I(e, t, n) {
880
+ return e < t ? t : e > n ? n : e;
881
+ }
882
+ function L(e) {
883
+ if (!e) return [];
884
+ switch (e) {
885
+ case "solid": return [];
886
+ case "dot":
887
+ case "sysDot": return [1, 2];
888
+ case "dash":
889
+ case "sysDash": return [4, 2];
890
+ case "lgDash": return [8, 3];
891
+ case "dashDot":
892
+ case "sysDashDot": return [
893
+ 4,
894
+ 2,
895
+ 1,
896
+ 2
897
+ ];
898
+ case "lgDashDot": return [
899
+ 8,
900
+ 3,
901
+ 1,
902
+ 3
903
+ ];
904
+ case "dashDotDot":
905
+ case "sysDashDotDot":
906
+ case "lgDashDotDot": return [
907
+ 4,
908
+ 2,
909
+ 1,
910
+ 2,
911
+ 1,
912
+ 2
913
+ ];
914
+ default: return [];
915
+ }
916
+ }
917
+ function R(t, n, r) {
918
+ let { x: i, y: a, w: o, h: s } = r, c = n.plotAreaManualLayout, l, u, d, f;
919
+ if (c && c.w != null && c.h != null) l = i + c.x * o, u = a + c.y * s, d = c.w * o, f = c.h * s;
920
+ else {
921
+ let e = n.valAxisHidden ? o * .01 : o * .11, t = o * .01, r = s * .12, c = s * .14;
922
+ l = i + e, u = a + r, d = o - e - t, f = s - r - c;
923
+ }
924
+ let p = n.series[0]?.values ?? [], m = n.categories, h = m.length;
925
+ if (h === 0) return;
926
+ let g = new Set(n.subtotalIndices), _ = 0, v = [];
927
+ for (let e = 0; e < h; e++) {
928
+ let t = p[e] ?? 0;
929
+ if (e === 0 || g.has(e)) v.push({
930
+ start: 0,
931
+ end: t,
932
+ isSub: !0,
933
+ isPos: !0
934
+ }), _ = t;
935
+ else {
936
+ let e = t >= 0 ? _ : _ + t, n = t >= 0 ? _ + t : _;
937
+ v.push({
938
+ start: e,
939
+ end: n,
940
+ isSub: !1,
941
+ isPos: t >= 0
942
+ }), _ += t;
943
+ }
944
+ }
945
+ let y = v.map((e) => e.end), b = v.map((e) => e.start), x = Math.max(...y, ...b), S = Math.min(...b, 0), C = x - S;
946
+ if (C <= 0) return;
947
+ let w = S < 0 ? S - C * .05 : 0, T = (x - w) * 1.1, E = w + T, D = e(T);
948
+ t.save();
949
+ let O = Math.round(s * .042);
950
+ if (t.font = `${O}px sans-serif`, !n.valAxisHidden) {
951
+ t.strokeStyle = "#e8e8e8", t.lineWidth = .7, t.fillStyle = "#666", t.textAlign = "right", t.textBaseline = "middle";
952
+ for (let e = Math.ceil(w / D) * D; e <= E; e += D) {
953
+ let n = u + f * (1 - (e - w) / T);
954
+ t.beginPath(), t.moveTo(l, n), t.lineTo(l + d, n), t.stroke(), t.fillText(e.toLocaleString(), l - 4, n);
955
+ }
956
+ }
957
+ let k = !n.valAxisHidden && !n.valAxisLineHidden, A = !n.catAxisHidden && !n.catAxisLineHidden;
958
+ (k || A) && (t.strokeStyle = "#bbb", t.lineWidth = 1, t.beginPath(), k ? (t.moveTo(l, u), t.lineTo(l, u + f), A && t.lineTo(l + d, u + f)) : A && (t.moveTo(l, u + f), t.lineTo(l + d, u + f)), t.stroke());
959
+ let j = d / h, M = j / (1 + (n.barGapWidth ?? 150) / 100);
960
+ v.forEach((e, r) => {
961
+ let i = l + j * r + (j - M) / 2, a = u + f * (1 - (e.end - w) / T), o = u + f * (1 - (e.start - w) / T), c = Math.max(1, o - a);
962
+ if (e.isSub ? (t.fillStyle = "#196ECA", t.fillRect(i, a, M, c)) : (t.strokeStyle = e.isPos ? "#5BA4E6" : "#E46970", t.lineWidth = 1.5, t.strokeRect(i + .75, a + .75, M - 1.5, c - 1.5)), r < h - 1) {
963
+ let n = l + j * (r + 1) + (j - M) / 2, s = e.isPos ? a : o;
964
+ t.strokeStyle = "#ccc", t.lineWidth = .8, t.setLineDash([3, 3]), t.beginPath(), t.moveTo(i + M, s), t.lineTo(n, s), t.stroke(), t.setLineDash([]);
965
+ }
966
+ let d = p[r] ?? 0, m = d < 0 ? `△ ${Math.abs(d).toLocaleString()}` : d.toLocaleString(), g = n.series[0]?.dataLabelColors?.[r] ?? null;
967
+ t.fillStyle = g ? `#${g}` : n.dataLabelFontColor ? `#${n.dataLabelFontColor}` : "#595959", t.font = `bold ${Math.round(s * .044)}px sans-serif`, t.textAlign = "center", d < 0 ? (t.textBaseline = "top", t.fillText(m, i + M / 2, o + 3)) : (t.textBaseline = "bottom", t.fillText(m, i + M / 2, a - 3));
968
+ }), t.textAlign = "center", t.textBaseline = "top", t.fillStyle = "#666", t.font = `${Math.round(s * .038)}px sans-serif`;
969
+ let N = u + f + 4;
970
+ for (let e = 0; e < h; e++) {
971
+ let n = l + j * e + j / 2;
972
+ m[e].split(/\s+/).forEach((e, r) => t.fillText(e, n, N + r * (O + 2)));
973
+ }
974
+ t.restore();
975
+ }
976
+ function z(e, t, n, r = 1.333) {
977
+ let { x: i, y: a, w: o, h: s } = n;
978
+ if (t.chartBg && (e.fillStyle = `#${t.chartBg}`, e.fillRect(i, a, o, s)), t.series.length === 0) {
979
+ e.fillStyle = "#888", e.font = "12px sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText("(no data)", i + o / 2, a + s / 2);
980
+ return;
981
+ }
982
+ switch (t.chartType) {
983
+ case "clusteredBar":
984
+ case "clusteredBarH":
985
+ case "stackedBar":
986
+ case "stackedBarH":
987
+ case "stackedBarPct":
988
+ case "stackedBarHPct":
989
+ E(e, t, n, r);
990
+ break;
991
+ case "line":
992
+ case "stackedLine":
993
+ case "stackedLinePct":
994
+ D(e, t, n, r);
995
+ break;
996
+ case "area":
997
+ case "stackedArea":
998
+ case "stackedAreaPct":
999
+ O(e, t, n, r);
1000
+ break;
1001
+ case "pie":
1002
+ k(e, t, n, !1, r);
1003
+ break;
1004
+ case "doughnut":
1005
+ k(e, t, n, !0, r);
1006
+ break;
1007
+ case "radar":
1008
+ A(e, t, n, r);
1009
+ break;
1010
+ case "scatter":
1011
+ case "bubble":
1012
+ j(e, t, n, r);
1013
+ break;
1014
+ case "waterfall":
1015
+ R(e, t, n);
1016
+ break;
1017
+ default: e.fillStyle = "#888", e.font = "11px sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText(`Chart: ${t.chartType}`, i + o / 2, a + s / 2);
1018
+ }
1019
+ }
1020
+ //#endregion
1021
+ export { z as t };