vue-data-ui 3.21.0 → 3.21.2
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/dist/PackageVersion-Djj1DmIU.js +12 -0
- package/dist/components/vue-ui-3d-bar.js +1 -1
- package/dist/components/vue-ui-age-pyramid.js +1 -1
- package/dist/components/vue-ui-bullet.js +1 -1
- package/dist/components/vue-ui-bump.js +1 -1
- package/dist/components/vue-ui-candlestick.js +1 -1
- package/dist/components/vue-ui-carousel-table.js +1 -1
- package/dist/components/vue-ui-chestnut.js +1 -1
- package/dist/components/vue-ui-chord.js +1 -1
- package/dist/components/vue-ui-circle-pack.js +1 -1
- package/dist/components/vue-ui-cursor.js +1 -1
- package/dist/components/vue-ui-dag.js +1 -1
- package/dist/components/vue-ui-dashboard.js +1 -1
- package/dist/components/vue-ui-digits.js +1 -1
- package/dist/components/vue-ui-donut-evolution.js +1 -1
- package/dist/components/vue-ui-donut.js +1 -1
- package/dist/components/vue-ui-dumbbell.js +1 -1
- package/dist/components/vue-ui-flow.js +1 -1
- package/dist/components/vue-ui-funnel.js +1 -1
- package/dist/components/vue-ui-galaxy.js +1 -1
- package/dist/components/vue-ui-gauge.js +1 -1
- package/dist/components/vue-ui-geo.js +1 -1
- package/dist/components/vue-ui-gizmo.js +1 -1
- package/dist/components/vue-ui-heatmap.js +1 -1
- package/dist/components/vue-ui-history-plot.js +1 -1
- package/dist/components/vue-ui-horizontal-bar.js +1 -1
- package/dist/components/vue-ui-kpi.js +1 -1
- package/dist/components/vue-ui-molecule.js +1 -1
- package/dist/components/vue-ui-mood-radar.js +1 -1
- package/dist/components/vue-ui-nested-donuts.js +1 -1
- package/dist/components/vue-ui-onion.js +1 -1
- package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
- package/dist/components/vue-ui-quadrant.js +1 -1
- package/dist/components/vue-ui-quick-chart.js +1 -1
- package/dist/components/vue-ui-radar.js +1 -1
- package/dist/components/vue-ui-relation-circle.js +1 -1
- package/dist/components/vue-ui-ridgeline.js +1 -1
- package/dist/components/vue-ui-rings.js +1 -1
- package/dist/components/vue-ui-scatter.js +1 -1
- package/dist/components/vue-ui-skeleton.js +1 -1
- package/dist/components/vue-ui-spark-trend.js +1 -1
- package/dist/components/vue-ui-sparkbar.js +1 -1
- package/dist/components/vue-ui-sparkgauge.js +1 -1
- package/dist/components/vue-ui-sparkhistogram.js +1 -1
- package/dist/components/vue-ui-sparkline.js +1 -1
- package/dist/components/vue-ui-sparkstackbar.js +1 -1
- package/dist/components/vue-ui-stackbar.js +1 -1
- package/dist/components/vue-ui-stackline.js +1 -1
- package/dist/components/vue-ui-strip-plot.js +1 -1
- package/dist/components/vue-ui-table-sparkline.js +1 -1
- package/dist/components/vue-ui-table.js +1 -1
- package/dist/components/vue-ui-thermometer.js +1 -1
- package/dist/components/vue-ui-timer.js +1 -1
- package/dist/components/vue-ui-tiremarks.js +1 -1
- package/dist/components/vue-ui-treemap.js +1 -1
- package/dist/components/vue-ui-vertical-bar.js +1 -1
- package/dist/components/vue-ui-waffle.js +1 -1
- package/dist/components/vue-ui-wheel.js +1 -1
- package/dist/components/vue-ui-word-cloud.js +1 -1
- package/dist/components/vue-ui-world.js +1 -1
- package/dist/components/vue-ui-xy.js +1 -1
- package/dist/package-DwtrIvz-.js +4 -0
- package/dist/render-common-aVBx5bwm.js +152 -0
- package/dist/ssr/vue-ui-donut.js +2 -0
- package/dist/ssr/vue-ui-xy.js +2 -0
- package/dist/ssr.js +3 -1366
- package/dist/types/ssr.d.ts +56 -2
- package/dist/{vue-data-ui-D2dM3IQZ.js → vue-data-ui-DxLmhpko.js} +60 -60
- package/dist/vue-data-ui.js +60 -60
- package/dist/{vue-ui-3d-bar-0C_yshya.js → vue-ui-3d-bar-Dzdo_8qY.js} +1 -1
- package/dist/{vue-ui-age-pyramid-DFNELwbT.js → vue-ui-age-pyramid-CIwN3HVR.js} +1 -1
- package/dist/{vue-ui-bullet-ChQq42AN.js → vue-ui-bullet-Dosih8Hb.js} +1 -1
- package/dist/{vue-ui-bump-BVCYywuS.js → vue-ui-bump--giMQaXE.js} +1 -1
- package/dist/{vue-ui-candlestick-CQ0nfkmL.js → vue-ui-candlestick-D_lfz0FX.js} +1 -1
- package/dist/{vue-ui-carousel-table-Cvi1gsKR.js → vue-ui-carousel-table-DEgFnasE.js} +1 -1
- package/dist/{vue-ui-chestnut-DeWbKqze.js → vue-ui-chestnut-i2Y-uK8C.js} +1 -1
- package/dist/{vue-ui-chord-bRXYWpGT.js → vue-ui-chord-DYwKe8vr.js} +1 -1
- package/dist/{vue-ui-circle-pack-DWO8x9gf.js → vue-ui-circle-pack-Cf0oDwlO.js} +1 -1
- package/dist/{vue-ui-cursor-BKGUvOWO.js → vue-ui-cursor-B7yLqYNS.js} +1 -1
- package/dist/{vue-ui-dag-lL0juBzN.js → vue-ui-dag-BDVRFz-1.js} +1 -1
- package/dist/{vue-ui-dashboard-CEk2z8v9.js → vue-ui-dashboard-AUHJopaF.js} +57 -57
- package/dist/{vue-ui-digits-BAjr0eIJ.js → vue-ui-digits-BEFXCA9O.js} +1 -1
- package/dist/{vue-ui-donut-BsSpIinL.js → vue-ui-donut-B3IYq0vZ.js} +1 -1
- package/dist/vue-ui-donut-BJyXzn6B.js +973 -0
- package/dist/{vue-ui-donut-evolution-1UhFKEgG.js → vue-ui-donut-evolution-BSV2Crlx.js} +1 -1
- package/dist/{vue-ui-dumbbell-ChqJicg9.js → vue-ui-dumbbell-7DAk8eNI.js} +1 -1
- package/dist/{vue-ui-flow-BXfzMTXx.js → vue-ui-flow-DUk1CDgi.js} +1 -1
- package/dist/{vue-ui-funnel-BpnC82m0.js → vue-ui-funnel-Bf9GDDV6.js} +1 -1
- package/dist/{vue-ui-galaxy-FNzwDOH1.js → vue-ui-galaxy-Z5Ev4iYr.js} +1 -1
- package/dist/{vue-ui-gauge-D6I78FZr.js → vue-ui-gauge-Cq_EA0Bj.js} +1 -1
- package/dist/{vue-ui-geo-Z1xuH8r6.js → vue-ui-geo-C7k7pTTU.js} +1 -1
- package/dist/{vue-ui-gizmo-ZlmJIh0_.js → vue-ui-gizmo-D_xYaP3o.js} +1 -1
- package/dist/{vue-ui-heatmap-BWN0UBKE.js → vue-ui-heatmap-DgmK3aY4.js} +1 -1
- package/dist/{vue-ui-history-plot-2E6KrNhv.js → vue-ui-history-plot-Cq9UBQYd.js} +1 -1
- package/dist/{vue-ui-horizontal-bar-BzP7k_3J.js → vue-ui-horizontal-bar-BcLFr3-H.js} +1 -1
- package/dist/{vue-ui-kpi-B9bdicir.js → vue-ui-kpi-CjiJWVnq.js} +1 -1
- package/dist/{vue-ui-molecule-B-69fE_1.js → vue-ui-molecule-CVu51gtg.js} +1 -1
- package/dist/{vue-ui-mood-radar-D3kF7iHz.js → vue-ui-mood-radar-bZC-Dg-1.js} +1 -1
- package/dist/{vue-ui-nested-donuts-CTmomXj1.js → vue-ui-nested-donuts-BYK8yR9-.js} +1 -1
- package/dist/{vue-ui-onion-3fJB4mfC.js → vue-ui-onion-DVQBUIfH.js} +1 -1
- package/dist/{vue-ui-parallel-coordinate-plot-CKKkbBlu.js → vue-ui-parallel-coordinate-plot-BxhGmOXk.js} +1 -1
- package/dist/{vue-ui-quadrant-DGLnjwva.js → vue-ui-quadrant-vnDlJEWL.js} +1 -1
- package/dist/{vue-ui-quick-chart-DJnhlEXi.js → vue-ui-quick-chart-CBauII4k.js} +1 -1
- package/dist/{vue-ui-radar-AIBX0QYs.js → vue-ui-radar-BYHLMJ0O.js} +1 -1
- package/dist/{vue-ui-relation-circle-BQVR8L9Y.js → vue-ui-relation-circle-WyHCmUGv.js} +1 -1
- package/dist/{vue-ui-ridgeline-CYq3APPQ.js → vue-ui-ridgeline-Dt2bsq8i.js} +1 -1
- package/dist/{vue-ui-rings-BgFO7NYF.js → vue-ui-rings-B97-rYT2.js} +1 -1
- package/dist/{vue-ui-scatter-BPu5DwaJ.js → vue-ui-scatter-DXOLVV7d.js} +1 -1
- package/dist/{vue-ui-skeleton-qpdvvWtx.js → vue-ui-skeleton-BFoHaAzE.js} +1 -1
- package/dist/{vue-ui-spark-trend-CQ9ZN5sL.js → vue-ui-spark-trend-BwSLGFz4.js} +1 -1
- package/dist/{vue-ui-sparkbar-d6ctWlLA.js → vue-ui-sparkbar-BQlbLbj_.js} +1 -1
- package/dist/{vue-ui-sparkgauge-HX_rqLxX.js → vue-ui-sparkgauge-gMtvy-s9.js} +1 -1
- package/dist/{vue-ui-sparkhistogram-B_zxKMHv.js → vue-ui-sparkhistogram-C5Elj_Rp.js} +1 -1
- package/dist/{vue-ui-sparkline-BSdOdtKu.js → vue-ui-sparkline-DJM-Ez8d.js} +1 -1
- package/dist/{vue-ui-sparkstackbar-B2sqpW-w.js → vue-ui-sparkstackbar-DrcKqBm_.js} +1 -1
- package/dist/{vue-ui-stackbar-DH75CCpy.js → vue-ui-stackbar-D2T1OrVG.js} +1 -1
- package/dist/{vue-ui-stackline-CXodezD1.js → vue-ui-stackline-ByefOdDI.js} +1 -1
- package/dist/{vue-ui-strip-plot-C1un5Mku.js → vue-ui-strip-plot-BVvVrhEq.js} +1 -1
- package/dist/{vue-ui-table-R-aXpHvF.js → vue-ui-table-C9o1vxEo.js} +2 -2
- package/dist/{vue-ui-table-sparkline-Dy-6i82F.js → vue-ui-table-sparkline-DbMBlaJr.js} +1 -1
- package/dist/{vue-ui-thermometer-CIse_lcE.js → vue-ui-thermometer-BGoNUm0Q.js} +1 -1
- package/dist/{vue-ui-timer-AlYvthQ6.js → vue-ui-timer-DrqEZJ9e.js} +1 -1
- package/dist/{vue-ui-tiremarks-CP_bw6by.js → vue-ui-tiremarks-h-OTdz5K.js} +1 -1
- package/dist/{vue-ui-treemap-BXrV5VAp.js → vue-ui-treemap-CVVSxQPH.js} +1 -1
- package/dist/{vue-ui-waffle-uoqEnQ30.js → vue-ui-waffle-nvE6zzca.js} +1 -1
- package/dist/{vue-ui-wheel-DLgw_xfe.js → vue-ui-wheel-CYu92PTs.js} +1 -1
- package/dist/{vue-ui-word-cloud-Bgu-qbcp.js → vue-ui-word-cloud-CRuXBu1K.js} +1 -1
- package/dist/{vue-ui-world-B93iq1ZM.js → vue-ui-world-Dn5KG6i-.js} +1 -1
- package/dist/vue-ui-xy-DjB1eAEf.js +1264 -0
- package/dist/{vue-ui-xy-DzuOBbPL.js → vue-ui-xy-Dzk3ILJy.js} +1 -1
- package/package.json +2 -2
- package/dist/PackageVersion-DYLo3MRd.js +0 -11
|
@@ -0,0 +1,973 @@
|
|
|
1
|
+
import { Bt as e, Ct as t, E as n, Et as r, Ft as i, G as a, H as o, Ht as s, Ot as c, Pt as l, Q as u, V as d, d as f, i as p, p as m, t as h, u as g, v as _, y as v } from "./lib-AJRHFE5U.js";
|
|
2
|
+
import { t as y } from "./useConfig-DnH7Pf_2.js";
|
|
3
|
+
import { t as b } from "./vue_ui_donut-BDGqG07h.js";
|
|
4
|
+
import { _ as x, a as S, c as C, d as w, g as T, i as E, l as D, n as O, o as k, p as A, r as j, s as ee, t as te, u as M, v as N } from "./render-common-aVBx5bwm.js";
|
|
5
|
+
//#region src/svg/vue-ui-donut/create.js
|
|
6
|
+
var { vue_ui_donut: ne } = y();
|
|
7
|
+
function re({ config: t = {} } = {}) {
|
|
8
|
+
let n = t ?? {}, r = s({
|
|
9
|
+
userConfig: n,
|
|
10
|
+
defaultConfig: ne
|
|
11
|
+
}), i = r.theme;
|
|
12
|
+
if (!i) return {
|
|
13
|
+
...r,
|
|
14
|
+
customPalette: r.customPalette?.length ? r.customPalette : c
|
|
15
|
+
};
|
|
16
|
+
let a = s({
|
|
17
|
+
userConfig: n,
|
|
18
|
+
defaultConfig: s({
|
|
19
|
+
userConfig: b[i] || {},
|
|
20
|
+
defaultConfig: r
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
...a,
|
|
25
|
+
customPalette: a.customPalette?.length ? a.customPalette : e[i] || c
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function P(e, t = 0) {
|
|
29
|
+
let n = Number(e);
|
|
30
|
+
return Number.isFinite(n) ? n : t;
|
|
31
|
+
}
|
|
32
|
+
function F(e, t, n) {
|
|
33
|
+
return String(t).split(".").reduce((e, t) => e && e[t] !== void 0 ? e[t] : void 0, e) ?? n;
|
|
34
|
+
}
|
|
35
|
+
function ie(e) {
|
|
36
|
+
return typeof e != "object" || !e ? 0 : Array.isArray(e.values) ? e.values.reduce((e, t) => e + P(t, 0), 0) : Array.isArray(e.series) ? e.series.reduce((e, t) => e + P(t, 0), 0) : P(e.value ?? e.y ?? 0, 0);
|
|
37
|
+
}
|
|
38
|
+
function ae(e, t) {
|
|
39
|
+
return String(e?.name ?? e?.label ?? `Serie ${t + 1}`);
|
|
40
|
+
}
|
|
41
|
+
function oe(e = [], t) {
|
|
42
|
+
let n = Array.isArray(t.customPalette) ? t.customPalette : c;
|
|
43
|
+
return (Array.isArray(e) ? e : []).map((e, t) => ({
|
|
44
|
+
source: e,
|
|
45
|
+
sourceIndex: t,
|
|
46
|
+
value: ie(e)
|
|
47
|
+
})).filter((e) => Number.isFinite(e.value)).sort((e, t) => e.source?.ghost && !t.source?.ghost ? 1 : t.source?.ghost && !e.source?.ghost ? -1 : t.value - e.value).map((e, t) => {
|
|
48
|
+
let r = e.source, i = e.value, a = (r?.color ? v(r.color) : "") || n[t % n.length];
|
|
49
|
+
return {
|
|
50
|
+
...r,
|
|
51
|
+
id: r?.id ?? `donut_serie_${t}`,
|
|
52
|
+
name: ae(r, t),
|
|
53
|
+
value: i,
|
|
54
|
+
absoluteValue: Math.abs(i),
|
|
55
|
+
absoluteValues: Array.isArray(r?.values) ? r.values : [i],
|
|
56
|
+
color: a,
|
|
57
|
+
index: t,
|
|
58
|
+
sourceIndex: e.sourceIndex,
|
|
59
|
+
patternIndex: r?.patternIndex ?? t,
|
|
60
|
+
seriesIndex: r?.seriesIndex ?? t,
|
|
61
|
+
ghost: !!r?.ghost
|
|
62
|
+
};
|
|
63
|
+
}).filter((e) => Number.isFinite(e.absoluteValue));
|
|
64
|
+
}
|
|
65
|
+
function se(e) {
|
|
66
|
+
return e.reduce((e, t) => e + t.absoluteValue, 0);
|
|
67
|
+
}
|
|
68
|
+
function ce({ series: e, total: t, startAngle: n = -90 }) {
|
|
69
|
+
let r = n;
|
|
70
|
+
return e.map((e) => {
|
|
71
|
+
let n = t ? e.absoluteValue / t : 0, i = n * 360, a = r, o = r + i;
|
|
72
|
+
return r = o, {
|
|
73
|
+
...e,
|
|
74
|
+
ratio: n,
|
|
75
|
+
percentage: n * 100,
|
|
76
|
+
startAngle: a,
|
|
77
|
+
endAngle: o,
|
|
78
|
+
midAngle: a + i / 2
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function le({ dataset: e = [], config: t = {}, width: n = 512, height: r = 512, additionalSvgContent: i = "", svgTitle: a = "" } = {}) {
|
|
83
|
+
let o = re({ config: t }), s = oe(e, o), c = se(s), l = {
|
|
84
|
+
top: P(F(o, "chart.padding.top", 24), 24),
|
|
85
|
+
right: P(F(o, "chart.padding.right", 24), 24),
|
|
86
|
+
bottom: P(F(o, "chart.padding.bottom", 24), 24),
|
|
87
|
+
left: P(F(o, "chart.padding.left", 24), 24)
|
|
88
|
+
}, u = {
|
|
89
|
+
top: l.top,
|
|
90
|
+
left: l.left,
|
|
91
|
+
right: n - l.right,
|
|
92
|
+
bottom: r - l.bottom
|
|
93
|
+
};
|
|
94
|
+
u.width = Math.max(1, u.right - u.left), u.height = Math.max(1, u.bottom - u.top);
|
|
95
|
+
let d = {
|
|
96
|
+
x: u.left + u.width / 2,
|
|
97
|
+
y: u.top + u.height / 2
|
|
98
|
+
}, f = Math.max(1, Math.min(u.width, u.height) / 2), p = P(F(o, "chart.donut.radius", f), f), m = P(F(o, "chart.donut.holeRatio", .5), .5);
|
|
99
|
+
return {
|
|
100
|
+
width: n,
|
|
101
|
+
height: r,
|
|
102
|
+
dataset: e,
|
|
103
|
+
config: o,
|
|
104
|
+
drawingArea: u,
|
|
105
|
+
center: d,
|
|
106
|
+
radius: p,
|
|
107
|
+
innerRadius: Math.max(0, Math.min(p - 1, p * m)),
|
|
108
|
+
total: c,
|
|
109
|
+
series: ce({
|
|
110
|
+
series: s,
|
|
111
|
+
total: c,
|
|
112
|
+
startAngle: P(F(o, "chart.donut.startAngle", -90), -90)
|
|
113
|
+
}),
|
|
114
|
+
additionalSvgContent: i,
|
|
115
|
+
svgTitle: a
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/svg/vue-ui-donut/render.js
|
|
120
|
+
var ue = o();
|
|
121
|
+
function I() {
|
|
122
|
+
return ue;
|
|
123
|
+
}
|
|
124
|
+
function L(e) {
|
|
125
|
+
return k(S(e, "backgroundColor", "#FFFFFF"), "#FFFFFF");
|
|
126
|
+
}
|
|
127
|
+
function de(e) {
|
|
128
|
+
return x(e?.value ?? e?.absoluteValue ?? 0, 0);
|
|
129
|
+
}
|
|
130
|
+
function R(e) {
|
|
131
|
+
return T(e.series).filter((e) => !e?.ghost).map((e, t) => ({
|
|
132
|
+
...e,
|
|
133
|
+
value: Math.abs(de(e)),
|
|
134
|
+
color: k(e.color, "#000000"),
|
|
135
|
+
name: String(e.name ?? `Serie ${t + 1}`),
|
|
136
|
+
seriesIndex: e.seriesIndex ?? e.index ?? t,
|
|
137
|
+
patternIndex: e.patternIndex ?? e.index ?? t
|
|
138
|
+
})).filter((e) => Number.isFinite(e.value));
|
|
139
|
+
}
|
|
140
|
+
function z(e) {
|
|
141
|
+
return e.reduce((e, t) => e + Math.abs(x(t.value, 0)), 0);
|
|
142
|
+
}
|
|
143
|
+
function fe(e) {
|
|
144
|
+
let t = S(e, "title", {}), n = A(t, "subtitle", {});
|
|
145
|
+
if (!t.text) return 0;
|
|
146
|
+
let r = x(t.fontSize, 20), i = n.show !== !1 && n.text ? x(n.fontSize, 14) : 0;
|
|
147
|
+
return x(t.paddingTop, 12) + r + (i ? i + 12 : 0) + x(t.paddingBottom, 36);
|
|
148
|
+
}
|
|
149
|
+
function pe({ state: e, series: t }) {
|
|
150
|
+
let { config: n, width: r } = e, i = S(n, "legend", {}), a = x(i.fontSize, 12), o = x(i.markerSize, 10), s = x(i.itemGap, 24), c = x(i.rowGap, 8), l = x(i.padding, 8), u = x(i.labelGap, 8), d = Math.max(1, r - l * 2), f = [], p = [], m = 0;
|
|
151
|
+
return t.forEach((t) => {
|
|
152
|
+
let n = Ve(e, t), r = O(n, a), i = o + u + r, c = m + i + (p.length ? s : 0);
|
|
153
|
+
p.length && c > d && (f.push({
|
|
154
|
+
items: p,
|
|
155
|
+
width: m
|
|
156
|
+
}), p = [], m = 0), p.push({
|
|
157
|
+
serie: t,
|
|
158
|
+
label: n,
|
|
159
|
+
itemWidth: i
|
|
160
|
+
}), m += i + (p.length > 1 ? s : 0);
|
|
161
|
+
}), p.length && f.push({
|
|
162
|
+
items: p,
|
|
163
|
+
width: m
|
|
164
|
+
}), {
|
|
165
|
+
rows: f,
|
|
166
|
+
fontSize: a,
|
|
167
|
+
markerSize: o,
|
|
168
|
+
itemGap: s,
|
|
169
|
+
labelGap: u,
|
|
170
|
+
rowGap: c,
|
|
171
|
+
padding: l,
|
|
172
|
+
height: f.length * Math.max(o, a) + Math.max(0, f.length - 1) * c + l * 2
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function B(e, t) {
|
|
176
|
+
return !S(e.config, "legend.show", !0) || !t.length ? {
|
|
177
|
+
rows: [],
|
|
178
|
+
height: 0,
|
|
179
|
+
padding: 0,
|
|
180
|
+
fontSize: 12,
|
|
181
|
+
markerSize: 10,
|
|
182
|
+
rowGap: 0
|
|
183
|
+
} : pe({
|
|
184
|
+
state: e,
|
|
185
|
+
series: t
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
function V(e) {
|
|
189
|
+
return !!E(e, "pie", S(e, "pie", !1));
|
|
190
|
+
}
|
|
191
|
+
function me(e, t) {
|
|
192
|
+
let { config: n, width: r, height: i } = e, a = fe(n), o = B(e, t), s = S(n, "legend.show", !0), c = S(n, "legend.position", "bottom"), l = s && c === "top" ? o.height : 0, u = s && c !== "top" ? o.height : 0, d = x(S(n, "padding.top", 24), 24), f = x(S(n, "padding.right", 24), 24), p = x(S(n, "padding.bottom", 24), 24), m = x(S(n, "padding.left", 24), 24), h = {
|
|
193
|
+
top: d + a + l,
|
|
194
|
+
right: r - f,
|
|
195
|
+
bottom: i - p - u,
|
|
196
|
+
left: m
|
|
197
|
+
};
|
|
198
|
+
h.width = Math.max(1, h.right - h.left), h.height = Math.max(1, h.bottom - h.top);
|
|
199
|
+
let g = a ? x(E(n, "title.chartOffsetY", 24), 24) : 0, _ = Math.max(1, h.height - g), v = {
|
|
200
|
+
x: h.left + h.width / 2,
|
|
201
|
+
y: h.top + g / 2 + _ / 2
|
|
202
|
+
}, y = x(S(n, "layout.donut.radiusRatio", .35), .35), b = Math.max(.1, Math.min(.50001, y)), C = Math.max(12, Math.min(h.width, _) * b), w = S(n, "layout.donut.radius", null), T = w == null ? C : Math.min(C, x(w, C)), D = x(S(n, "layout.donut.strokeWidth", 64), 64) / 300, O = Math.max(Math.min(T * D * 2, T), 12 * (1 + D)), k = S(n, "layout.donut.thickness", S(n, "layout.donut.size", O)), A = Math.max(0, Math.min(T - 1, k == null ? O : x(k, O)));
|
|
203
|
+
return {
|
|
204
|
+
...e,
|
|
205
|
+
drawingArea: h,
|
|
206
|
+
center: v,
|
|
207
|
+
radius: T,
|
|
208
|
+
thickness: A,
|
|
209
|
+
innerRadius: V(n) ? 0 : Math.max(0, T - A)
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function he(e, n) {
|
|
213
|
+
let r = x(S(e.config, "layout.donut.rotation", 105.25), 105.25);
|
|
214
|
+
return t({ series: n }, e.center.x, e.center.y, e.radius, e.radius, 1.99999, 2, 1, 360, r, V(e.config) ? e.radius : e.thickness).map((e, t) => ({
|
|
215
|
+
...e,
|
|
216
|
+
index: t,
|
|
217
|
+
color: k(e.color, n[t]?.color),
|
|
218
|
+
value: x(e.value, 0),
|
|
219
|
+
name: String(e.name ?? n[t]?.name ?? `Serie ${t + 1}`),
|
|
220
|
+
patternIndex: e.patternIndex ?? n[t]?.patternIndex ?? t,
|
|
221
|
+
seriesIndex: e.seriesIndex ?? n[t]?.seriesIndex ?? t
|
|
222
|
+
}));
|
|
223
|
+
}
|
|
224
|
+
function ge(e, t) {
|
|
225
|
+
let r = Math.max(1, ...t.map((e) => Math.abs(x(e.value, 0))));
|
|
226
|
+
return n({
|
|
227
|
+
series: t.map((e) => Math.abs(x(e.value, 0)) / r),
|
|
228
|
+
center: e.center,
|
|
229
|
+
maxRadius: Math.min(e.drawingArea.width, e.drawingArea.height) / 3,
|
|
230
|
+
hasGhost: !1
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function H(e) {
|
|
234
|
+
return `gradient_${I()}`;
|
|
235
|
+
}
|
|
236
|
+
function U(e, t) {
|
|
237
|
+
return `polar_gradient_${t}_${I()}`;
|
|
238
|
+
}
|
|
239
|
+
function _e(e) {
|
|
240
|
+
return E(e.config, "type", "classic") !== "classic" || !S(e.config, "useGradient", !1) ? "" : w("circle", {
|
|
241
|
+
"data-cy": "donut-gradient-hollow",
|
|
242
|
+
cx: e.center.x,
|
|
243
|
+
cy: e.center.y,
|
|
244
|
+
r: e.radius <= 0 ? 10 : e.radius,
|
|
245
|
+
fill: `url(#${H(e)})`
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function W(e) {
|
|
249
|
+
return `drop_shadow_${I()}`;
|
|
250
|
+
}
|
|
251
|
+
function ve(e) {
|
|
252
|
+
let { config: t, width: n } = e, r = S(t, "title", {}), i = A(r, "subtitle", {});
|
|
253
|
+
if (!r.text) return "";
|
|
254
|
+
let a = r.textAlign || "center", o = a === "left" ? x(r.paddingLeft, 12) : a === "right" ? n - x(r.paddingRight, 12) : n / 2, s = a === "left" ? "start" : a === "right" ? "end" : "middle", c = x(r.fontSize, 20), l = x(i.fontSize, 14), u = x(r.paddingTop, 12) + c, d = [N(r.text, {
|
|
255
|
+
"data-cy": "donut-div-title",
|
|
256
|
+
x: o,
|
|
257
|
+
y: u,
|
|
258
|
+
"font-size": c,
|
|
259
|
+
"font-weight": r.bold ? "700" : "400",
|
|
260
|
+
"text-anchor": s,
|
|
261
|
+
fill: k(r.color, j(t))
|
|
262
|
+
})];
|
|
263
|
+
return i.text && d.push(N(i.text, {
|
|
264
|
+
"data-cy": "donut-div-subtitle",
|
|
265
|
+
x: o,
|
|
266
|
+
y: u + l + 4,
|
|
267
|
+
"font-size": l,
|
|
268
|
+
"font-weight": i.bold ? "700" : "400",
|
|
269
|
+
"text-anchor": s,
|
|
270
|
+
fill: k(i.color || r.color, j(t))
|
|
271
|
+
})), M("g", { "data-layer": "title" }, d.join(""));
|
|
272
|
+
}
|
|
273
|
+
function ye(e, t) {
|
|
274
|
+
let { config: n } = e, r = [], a = !!S(n, "useGradient", !1), o = !!S(n, "layout.donut.useShadow", !1);
|
|
275
|
+
if (a) {
|
|
276
|
+
let a = E(n, "type", "classic"), o = x(S(n, "gradientIntensity", 30), 30);
|
|
277
|
+
if (a === "classic" && Number.isFinite(e.thickness / e.radius)) {
|
|
278
|
+
let t = V(n) ? 1 : e.thickness / e.radius;
|
|
279
|
+
r.push(M("radialGradient", { id: H(e) }, [
|
|
280
|
+
w("stop", {
|
|
281
|
+
offset: "0%",
|
|
282
|
+
"stop-color": l(L(n), 0),
|
|
283
|
+
"stop-opacity": 0
|
|
284
|
+
}),
|
|
285
|
+
w("stop", {
|
|
286
|
+
offset: `${(1 - t) * 100}%`,
|
|
287
|
+
"stop-color": l("#FFFFFF", 0),
|
|
288
|
+
"stop-opacity": 0
|
|
289
|
+
}),
|
|
290
|
+
w("stop", {
|
|
291
|
+
offset: `${(1 - t / 2) * 100}%`,
|
|
292
|
+
"stop-color": l("#FFFFFF", o)
|
|
293
|
+
}),
|
|
294
|
+
w("stop", {
|
|
295
|
+
offset: "100%",
|
|
296
|
+
"stop-color": l(L(n), 0),
|
|
297
|
+
"stop-opacity": 0
|
|
298
|
+
})
|
|
299
|
+
].join("")));
|
|
300
|
+
}
|
|
301
|
+
a === "polar" && t.forEach((t, n) => {
|
|
302
|
+
let a = e.polarAreas?.[n];
|
|
303
|
+
a?.middlePoint && r.push(M("radialGradient", {
|
|
304
|
+
id: U(e, n),
|
|
305
|
+
cx: `${_(a.middlePoint.x / e.width * 100)}%`,
|
|
306
|
+
cy: `${_(a.middlePoint.y / e.height * 100)}%`,
|
|
307
|
+
r: "62%"
|
|
308
|
+
}, [w("stop", {
|
|
309
|
+
offset: "0%",
|
|
310
|
+
"stop-color": i(t.color, .05),
|
|
311
|
+
"stop-opacity": o / 100
|
|
312
|
+
}), w("stop", {
|
|
313
|
+
offset: "100%",
|
|
314
|
+
"stop-color": t.color
|
|
315
|
+
})].join("")));
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
if (o) {
|
|
319
|
+
let t = k(S(n, "layout.donut.shadowColor", "#000000"), "#000000"), i = x(S(n, "layout.donut.shadowOpacity", .2), .2), a = x(S(n, "layout.donut.shadowBlur", 6), 6), o = x(S(n, "layout.donut.shadowOffsetY", 3), 3);
|
|
320
|
+
r.push(M("filter", {
|
|
321
|
+
id: W(e),
|
|
322
|
+
x: "-50%",
|
|
323
|
+
y: "-50%",
|
|
324
|
+
width: "200%",
|
|
325
|
+
height: "200%"
|
|
326
|
+
}, [w("feDropShadow", {
|
|
327
|
+
dx: 0,
|
|
328
|
+
dy: o,
|
|
329
|
+
stdDeviation: a,
|
|
330
|
+
"flood-color": t,
|
|
331
|
+
"flood-opacity": i
|
|
332
|
+
})].join("")));
|
|
333
|
+
}
|
|
334
|
+
return r.length ? M("defs", { "data-layer": "definitions" }, r.join("")) : "";
|
|
335
|
+
}
|
|
336
|
+
function be(e, t) {
|
|
337
|
+
return t.color;
|
|
338
|
+
}
|
|
339
|
+
function xe(e, t, n) {
|
|
340
|
+
return S(e.config, "useGradient", !1) ? `url(#${U(e, n)})` : t.color;
|
|
341
|
+
}
|
|
342
|
+
function G(e) {
|
|
343
|
+
let { config: t } = e;
|
|
344
|
+
return S(t, "layout.donut.borderColorAuto", !0) ? L(t) : k(S(t, "layout.donut.borderColor", L(t)), L(t));
|
|
345
|
+
}
|
|
346
|
+
function K(e) {
|
|
347
|
+
return S(e.config, "layout.donut.useShadow", !1) ? `url(#${W(e)})` : void 0;
|
|
348
|
+
}
|
|
349
|
+
function Se(e, t) {
|
|
350
|
+
if (!t.length) return "";
|
|
351
|
+
let n = G(e), r = x(S(e.config, "layout.donut.borderWidth", 1), 1), i = [];
|
|
352
|
+
return t.forEach((t, a) => {
|
|
353
|
+
x(t.proportion, 0) <= 0 || (i.push(w("path", {
|
|
354
|
+
"data-cy": `donut-arc-underlay-${a}`,
|
|
355
|
+
d: t.arcSlice,
|
|
356
|
+
fill: "#FFFFFF",
|
|
357
|
+
stroke: L(e.config)
|
|
358
|
+
})), i.push(w("path", {
|
|
359
|
+
class: "vue-ui-donut-arc-path",
|
|
360
|
+
"data-cy": `donut-arc-${a}`,
|
|
361
|
+
d: t.arcSlice,
|
|
362
|
+
fill: be(e, t, a),
|
|
363
|
+
stroke: n,
|
|
364
|
+
"stroke-width": r,
|
|
365
|
+
filter: K(e)
|
|
366
|
+
})));
|
|
367
|
+
}), M("g", { "data-layer": "classic-slices" }, i.join(""));
|
|
368
|
+
}
|
|
369
|
+
function Ce(e, t, n) {
|
|
370
|
+
if (!t.length) return "";
|
|
371
|
+
let r = G(e), i = x(S(e.config, "layout.donut.borderWidth", 1), 1), a = [];
|
|
372
|
+
return t.forEach((t, o) => {
|
|
373
|
+
let s = n[o];
|
|
374
|
+
s?.path && (a.push(w("path", {
|
|
375
|
+
"data-cy": `polar-arc-underlay-${o}`,
|
|
376
|
+
d: s.path,
|
|
377
|
+
fill: "#FFFFFF",
|
|
378
|
+
stroke: r
|
|
379
|
+
})), a.push(w("path", {
|
|
380
|
+
class: "vue-ui-donut-arc-path",
|
|
381
|
+
"data-cy": `donut-arc-${o}`,
|
|
382
|
+
d: s.path,
|
|
383
|
+
fill: xe(e, t, o),
|
|
384
|
+
stroke: r,
|
|
385
|
+
"stroke-width": i,
|
|
386
|
+
filter: K(e)
|
|
387
|
+
})));
|
|
388
|
+
}), M("g", { "data-layer": "polar-slices" }, a.join(""));
|
|
389
|
+
}
|
|
390
|
+
function q(e, t, n = "layout.labels.value.rounding") {
|
|
391
|
+
let { config: r } = e, i = S(r, "layout.labels", {}), o = i.dataLabels ?? {}, s = i.value ?? {}, c = a({
|
|
392
|
+
p: o.prefix ?? "",
|
|
393
|
+
v: t.value,
|
|
394
|
+
s: o.suffix ?? "",
|
|
395
|
+
r: x(S(r, n, s.rounding ?? 0), s.rounding ?? 0)
|
|
396
|
+
});
|
|
397
|
+
return p(s.formatter, t.value, c, { datapoint: t });
|
|
398
|
+
}
|
|
399
|
+
function J(e, t) {
|
|
400
|
+
let { config: n } = e, r = S(n, "layout.labels.percentage", {}), i = x(t.proportion, 0) * 100, o = a({
|
|
401
|
+
v: i,
|
|
402
|
+
s: "%",
|
|
403
|
+
r: x(r.rounding, 0)
|
|
404
|
+
});
|
|
405
|
+
return p(r.formatter, i, o, { datapoint: t });
|
|
406
|
+
}
|
|
407
|
+
function Y(e, t) {
|
|
408
|
+
let n = S(e.config, "layout.labels", {}), r = !!n.name?.show, i = !!(n.value?.show ?? !0), a = !!(n.percentage?.show ?? !0);
|
|
409
|
+
return {
|
|
410
|
+
name: r ? String(t.name ?? "") : "",
|
|
411
|
+
value: i ? q(e, t) : "",
|
|
412
|
+
percentage: a ? J(e, t) : ""
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function we(e, t) {
|
|
416
|
+
let { value: n, percentage: r } = Y(e, t);
|
|
417
|
+
return r && n ? `${r} (${n})` : r || n || "";
|
|
418
|
+
}
|
|
419
|
+
function X(e, t) {
|
|
420
|
+
let n = S(e.config, "layout.labels", {}), r = n.dataLabels ?? {}, i = !!(n.value?.show ?? !0), a = !!(n.percentage?.show ?? !0), o = i ? q(e, t) : "", s = a ? J(e, t) : "";
|
|
421
|
+
return o && s ? r.valuePercentageRatio === "percentageFirst" ? `${s}\n${o}` : `${o}\n${s}` : o || s || "";
|
|
422
|
+
}
|
|
423
|
+
function Z(e, t) {
|
|
424
|
+
let n = S(e.config, "layout.labels", {}).dataLabels ?? {};
|
|
425
|
+
if (!E(e.config, "dataLabels.show", n.show ?? !0) || !n.show) return !1;
|
|
426
|
+
let r = x(n.hideUnderValue, 0);
|
|
427
|
+
return x(t.proportion, 0) * 100 > r;
|
|
428
|
+
}
|
|
429
|
+
function Te(e, t) {
|
|
430
|
+
let n = S(e.config, "layout.labels.dataLabels", {}), r = x(n.smallArcClusterThreshold, 0), i = x(n.hideUnderValue, 0), a = x(t.proportion, 0) * 100;
|
|
431
|
+
return a > i && r > 0 && a <= r;
|
|
432
|
+
}
|
|
433
|
+
function Q(e) {
|
|
434
|
+
return !!S(e.config, "layout.curvedMarkers", S(e.config, "layout.donut.curvedMarkers", !1));
|
|
435
|
+
}
|
|
436
|
+
function Ee(e, t) {
|
|
437
|
+
let n = S(e.config, "layout.labels.dataLabels", {}), r = {}, i = e.center.x, a = e.center.y, o = x(n.smallArcClusterFontSize ?? n.fontSize, 10), s = o / 3, c = o * 1.5, l = e.drawingArea.top + 16, u = e.drawingArea.bottom - 16, d = i - (e.radius + 6), p = i + (e.radius + 6), m = Q(e);
|
|
438
|
+
function h(e) {
|
|
439
|
+
return {
|
|
440
|
+
x: _(e.center?.endX ?? e.endX),
|
|
441
|
+
y: _(e.center?.endY ?? e.endY)
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
function v({ midX: e, midY: t, bandX: n, bandY: r }) {
|
|
445
|
+
if (!m) return `M ${e} ${t} L ${e} ${r} L ${n} ${r}`;
|
|
446
|
+
let o = n < i ? -1 : 1, s = n - e, c = r - t, l = Math.sqrt(s * s + c * c) || 1, u = e - i, d = t - a, f = Math.sqrt(u * u + d * d) || 1, p = u / f, h = d / f, g = f + 9;
|
|
447
|
+
function _({ x: e, y: t }) {
|
|
448
|
+
let n = e - i, r = t - a, o = Math.sqrt(n * n + r * r) || 1;
|
|
449
|
+
if (o >= g) return {
|
|
450
|
+
x: e,
|
|
451
|
+
y: t
|
|
452
|
+
};
|
|
453
|
+
let s = g / o;
|
|
454
|
+
return {
|
|
455
|
+
x: i + n * s,
|
|
456
|
+
y: a + r * s
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
if (l < 56) {
|
|
460
|
+
let o = s / l, u = -(c / l), d = o, f = (e + n) * .5, m = (t + r) * .5, g = (f + u - i) ** 2 + (m + d - a) ** 2;
|
|
461
|
+
(f - u - i) ** 2 + (m - d - a) ** 2 > g && (u = -u, d = -d);
|
|
462
|
+
let v = Math.max(0, Math.min(1, (l - 18) / 44)), y = v * v * (3 - 2 * v), b = e + s * .78, x = t + c * .78, S = _({
|
|
463
|
+
x: b + u * (2.5 + y * 4) * .9 + p * (1 + y * 2.5),
|
|
464
|
+
y: x + d * (2.5 + y * 4) * .9 + h * (1 + y * 2.5)
|
|
465
|
+
});
|
|
466
|
+
return `M ${e} ${t} Q ${S.x} ${S.y} ${n} ${r}`;
|
|
467
|
+
}
|
|
468
|
+
let v = l * .34;
|
|
469
|
+
v < 20 && (v = 20), v > 46 && (v = 46);
|
|
470
|
+
let y = l * .46;
|
|
471
|
+
y < 22 && (y = 22), y > 70 && (y = 70);
|
|
472
|
+
let b = _({
|
|
473
|
+
x: e + p * v,
|
|
474
|
+
y: t + h * v
|
|
475
|
+
}), x = i + o * Math.max(Math.abs(n - i), g), S = _({
|
|
476
|
+
x: n - o * Math.min(y, Math.abs(x - n) * .75),
|
|
477
|
+
y: r
|
|
478
|
+
});
|
|
479
|
+
return `M ${e} ${t} C ${b.x} ${b.y} ${S.x} ${S.y} ${n} ${r}`;
|
|
480
|
+
}
|
|
481
|
+
function y(e) {
|
|
482
|
+
let t = String(e ?? "").split(/\n/g);
|
|
483
|
+
return c + Math.max(0, t.length - 1) * o * 1.2;
|
|
484
|
+
}
|
|
485
|
+
function b({ arc: e, index: t }) {
|
|
486
|
+
let n = h(e);
|
|
487
|
+
return {
|
|
488
|
+
arc: e,
|
|
489
|
+
index: t,
|
|
490
|
+
midX: n.x,
|
|
491
|
+
midY: n.y,
|
|
492
|
+
inlineMarkerX: g(e).x,
|
|
493
|
+
inlineMarkerY: f(e) - 3.5,
|
|
494
|
+
labelHeight: y(e.name)
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
function C(e) {
|
|
498
|
+
let t = e.inlineMarkerY < a, n = e.inlineMarkerX < i;
|
|
499
|
+
return t && n ? "TL" : t && !n ? "TR" : !t && n ? "BL" : "BR";
|
|
500
|
+
}
|
|
501
|
+
function w(e, t) {
|
|
502
|
+
let n = t.startsWith("T");
|
|
503
|
+
e.sort((e, t) => n ? e.inlineMarkerY - t.inlineMarkerY || e.index - t.index : t.inlineMarkerY - e.inlineMarkerY || e.index - t.index);
|
|
504
|
+
}
|
|
505
|
+
function T({ side: e, markerX: t, markerY: n, labelY: r, connectorPath: i }) {
|
|
506
|
+
return {
|
|
507
|
+
side: e,
|
|
508
|
+
labelX: e === "left" ? t - 8 : t + 8,
|
|
509
|
+
labelY: r + s,
|
|
510
|
+
textAnchor: e === "left" ? "end" : "start",
|
|
511
|
+
markerX: t,
|
|
512
|
+
markerY: n,
|
|
513
|
+
connectorPath: i
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
function E({ candidateList: e, side: t, bandMarkerX: n, startY: i, direction: a }) {
|
|
517
|
+
let o = i;
|
|
518
|
+
e.forEach((e) => {
|
|
519
|
+
let { index: i, midX: s, midY: c, labelHeight: l } = e, u;
|
|
520
|
+
a === "down" ? (u = o, o += l) : (o -= l, u = o);
|
|
521
|
+
let d = u, f = v({
|
|
522
|
+
midX: s,
|
|
523
|
+
midY: c,
|
|
524
|
+
bandX: n,
|
|
525
|
+
bandY: d
|
|
526
|
+
});
|
|
527
|
+
r[i] = T({
|
|
528
|
+
side: t,
|
|
529
|
+
markerX: n,
|
|
530
|
+
markerY: d,
|
|
531
|
+
labelY: u,
|
|
532
|
+
connectorPath: f
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
let D = {
|
|
537
|
+
TL: [],
|
|
538
|
+
TR: [],
|
|
539
|
+
BL: [],
|
|
540
|
+
BR: []
|
|
541
|
+
};
|
|
542
|
+
return t.map((e, t) => b({
|
|
543
|
+
arc: e,
|
|
544
|
+
index: t
|
|
545
|
+
})).filter(({ arc: t }) => Z(e, t) && Te(e, t)).forEach((e) => {
|
|
546
|
+
D[C(e)].push(e);
|
|
547
|
+
}), Object.keys(D).forEach((e) => {
|
|
548
|
+
w(D[e], e);
|
|
549
|
+
}), E({
|
|
550
|
+
candidateList: D.TL,
|
|
551
|
+
side: "left",
|
|
552
|
+
bandMarkerX: d,
|
|
553
|
+
startY: l,
|
|
554
|
+
direction: "down"
|
|
555
|
+
}), E({
|
|
556
|
+
candidateList: D.TR,
|
|
557
|
+
side: "right",
|
|
558
|
+
bandMarkerX: p,
|
|
559
|
+
startY: l,
|
|
560
|
+
direction: "down"
|
|
561
|
+
}), D.BL.length > 1 && E({
|
|
562
|
+
candidateList: D.BL,
|
|
563
|
+
side: "left",
|
|
564
|
+
bandMarkerX: d,
|
|
565
|
+
startY: u,
|
|
566
|
+
direction: "up"
|
|
567
|
+
}), D.BR.length > 1 && E({
|
|
568
|
+
candidateList: D.BR,
|
|
569
|
+
side: "right",
|
|
570
|
+
bandMarkerX: p,
|
|
571
|
+
startY: u,
|
|
572
|
+
direction: "up"
|
|
573
|
+
}), r;
|
|
574
|
+
}
|
|
575
|
+
function De({ state: e, arc: t, arcIndex: n, smallArcLayout: r, fontSize: i }) {
|
|
576
|
+
let a = S(e.config, "layout.labels", {}), o = a.percentage ?? {}, s = a.name ?? {}, c = r?.labelX ?? g(t, !0, 12).x, l = r?.labelY ?? f(t), d = r?.textAnchor ?? g(t, !0, 12).anchor, { name: p } = Y(e, t), m = we(e, t), h = String(p).split(/\n/g), _ = p ? h.map((t, n) => M("tspan", {
|
|
577
|
+
class: "vue-data-ui-datalabel-name",
|
|
578
|
+
x: n === 0 ? void 0 : c,
|
|
579
|
+
dy: n === 0 ? void 0 : i * 1.2,
|
|
580
|
+
fill: k(s.color, j(e.config)),
|
|
581
|
+
"font-size": i,
|
|
582
|
+
"font-weight": s.bold ? "700" : "400"
|
|
583
|
+
}, u(t + (n === h.length - 1 ? " " : "")))).join("") : "", v = m ? M("tspan", {
|
|
584
|
+
class: "vue-data-ui-datalabel-value",
|
|
585
|
+
fill: k(o.color, j(e.config)),
|
|
586
|
+
"font-size": i,
|
|
587
|
+
"font-weight": o.bold ? "700" : "400"
|
|
588
|
+
}, u(m)) : "";
|
|
589
|
+
return M("text", {
|
|
590
|
+
"data-cy": `donut-label-inline-${n}`,
|
|
591
|
+
class: "vue-data-ui-datalabel-inline",
|
|
592
|
+
x: c,
|
|
593
|
+
y: l,
|
|
594
|
+
"text-anchor": d
|
|
595
|
+
}, `${_}${v}`);
|
|
596
|
+
}
|
|
597
|
+
function Oe(e, t) {
|
|
598
|
+
let n = S(e.config, "layout.labels", {}), r = n.dataLabels ?? {};
|
|
599
|
+
if (!E(e.config, "dataLabels.show", r.show ?? !0) || !r.show) return "";
|
|
600
|
+
let i = x(r.fontSize ?? n.value?.fontSize ?? 12, 12);
|
|
601
|
+
k(r.color ?? n.value?.color ?? j(e.config), j(e.config)), r.bold ?? n.value?.bold;
|
|
602
|
+
let a = x(r.offset, 16), o = Ee(e, t), s = [];
|
|
603
|
+
return t.forEach((t, n) => {
|
|
604
|
+
if (!Z(e, t)) return;
|
|
605
|
+
let c = o[n];
|
|
606
|
+
if (X(e, t), c) {
|
|
607
|
+
s.push(De({
|
|
608
|
+
state: e,
|
|
609
|
+
arc: t,
|
|
610
|
+
arcIndex: n,
|
|
611
|
+
smallArcLayout: c,
|
|
612
|
+
fontSize: x(r.smallArcClusterFontSize, i)
|
|
613
|
+
}));
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
s.push(De({
|
|
617
|
+
state: e,
|
|
618
|
+
arc: t,
|
|
619
|
+
arcIndex: n,
|
|
620
|
+
smallArcLayout: {
|
|
621
|
+
labelX: g(t, !1, a + i / 2).x,
|
|
622
|
+
labelY: f(t, a, a),
|
|
623
|
+
textAnchor: g(t).anchor
|
|
624
|
+
},
|
|
625
|
+
fontSize: i
|
|
626
|
+
}));
|
|
627
|
+
}), s.length ? M("g", { "data-layer": "data-labels" }, s.join("")) : "";
|
|
628
|
+
}
|
|
629
|
+
function ke(e, t, n = 42) {
|
|
630
|
+
return r({
|
|
631
|
+
initX: t.middlePoint.x,
|
|
632
|
+
initY: t.middlePoint.y,
|
|
633
|
+
offset: n,
|
|
634
|
+
centerX: e.center.x,
|
|
635
|
+
centerY: e.center.y
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
function Ae(e, t) {
|
|
639
|
+
return t.x < e.center.x ? "end" : t.x > e.center.x ? "start" : "middle";
|
|
640
|
+
}
|
|
641
|
+
function je(e, t, n, r) {
|
|
642
|
+
let i = S(e.config, "layout.labels", {}), a = i.percentage ?? {}, o = i.name ?? {}, s = x(a.fontSize, i.dataLabels?.fontSize ?? 12), c = x(o.fontSize, i.dataLabels?.fontSize ?? 12), l = M("tspan", {
|
|
643
|
+
class: "vue-data-ui-datalabel-value",
|
|
644
|
+
fill: k(a.color, j(e.config)),
|
|
645
|
+
"font-size": s,
|
|
646
|
+
"font-weight": a.bold ? "700" : "400"
|
|
647
|
+
}, u(String(X(e, t).replace(/\n/g, " / ")))), d = o.show ? String(t.name ?? "").split(/\n/g).map((t, r) => M("tspan", {
|
|
648
|
+
class: "vue-data-ui-datalabel-name",
|
|
649
|
+
x: r === 0 ? void 0 : n,
|
|
650
|
+
dy: r === 0 ? void 0 : c * 1.2,
|
|
651
|
+
fill: k(o.color, j(e.config)),
|
|
652
|
+
"font-size": c,
|
|
653
|
+
"font-weight": o.bold ? "700" : "400"
|
|
654
|
+
}, u(t))).join("") : "";
|
|
655
|
+
return r === "end" ? `${d}${l}` : `${l}${d}`;
|
|
656
|
+
}
|
|
657
|
+
function Me(e, t, n) {
|
|
658
|
+
let r = S(e.config, "layout.labels", {}), i = r.dataLabels ?? {}, a = r.value ?? {}, o = r.percentage ?? {}, s = r.name ?? {};
|
|
659
|
+
if (!E(e.config, "dataLabels.show", i.show ?? !0) || !i.show) return "";
|
|
660
|
+
let c = !!i.oneLine, l = x(a.fontSize, i.fontSize ?? 12), f = x(s.fontSize, i.fontSize ?? 12), p = [];
|
|
661
|
+
return t.forEach((t, r) => {
|
|
662
|
+
let i = n[r];
|
|
663
|
+
if (!i || !Z(e, t)) return;
|
|
664
|
+
let a = ke(e, i, 42), m = Ae(e, a);
|
|
665
|
+
if (c) {
|
|
666
|
+
p.push(M("text", {
|
|
667
|
+
"data-cy": "polar-label-inline",
|
|
668
|
+
class: "vue-data-ui-datalabel-inline",
|
|
669
|
+
x: a.x,
|
|
670
|
+
y: a.y,
|
|
671
|
+
"text-anchor": m
|
|
672
|
+
}, je(e, t, a.x, m)));
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
p.push(M("text", {
|
|
676
|
+
"data-cy": "polar-label-value",
|
|
677
|
+
class: "vue-data-ui-datalabel-value",
|
|
678
|
+
x: a.x,
|
|
679
|
+
y: a.y,
|
|
680
|
+
"font-size": l,
|
|
681
|
+
"font-weight": o.bold ? "700" : "400",
|
|
682
|
+
"text-anchor": m,
|
|
683
|
+
fill: valueFill
|
|
684
|
+
}, te({
|
|
685
|
+
content: X(e, t),
|
|
686
|
+
x: a.x,
|
|
687
|
+
fontSize: l,
|
|
688
|
+
fill: valueFill,
|
|
689
|
+
textAnchor: m
|
|
690
|
+
}))), s.show && p.push(M("text", {
|
|
691
|
+
"data-cy": "polar-label-name",
|
|
692
|
+
class: "vue-data-ui-datalabel-name",
|
|
693
|
+
x: a.x,
|
|
694
|
+
y: a.y + f * 1.2,
|
|
695
|
+
"font-size": f,
|
|
696
|
+
"font-weight": s.bold ? "700" : "400",
|
|
697
|
+
"text-anchor": m,
|
|
698
|
+
fill: k(s.color, j(e.config))
|
|
699
|
+
}, d({
|
|
700
|
+
content: u(String(t.name ?? "")),
|
|
701
|
+
fontSize: f,
|
|
702
|
+
fill: k(s.color, j(e.config)),
|
|
703
|
+
x: a.x
|
|
704
|
+
})));
|
|
705
|
+
}), p.length ? M("g", { "data-layer": "polar-data-labels" }, p.join("")) : "";
|
|
706
|
+
}
|
|
707
|
+
function Ne(e, t, n = null) {
|
|
708
|
+
if (n?.connectorPath) return n.connectorPath;
|
|
709
|
+
let r = S(e.config, "layout.labels.dataLabels", {}), i = x(r.offset, 16);
|
|
710
|
+
return m(t, !1, i, i, !1, !1, 0, x(r.markerFlatLength, 12), Q(e));
|
|
711
|
+
}
|
|
712
|
+
function Pe(e, t) {
|
|
713
|
+
let n = S(e.config, "layout.labels.dataLabels", {});
|
|
714
|
+
if (!E(e.config, "dataLabels.show", n.show ?? !0) || !n.show) return "";
|
|
715
|
+
let r = Ee(e, t), i = [];
|
|
716
|
+
return t.forEach((t, a) => {
|
|
717
|
+
if (!Z(e, t)) return;
|
|
718
|
+
let o = r[a], s = Ne(e, t, o);
|
|
719
|
+
s && (i.push(w("path", {
|
|
720
|
+
"data-cy": `donut-marker-${a}`,
|
|
721
|
+
d: s,
|
|
722
|
+
stroke: t.color,
|
|
723
|
+
"stroke-width": x(n.markerStrokeWidth, 1),
|
|
724
|
+
"stroke-linecap": "round",
|
|
725
|
+
"stroke-linejoin": "round",
|
|
726
|
+
fill: "none"
|
|
727
|
+
})), i.push(w("circle", {
|
|
728
|
+
"data-cy": `donut-label-marker-${a}`,
|
|
729
|
+
cx: o?.markerX ?? g(t).x,
|
|
730
|
+
cy: o?.markerY ?? f(t) - 3.5,
|
|
731
|
+
r: x(n.markerRadius, 3),
|
|
732
|
+
fill: t.color,
|
|
733
|
+
stroke: L(e.config),
|
|
734
|
+
"stroke-width": 1
|
|
735
|
+
})));
|
|
736
|
+
}), i.length ? M("g", { "data-layer": "label-markers" }, i.join("")) : "";
|
|
737
|
+
}
|
|
738
|
+
function Fe(e, t, n) {
|
|
739
|
+
let i = S(e.config, "layout.labels.dataLabels", {});
|
|
740
|
+
if (!E(e.config, "dataLabels.show", i.show ?? !0) || !i.show) return "";
|
|
741
|
+
let a = [];
|
|
742
|
+
return t.forEach((t, o) => {
|
|
743
|
+
let s = n[o];
|
|
744
|
+
if (!s?.middlePoint || !Z(e, t)) return;
|
|
745
|
+
let c = r({
|
|
746
|
+
initX: s.middlePoint.x,
|
|
747
|
+
initY: s.middlePoint.y,
|
|
748
|
+
offset: 24,
|
|
749
|
+
centerX: e.center.x,
|
|
750
|
+
centerY: e.center.y
|
|
751
|
+
});
|
|
752
|
+
a.push(w("path", {
|
|
753
|
+
"data-cy": `polar-marker-${o}`,
|
|
754
|
+
d: `M ${c.x},${c.y} ${s.middlePoint.x},${s.middlePoint.y}`,
|
|
755
|
+
stroke: t.color,
|
|
756
|
+
"stroke-width": x(i.markerStrokeWidth, 1),
|
|
757
|
+
"stroke-linecap": "round",
|
|
758
|
+
"stroke-linejoin": "round",
|
|
759
|
+
fill: "none"
|
|
760
|
+
})), a.push(w("circle", {
|
|
761
|
+
"data-cy": `polar-label-marker-${o}`,
|
|
762
|
+
cx: c.x,
|
|
763
|
+
cy: c.y,
|
|
764
|
+
r: x(i.markerRadius, 3),
|
|
765
|
+
fill: t.color,
|
|
766
|
+
stroke: L(e.config),
|
|
767
|
+
"stroke-width": 1
|
|
768
|
+
}));
|
|
769
|
+
}), a.length ? M("g", { "data-layer": "polar-label-markers" }, a.join("")) : "";
|
|
770
|
+
}
|
|
771
|
+
function $(e, t) {
|
|
772
|
+
return e == null || e === "" ? "" : N(e, {
|
|
773
|
+
"text-anchor": "middle",
|
|
774
|
+
...t
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
function Ie(e, t, n) {
|
|
778
|
+
if (E(e.config, "type", "classic") !== "classic" || V(e.config) || !t) return "";
|
|
779
|
+
let r = S(e.config, "layout.labels.hollow", {}), i = r.total ?? {}, o = r.average ?? {}, s = [];
|
|
780
|
+
if (i.show) {
|
|
781
|
+
let n = x(i.fontSize, 14), r = !!o.show, c = e.center.y - (r ? n : 0) + x(i.offsetY, 0), l = i.value ?? {}, u = x(l.fontSize, n), d = p(l.formatter, t, a({
|
|
782
|
+
p: l.prefix ?? "",
|
|
783
|
+
v: t,
|
|
784
|
+
s: l.suffix ?? "",
|
|
785
|
+
r: x(l.rounding, 0)
|
|
786
|
+
}), { total: t });
|
|
787
|
+
s.push($(i.text ?? "", {
|
|
788
|
+
"data-cy": "hollow-total-name",
|
|
789
|
+
x: e.center.x,
|
|
790
|
+
y: c,
|
|
791
|
+
fill: k(i.color, j(e.config)),
|
|
792
|
+
"font-size": n,
|
|
793
|
+
"font-weight": i.bold ? "700" : "400"
|
|
794
|
+
})), s.push($(d, {
|
|
795
|
+
"data-cy": "hollow-total-value",
|
|
796
|
+
x: e.center.x,
|
|
797
|
+
y: e.center.y + n - (r ? n : 0) + x(l.offsetY, 0),
|
|
798
|
+
fill: k(l.color, k(i.color, j(e.config))),
|
|
799
|
+
"font-size": u,
|
|
800
|
+
"font-weight": l.bold ? "700" : "400"
|
|
801
|
+
}));
|
|
802
|
+
}
|
|
803
|
+
if (o.show) {
|
|
804
|
+
let r = x(o.fontSize, 14), c = !!i.show, l = t / Math.max(1, n.length), u = o.value ?? {}, d = x(u.fontSize, r), f = p(u.formatter, l, a({
|
|
805
|
+
p: u.prefix ?? "",
|
|
806
|
+
v: l,
|
|
807
|
+
s: u.suffix ?? "",
|
|
808
|
+
r: x(u.rounding, 0)
|
|
809
|
+
}), { average: l });
|
|
810
|
+
s.push($(o.text ?? "", {
|
|
811
|
+
"data-cy": "hollow-average-name",
|
|
812
|
+
x: e.center.x,
|
|
813
|
+
y: e.center.y + (c ? r : 0) + x(o.offsetY, 0),
|
|
814
|
+
fill: k(o.color, j(e.config)),
|
|
815
|
+
"font-size": r,
|
|
816
|
+
"font-weight": o.bold ? "700" : "400"
|
|
817
|
+
})), s.push($(f, {
|
|
818
|
+
"data-cy": "hollow-average-value",
|
|
819
|
+
x: e.center.x,
|
|
820
|
+
y: e.center.y + (c ? r : 0) + r + x(u.offsetY, 0),
|
|
821
|
+
fill: k(u.color, k(o.color, j(e.config))),
|
|
822
|
+
"font-size": d,
|
|
823
|
+
"font-weight": u.bold ? "700" : "400"
|
|
824
|
+
}));
|
|
825
|
+
}
|
|
826
|
+
return s.filter(Boolean).length ? M("g", {
|
|
827
|
+
class: "vue-data-ui-donut-hollow-labels",
|
|
828
|
+
"data-layer": "hollow-labels"
|
|
829
|
+
}, s.join("")) : "";
|
|
830
|
+
}
|
|
831
|
+
function Le(e, t) {
|
|
832
|
+
let { config: n, center: r } = e, i = S(n, "layout.donut.labels.total", S(n, "layout.labels.total", {}));
|
|
833
|
+
if (!i.show || !Number.isFinite(t) || t <= 0) return "";
|
|
834
|
+
let o = S(n, "layout.labels.dataLabels", {}), s = x(i.fontSize, 20), c = k(i.color, j(n));
|
|
835
|
+
return N(p(i.formatter, t, a({
|
|
836
|
+
p: o.prefix ?? "",
|
|
837
|
+
v: t,
|
|
838
|
+
s: o.suffix ?? "",
|
|
839
|
+
r: x(i.rounding, 0)
|
|
840
|
+
}), { total: t }), {
|
|
841
|
+
"data-cy": "donut-total",
|
|
842
|
+
x: r.x,
|
|
843
|
+
y: r.y + s / 3,
|
|
844
|
+
"font-size": s,
|
|
845
|
+
"font-weight": i.bold ? "700" : "400",
|
|
846
|
+
"text-anchor": "middle",
|
|
847
|
+
fill: c
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
function Re(e, t) {
|
|
851
|
+
let n = z(R(e));
|
|
852
|
+
return n ? x(t.value, 0) / n * 100 : 0;
|
|
853
|
+
}
|
|
854
|
+
function ze(e, t) {
|
|
855
|
+
let n = S(e.config, "legend", {}), r = S(e.config, "layout.labels", {}), i = r.dataLabels ?? {}, o = r.value ?? {}, s = a({
|
|
856
|
+
p: i.prefix ?? "",
|
|
857
|
+
v: t.value,
|
|
858
|
+
s: i.suffix ?? "",
|
|
859
|
+
r: x(n.roundingValue, o.rounding ?? 0)
|
|
860
|
+
});
|
|
861
|
+
return p(o.formatter, t.value, s, {
|
|
862
|
+
datapoint: t,
|
|
863
|
+
serie: t
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
function Be(e, t) {
|
|
867
|
+
let n = S(e.config, "legend", {}), r = S(e.config, "layout.labels", {}).percentage ?? {}, i = Re(e, t), o = a({
|
|
868
|
+
v: i,
|
|
869
|
+
s: "%",
|
|
870
|
+
r: x(n.roundingPercentage, r.rounding ?? 0)
|
|
871
|
+
});
|
|
872
|
+
return p(r.formatter, i, o, {
|
|
873
|
+
datapoint: t,
|
|
874
|
+
serie: t
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
function Ve(e, t) {
|
|
878
|
+
let n = S(e.config, "legend", {}), r = [], i = n.showPercentage ? Be(e, t) : "", a = n.showValue ? ze(e, t) : "", o = i && n.usePercentageParens ? `(${i})` : i, s = a && n.useValueParens ? `(${a})` : a;
|
|
879
|
+
return n.showValueFirst ? (s && r.push(s), o && r.push(o)) : (o && r.push(o), s && r.push(s)), `${t.name}${r.length ? `: ${r.join(" ")}` : ""}`;
|
|
880
|
+
}
|
|
881
|
+
function He(e, t) {
|
|
882
|
+
let n = S(e.config, "legend", {});
|
|
883
|
+
if (!n.show || !t.length) return "";
|
|
884
|
+
let r = B(e, t), i = k(n.color, j(e.config)), a = n.position || "bottom", o = Math.max(r.markerSize, r.fontSize), s = a === "top" ? r.padding + o : e.height - r.height + r.padding + o, c = [];
|
|
885
|
+
return r.rows.forEach((t, a) => {
|
|
886
|
+
let l = r.padding + (e.width - r.padding * 2) / 2 - t.width / 2, u = s + a * (o + r.rowGap);
|
|
887
|
+
t.items.forEach(({ serie: e, label: t, itemWidth: a }) => {
|
|
888
|
+
c.push(w("circle", {
|
|
889
|
+
cx: l + r.markerSize / 2,
|
|
890
|
+
cy: u,
|
|
891
|
+
r: r.markerSize / 2,
|
|
892
|
+
fill: e.color,
|
|
893
|
+
opacity: e.opacity ?? 1
|
|
894
|
+
})), c.push(N(t, {
|
|
895
|
+
x: l + r.markerSize + r.labelGap,
|
|
896
|
+
y: u + 2,
|
|
897
|
+
"font-size": r.fontSize,
|
|
898
|
+
"font-weight": n.bold ? "700" : "400",
|
|
899
|
+
"dominant-baseline": "middle",
|
|
900
|
+
fill: i,
|
|
901
|
+
opacity: e.opacity ?? 1
|
|
902
|
+
})), l += a + r.itemGap;
|
|
903
|
+
});
|
|
904
|
+
}), M("g", {
|
|
905
|
+
"data-layer": "legend",
|
|
906
|
+
"data-cy": "donut-div-legend"
|
|
907
|
+
}, c.join(""));
|
|
908
|
+
}
|
|
909
|
+
function Ue(e) {
|
|
910
|
+
return M("g", { "data-layer": "no-data" }, [w("circle", {
|
|
911
|
+
cx: e.center.x,
|
|
912
|
+
cy: e.center.y,
|
|
913
|
+
r: Math.max(1, e.radius),
|
|
914
|
+
fill: k(S(e.config, "layout.donut.emptyFill", "#E1E5E8"), "#E1E5E8"),
|
|
915
|
+
opacity: .4
|
|
916
|
+
})].join(""));
|
|
917
|
+
}
|
|
918
|
+
function We(e, t) {
|
|
919
|
+
let n = e.additionalSvgContent;
|
|
920
|
+
return typeof n == "function" ? n({
|
|
921
|
+
width: e.width,
|
|
922
|
+
height: e.height,
|
|
923
|
+
drawingArea: e.drawingArea,
|
|
924
|
+
center: e.center,
|
|
925
|
+
radius: e.radius,
|
|
926
|
+
thickness: e.thickness,
|
|
927
|
+
innerRadius: e.innerRadius,
|
|
928
|
+
config: e.config,
|
|
929
|
+
series: t.map((e) => ({ ...e }))
|
|
930
|
+
}) ?? "" : n ?? "";
|
|
931
|
+
}
|
|
932
|
+
function Ge(e, t, n) {
|
|
933
|
+
return M("title", {}, u(`${E(e.config, "title.text", "Donut chart") || e.svgTitle || "Donut chart"}. ${t.length} series. Total ${_(n)}.`));
|
|
934
|
+
}
|
|
935
|
+
async function Ke(e) {
|
|
936
|
+
let t = e.config, n = x(e.width, S(t, "width", 512)), r = x(e.height, S(t, "height", 512)), i = R(e), a = z(i), o = me({
|
|
937
|
+
...e,
|
|
938
|
+
width: n,
|
|
939
|
+
height: r
|
|
940
|
+
}, i), s = he(o, i), c = ge(o, i), l = E(t, "type", "classic"), u = a > 0 && s.some((e) => x(e.proportion, 0) > 0);
|
|
941
|
+
return `
|
|
942
|
+
<svg
|
|
943
|
+
xmlns="${h}"
|
|
944
|
+
width="100%"
|
|
945
|
+
viewBox="0 0 ${n} ${r}"
|
|
946
|
+
role="img"
|
|
947
|
+
>
|
|
948
|
+
${D()}
|
|
949
|
+
${Ge(o, i, a)}
|
|
950
|
+
${C(o)}
|
|
951
|
+
${ye({
|
|
952
|
+
...o,
|
|
953
|
+
polarAreas: c
|
|
954
|
+
}, s)}
|
|
955
|
+
${ee(o)}
|
|
956
|
+
${ve(o)}
|
|
957
|
+
${u ? l === "polar" ? Ce(o, s, c) : Se(o, s) : Ue(o)}
|
|
958
|
+
${u && l === "classic" ? _e(o) : ""}
|
|
959
|
+
${u ? l === "polar" ? Fe(o, s, c) : Pe(o, s) : ""}
|
|
960
|
+
${u ? Ie(o, a, i) : ""}
|
|
961
|
+
${u ? l === "polar" ? Me(o, s, c) : Oe(o, s) : ""}
|
|
962
|
+
${u ? Le(o, a) : ""}
|
|
963
|
+
${He(o, i)}
|
|
964
|
+
${We(o, s)}
|
|
965
|
+
</svg>`.trim();
|
|
966
|
+
}
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region src/svg/vue-ui-donut/index.js
|
|
969
|
+
async function qe(e = {}) {
|
|
970
|
+
return await Ke(le(e));
|
|
971
|
+
}
|
|
972
|
+
//#endregion
|
|
973
|
+
export { qe as t };
|