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