@silurus/ooxml 0.80.2 → 0.81.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 +57 -77
- package/dist/assets/render-worker-C2ACcLes.js +11 -0
- package/dist/assets/render-worker-Cx5uR77k.js +10 -0
- package/dist/assets/render-worker-DtU8oQZ7.js +24 -0
- package/dist/{canvas-viewer-mechanics-D-r6wHY_.js → canvas-viewer-mechanics-CqxKRGCp.js} +1 -1
- package/dist/chart-ex.mjs +1017 -0
- package/dist/{document-pull-client-Cukkyojh.js → document-pull-client-Ux4a_ax8.js} +4540 -4412
- package/dist/{docx-BlELeDNF.js → docx-SEyQ4gS-.js} +79 -75
- package/dist/docx.mjs +5 -4
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/index.mjs +3 -3
- package/dist/{line-distribute-Bvtp0Gt6.js → line-distribute-BBGvvwLt.js} +17 -16
- package/dist/{line-metrics-DdEJYxjx.js → line-metrics-Baz31mML.js} +663 -7488
- package/dist/math.mjs +29 -24
- package/dist/node.mjs +248 -247
- package/dist/plot-area-frame-Dg1VIpUU.js +3669 -0
- package/dist/{pptx-JBkXh6Cy.js → pptx-5lQrMvMR.js} +236 -232
- package/dist/pptx.mjs +6 -5
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/region-map.mjs +102 -97
- package/dist/{render-CoqMHcbF.js → render-DEHjijQD.js} +1 -1
- package/dist/{render-worker-host-CM1JXVqg.js → render-worker-host-B1nbV_k7.js} +1 -1
- package/dist/{render-worker-host-DFtd9Z-J.js → render-worker-host-Bze5M6k5.js} +1 -1
- package/dist/{render-worker-host-Br7ZDyGE.js → render-worker-host-Dg_74V64.js} +1 -1
- package/dist/renderer-DuopJE1K.js +5855 -0
- package/dist/{renderer-module-contract-BNGz8HvO.js → renderer-module-contract-0bO_5SC0.js} +4 -3
- package/dist/{resource-measurement-CgMubiAI.js → resource-measurement-DRLp4nFt.js} +12 -11
- package/dist/{session-DkPblDiq.js → session-CNVc3VJ4.js} +8 -8
- package/dist/{slide-pull-client-m2blvngt.js → slide-pull-client-CzutXnGc.js} +888 -1082
- package/dist/three-d-BYiWCNlz.js +1345 -0
- package/dist/three-d.mjs +1238 -798
- package/dist/types/chart-ex.d.ts +949 -0
- package/dist/types/docx.d.ts +325 -18
- package/dist/types/index.d.ts +325 -26
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +303 -14
- package/dist/types/pptx.d.ts +314 -22
- package/dist/types/region-map.d.ts +318 -6
- package/dist/types/three-d.d.ts +318 -6
- package/dist/types/xlsx.d.ts +317 -18
- package/dist/{worksheet-pull-client-BntP6RiO.js → worksheet-pull-client-Cxj3Ej0s.js} +19 -19
- package/dist/{xlsx-dhsUXUpX.js → xlsx-Bl3TIEVu.js} +1313 -1279
- package/dist/xlsx.mjs +6 -5
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +7 -1
- package/dist/assets/render-worker-BD1_LaFD.js +0 -9
- package/dist/assets/render-worker-BIqMQFkZ.js +0 -8
- package/dist/assets/render-worker-DuvX4_li.js +0 -22
- package/dist/chart-number-format-qLhnk6hj.js +0 -475
- package/dist/three-d-C28kqDym.js +0 -1086
- /package/dist/{highlight-rect-BuX5rWP4.js → highlight-rect-BqcZMHUE.js} +0 -0
- /package/dist/{mathjax-DgAl7Yi5.js → mathjax-DJa-Q93p.js} +0 -0
- /package/dist/{transfer-CKZ79zFw.js → transfer-D0U6Uhn4.js} +0 -0
- /package/dist/{visible-index-BjesVGhg.js → visible-index-DbDuGMCE.js} +0 -0
|
@@ -0,0 +1,1017 @@
|
|
|
1
|
+
import { $t as e, Bt as t, Ft as n, Gt as r, Ht as i, It as a, J as o, K as s, Lt as c, Ot as l, Pt as u, Qt as d, Zt as f, ct as p, en as m, f as h, r as g, t as _, u as v } from "./plot-area-frame-Dg1VIpUU.js";
|
|
2
|
+
import { T as y, w as b } from "./three-d-BYiWCNlz.js";
|
|
3
|
+
import { A as x, C as S, D as C, E as w, F as T, I as E, L as D, M as O, N as k, O as A, P as j, R as M, S as N, T as ee, _ as te, a as P, b as ne, c as re, d as F, f as I, g as ie, h as L, i as R, j as z, l as B, m as V, n as ae, o as oe, p as se, r as ce, s as le, t as ue, u as de, v as fe, w as pe, x as me, y as he } from "./renderer-DuopJE1K.js";
|
|
4
|
+
import { t as ge } from "./renderer-module-contract-0bO_5SC0.js";
|
|
5
|
+
function H(e) {
|
|
6
|
+
return e != null && Number.isFinite(e) ? e : null;
|
|
7
|
+
}
|
|
8
|
+
function U(e) {
|
|
9
|
+
return Object.is(e, -0) ? "0" : String(Number.isInteger(e) ? e : Number(e.toPrecision(6)));
|
|
10
|
+
}
|
|
11
|
+
function _e(e, t) {
|
|
12
|
+
if (e.length > 1048576) return { kind: "tooManyInputPoints" };
|
|
13
|
+
let n = t.intervalClosed === "r" ? "r" : "l", r = H(t.underflow), i = H(t.overflow);
|
|
14
|
+
r != null && i != null && r >= i && (r = null, i = null);
|
|
15
|
+
let a = (e) => r != null && (n === "r" ? e <= r : e < r), o = (e) => i != null && (n === "r" ? e > i : e >= i), s = Infinity, c = -Infinity, l = 0, u = 0, d = 0;
|
|
16
|
+
for (let t of e) {
|
|
17
|
+
let e = H(t);
|
|
18
|
+
e != null && (a(e) ? u++ : o(e) ? d++ : (l++, s = Math.min(s, e), c = Math.max(c, e)));
|
|
19
|
+
}
|
|
20
|
+
if (l + u + d === 0) return {
|
|
21
|
+
kind: "bins",
|
|
22
|
+
categories: [],
|
|
23
|
+
counts: []
|
|
24
|
+
};
|
|
25
|
+
let f = [], p = [];
|
|
26
|
+
if (r != null && (f.push(`${n === "r" ? "≤" : "<"} ${U(r)}`), p.push(u)), l > 0) {
|
|
27
|
+
let u = r ?? s, d = i ?? c, m = d - u;
|
|
28
|
+
if (!Number.isFinite(m)) f.push(`${U(u)} – ${U(d)}`), p.push(l);
|
|
29
|
+
else {
|
|
30
|
+
let s = H(t.binSize), c;
|
|
31
|
+
c = s != null && s > 0 && m > 0 ? Math.max(1, Math.ceil(m / s)) : t.binCount != null && Number.isFinite(t.binCount) && t.binCount > 0 ? Math.max(1, Math.floor(t.binCount)) : Math.max(1, Math.ceil(Math.sqrt(l)));
|
|
32
|
+
let d = m <= 0 ? 1 : Math.min(512, c), h = m > 0 && s != null && s > 0 && c <= 512, g = m === 0 ? 1 : h ? s : m / d, _ = Array(d).fill(0);
|
|
33
|
+
for (let t of e) {
|
|
34
|
+
let e = H(t);
|
|
35
|
+
if (e == null || a(e) || o(e)) continue;
|
|
36
|
+
let r = h ? (e - u) / g : m === 0 ? 0 : (e - u) / m * d, i = n === "r" ? Math.ceil(r) - 1 : Math.floor(r), s = Math.max(0, Math.min(d - 1, i));
|
|
37
|
+
_[s]++;
|
|
38
|
+
}
|
|
39
|
+
for (let e = 0; e < d; e++) {
|
|
40
|
+
let t = h ? u + g * e : u + e / d * m, a = h ? t + g : u + m * ((e + 1) / d), o = i == null ? a : Math.min(a, i), s = n === "r" && (r != null || e > 0) ? ">" : "≥", c = n === "l" && (i != null || e < d - 1) ? "<" : "≤";
|
|
41
|
+
f.push(`${s} ${U(t)} – ${c} ${U(o)}`), p.push(_[e]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return i != null && (f.push(`${n === "r" ? ">" : "≥"} ${U(i)}`), p.push(d)), {
|
|
46
|
+
kind: "bins",
|
|
47
|
+
categories: f,
|
|
48
|
+
counts: p
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region packages/core/src/chart/pareto-layout.ts
|
|
53
|
+
function ve(e, t) {
|
|
54
|
+
return e == null ? e : e.flatMap((e) => {
|
|
55
|
+
let n = t.get(e.idx);
|
|
56
|
+
return n == null ? [] : [{
|
|
57
|
+
...e,
|
|
58
|
+
idx: n
|
|
59
|
+
}];
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function ye(e, t) {
|
|
63
|
+
return e == null ? e : t.map((t) => e[t] ?? null);
|
|
64
|
+
}
|
|
65
|
+
function be(e, t, n = {}) {
|
|
66
|
+
let r = e.values.map((e, t) => ({
|
|
67
|
+
value: e,
|
|
68
|
+
sourceIndex: t
|
|
69
|
+
})).filter((e) => e.value != null && Number.isFinite(e.value) && e.value >= 0);
|
|
70
|
+
n.sortDescending !== !1 && r.sort((e, t) => t.value - e.value || e.sourceIndex - t.sourceIndex);
|
|
71
|
+
let i = r[0]?.value ?? 0, a = i > 0 ? r.reduce((e, t) => e + t.value / i, 0) : 0, o = 0, s = r.map((n) => (i > 0 && (o += n.value / i), {
|
|
72
|
+
sourceIndex: n.sourceIndex,
|
|
73
|
+
category: e.categories?.[n.sourceIndex] ?? t[n.sourceIndex] ?? String(n.sourceIndex + 1),
|
|
74
|
+
value: n.value,
|
|
75
|
+
cumulativeFraction: a > 0 ? o >= a ? 1 : o / a : 0
|
|
76
|
+
})), c = s.map((e) => e.sourceIndex), l = new Map(c.map((e, t) => [e, t])), u = s.map((e) => e.category), d = {
|
|
77
|
+
...e,
|
|
78
|
+
categories: u,
|
|
79
|
+
catFormatCodes: ye(e.catFormatCodes, c),
|
|
80
|
+
dataPointColors: ye(e.dataPointColors, c),
|
|
81
|
+
dataLabelColors: ye(e.dataLabelColors, c),
|
|
82
|
+
dataPointOverrides: ve(e.dataPointOverrides, l),
|
|
83
|
+
dataLabelOverrides: ve(e.dataLabelOverrides, l)
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
points: s,
|
|
87
|
+
categories: u,
|
|
88
|
+
orderedSeries: {
|
|
89
|
+
...d,
|
|
90
|
+
values: s.map((e) => e.value)
|
|
91
|
+
},
|
|
92
|
+
series: {
|
|
93
|
+
...d,
|
|
94
|
+
values: s.map((e) => e.cumulativeFraction)
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function xe(e) {
|
|
99
|
+
if (e.length > 1e4) return !0;
|
|
100
|
+
let t = 0;
|
|
101
|
+
for (let n of e) {
|
|
102
|
+
if (n.path.length > 512 || t > 1e4 - n.path.length) return !0;
|
|
103
|
+
t += n.path.length;
|
|
104
|
+
}
|
|
105
|
+
return !1;
|
|
106
|
+
}
|
|
107
|
+
function Se(e, t = !1) {
|
|
108
|
+
let n = {
|
|
109
|
+
label: "",
|
|
110
|
+
layoutWeight: 0,
|
|
111
|
+
value: 0,
|
|
112
|
+
depth: -1,
|
|
113
|
+
children: [],
|
|
114
|
+
branchIndex: -1,
|
|
115
|
+
labelIndex: -1,
|
|
116
|
+
a0: 0,
|
|
117
|
+
a1: 0
|
|
118
|
+
}, r = e.reduce((e, t) => Number.isFinite(t.size) && t.size > e ? t.size : e, 0), i = (e, t) => e > Number.MAX_VALUE - t ? Number.MAX_VALUE : e + t, a = /* @__PURE__ */ new WeakMap();
|
|
119
|
+
for (let o of e) {
|
|
120
|
+
let e = Number.isFinite(o.size) && o.size > 0 ? o.size : 0, s = r > 0 ? e / r : 0, c = n;
|
|
121
|
+
for (let n = 0; n < o.path.length; n++) {
|
|
122
|
+
let r = o.path[n], l = a.get(c);
|
|
123
|
+
l || (l = /* @__PURE__ */ new Map(), a.set(c, l));
|
|
124
|
+
let u = t && n === o.path.length - 1, d = u ? void 0 : l.get(r);
|
|
125
|
+
d || (d = {
|
|
126
|
+
label: r,
|
|
127
|
+
layoutWeight: 0,
|
|
128
|
+
value: 0,
|
|
129
|
+
depth: n,
|
|
130
|
+
children: [],
|
|
131
|
+
branchIndex: n === 0 ? c.children.length : c.branchIndex,
|
|
132
|
+
labelIndex: -1,
|
|
133
|
+
a0: 0,
|
|
134
|
+
a1: 0
|
|
135
|
+
}, c.children.push(d), u || l.set(r, d)), d.layoutWeight += s, d.value = i(d.value, e), c = d;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
n.layoutWeight = n.children.reduce((e, t) => e + t.layoutWeight, 0), n.value = n.children.reduce((e, t) => i(e, t.value), 0);
|
|
139
|
+
let o = 0, s = [...n.children].reverse();
|
|
140
|
+
for (; s.length > 0;) {
|
|
141
|
+
let e = s.pop();
|
|
142
|
+
e.labelIndex = o++;
|
|
143
|
+
for (let t = e.children.length - 1; t >= 0; t--) s.push(e.children[t]);
|
|
144
|
+
}
|
|
145
|
+
return n;
|
|
146
|
+
}
|
|
147
|
+
function Ce(e) {
|
|
148
|
+
let t = [e];
|
|
149
|
+
for (; t.length > 0;) {
|
|
150
|
+
let e = t.pop(), n = 0;
|
|
151
|
+
for (let t of e.children) n += t.layoutWeight;
|
|
152
|
+
if (n <= 0) continue;
|
|
153
|
+
let r = e.a0;
|
|
154
|
+
for (let i of e.children) {
|
|
155
|
+
let a = (e.a1 - e.a0) * i.layoutWeight / n;
|
|
156
|
+
i.a0 = r, i.a1 = r + a, r = i.a1, t.push(i);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function W(e) {
|
|
161
|
+
let t = e.depth, n = [e];
|
|
162
|
+
for (; n.length > 0;) {
|
|
163
|
+
let e = n.pop();
|
|
164
|
+
t = Math.max(t, e.depth);
|
|
165
|
+
for (let t = e.children.length - 1; t >= 0; t--) n.push(e.children[t]);
|
|
166
|
+
}
|
|
167
|
+
return t;
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region packages/core/src/chart/chart-ex-renderer.ts
|
|
171
|
+
function we(e) {
|
|
172
|
+
return !e || e.fillNoStyle === !0 ? !1 : e.fillPaintAuthored === !0 || e.fillHidden === !0 || e.fillColors?.some((e) => e != null) === !0 || e.fillPaints?.some((e) => e != null) === !0;
|
|
173
|
+
}
|
|
174
|
+
function Te(e, t, n, r) {
|
|
175
|
+
return t?.fillHidden === !0 || t?.color != null || we(t?.chartexStyle) ? B(e, r, 3, t?.fillHidden === !0 ? {
|
|
176
|
+
...t.chartexStyle,
|
|
177
|
+
fillHidden: !0,
|
|
178
|
+
fillPaintAuthored: !0
|
|
179
|
+
} : t?.chartexStyle, t?.color, {
|
|
180
|
+
fillHidden: !0,
|
|
181
|
+
fillPaintAuthored: !0
|
|
182
|
+
}) : n?.chartexStyle?.fillPaintAuthored === !0 ? B(e, r, 3, n.chartexStyle, n.color, {
|
|
183
|
+
fillHidden: !0,
|
|
184
|
+
fillPaintAuthored: !0
|
|
185
|
+
}) : oe(e, r, 3, n?.chartexStyle, n?.color);
|
|
186
|
+
}
|
|
187
|
+
function Ee(e) {
|
|
188
|
+
let t = e?.chartexStyle;
|
|
189
|
+
return e?.lineHidden != null || e?.lineColor != null || e?.lineWidthEmu != null || e?.lineDash != null || t?.linePaintAuthored === !0 || t?.lineHidden != null || t?.lineColors?.some((e) => e != null) === !0 || t?.linePaints?.some((e) => e != null) === !0 || t?.lineWidthEmu != null || t?.lineDash != null || t?.lineCustomDash != null || t?.lineCap != null || t?.lineJoin != null;
|
|
190
|
+
}
|
|
191
|
+
function De(e) {
|
|
192
|
+
let t = e.chartexSunburst ? {
|
|
193
|
+
rows: e.chartexSunburst.rows,
|
|
194
|
+
kind: "sunburst"
|
|
195
|
+
} : e.chartexTreemap ? {
|
|
196
|
+
rows: e.chartexTreemap.rows,
|
|
197
|
+
kind: "treemap"
|
|
198
|
+
} : void 0;
|
|
199
|
+
if (!t) return null;
|
|
200
|
+
if (t.rows.length === 0) return 0;
|
|
201
|
+
if (xe(t.rows)) return o + 1;
|
|
202
|
+
let n = Se(t.rows, t.kind === "treemap");
|
|
203
|
+
if (n.layoutWeight <= 0 || n.children.length === 0) return 0;
|
|
204
|
+
t.kind === "sunburst" && (n.a0 = -Math.PI / 2, n.a1 = n.a0 + Math.PI * 2, Ce(n));
|
|
205
|
+
let r = e.series[0], i = S(r?.dataLabelOverrides), a = e.chartexTreemap?.parentLabelLayout ?? "overlapping", s = 0, c = [...n.children];
|
|
206
|
+
for (; c.length > 0;) {
|
|
207
|
+
let n = c.pop();
|
|
208
|
+
for (let e of n.children) c.push(e);
|
|
209
|
+
if (n.layoutWeight <= 0 || t.kind === "sunburst" && n.a1 - n.a0 <= 1e-4) continue;
|
|
210
|
+
let l;
|
|
211
|
+
t.kind === "sunburst" ? l = z(e, r, n.labelIndex, n.label, n.value, {
|
|
212
|
+
visible: !1,
|
|
213
|
+
showVal: !1,
|
|
214
|
+
showCatName: !1
|
|
215
|
+
}, i) : n.children.length > 0 ? (l = z(e, r, n.labelIndex, n.label, n.value, {
|
|
216
|
+
visible: a !== "none",
|
|
217
|
+
showVal: !1,
|
|
218
|
+
showCatName: !0
|
|
219
|
+
}, i), a === "overlapping" && n.depth !== 0 && (l = null)) : l = z(e, r, n.labelIndex, n.label, n.value, {
|
|
220
|
+
visible: !1,
|
|
221
|
+
showVal: !1,
|
|
222
|
+
showCatName: !1
|
|
223
|
+
}, i);
|
|
224
|
+
for (let e of [l?.labelBox?.fillPaint, l?.labelBox?.borderFill]) {
|
|
225
|
+
if (!e) continue;
|
|
226
|
+
let t = p(e);
|
|
227
|
+
if (e.fillType === "gradient" && t > 4096 || t > 1048576 - s) return o + 1;
|
|
228
|
+
s += t;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return s;
|
|
232
|
+
}
|
|
233
|
+
function G(e, t, n, r, i = 0) {
|
|
234
|
+
let a = t.series[0];
|
|
235
|
+
if (!a) return;
|
|
236
|
+
let o = _e(a.values, t.chartexHistogramBinning ?? {});
|
|
237
|
+
if (o.kind === "tooManyInputPoints") {
|
|
238
|
+
C(e, n, s + 1);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
A(e, {
|
|
242
|
+
...t,
|
|
243
|
+
chartType: "clusteredBar",
|
|
244
|
+
categories: o.categories,
|
|
245
|
+
series: [{
|
|
246
|
+
...a,
|
|
247
|
+
categories: void 0,
|
|
248
|
+
values: o.counts
|
|
249
|
+
}]
|
|
250
|
+
}, n, r, { gapPolicy: "chartex" }, i);
|
|
251
|
+
}
|
|
252
|
+
function Oe(e, n, r, o, s) {
|
|
253
|
+
let { x: l, y: u, w: d, h: p } = r, m = n.series[0]?.values ?? [], v = n.categories, y = Math.max(m.length, v.length);
|
|
254
|
+
if (y === 0 || C(e, r, y)) return;
|
|
255
|
+
let b = new Set(n.subtotalIndices), x = !1, A = (e, t) => {
|
|
256
|
+
let n = e + t;
|
|
257
|
+
return Number.isFinite(n) ? n : (x = !0, n < 0 ? -Number.MAX_VALUE : Number.MAX_VALUE);
|
|
258
|
+
}, ne = 0, I = [], R = -Infinity, B = 0;
|
|
259
|
+
for (let e = 0; e < y; e++) {
|
|
260
|
+
let t = m[e], n = t != null && Number.isFinite(t), r = t == null || n, i = n ? t : 0;
|
|
261
|
+
if (b.has(e)) {
|
|
262
|
+
let e = {
|
|
263
|
+
start: 0,
|
|
264
|
+
end: i,
|
|
265
|
+
isSub: !0,
|
|
266
|
+
isPos: !0,
|
|
267
|
+
hasValue: n,
|
|
268
|
+
paintSlot: r
|
|
269
|
+
};
|
|
270
|
+
I.push(e), r && (R = Math.max(R, e.start, e.end), B = Math.min(B, e.start, e.end)), n && (ne = i);
|
|
271
|
+
} else {
|
|
272
|
+
let e = A(ne, i), t = {
|
|
273
|
+
start: i >= 0 ? ne : e,
|
|
274
|
+
end: i >= 0 ? e : ne,
|
|
275
|
+
isSub: !1,
|
|
276
|
+
isPos: i >= 0,
|
|
277
|
+
hasValue: n,
|
|
278
|
+
paintSlot: r
|
|
279
|
+
};
|
|
280
|
+
I.push(t), r && (R = Math.max(R, t.start, t.end), B = Math.min(B, t.start, t.end)), n && (ne = e);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (x) {
|
|
284
|
+
e.fillStyle = "#888", e.font = "12px sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText("(chart values out of range)", l + d / 2, u + p / 2);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (R <= B) return;
|
|
288
|
+
let de = b.size === 0 && I.every((e, t) => !e.hasValue || m[t] >= 0), ge = !n.valAxisHidden && n.valAxisTickLabelPos !== "none" && !de, H = pe(e, n, d, p, o), U = a(n, d, p, o), _e = ce(n.valAxisFontSizeHpt, p, o), ve = ce(n.catAxisFontSizeHpt, p, o), ye = V(n, n.valAxisFontFace, "minor"), be = V(n, n.catAxisFontFace, "minor"), xe = w(n, B, R, p / o);
|
|
289
|
+
e.save();
|
|
290
|
+
let Se = 0;
|
|
291
|
+
if (ge) {
|
|
292
|
+
e.font = se(_e, ye, n.valAxisFontBold ?? !1, n.valAxisFontItalic ?? !1);
|
|
293
|
+
let t = 0;
|
|
294
|
+
for (let r of xe.majorLines) t = Math.max(t, e.measureText(N(n, r, !1)).width);
|
|
295
|
+
Se = t + 8;
|
|
296
|
+
}
|
|
297
|
+
let Ce = Math.max(1, d - U.valBandW - Se - d * .02) / y;
|
|
298
|
+
e.font = se(ve, be, n.catAxisFontBold ?? !1, n.catAxisFontItalic ?? !1);
|
|
299
|
+
let W = v.slice(0, y).map((t) => M(e, g(t, n.catAxisFormatCode, n.date1904), Math.max(1, Ce - 8))), we = 0;
|
|
300
|
+
for (let e of W) e.some(Boolean) && (we = Math.max(we, e.length));
|
|
301
|
+
let De = n.catAxisHidden || we === 0 ? 0 : we * (ve + 2) + 4, G = n.series[0], Oe = S(G?.dataLabelOverrides), ke = S(G?.dataPointOverrides), Ae = G?.chartexStyle, je = `#${G?.color ?? P(n, 0, 3, Ae)}`, K = `#${P(n, 1, 3, Ae)}`, q = `#${P(n, 2, 3, Ae)}`, Me = oe(n, 0, 3, Ae, G?.color), Ne = oe(n, 1, 3, Ae), J = oe(n, 2, 3, Ae), Pe = {
|
|
302
|
+
...n,
|
|
303
|
+
chartType: "clusteredBar",
|
|
304
|
+
series: [
|
|
305
|
+
re(n, "Increase", G, n.chartexDataPointStyle, 0, 3, je),
|
|
306
|
+
re(n, "Decrease", G, n.chartexDataPointStyle, 1, 3, K),
|
|
307
|
+
re(n, "Total", G, n.chartexDataPointStyle, 2, 3, q)
|
|
308
|
+
]
|
|
309
|
+
}, Fe = ee(e, Pe, d, p, .22, o), { legRightW: Ie, legLeftW: Le, legTopH: Re, legBottomH: ze } = c(Fe, n.legendOverlay === !0), Y = i(n, l, u, d, p, o, {
|
|
310
|
+
titleBand: H,
|
|
311
|
+
legendSideReserveFrac: 0,
|
|
312
|
+
legendReserve: Fe,
|
|
313
|
+
pad: {
|
|
314
|
+
t: H.bandH + Re + _e / 2 + 2,
|
|
315
|
+
r: Ie + d * .02,
|
|
316
|
+
b: ze + U.catBandH + De,
|
|
317
|
+
l: Le + U.valBandW + (n.valAxisHidden ? d * .02 : Math.max(d * .03, Se))
|
|
318
|
+
},
|
|
319
|
+
honorPlotAreaManualLayout: !0
|
|
320
|
+
});
|
|
321
|
+
fe(e, n, l, u, d, p, u + Y.title.topPad, Y.title.fontPx);
|
|
322
|
+
let { px0: X, py0: Z, pw: Q, ph: $ } = Y.plotRect;
|
|
323
|
+
_(e, n, X, Z, Q, $, o, s);
|
|
324
|
+
let Be = w(n, B, R, $ / o), Ve = (e) => Z + $ - Be.frac(e) * $, He = h(n.valAxisLineColor, n.valAxisLineWidthEmu, o), Ue = h(n.catAxisLineColor, n.catAxisLineWidthEmu, o), We = E(n, o);
|
|
325
|
+
if (!n.valAxisHidden) {
|
|
326
|
+
e.font = se(_e, ye, n.valAxisFontBold ?? !1, n.valAxisFontItalic ?? !1), e.fillStyle = n.valAxisFontColor ? `#${n.valAxisFontColor}` : "#595959", e.textAlign = "right", e.textBaseline = "middle";
|
|
327
|
+
let t = D(n, o);
|
|
328
|
+
for (let n of Be.minorLines) T(e, X, Q, Ve(n), !1, t);
|
|
329
|
+
for (let t of Be.majorLines) {
|
|
330
|
+
let r = Ve(t);
|
|
331
|
+
if (me(n)) {
|
|
332
|
+
e.strokeStyle = We.color, e.lineWidth = We.width;
|
|
333
|
+
let t = We.dash.length > 0 && e.getLineDash ? e.getLineDash() : [];
|
|
334
|
+
We.dash.length > 0 && e.setLineDash(We.dash), e.beginPath(), e.moveTo(X, r), e.lineTo(X + Q, r), e.stroke(), We.dash.length > 0 && e.setLineDash(t);
|
|
335
|
+
}
|
|
336
|
+
ge && e.fillText(N(n, t, !1), X - 4, r), L(e, n.valAxisMajorTickMark, "val", X, r, He.color, He.width, !1, n.valAxisLineHidden, "major", o, n.valAxisLineDash);
|
|
337
|
+
}
|
|
338
|
+
for (let t of Be.minorTicks) L(e, n.valAxisMinorTickMark, "val", X, Ve(t), He.color, He.width, !1, n.valAxisLineHidden, "minor", o, n.valAxisLineDash);
|
|
339
|
+
}
|
|
340
|
+
let Ge = !n.valAxisHidden && !n.valAxisLineHidden, Ke = !n.catAxisHidden && !n.catAxisLineHidden;
|
|
341
|
+
Ge && j(e, X, Z, X, Z + $, He.color, He.width, n.valAxisLineDash), Ke && j(e, X, Z + $, X + Q, Z + $, Ue.color, Ue.width, n.catAxisLineDash);
|
|
342
|
+
let qe = Q / y, Je = qe / (1 + f(n.barGapWidth, "chartex") / 100);
|
|
343
|
+
I.forEach((r, i) => {
|
|
344
|
+
let a = X + qe * i + (qe - Je) / 2, c = Math.min(Ve(r.start), Ve(r.end)), f = Math.max(Ve(r.start), Ve(r.end)), h = Math.max(1, f - c), g = r.isSub ? 2 : +!r.isPos, _ = ke.get(i), b = Te(n, _, G, g), x = _?.color ? `#${_.color}` : r.isSub ? q : r.isPos ? je : K;
|
|
345
|
+
r.paintSlot && b && (e.fillStyle = le(e, b, a, c, Je, h, x, s), e.fillRect(a, c, Je, h));
|
|
346
|
+
let S = F(n, n.chartexDataPointStyle, "line", g, 3), C = Ee(_) ? _ : G;
|
|
347
|
+
if (r.paintSlot && ue(e, n, n.chartexDataPointStyle, C, g, 3, S ? `#${S}` : x, o) && e.strokeRect(a, c, Je, h), r.paintSlot && I[i + 1]?.paintSlot && i < y - 1 && n.chartexConnectorLines !== !1) {
|
|
348
|
+
let t = X + qe * (i + 1) + (qe - Je) / 2, s = r.isPos ? c : f;
|
|
349
|
+
e.save();
|
|
350
|
+
let l = O(n, n.chartexSeriesLineStyle, G, g, 3, "#000000", { linkedNoStyleFallback: !0 });
|
|
351
|
+
ae(e, l, o) && (l.widthEmu ?? (e.lineWidth = .75 * o), e.beginPath(), e.moveTo(a + Je, s), e.lineTo(t, s), e.stroke()), e.restore();
|
|
352
|
+
}
|
|
353
|
+
let w = r.hasValue ? m[i] : 0, T = z(n, G, i, v[i] ?? "", w, {
|
|
354
|
+
visible: n.showDataLabels,
|
|
355
|
+
showVal: !0,
|
|
356
|
+
showCatName: !1
|
|
357
|
+
}, Oe, !r.hasValue);
|
|
358
|
+
if (T) {
|
|
359
|
+
let r = G?.dataLabelColors?.[i] ?? T.fontColor ?? null, f = r ? `#${r}` : n.dataLabelFontColor ? `#${n.dataLabelFontColor}` : "#595959", m = t(T.fontSizeHpt, o) ?? ce(n.dataLabelFontSizeHpt, p, o), g = T.fontBold ?? n.dataLabelFontBold ?? !1, _ = V(n, T.fontFace ?? n.dataLabelFontFace, "minor");
|
|
360
|
+
e.font = `${T.textStyle.fontItalic ? "italic " : ""}${g ? "bold " : ""}${m}px ${_}`, te(e, T.text, {
|
|
361
|
+
kind: "bar",
|
|
362
|
+
rect: {
|
|
363
|
+
x: a,
|
|
364
|
+
y: c,
|
|
365
|
+
w: Je,
|
|
366
|
+
h
|
|
367
|
+
},
|
|
368
|
+
orientation: "vertical",
|
|
369
|
+
negative: w < 0,
|
|
370
|
+
position: T.position ?? "outEnd"
|
|
371
|
+
}, {
|
|
372
|
+
x: X,
|
|
373
|
+
y: Z,
|
|
374
|
+
w: Q,
|
|
375
|
+
h: $
|
|
376
|
+
}, m, f, T.manualLayout, {
|
|
377
|
+
x: l,
|
|
378
|
+
y: u,
|
|
379
|
+
w: d,
|
|
380
|
+
h: p
|
|
381
|
+
}, k(n, T.richRuns, o, _, g, T.textStyle), void 0, T.textStyle, o, T.labelBox, s);
|
|
382
|
+
}
|
|
383
|
+
}), e.textAlign = "center", e.textBaseline = "top", e.fillStyle = n.catAxisFontColor ? `#${n.catAxisFontColor}` : "#595959", e.font = se(ve, be, n.catAxisFontBold ?? !1, n.catAxisFontItalic ?? !1);
|
|
384
|
+
let Ye = Z + $ + 4;
|
|
385
|
+
for (let t = 0; t < y && !n.catAxisHidden; t++) {
|
|
386
|
+
let n = X + qe * t + qe / 2;
|
|
387
|
+
(W[t] ?? []).forEach((t, r) => t && e.fillText(t, n, Ye + r * (ve + 2)));
|
|
388
|
+
}
|
|
389
|
+
ie(e, n, l, u, d, p, X, Z, Q, $, Le, ze, U.catFontPx, U.valFontPx), he(e, Pe, Fe, l, u, d, p, X, Z, Q, $, H.bandH + 2, o, [
|
|
390
|
+
Me,
|
|
391
|
+
Ne,
|
|
392
|
+
J
|
|
393
|
+
], s), e.restore();
|
|
394
|
+
}
|
|
395
|
+
function ke(e, n, r, a, o) {
|
|
396
|
+
let s = n.series[0]?.values ?? [], l = Math.max(s.length, n.categories.length);
|
|
397
|
+
if (l === 0 || C(e, r, l)) return;
|
|
398
|
+
let u = 0;
|
|
399
|
+
for (let e = 0; e < l; e++) u = Math.max(u, s[e] ?? 0);
|
|
400
|
+
if (!(u > 0)) return;
|
|
401
|
+
let { x: d, y: p, w: m, h: g } = r, v = pe(e, n, m, g, a), y = n.series[0], b = S(y?.dataLabelOverrides), x = `#${y?.color ?? P(n, 0, 1, y?.chartexStyle)}`, w = oe(n, 0, 1, y?.chartexStyle, y?.color), T = {
|
|
402
|
+
...n,
|
|
403
|
+
series: [re(n, y?.name ?? "", y, n.chartexDataPointStyle, 0, 1, x)]
|
|
404
|
+
}, E = ee(e, T, m, g, .22, a), { legRightW: D, legLeftW: O, legTopH: A, legBottomH: j } = c(E, n.legendOverlay === !0), M = ce(n.catAxisFontSizeHpt, g, a);
|
|
405
|
+
e.save(), e.font = se(M, V(n, n.catAxisFontFace, "minor"), n.catAxisFontBold ?? !1, n.catAxisFontItalic ?? !1);
|
|
406
|
+
let N = 0;
|
|
407
|
+
if (!n.catAxisHidden) {
|
|
408
|
+
for (let t = 0; t < Math.min(l, n.categories.length); t++) N = Math.max(N, e.measureText(n.categories[t]).width);
|
|
409
|
+
n.categories.length > 0 && (N += 10);
|
|
410
|
+
}
|
|
411
|
+
let ne = i(n, d, p, m, g, a, {
|
|
412
|
+
titleBand: v,
|
|
413
|
+
legendSideReserveFrac: .22,
|
|
414
|
+
legendReserve: E,
|
|
415
|
+
pad: {
|
|
416
|
+
t: v.bandH + A + 2,
|
|
417
|
+
r: D + m * .02,
|
|
418
|
+
b: j + g * .02,
|
|
419
|
+
l: O + N + m * .02
|
|
420
|
+
},
|
|
421
|
+
honorPlotAreaManualLayout: !0
|
|
422
|
+
});
|
|
423
|
+
fe(e, n, d, p, m, g, p + ne.title.topPad, ne.title.fontPx);
|
|
424
|
+
let { px0: F, py0: I, pw: ie, ph: L } = ne.plotRect;
|
|
425
|
+
_(e, n, F, I, ie, L, a, o);
|
|
426
|
+
let R = L / l, B = R / (1 + f(n.barGapWidth, "chartex") / 100);
|
|
427
|
+
for (let r = 0; r < l; r++) {
|
|
428
|
+
let i = Math.max(0, s[r] ?? 0), c = ie * i / u, l = F + (ie - c) / 2, f = I + R * r + (R - B) / 2;
|
|
429
|
+
w && (e.fillStyle = le(e, w, l, f, c, B, x, o), e.fillRect(l, f, c, B)), ue(e, n, n.chartexDataPointStyle, y, 0, 1, x, a) && e.strokeRect(l, f, c, B);
|
|
430
|
+
let h = n.categories[r];
|
|
431
|
+
!n.catAxisHidden && h != null && (e.fillStyle = n.catAxisFontColor ? `#${n.catAxisFontColor}` : "#595959", e.textAlign = "right", e.textBaseline = "middle", e.fillText(h, F - 6, f + B / 2));
|
|
432
|
+
let _ = z(n, y, r, h ?? "", i, {
|
|
433
|
+
visible: !1,
|
|
434
|
+
showVal: !1,
|
|
435
|
+
showCatName: !1
|
|
436
|
+
}, b);
|
|
437
|
+
if (_) {
|
|
438
|
+
let r = t(_.fontSizeHpt, a) ?? ce(n.dataLabelFontSizeHpt, g, a), i = V(n, _.fontFace ?? n.dataLabelFontFace, "minor");
|
|
439
|
+
e.font = `${_.textStyle.fontItalic ? "italic " : ""}${_.fontBold ? "bold " : ""}${r}px ${i}`, te(e, _.text, {
|
|
440
|
+
kind: "bar",
|
|
441
|
+
rect: {
|
|
442
|
+
x: l,
|
|
443
|
+
y: f,
|
|
444
|
+
w: c,
|
|
445
|
+
h: B
|
|
446
|
+
},
|
|
447
|
+
orientation: "horizontal",
|
|
448
|
+
negative: !1,
|
|
449
|
+
position: _.position ?? "ctr"
|
|
450
|
+
}, {
|
|
451
|
+
x: F,
|
|
452
|
+
y: I,
|
|
453
|
+
w: ie,
|
|
454
|
+
h: L
|
|
455
|
+
}, r, _.fontColor ? `#${_.fontColor}` : "#ffffff", _.manualLayout, {
|
|
456
|
+
x: d,
|
|
457
|
+
y: p,
|
|
458
|
+
w: m,
|
|
459
|
+
h: g
|
|
460
|
+
}, k(n, _.richRuns, a, i, _.fontBold ?? !1, _.textStyle), void 0, _.textStyle, a, _.labelBox, o);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if (!n.catAxisHidden && !n.catAxisLineHidden) {
|
|
464
|
+
let t = h(n.catAxisLineColor, n.catAxisLineWidthEmu, a);
|
|
465
|
+
e.strokeStyle = t.color, e.lineWidth = t.width, e.beginPath(), e.moveTo(F, I), e.lineTo(F, I + L), e.stroke();
|
|
466
|
+
}
|
|
467
|
+
he(e, T, E, d, p, m, g, F, I, ie, L, v.bandH + 2, a, [w], o), e.restore();
|
|
468
|
+
}
|
|
469
|
+
function Ae(e, t, n, r, i = 0) {
|
|
470
|
+
let a = t.series[0];
|
|
471
|
+
if (!a || C(e, n, Math.max(t.categories.length, a.categories?.length ?? 0, a.values.length))) return;
|
|
472
|
+
let o = be(a, t.categories, { sortDescending: !1 });
|
|
473
|
+
if (o.points.length === 0) return;
|
|
474
|
+
let s = de(a, 0), c = O(t, t.chartexDataPointLineStyle, a, s, 1, R(0, a), { linkedNoStyleFallback: !0 });
|
|
475
|
+
x(e, {
|
|
476
|
+
...t,
|
|
477
|
+
chartType: "line",
|
|
478
|
+
categories: o.categories,
|
|
479
|
+
series: [{
|
|
480
|
+
...o.series,
|
|
481
|
+
showMarker: !1,
|
|
482
|
+
lineHidden: !c.visible,
|
|
483
|
+
lineColor: c.color.replace(/^#/, ""),
|
|
484
|
+
lineWidthEmu: c.widthEmu,
|
|
485
|
+
chartexStyle: {
|
|
486
|
+
lineDash: c.dash,
|
|
487
|
+
lineCap: c.cap,
|
|
488
|
+
lineJoin: c.join
|
|
489
|
+
}
|
|
490
|
+
}],
|
|
491
|
+
catAxisHidden: !1,
|
|
492
|
+
catAxisTickLabelPos: "none",
|
|
493
|
+
showLegend: !1,
|
|
494
|
+
valMin: t.valMin ?? 0,
|
|
495
|
+
valMax: t.valMax ?? 1.2,
|
|
496
|
+
valAxisMajorUnit: t.valAxisMajorUnit ?? .2
|
|
497
|
+
}, n, r, i);
|
|
498
|
+
}
|
|
499
|
+
function je(e, t, n, r, i = 0) {
|
|
500
|
+
let a = t.series[0];
|
|
501
|
+
if (!a || C(e, n, Math.max(t.categories.length, a.categories?.length ?? 0, a.values.length))) return;
|
|
502
|
+
let o = be(a, t.categories);
|
|
503
|
+
if (o.points.length === 0) return;
|
|
504
|
+
let s = t.series.find((e) => e.seriesType === "line"), c = s?.chartexFormatIdx ?? a.chartexFormatIdx ?? 0, l = {
|
|
505
|
+
...s ?? o.series,
|
|
506
|
+
name: s?.name || "Cumulative %",
|
|
507
|
+
values: o.series.values,
|
|
508
|
+
categories: o.categories,
|
|
509
|
+
color: s?.color ?? F(t, t.chartexDataPointLineStyle, "line", c, 1) ?? a.lineColor ?? a.color,
|
|
510
|
+
seriesType: "line",
|
|
511
|
+
useSecondaryAxis: !0,
|
|
512
|
+
showMarker: !1
|
|
513
|
+
}, u = {
|
|
514
|
+
min: t.secondaryValAxis?.min ?? 0,
|
|
515
|
+
max: t.secondaryValAxis?.max ?? 1,
|
|
516
|
+
title: t.secondaryValAxis?.title ?? null,
|
|
517
|
+
hidden: t.secondaryValAxis?.hidden ?? !1,
|
|
518
|
+
formatCode: t.secondaryValAxis?.formatCode ?? "0%",
|
|
519
|
+
fontColor: t.secondaryValAxis?.fontColor ?? null,
|
|
520
|
+
fontSizeHpt: t.secondaryValAxis?.fontSizeHpt ?? null,
|
|
521
|
+
fontFace: t.secondaryValAxis?.fontFace ?? null,
|
|
522
|
+
lineColor: t.secondaryValAxis?.lineColor ?? null,
|
|
523
|
+
lineWidthEmu: t.secondaryValAxis?.lineWidthEmu ?? null,
|
|
524
|
+
lineHidden: t.secondaryValAxis?.lineHidden ?? !1,
|
|
525
|
+
majorTickMark: t.secondaryValAxis?.majorTickMark ?? "out",
|
|
526
|
+
minorTickMark: t.secondaryValAxis?.minorTickMark ?? null,
|
|
527
|
+
majorUnit: t.secondaryValAxis?.majorUnit ?? null,
|
|
528
|
+
minorUnit: t.secondaryValAxis?.minorUnit ?? null,
|
|
529
|
+
titleFontSizeHpt: t.secondaryValAxis?.titleFontSizeHpt ?? null,
|
|
530
|
+
titleFontBold: t.secondaryValAxis?.titleFontBold ?? null,
|
|
531
|
+
titleFontColor: t.secondaryValAxis?.titleFontColor ?? null,
|
|
532
|
+
titleFontFace: t.secondaryValAxis?.titleFontFace ?? null
|
|
533
|
+
};
|
|
534
|
+
A(e, {
|
|
535
|
+
...t,
|
|
536
|
+
chartType: "clusteredBar",
|
|
537
|
+
categories: o.categories,
|
|
538
|
+
series: [{
|
|
539
|
+
...o.orderedSeries,
|
|
540
|
+
seriesType: null,
|
|
541
|
+
useSecondaryAxis: !1
|
|
542
|
+
}, l],
|
|
543
|
+
secondaryValAxis: u
|
|
544
|
+
}, n, r, {
|
|
545
|
+
gapPolicy: "chartex",
|
|
546
|
+
semanticLineNoStyleFallback: !0
|
|
547
|
+
}, i);
|
|
548
|
+
}
|
|
549
|
+
var K = 7, q = .05, Me = 1.2;
|
|
550
|
+
function Ne(e, t, n, r) {
|
|
551
|
+
let i = (r ?? t) - (n ?? e);
|
|
552
|
+
if (!(i > 0) || !Number.isFinite(i)) return null;
|
|
553
|
+
let a = b(i, K);
|
|
554
|
+
if (!(a > 0) || !Number.isFinite(a)) return null;
|
|
555
|
+
let o = e - i * q, s = t + i * q;
|
|
556
|
+
e >= 0 && (e === 0 || t > Me * e) && (o = 0), t <= 0 && (t === 0 || Math.abs(e) > Me * Math.abs(t)) && (s = 0);
|
|
557
|
+
let c = n ?? Math.floor(o / a) * a, l = r ?? Math.ceil(s / a) * a;
|
|
558
|
+
return ![c, l].every(Number.isFinite) || !(l > c) ? null : {
|
|
559
|
+
min: c,
|
|
560
|
+
max: l,
|
|
561
|
+
majorUnit: a
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
function J(t, o, s, p, g) {
|
|
565
|
+
let b = 3 * p, x = o.chartexBox;
|
|
566
|
+
if (!x || x.categories.length === 0 || x.series.length === 0) return;
|
|
567
|
+
let { x: S, y: O, w: k, h: A } = s;
|
|
568
|
+
if (C(t, s, e(x.series.map((e) => e.valuesByCategory), 1e4))) return;
|
|
569
|
+
let M = () => {
|
|
570
|
+
t.fillStyle = "#888", t.font = "12px sans-serif", t.textAlign = "center", t.textBaseline = "middle", t.fillText("(chart values out of range)", S + k / 2, O + A / 2);
|
|
571
|
+
}, te = (e) => {
|
|
572
|
+
let t = e.max - e.min, n = t / e.step;
|
|
573
|
+
return Number.isFinite(e.min) && Number.isFinite(e.max) && Number.isFinite(e.step) && Number.isFinite(t) && Number.isFinite(n) && e.max > e.min && e.step > 0 && n <= 1e3 && e.min + e.step > e.min;
|
|
574
|
+
}, R = Infinity, z = -Infinity;
|
|
575
|
+
for (let e of x.series) for (let t of e.valuesByCategory) for (let e of t) Number.isFinite(e) && (e < R && (R = e), e > z && (z = e));
|
|
576
|
+
if (!isFinite(R) || !isFinite(z)) return;
|
|
577
|
+
if (!Number.isFinite(z - R)) {
|
|
578
|
+
M();
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
let ae = o.valAxisMajorUnit == null ? Ne(R, z, o.valMin, o.valMax) : null, me = ae ? {
|
|
582
|
+
...o,
|
|
583
|
+
valMin: ae.min,
|
|
584
|
+
valMax: ae.max,
|
|
585
|
+
valAxisMajorUnit: ae.majorUnit
|
|
586
|
+
} : o, ge = V(o, o.valAxisFontFace, "minor"), H = ce(o.valAxisFontSizeHpt, A, p), U = r(H), _e = I(p), ve = y({
|
|
587
|
+
dataMin: R,
|
|
588
|
+
dataMax: z,
|
|
589
|
+
explicitMin: me.valMin,
|
|
590
|
+
explicitMax: me.valMax,
|
|
591
|
+
axisLenPt: A / p,
|
|
592
|
+
majorUnit: me.valAxisMajorUnit
|
|
593
|
+
});
|
|
594
|
+
if (!te({
|
|
595
|
+
min: ve.min,
|
|
596
|
+
max: ve.max,
|
|
597
|
+
step: ve.majorUnit
|
|
598
|
+
})) {
|
|
599
|
+
M();
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
let ye = 0;
|
|
603
|
+
if (!o.valAxisHidden) {
|
|
604
|
+
let e = t.font;
|
|
605
|
+
t.font = se(H, ge, o.valAxisFontBold ?? !1, o.valAxisFontItalic ?? !1);
|
|
606
|
+
let n = 0;
|
|
607
|
+
for (let e of ve.majorTicks) {
|
|
608
|
+
let r = N(o, e, !1);
|
|
609
|
+
n = Math.max(n, t.measureText(r).width);
|
|
610
|
+
}
|
|
611
|
+
t.font = e, ye = n + U + l * p;
|
|
612
|
+
}
|
|
613
|
+
let be = pe(t, o, k, A, p), xe = ce(o.catAxisFontSizeHpt, A, p), Se = ce(o.valAxisFontSizeHpt, A, p), Ce = a(o, k, A, p), W = x.series.length, we = x.series.map((e, t) => de(e, t)), Te = x.series.map((e, t) => {
|
|
614
|
+
let n = we[t], r = e.color ?? P(o, n, W, e.chartexStyle);
|
|
615
|
+
return re(o, e.name, e, o.chartexDataPointStyle, n, W, r, !0);
|
|
616
|
+
}), Ee = {
|
|
617
|
+
...o,
|
|
618
|
+
series: Te
|
|
619
|
+
}, De = ee(t, Ee, k, A, .22, p), { legRightW: G, legLeftW: Oe, legTopH: ke, legBottomH: Ae } = c(De, o.legendOverlay === !0), je = i(o, S, O, k, A, p, {
|
|
620
|
+
titleBand: be,
|
|
621
|
+
legendSideReserveFrac: .22,
|
|
622
|
+
legendReserve: De,
|
|
623
|
+
pad: {
|
|
624
|
+
t: be.bandH + ke + Se / 2 + 2,
|
|
625
|
+
r: G + k * .02,
|
|
626
|
+
b: Ae + Ce.catBandH + (o.catAxisHidden ? A * .02 : u(xe)),
|
|
627
|
+
l: Oe + Ce.valBandW + (o.valAxisHidden ? k * .02 : ye)
|
|
628
|
+
},
|
|
629
|
+
honorPlotAreaManualLayout: !0
|
|
630
|
+
}), { px0: K, py0: q, pw: Me, ph: J } = je.plotRect;
|
|
631
|
+
_(t, o, K, q, Me, J, p, g);
|
|
632
|
+
let Pe = x.categories, Fe = Pe.length, Ie = w(me, R, z, J / p);
|
|
633
|
+
if (!te(Ie)) {
|
|
634
|
+
M();
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
fe(t, o, S, O, k, A, O + je.title.topPad, je.title.fontPx);
|
|
638
|
+
let { min: Le, max: Re } = Ie, ze = Re - Le, Y = (e) => q + J * (1 - (e - Le) / ze), X = h(o.valAxisLineColor, o.valAxisLineWidthEmu, p), Z = E(o, p);
|
|
639
|
+
if (t.save(), !o.valAxisHidden) {
|
|
640
|
+
if (t.font = se(H, ge, o.valAxisFontBold ?? !1, o.valAxisFontItalic ?? !1), t.textAlign = "right", t.textBaseline = "middle", o.valAxisMinorGridlines) {
|
|
641
|
+
let e = D(o, p);
|
|
642
|
+
for (let n of Ie.minorLines) T(t, K, Me, Y(n), !1, e);
|
|
643
|
+
}
|
|
644
|
+
for (let e of Ie.majorLines) {
|
|
645
|
+
let n = Y(e);
|
|
646
|
+
if (o.valAxisMajorGridlines !== !1) {
|
|
647
|
+
t.strokeStyle = Z.color, t.lineWidth = Z.width;
|
|
648
|
+
let e = Z.dash.length > 0 && t.getLineDash ? t.getLineDash() : [];
|
|
649
|
+
Z.dash.length > 0 && t.setLineDash(Z.dash), t.beginPath(), t.moveTo(K, n), t.lineTo(K + Me, n), t.stroke(), Z.dash.length > 0 && t.setLineDash(e);
|
|
650
|
+
}
|
|
651
|
+
t.fillStyle = o.valAxisFontColor ? `#${o.valAxisFontColor}` : "#595959", t.fillText(N(o, e, !1), K - _e, n), L(t, o.valAxisMajorTickMark, "val", K, n, X.color, X.width, !1, o.valAxisLineHidden, "major", p, o.valAxisLineDash);
|
|
652
|
+
}
|
|
653
|
+
for (let e of Ie.minorTicks) L(t, o.valAxisMinorTickMark, "val", K, Y(e), X.color, X.width, !1, o.valAxisLineHidden, "minor", p, o.valAxisLineDash);
|
|
654
|
+
o.valAxisLineHidden || j(t, K, q, K, q + J, X.color, X.width, o.valAxisLineDash);
|
|
655
|
+
}
|
|
656
|
+
let Q = h(o.catAxisLineColor, o.catAxisLineWidthEmu, p);
|
|
657
|
+
!o.catAxisHidden && !o.catAxisLineHidden && j(t, K, q + J, K + Me, q + J, Q.color, Q.width, o.catAxisLineDash);
|
|
658
|
+
let $ = Me / Fe, Be = f(o.barGapWidth, "chartex"), Ve = (e) => `#${x.series[e].color ?? P(o, we[e], W, x.series[e].chartexStyle)}`, He = (e) => oe(o, we[e], W, x.series[e].chartexStyle, x.series[e].color), Ue = x.series.map((e) => e.valuesByCategory.map((t) => m(t, e.quartileMethod))), We = (e, t) => {
|
|
659
|
+
let n = d(K, Me, x.oneBoxPerSeries ? 1 : Fe, W, x.oneBoxPerSeries ? 0 : e, t, Be);
|
|
660
|
+
return n ? {
|
|
661
|
+
bx: n.boxX,
|
|
662
|
+
boxW: n.boxWidth,
|
|
663
|
+
cx: n.centerX
|
|
664
|
+
} : {
|
|
665
|
+
bx: K,
|
|
666
|
+
boxW: 0,
|
|
667
|
+
cx: K
|
|
668
|
+
};
|
|
669
|
+
};
|
|
670
|
+
for (let e = 0; e < W; e++) {
|
|
671
|
+
let n = x.series[e];
|
|
672
|
+
if (!n.meanLine) continue;
|
|
673
|
+
let r = o.chartexDataPointLineStyle ?? o.chartexDataPointStyle, i = n.lineColor ? `#${n.lineColor}` : Ve(e);
|
|
674
|
+
if (t.save(), ue(t, o, r, n, we[e], W, i, p) || n.lineColor != null) {
|
|
675
|
+
n.lineColor && (t.strokeStyle = i), n.lineWidthEmu && (t.lineWidth = v(n.lineWidthEmu, p));
|
|
676
|
+
let r = !1;
|
|
677
|
+
t.beginPath();
|
|
678
|
+
for (let n = 0; n < Fe; n++) {
|
|
679
|
+
let i = Ue[e][n];
|
|
680
|
+
if (!i) {
|
|
681
|
+
r = !1;
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
684
|
+
let { cx: a } = We(n, e), o = Y(i.mean);
|
|
685
|
+
r ? t.lineTo(a, o) : t.moveTo(a, o), r = !0;
|
|
686
|
+
}
|
|
687
|
+
t.stroke();
|
|
688
|
+
}
|
|
689
|
+
t.restore();
|
|
690
|
+
}
|
|
691
|
+
let Ge = ce(o.catAxisFontSizeHpt, A, p), Ke = n(Ge);
|
|
692
|
+
for (let e = 0; e < Fe; e++) {
|
|
693
|
+
let n = K + $ * (e + .5);
|
|
694
|
+
o.catAxisHidden || L(t, o.catAxisMajorTickMark, "cat", q + J, n, Q.color, Q.width, !1, o.catAxisLineHidden, "major", p, o.catAxisLineDash);
|
|
695
|
+
for (let n = 0; n < W; n++) {
|
|
696
|
+
let r = x.series[n], i = Ue[n][e];
|
|
697
|
+
if (!i) continue;
|
|
698
|
+
let { bx: a, boxW: s, cx: c } = We(e, n), l = Ve(n), u = He(n), d = o.chartexDataPointStyle, f = o.chartexDataPointLineStyle ?? d, m = o.chartexDataPointMarkerStyle ?? d, h = we[n], _ = F(o, d, "line", h, W), y = r.lineColor ? `#${r.lineColor}` : _ ? `#${_}` : l, S = r.lineWidthEmu ? v(r.lineWidthEmu, p) : d?.lineWidthEmu == null ? 1 : v(d.lineWidthEmu, p), C = F(o, f, "line", h, W), w = F(o, m, "fill", h, W), T = B(o, h, W, r.chartexStyle, r.color, m), E = F(o, m, "line", h, W), D = (e, n) => {
|
|
699
|
+
let i = r.chartexStyle, a = i?.lineHidden != null || i?.lineColors?.some(Boolean) || i?.lineWidthEmu != null || i?.lineDash != null || i?.lineCap != null || i?.lineJoin != null, s = ue(t, o, e, r, h, W, n, p), c = e?.lineNoStyle === !0 && !a && r.lineColor == null && r.lineWidthEmu == null;
|
|
700
|
+
return !s && c && (t.strokeStyle = n, t.lineWidth = 1, t.setLineDash([])), r.lineColor && (t.strokeStyle = y), r.lineWidthEmu && (t.lineWidth = S), s || c || r.lineColor != null;
|
|
701
|
+
}, O = Y(i.q1), k = Y(i.q3), A = Math.min(O, k), j = Math.max(1, Math.abs(O - k)), M = s * .4;
|
|
702
|
+
D(f, C ?? y) && (t.beginPath(), t.moveTo(c, Y(i.whiskerHi)), t.lineTo(c, k), t.moveTo(c, O), t.lineTo(c, Y(i.whiskerLo)), t.moveTo(c - M / 2, Y(i.whiskerHi)), t.lineTo(c + M / 2, Y(i.whiskerHi)), t.moveTo(c - M / 2, Y(i.whiskerLo)), t.lineTo(c + M / 2, Y(i.whiskerLo)), t.stroke()), u && (t.fillStyle = le(t, u, a, A, s, j, l, g), t.fillRect(a, A, s, j)), D(d, y) && t.strokeRect(a + S / 2, A + S / 2, s - S, j - S);
|
|
703
|
+
let N = Y(i.median);
|
|
704
|
+
if (D(f, C ?? y) && (t.beginPath(), t.moveTo(a, N), t.lineTo(a + s, N), t.stroke()), r.showNonoutliers) {
|
|
705
|
+
let e = o.chartStyleMarkerSymbol ?? o.chartexMarkerSymbol ?? "circle";
|
|
706
|
+
for (let n of i.inner) {
|
|
707
|
+
if (e === "none") continue;
|
|
708
|
+
let r = D(m, E ?? y);
|
|
709
|
+
ne(t, c, Y(n), e, 3, T ? w ? `#${w}` : l : "transparent", r ? y : null, p, t.lineWidth, T, g);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (r.meanMarker) {
|
|
713
|
+
let e = Y(i.mean), n = b;
|
|
714
|
+
D(m, E ?? y) && (t.beginPath(), t.moveTo(c - n, e - n), t.lineTo(c + n, e + n), t.moveTo(c + n, e - n), t.lineTo(c - n, e + n), t.stroke());
|
|
715
|
+
}
|
|
716
|
+
if (r.showOutliers) {
|
|
717
|
+
let e = o.chartStyleMarkerSymbol ?? o.chartexMarkerSymbol ?? "circle";
|
|
718
|
+
for (let n of i.outliers) {
|
|
719
|
+
if (e === "none") continue;
|
|
720
|
+
let r = D(m, E ?? y);
|
|
721
|
+
ne(t, c, Y(n), e, 3, T ? w ? `#${w}` : l : "transparent", r ? y : null, p, t.lineWidth, T, g);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (!o.catAxisHidden) {
|
|
726
|
+
t.font = se(Ge, V(o, o.catAxisFontFace, "minor"), o.catAxisFontBold ?? !1, o.catAxisFontItalic ?? !1), t.fillStyle = o.catAxisFontColor ? `#${o.catAxisFontColor}` : "#595959", t.textAlign = "center", t.textBaseline = "top";
|
|
727
|
+
let r = Pe[e];
|
|
728
|
+
t.fillText(r, n, q + J + Ke);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
t.restore(), ie(t, o, S, O, k, A, K, q, Me, J, Oe, Ae, Ce.catFontPx, Ce.valFontPx), he(t, Ee, De, S, O, k, A, K, q, Me, J, be.bandH + 2, p, x.series.map((e, t) => He(t)), g);
|
|
732
|
+
}
|
|
733
|
+
var Pe = .18;
|
|
734
|
+
function Fe(e, n, r, a, o) {
|
|
735
|
+
let c = n.chartexSunburst;
|
|
736
|
+
if (!c || c.rows.length === 0) return;
|
|
737
|
+
let { x: l, y: u, w: d, h: f } = r;
|
|
738
|
+
if (xe(c.rows)) {
|
|
739
|
+
C(e, r, s + 1);
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
let p = Se(c.rows);
|
|
743
|
+
if (p.layoutWeight <= 0 || p.children.length === 0) return;
|
|
744
|
+
let m = n.series[0], h = S(m?.dataLabelOverrides), g = p.children.map((e, t) => oe(n, t, p.children.length, m?.chartexStyle, m?.color)), v = {
|
|
745
|
+
...n,
|
|
746
|
+
chartType: "clusteredBar",
|
|
747
|
+
series: p.children.map((e) => {
|
|
748
|
+
let t = P(n, e.branchIndex, p.children.length, m?.chartexStyle);
|
|
749
|
+
return re(n, e.label, m, n.chartexDataPointStyle, e.branchIndex, p.children.length, t, !1, !1);
|
|
750
|
+
})
|
|
751
|
+
}, y = ee(e, v, d, f, .22, a), b = i(n, l, u, d, f, a, {
|
|
752
|
+
titleTopPadFrac: .035,
|
|
753
|
+
titleBottomPadFrac: .035,
|
|
754
|
+
legendSideReserveFrac: 0,
|
|
755
|
+
legendReserve: y,
|
|
756
|
+
radialGapFrac: .02,
|
|
757
|
+
honorPlotAreaManualLayout: !0
|
|
758
|
+
});
|
|
759
|
+
fe(e, n, l, u, d, f, u + b.title.topPad, b.title.fontPx);
|
|
760
|
+
let { px0: x, py0: w, pw: T, ph: E } = b.plotRect;
|
|
761
|
+
_(e, n, x, w, T, E, a, o);
|
|
762
|
+
let D = x + T / 2, O = w + E / 2, A = Math.min(T, E) * .46;
|
|
763
|
+
p.a0 = -Math.PI / 2, p.a1 = -Math.PI / 2 + Math.PI * 2, Ce(p);
|
|
764
|
+
let j = W(p) + 1, M = A * Pe, N = (A - M) / j, ne = (e) => `#${P(n, e, p.children.length, m?.chartexStyle)}`, F = (e) => oe(n, e, p.children.length, m?.chartexStyle, m?.color), I = m?.seriesDataLabels, ie = V(n, I?.fontFace ?? n.dataLabelFontFace, "minor"), L = t(I?.fontSizeHpt, a) ?? Math.max(7, Math.min(13, A * .075)), R = I?.fontColor ? `#${I.fontColor}` : "#ffffff", B = Array.from({ length: j }, () => []), ae = [p];
|
|
765
|
+
for (; ae.length > 0;) {
|
|
766
|
+
let e = ae.pop();
|
|
767
|
+
e.depth >= 0 && B[e.depth].push(e);
|
|
768
|
+
for (let t = e.children.length - 1; t >= 0; t--) ae.push(e.children[t]);
|
|
769
|
+
}
|
|
770
|
+
e.save();
|
|
771
|
+
for (let r = 0; r < j; r++) {
|
|
772
|
+
let i = M + r * N, s = i + N;
|
|
773
|
+
for (let c of B[r]) {
|
|
774
|
+
let r = c.a1 - c.a0;
|
|
775
|
+
if (r <= 1e-4) continue;
|
|
776
|
+
e.beginPath(), e.arc(D, O, s, c.a0, c.a1), e.arc(D, O, i, c.a1, c.a0, !0), e.closePath();
|
|
777
|
+
let g = F(c.branchIndex);
|
|
778
|
+
g && (e.fillStyle = le(e, g, D - s, O - s, s * 2, s * 2, ne(c.branchIndex), o), e.fill()), ue(e, n, n.chartexDataPointStyle, n.series[0], c.branchIndex, p.children.length, "#ffffff", a) && e.stroke();
|
|
779
|
+
let _ = z(n, m, c.labelIndex, c.label, c.value, {
|
|
780
|
+
visible: !1,
|
|
781
|
+
showVal: !1,
|
|
782
|
+
showCatName: !1
|
|
783
|
+
}, h);
|
|
784
|
+
if (!_) continue;
|
|
785
|
+
let v = _.text, y = t(_.fontSizeHpt, a) ?? L, b = _.fontColor ? `#${_.fontColor}` : R, S = _.fontFace ? V(n, _.fontFace, "minor") : ie, C = (c.a0 + c.a1) / 2, A = (i + s) / 2, j = N - 4, M = r * A;
|
|
786
|
+
if (!_.manualLayout && j < y * .9 && M < y * .9) continue;
|
|
787
|
+
let ee = D + Math.cos(C) * A, P = O + Math.sin(C) * A;
|
|
788
|
+
if (e.font = `${_.textStyle.fontItalic ? "italic " : ""}${_.fontBold ? "bold " : ""}${y}px ${S}`, _.manualLayout) {
|
|
789
|
+
te(e, v, {
|
|
790
|
+
kind: "point",
|
|
791
|
+
x: ee,
|
|
792
|
+
y: P,
|
|
793
|
+
position: _.position ?? "ctr"
|
|
794
|
+
}, {
|
|
795
|
+
x,
|
|
796
|
+
y: w,
|
|
797
|
+
w: T,
|
|
798
|
+
h: E
|
|
799
|
+
}, y, b, _.manualLayout, {
|
|
800
|
+
x: l,
|
|
801
|
+
y: u,
|
|
802
|
+
w: d,
|
|
803
|
+
h: f
|
|
804
|
+
}, k(n, _.richRuns, a, S, _.fontBold ?? !1, _.textStyle), void 0, _.textStyle, a, _.labelBox, o);
|
|
805
|
+
continue;
|
|
806
|
+
}
|
|
807
|
+
e.save(), e.translate(ee, P);
|
|
808
|
+
let re = C, I = re * 180 / Math.PI % 360;
|
|
809
|
+
(I > 90 || I < -90) && (re += Math.PI), e.rotate(re), e.font = `${_.textStyle.fontItalic ? "italic " : ""}${_.fontBold ? "bold " : ""}${y}px ${S}`, te(e, v, {
|
|
810
|
+
kind: "point",
|
|
811
|
+
x: 0,
|
|
812
|
+
y: 0,
|
|
813
|
+
position: _.position ?? "ctr"
|
|
814
|
+
}, {
|
|
815
|
+
x: -j / 2,
|
|
816
|
+
y: -M / 2,
|
|
817
|
+
w: j,
|
|
818
|
+
h: M
|
|
819
|
+
}, y, b, void 0, {
|
|
820
|
+
x: -j / 2,
|
|
821
|
+
y: -M / 2,
|
|
822
|
+
w: j,
|
|
823
|
+
h: M
|
|
824
|
+
}, k(n, _.richRuns, a, S, _.fontBold ?? !1, _.textStyle), void 0, _.textStyle, a, _.labelBox, o), e.restore();
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
e.restore(), he(e, v, y, l, u, d, f, x, w, T, E, b.title.bandH + 2, a, g, o);
|
|
828
|
+
}
|
|
829
|
+
function Ie(e, t) {
|
|
830
|
+
let n = e.map((e, t) => ({
|
|
831
|
+
node: e,
|
|
832
|
+
index: t,
|
|
833
|
+
value: e.layoutWeight
|
|
834
|
+
})).filter((e) => e.value > 0).sort((e, t) => t.value - e.value || e.index - t.index), r = n.reduce((e, t) => e + t.value, 0);
|
|
835
|
+
if (r <= 0 || t.w <= 0 || t.h <= 0) return [];
|
|
836
|
+
let i = t.w * t.h / r, a = n.map((e) => ({
|
|
837
|
+
...e,
|
|
838
|
+
area: e.value * i
|
|
839
|
+
})), o = [], s = { ...t }, c = [], l = 0, u = Infinity, d = 0, f = (e, t, n, r) => {
|
|
840
|
+
if (e <= 0 || t <= 0 || r <= 0) return Infinity;
|
|
841
|
+
let i = r * r;
|
|
842
|
+
return Math.max(i * n / (e * e), e * e / (i * t));
|
|
843
|
+
}, p = (e, t) => {
|
|
844
|
+
if (e.length !== 0) if (s.w >= s.h) {
|
|
845
|
+
let n = s.h > 0 ? t / s.h : 0, r = s.y;
|
|
846
|
+
for (let t = 0; t < e.length; t++) {
|
|
847
|
+
let i = t === e.length - 1 ? s.y + s.h - r : e[t].area / n;
|
|
848
|
+
o.push({
|
|
849
|
+
node: e[t].node,
|
|
850
|
+
rect: {
|
|
851
|
+
x: s.x,
|
|
852
|
+
y: r,
|
|
853
|
+
w: n,
|
|
854
|
+
h: i
|
|
855
|
+
}
|
|
856
|
+
}), r += i;
|
|
857
|
+
}
|
|
858
|
+
s = {
|
|
859
|
+
x: s.x + n,
|
|
860
|
+
y: s.y,
|
|
861
|
+
w: Math.max(0, s.w - n),
|
|
862
|
+
h: s.h
|
|
863
|
+
};
|
|
864
|
+
} else {
|
|
865
|
+
let n = s.w > 0 ? t / s.w : 0, r = s.x;
|
|
866
|
+
for (let t = 0; t < e.length; t++) {
|
|
867
|
+
let i = t === e.length - 1 ? s.x + s.w - r : e[t].area / n;
|
|
868
|
+
o.push({
|
|
869
|
+
node: e[t].node,
|
|
870
|
+
rect: {
|
|
871
|
+
x: r,
|
|
872
|
+
y: s.y,
|
|
873
|
+
w: i,
|
|
874
|
+
h: n
|
|
875
|
+
}
|
|
876
|
+
}), r += i;
|
|
877
|
+
}
|
|
878
|
+
s = {
|
|
879
|
+
x: s.x,
|
|
880
|
+
y: s.y + n,
|
|
881
|
+
w: s.w,
|
|
882
|
+
h: Math.max(0, s.h - n)
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
}, m = 0;
|
|
886
|
+
for (; m < a.length;) {
|
|
887
|
+
let e = a[m], t = Math.min(s.w, s.h), n = l + e.area, r = Math.min(u, e.area), i = Math.max(d, e.area);
|
|
888
|
+
c.length === 0 || f(n, r, i, t) <= f(l, u, d, t) ? (c.push(e), l = n, u = r, d = i, m++) : (p(c, l), c = [], l = 0, u = Infinity, d = 0);
|
|
889
|
+
}
|
|
890
|
+
return p(c, l), o;
|
|
891
|
+
}
|
|
892
|
+
function Le(e, n, r, a, o) {
|
|
893
|
+
let c = n.chartexTreemap;
|
|
894
|
+
if (!c || c.rows.length === 0) return;
|
|
895
|
+
if (xe(c.rows)) {
|
|
896
|
+
C(e, r, s + 1);
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
let l = Se(c.rows, !0);
|
|
900
|
+
if (l.layoutWeight <= 0 || l.children.length === 0) return;
|
|
901
|
+
let u = n.series[0], d = l.children.map((e) => oe(n, e.branchIndex, l.children.length, u?.chartexStyle, u?.color)), f = {
|
|
902
|
+
...n,
|
|
903
|
+
chartType: "clusteredBar",
|
|
904
|
+
series: l.children.map((e) => {
|
|
905
|
+
let t = P(n, e.branchIndex, l.children.length, u?.chartexStyle);
|
|
906
|
+
return re(n, e.label, u, n.chartexDataPointStyle, e.branchIndex, l.children.length, t, !0, !1);
|
|
907
|
+
})
|
|
908
|
+
}, p = ee(e, f, r.w, r.h, .22, a), m = i(n, r.x, r.y, r.w, r.h, a, {
|
|
909
|
+
titleTopPadFrac: .035,
|
|
910
|
+
titleBottomPadFrac: .035,
|
|
911
|
+
legendSideReserveFrac: 0,
|
|
912
|
+
legendReserve: p,
|
|
913
|
+
radialGapFrac: .015,
|
|
914
|
+
honorPlotAreaManualLayout: !0
|
|
915
|
+
});
|
|
916
|
+
fe(e, n, r.x, r.y, r.w, r.h, r.y + m.title.topPad, m.title.fontPx);
|
|
917
|
+
let { px0: h, py0: g, pw: v, ph: y } = m.plotRect;
|
|
918
|
+
_(e, n, h, g, v, y, a, o);
|
|
919
|
+
let b = {
|
|
920
|
+
x: h,
|
|
921
|
+
y: g,
|
|
922
|
+
w: v,
|
|
923
|
+
h: y
|
|
924
|
+
}, x = c.parentLabelLayout ?? "overlapping", S = n.series[0]?.seriesDataLabels, w = V(n, S?.fontFace ?? n.dataLabelFontFace, "minor"), T = t(S?.fontSizeHpt, a) ?? Math.max(8, Math.min(13, m.plotRect.ph * .025)), E = S?.fontColor ? `#${S.fontColor}` : "#ffffff", D = new Map((n.series[0]?.dataLabelOverrides ?? []).map((e) => [e.idx, e])), O = n.chartBg ? n.chartBg.startsWith("#") ? n.chartBg : `#${n.chartBg}` : "#ffffff", A = (i, s) => {
|
|
925
|
+
if (s.w < .5 || s.h < .5) return;
|
|
926
|
+
let c = `#${P(n, i.branchIndex, l.children.length, u?.chartexStyle)}`, d = oe(n, i.branchIndex, l.children.length, u?.chartexStyle, u?.color), f = D.get(i.labelIndex), p = f?.fontColor ? `#${f.fontColor}` : E, m = t(f?.fontSizeHpt, a) ?? T, h = f?.fontBold ?? S?.fontBold ?? !1;
|
|
927
|
+
if (i.children.length > 0) {
|
|
928
|
+
let t = z(n, u, i.labelIndex, i.label, i.value, {
|
|
929
|
+
visible: x !== "none",
|
|
930
|
+
showVal: !1,
|
|
931
|
+
showCatName: !0
|
|
932
|
+
}, D, !0), l = t != null && (x !== "overlapping" || i.depth === 0), g = m, _ = t?.fontFace ? V(n, t.fontFace, "minor") : w, v = x === "banner" && l ? Math.min(s.h * .28, g + 7) : 0;
|
|
933
|
+
v > 0 && d && (e.fillStyle = le(e, d, s.x, s.y, s.w, v, c, o), e.fillRect(s.x, s.y, s.w, v));
|
|
934
|
+
let y = {
|
|
935
|
+
x: s.x,
|
|
936
|
+
y: s.y + v,
|
|
937
|
+
w: s.w,
|
|
938
|
+
h: Math.max(0, s.h - v)
|
|
939
|
+
};
|
|
940
|
+
for (let e of Ie(i.children, y)) A(e.node, e.rect);
|
|
941
|
+
if (l && (t.manualLayout || s.w > g * 2 && s.h > g + 4)) {
|
|
942
|
+
e.font = `${h ? "bold " : ""}${g}px ${_}`;
|
|
943
|
+
let i = v > 0 ? {
|
|
944
|
+
x: s.x,
|
|
945
|
+
y: s.y,
|
|
946
|
+
w: s.w,
|
|
947
|
+
h: v
|
|
948
|
+
} : s, c = f?.position ?? "inBase";
|
|
949
|
+
te(e, t.text, t.manualLayout ? {
|
|
950
|
+
kind: "point",
|
|
951
|
+
x: s.x + s.w / 2,
|
|
952
|
+
y: s.y + s.h / 2,
|
|
953
|
+
position: c
|
|
954
|
+
} : {
|
|
955
|
+
kind: "box",
|
|
956
|
+
rect: i,
|
|
957
|
+
position: c
|
|
958
|
+
}, t.manualLayout ? b : i, g, p, t.manualLayout, r, k(n, t.richRuns, a, _, h, t.textStyle), void 0, t.textStyle, a, t.labelBox, o);
|
|
959
|
+
}
|
|
960
|
+
return;
|
|
961
|
+
}
|
|
962
|
+
d && (e.fillStyle = le(e, d, s.x, s.y, s.w, s.h, c, o), e.fillRect(s.x, s.y, s.w, s.h)), ue(e, n, n.chartexDataPointStyle, n.series[0], i.branchIndex, l.children.length, O, a, { linkedNoStyleFallback: !0 }) && e.strokeRect(s.x, s.y, s.w, s.h);
|
|
963
|
+
let g = z(n, u, i.labelIndex, i.label, i.value, {
|
|
964
|
+
visible: !1,
|
|
965
|
+
showVal: !1,
|
|
966
|
+
showCatName: !1
|
|
967
|
+
}, D);
|
|
968
|
+
if (!g) return;
|
|
969
|
+
let _ = t(g.fontSizeHpt, a) ?? m;
|
|
970
|
+
if (!g.manualLayout && (s.w <= _ * 1.2 || s.h <= _ * 1.2)) return;
|
|
971
|
+
let v = g.fontFace ? V(n, g.fontFace, "minor") : w;
|
|
972
|
+
e.font = `${g.fontBold ? "bold " : ""}${_}px ${v}`;
|
|
973
|
+
let y = s, C = g.position === "outEnd" ? "inEnd" : g.position ?? "ctr";
|
|
974
|
+
te(e, g.text, g.manualLayout ? {
|
|
975
|
+
kind: "point",
|
|
976
|
+
x: s.x + s.w / 2,
|
|
977
|
+
y: s.y + s.h / 2,
|
|
978
|
+
position: C
|
|
979
|
+
} : {
|
|
980
|
+
kind: "box",
|
|
981
|
+
rect: y,
|
|
982
|
+
position: C
|
|
983
|
+
}, g.manualLayout ? b : y, _, g.fontColor ? `#${g.fontColor}` : p, g.manualLayout, r, k(n, g.richRuns, a, v, g.fontBold ?? !1, g.textStyle), void 0, g.textStyle, a, g.labelBox, o);
|
|
984
|
+
};
|
|
985
|
+
e.save(), e.beginPath(), e.rect(h, g, v, y), e.clip();
|
|
986
|
+
for (let e of Ie(l.children, {
|
|
987
|
+
x: h,
|
|
988
|
+
y: g,
|
|
989
|
+
w: v,
|
|
990
|
+
h: y
|
|
991
|
+
})) A(e.node, e.rect);
|
|
992
|
+
e.restore(), he(e, f, p, r.x, r.y, r.w, r.h, h, g, v, y, m.title.bandH + 2, a, d, o);
|
|
993
|
+
}
|
|
994
|
+
function Re(e, t, n, r, i = 0) {
|
|
995
|
+
let a = De(t);
|
|
996
|
+
if (a != null && a > 1048576) return C(e, n, s + 1), !0;
|
|
997
|
+
switch (t.chartType) {
|
|
998
|
+
case "waterfall": return Oe(e, t, n, r, i), !0;
|
|
999
|
+
case "clusteredColumn": return A(e, {
|
|
1000
|
+
...t,
|
|
1001
|
+
chartType: "clusteredBar"
|
|
1002
|
+
}, n, r, { gapPolicy: "chartex" }, i), !0;
|
|
1003
|
+
case "histogram": return G(e, t, n, r, i), !0;
|
|
1004
|
+
case "funnel": return ke(e, t, n, r, i), !0;
|
|
1005
|
+
case "paretoLine": return Ae(e, t, n, r, i), !0;
|
|
1006
|
+
case "pareto": return je(e, t, n, r, i), !0;
|
|
1007
|
+
case "boxWhisker": return J(e, t, n, r, i), !0;
|
|
1008
|
+
case "sunburst": return Fe(e, t, n, r, i), !0;
|
|
1009
|
+
case "treemap": return Le(e, t, n, r, i), !0;
|
|
1010
|
+
default: return !1;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
//#endregion
|
|
1014
|
+
//#region src/chart-ex.ts
|
|
1015
|
+
var ze = ge({ render: Re }, "chartEx");
|
|
1016
|
+
//#endregion
|
|
1017
|
+
export { ze as chartEx };
|