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