vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
2,086 lines • 95.2 kB
JavaScript
import { computed as g, defineAsyncComponent as Se, useSlots as Hl, shallowRef as Me, ref as k, onMounted as ol, onBeforeUnmount as al, toRefs as Gl, watch as Ne, createElementBlock as i, openBlock as u, normalizeStyle as I, normalizeClass as Nt, createBlock as Pe, createCommentVNode as f, renderSlot as w, createElementVNode as b, createVNode as wt, unref as s, withCtx as C, normalizeProps as ee, guardReactiveProps as te, createSlots as Rt, Fragment as _, renderList as j, mergeProps as Vt, toDisplayString as ke, withDirectives as kt, vShow as Ct, Teleport as jl, resolveDynamicComponent as Wl, createTextVNode as nl, nextTick as ql } from "vue";
import { o as sl, g as Ut, l as Ql, c as Jl, t as Kl, k as Zl, U as eo, m as ul, j as Ee, a as ge, d as ie, a3 as rl, au as to, X as lo, s as xt, h as oo, a4 as ao, ac as z, a5 as Ce, a6 as A, ar as il, f as no, i as so, a1 as Ht, v as uo, r as ro, y as io, ag as cl, av as co } from "./lib-BwysEpWI.js";
import { f as vo, b as ho } from "./labelUtils-PMU3ZGCb.js";
import { t as fo, u as yo } from "./useResponsive-DfdjqQps.js";
import { u as go, a as Gt } from "./useNestedProp-OFRiX4kU.js";
import { u as po } from "./usePrinter-BJzHDpYF.js";
import { u as bo, B as mo } from "./BaseScanner-BMpwQAfz.js";
import { u as wo } from "./useSvgExport-ByUukOZt.js";
import { u as ko } from "./useThemeCheck-DGJ31Vi5.js";
import { u as Co } from "./useUserOptionState-BIvW1Kz7.js";
import { u as xo } from "./useChartAccessibility-9icAAmYg.js";
import $o from "./img-DKigoPDs.js";
import { _ as Ao } from "./Shape-DAHhCEdg.js";
import _o from "./Title-DGnfNZuO.js";
import To from "./Legend-D6z73edh.js";
import { _ as Lo } from "./_plugin-vue_export-helper-CHgC5LLL.js";
function So(tt) {
const {
FINAL_CONFIG: lt,
noGhostDonut: $t,
svg: Re,
padding: ot,
labels_inline_fontSize: At,
minSize: at,
findArcMidpoint: _t,
calcMarkerOffsetX: Tt,
calcMarkerOffsetY: Lt,
animatingIndex: St,
segregated: Mt,
isSmallArc: Pt
} = tt;
return { smallArcLayoutsClassic: g(() => {
if (lt.value.type !== "classic") return {};
const Ve = {}, x = $t.value || [];
if (!x.length) return Ve;
const D = Re.value.width / 2, L = Re.value.height / 2, Fe = ot.value.top + 16, nt = Re.value.height - ot.value.bottom - 16, Ue = At.value, st = Ue / 3, ut = Ue * 1.5, le = 8, pe = 6, He = D - (at.value + pe), Ge = D + (at.value + pe), rt = !!lt.value.style.chart.layout.curvedMarkers;
function it({ midX: h, midY: y, bandX: p, bandY: c }) {
if (!rt)
return `M ${h} ${y} L ${h} ${c} L ${p} ${c}`;
const S = p < D ? -1 : 1, V = p - h, M = c - y, ae = Math.sqrt(V * V + M * M) || 1, be = h - D, e = y - L, ne = Math.sqrt(be * be + e * e) || 1, W = be / ne, ce = e / ne, P = ne + 9;
function me({ x: Be, y: $e }) {
const K = Be - D, Z = $e - L, Ae = Math.sqrt(K * K + Z * Z) || 1;
if (Ae >= P) return { x: Be, y: $e };
const _e = P / Ae;
return {
x: D + K * _e,
y: L + Z * _e
};
}
if (ae < 56) {
const Be = V / ae;
let K = -(M / ae), Z = Be;
const Ae = (h + p) * 0.5, _e = (y + c) * 0.5, gt = Ae + K, Qe = _e + Z, m = (gt - D) * (gt - D) + (Qe - L) * (Qe - L), n = Ae - K, ve = _e - Z;
(n - D) * (n - D) + (ve - L) * (ve - L) > m && (K = -K, Z = -Z);
const R = 0.78, H = h + V * R, Dt = y + M * R, O = Math.max(0, Math.min(1, (ae - 18) / 44)), se = O * O * (3 - 2 * O);
let ue = 2.5 + se * 4, Je = 1 + se * 2.5;
ue *= 0.9;
const Xe = {
x: H + K * ue + W * Je,
y: Dt + Z * ue + ce * Je
}, Ke = me(Xe);
return `M ${h} ${y} Q ${Ke.x} ${Ke.y} ${p} ${c}`;
}
let J = ae * 0.34;
J < 20 && (J = 20), J > 46 && (J = 46);
let De = ae * 0.46;
De < 22 && (De = 22), De > 70 && (De = 70);
const qe = {
x: h + W * J,
y: y + ce * J
}, ht = D + S * Math.max(Math.abs(p - D), P), ft = {
x: p - S * Math.min(De, Math.abs(ht - p) * 0.75),
y: c
}, de = me(qe), yt = me(ft);
return `M ${h} ${y} C ${de.x} ${de.y} ${yt.x} ${yt.y} ${p} ${c}`;
}
function ct(h) {
const y = String(h ?? "").split(/\n/g), p = Math.max(0, y.length - 1), c = Ue * 1.2, S = p * c;
return ut + S;
}
function dt({ arc: h, index: y }) {
const { x: p, y: c } = _t(h.path), S = Tt(h).x, V = Lt(h) - 3.5, M = ct(h.name);
return {
arc: h,
index: y,
midX: p,
midY: c,
inlineMarkerX: S,
inlineMarkerY: V,
labelHeight: M
};
}
function Ie(h) {
const { arc: y } = h, p = y.seriesIndex ?? 0;
return St.value === p || Mt.value.includes(p) ? !1 : Pt(y, p);
}
function je(h) {
const y = h.inlineMarkerY < L, p = h.inlineMarkerX < D;
return y && p ? "TL" : y && !p ? "TR" : !y && p ? "BL" : "BR";
}
function xe(h, y) {
if (y.startsWith("T")) {
h.sort((c, S) => c.inlineMarkerY - S.inlineMarkerY || c.index - S.index);
return;
}
h.sort((c, S) => S.inlineMarkerY - c.inlineMarkerY || c.index - S.index);
}
function N({ side: h, markerX: y, markerY: p, labelY: c, connectorPath: S }) {
return {
side: h,
labelX: h === "left" ? y - le : y + le,
labelY: c + st,
textAnchor: h === "left" ? "end" : "start",
markerX: y,
markerY: p,
connectorPath: S
};
}
function oe({
candidateList: h,
side: y,
bandMarkerX: p,
startY: c,
direction: S
}) {
let V = c;
h.forEach((M) => {
const { index: ae, midX: be, midY: e, labelHeight: ne } = M;
let W;
S === "down" ? (W = V, V += ne) : (V -= ne, W = V);
const ce = W, vt = it({
midX: be,
midY: e,
bandX: p,
bandY: ce
});
Ve[ae] = N({
side: y,
markerX: p,
markerY: ce,
labelY: W,
connectorPath: vt
});
});
}
const We = x.map((h, y) => dt({ arc: h, index: y })).filter(Ie), B = {
TL: [],
TR: [],
BL: [],
BR: []
};
return We.forEach((h) => {
B[je(h)].push(h);
}), Object.keys(B).forEach((h) => {
xe(B[h], h);
}), oe({
candidateList: B.TL,
side: "left",
bandMarkerX: He,
startY: Fe,
direction: "down"
}), oe({
candidateList: B.TR,
side: "right",
bandMarkerX: Ge,
startY: Fe,
direction: "down"
}), B.BL.length > 1 && oe({
candidateList: B.BL,
side: "left",
bandMarkerX: He,
startY: nt,
direction: "up"
}), B.BR.length > 1 && oe({
candidateList: B.BR,
side: "right",
bandMarkerX: Ge,
startY: nt,
direction: "up"
}), Ve;
}) };
}
const dl = { style: { chart: { backgroundColor: "#1A1A1A", color: "#CCCCCC", layout: { labels: { percentage: { color: "#CCCCCC" }, name: { color: "#CCCCCC" }, hollow: { total: { color: "#CCCCCC", value: { color: "#CCCCCC" } }, average: { color: "#CCCCCC", value: { color: "#CCCCCC" } } } } }, legend: { backgroundColor: "#1A1A1A", color: "#CCCCCC" }, title: { color: "#CCCCCC", subtitle: { color: "#757575" } }, tooltip: { backgroundColor: "#1A1A1A", backgroundOpacity: 70, color: "#CCCCCC", borderColor: "#5A5A5A" } } }, table: { th: { backgroundColor: "#1A1A1A", color: "#CCCCCC" }, td: { backgroundColor: "#1A1A1A", color: "#CCCCCC" } } }, vl = { style: { chart: { backgroundColor: "#FFF8E1", color: "#424242", layout: { labels: { percentage: { color: "#424242" }, name: { color: "#424242" }, hollow: { total: { color: "#424242", value: { color: "#424242" } }, average: { color: "#424242", value: { color: "#424242" } } } } }, legend: { backgroundColor: "#FFF8E1", color: "#424242" }, title: { color: "#424242", subtitle: { color: "#757575" } }, tooltip: { backgroundColor: "#FFECB3", backgroundOpacity: 30, color: "#424242", borderColor: "#FF8A65" } } }, table: { th: { backgroundColor: "#FFF8E1", color: "#424242" }, td: { backgroundColor: "#FFF8E1", color: "#424242" } } }, hl = { style: { chart: { backgroundColor: "#1E1E1E", color: "#BDBDBD", layout: { labels: { percentage: { color: "#BDBDBD" }, name: { color: "#BDBDBD" }, hollow: { total: { color: "#BDBDBD", value: { color: "#BDBDBD" } }, average: { color: "#BDBDBD", value: { color: "#BDBDBD" } } } } }, legend: { backgroundColor: "#1E1E1E", color: "#BDBDBD" }, title: { color: "#FFF8E1", subtitle: { color: "#BDBDBD" } }, tooltip: { backgroundColor: "#1E1E1E", backgroundOpacity: 30, color: "#FFF8E1", borderColor: "#FF8A65" } } }, table: { th: { backgroundColor: "#1E1E1E", color: "#BDBDBD" }, td: { backgroundColor: "#1E1E1E", color: "#BDBDBD" } } }, fl = { style: { chart: { backgroundColor: "#f6f6fb", color: "#50606C", layout: { labels: { percentage: { color: "#61747E" }, name: { color: "#8A9892" }, hollow: { total: { color: "#8A9892", value: { color: "#61747E" } }, average: { color: "#8A9892", value: { color: "#61747E" } } } } }, legend: { backgroundColor: "#f6f6fb", color: "#61747E" }, title: { color: "#50606C", subtitle: { color: "#718890" } }, tooltip: { backgroundColor: "#f6f6fb", color: "#50606C" } } }, table: { th: { backgroundColor: "#f6f6fb", color: "#50606C" }, td: { backgroundColor: "#f6f6fb", color: "#50606C" } } }, yl = { style: { chart: { backgroundColor: "#1A1A1A", color: "#99AA99", layout: { labels: { percentage: { color: "#AACCAA" }, name: { color: "#99CC99" }, hollow: { total: { color: "#99CC99", value: { color: "#AACCAA" } }, average: { color: "#99CC99", value: { color: "#AACCAA" } } } } }, legend: { backgroundColor: "#1A1A1A", color: "#99AA99" }, title: { color: "#66CC66", subtitle: { color: "#99AA99" } }, tooltip: { backgroundColor: "#2A2F2A", color: "#AACCAA", borderColor: "#66CC66" } } }, table: { th: { backgroundColor: "#1A1A1A", color: "#99AA99" }, td: { backgroundColor: "#1A1A1A", color: "#AACCAA" } } }, gl = { style: { chart: { backgroundColor: "#fbfafa", color: "#8A9892", layout: { labels: { percentage: { color: "#A0AC94" }, name: { color: "#8A9892" }, hollow: { total: { color: "#8A9892", value: { color: "#A0AC94" } }, average: { color: "#8A9892", value: { color: "#A0AC94" } } } } }, legend: { backgroundColor: "#fbfafa", color: "#99AA99" }, title: { color: "#8A9892", subtitle: { color: "#99AA99" } }, tooltip: { backgroundColor: "#fbfafa", color: "#8A9892" } } }, table: { th: { backgroundColor: "#fbfafa", color: "#8F837A" }, td: { backgroundColor: "#fbfafa", color: "#8F837A" } } }, pl = {
default: {},
dark: dl,
celebration: vl,
celebrationNight: hl,
concrete: fl,
hack: yl,
zen: gl
}, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
celebration: vl,
celebrationNight: hl,
concrete: fl,
dark: dl,
default: pl,
hack: yl,
zen: gl
}, Symbol.toStringTag, { value: "Module" })), Mo = ["id"], Po = ["id"], Fo = ["xmlns", "viewBox"], Io = ["width", "height"], Do = { key: 1 }, Bo = ["id"], zo = ["stop-color"], Oo = ["offset", "stop-color"], Yo = ["offset", "stop-color"], Eo = ["stop-color"], Xo = { key: 2 }, No = ["id", "cx", "cy"], Ro = ["stop-color", "stop-opacity"], Vo = ["stop-color"], Uo = ["id"], Ho = ["id"], Go = ["id"], jo = ["flood-color"], Wo = ["id"], qo = ["flood-color"], Qo = ["d", "stroke", "filter"], Jo = ["d", "stroke", "filter"], Ko = ["cx", "cy", "r", "fill", "filter"], Zo = { key: 6 }, ea = ["stroke", "d"], ta = ["d", "fill", "stroke", "stroke-width", "filter"], la = { key: 0 }, oa = ["d", "fill", "stroke", "stroke-width", "filter"], aa = { key: 0 }, na = ["stroke", "d"], sa = { key: 0 }, ua = ["d", "stroke", "stroke-width", "filter"], ra = { key: 1 }, ia = ["d", "fill", "stroke", "stroke-width", "filter"], ca = ["d", "fill", "stroke", "stroke-width", "filter"], da = { key: 1 }, va = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], ha = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], fa = { key: 0 }, ya = ["d", "fill", "stroke", "stroke-width"], ga = ["cx", "cy", "r", "stroke"], pa = ["cx", "cy", "r", "fill"], ba = ["cx", "cy", "r"], ma = { key: 0 }, wa = ["d", "stroke", "fill", "onMouseenter", "onMouseleave", "onClick"], ka = { key: 1 }, Ca = ["cx", "cy", "r"], xa = ["x", "y", "fill", "font-size"], $a = ["x", "y", "fill", "font-size"], Aa = ["x", "y", "fill", "font-size"], _a = ["x", "y", "fill", "font-size"], Ta = ["filter", "opacity"], La = { key: 0 }, Sa = ["x", "y"], Ma = { key: 1 }, Pa = ["cx", "cy", "fill", "stroke", "filter", "onClick", "onMouseenter", "onMouseleave"], Fa = ["text-anchor", "x", "y", "onClick", "onMouseenter", "onMouseleave", "innerHTML"], Ia = ["text-anchor", "x", "y", "fill", "font-size", "onClick", "onMouseenter", "onMouseleave"], Da = ["text-anchor", "x", "y", "fill", "font-size", "onClick", "onMouseenter", "onMouseleave", "innerHTML"], Ba = ["cx", "cy", "fill", "stroke", "filter", "onClick", "onMouseenter", "onMouseleave"], za = ["text-anchor", "x", "y", "onClick", "onMouseenter", "onMouseleave", "innerHTML"], Oa = ["text-anchor", "x", "y", "fill", "font-size", "onClick", "onMouseenter", "onMouseleave"], Ya = ["text-anchor", "x", "y", "fill", "font-size", "onClick", "onMouseenter", "onMouseleave", "innerHTML"], Ea = { key: 2 }, Xa = ["x", "y", "width"], Na = ["x", "y", "width"], Ra = {
key: 4,
class: "vue-data-ui-watermark"
}, Va = ["id"], Ua = ["onClick"], Ha = {
key: 7,
class: "vue-ui-donut-hollow"
}, Ga = ["innerHTML"], ja = {
__name: "vue-ui-donut",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectLegend", "selectDatapoint"],
setup(tt, { expose: lt, emit: $t }) {
const Re = Se(() => import("./Tooltip-TDyKgLB6.js")), ot = Se(() => import("./BaseIcon-4i3dd7Ty.js")), At = Se(() => import("./vue-ui-accordion-DUuwVsuJ.js")), at = Se(() => import("./DataTable-WrXCJkfE.js")), _t = Se(() => import("./PenAndPaper-DxIUvoQ8.js")), Tt = Se(() => import("./UserOptions-CzJWRC4s.js")), Lt = Se(() => import("./PackageVersion-BLzm8l_I.js")), St = Se(() => import("./BaseDraggableDialog-CAJxIF6g.js")), { vue_ui_donut: Mt } = go(), { isThemeValid: Pt, warnInvalidTheme: jt } = ko(), Ve = Hl(), x = tt, D = g({
get() {
return !!x.dataset && x.dataset.length;
},
set(l) {
return l;
}
}), L = Me(null), Fe = k(null), nt = k(null), Ue = k(null), st = Me(null), ut = Me(null), le = Me(null), pe = Me(null), He = Me(null), Ge = Me(null), rt = k(0), it = k(0), ct = k(0), dt = k(!1), Ie = k(null), je = k(null), xe = g({
get: () => e.value.style.chart.layout.labels.percentage.fontSize,
set: (l) => l
}), N = g({
get: () => e.value.style.chart.layout.labels.name.fontSize,
set: (l) => l
}), oe = g({
get: () => e.value.style.chart.layout.labels.dataLabels.smallArcClusterFontSize,
set: (l) => l
});
let We = !1;
const B = () => {
!e.value.autoSize || We || (We = !0, requestAnimationFrame(() => {
We = !1;
const l = e.value, a = Fe.value, t = de.value;
if (!l.autoSize || !a || !t) return;
const [o, r, d, $] = t.getAttribute("viewBox").split(" ").map(Number), T = { x: o, y: r, width: d, height: $ }, E = [
{
selector: ".vue-data-ui-datalabel-value",
baseSize: l.style.chart.layout.labels.percentage.fontSize,
minSize: l.style.chart.layout.labels.percentage.minFontSize,
sizeRef: xe
},
{
selector: ".vue-data-ui-datalabel-name",
baseSize: l.style.chart.layout.labels.name.fontSize,
minSize: l.style.chart.layout.labels.name.minFontSize,
sizeRef: N
},
{
selector: ".vue-data-ui-datalabel-inline",
baseSize: l.style.chart.layout.labels.dataLabels.smallArcClusterFontSize,
minSize: l.style.chart.layout.labels.name.minFontSize,
sizeRef: oe
}
];
E.map((G) => a.querySelectorAll(G.selector).length).reduce((G, Ye) => G + Ye, 0) !== 0 && E.forEach(({ selector: G, baseSize: Ye, minSize: Nl, sizeRef: Rl }) => {
a.querySelectorAll(G).forEach((Vl) => {
const Ul = no({
el: Vl,
bounds: T,
currentFontSize: Ye,
minFontSize: Nl,
attempts: 200,
padding: 1
});
Rl.value = Ul;
});
});
}));
};
ol(async () => {
dt.value = !0, p(), requestAnimationFrame(B);
});
let h;
ol(() => {
L.value && (h = new ResizeObserver((l) => {
for (const a of l) {
const { width: t, height: o } = a.contentRect;
if (t > 0 && o > 0) {
B();
break;
}
}
}), h.observe(L.value.parentElement));
}), al(() => {
h?.disconnect();
}), al(() => {
le.value && (pe.value && le.value.unobserve(pe.value), le.value.disconnect());
});
const y = g(() => !!e.value.debug);
function p() {
if (sl(x.dataset) ? (Ut({
componentName: "VueUiDonut",
type: "dataset",
debug: y.value
}), D.value = !1, ce.value = !0) : (x.dataset.forEach((l, a) => {
Ql({
datasetObject: l,
requiredAttributes: ["name", "values"]
}).forEach((t) => {
Ut({
componentName: "VueUiDonut",
type: "datasetSerieAttribute",
property: t,
index: a,
debug: y.value
}), D.value = !1, ce.value = !0;
});
}), x.dataset.forEach((l, a) => {
(!l.name || l.name === "") && Ut({
componentName: "VueUiDonut",
type: "datasetAttributeEmpty",
property: "name",
index: a,
debug: y.value
});
})), sl(x.dataset) || (ce.value = e.value.loading), e.value.responsive) {
const l = fo(() => {
const { width: a, height: t } = yo({
chart: L.value,
title: e.value.style.chart.title.text ? st.value : null,
legend: e.value.style.chart.legend.show ? ut.value : null,
source: He.value,
noTitle: Ge.value,
padding: e.value.autoSize ? void 0 : $e.value
});
requestAnimationFrame(() => {
n.value.width = a, n.value.height = t, B();
});
});
le.value && (pe.value && le.value.unobserve(pe.value), le.value.disconnect()), le.value = new ResizeObserver(l), pe.value = L.value.parentNode, le.value.observe(pe.value);
}
}
const c = k(Jl()), S = k(!1), V = k(""), M = k(null), ae = k(0);
function be() {
const l = Gt({
userConfig: x.config,
defaultConfig: Mt
});
let a = {};
const t = l.theme;
if (!t)
a = l;
else if (!Pt.value(l))
jt(l), a = l;
else {
const o = Gt({
userConfig: pl[t] || x.config,
defaultConfig: l
});
a = {
...Gt({
userConfig: x.config,
defaultConfig: o
}),
customPalette: l.customPalette.length ? l.customPalette : so[t] || Ee
};
}
return x.config && Ht(x.config, "events.datapointEnter") ? a.events.datapointEnter = x.config.events.datapointEnter : a.events.datapointEnter = null, x.config && Ht(x.config, "events.datapointLeave") ? a.events.datapointLeave = x.config.events.datapointLeave : a.events.datapointLeave = null, x.config && Ht(x.config, "events.datapointClick") ? a.events.datapointClick = x.config.events.datapointClick : a.events.datapointClick = null, a;
}
const e = k(be()), { loading: ne, FINAL_DATASET: W, manualLoading: ce, skeletonDataset: vt } = bo({
...Gl(x),
FINAL_CONFIG: e,
prepareConfig: be,
skeletonDataset: [
{
name: "",
values: [3],
color: "#BABABA"
},
{
name: "",
values: [2],
color: "#AAAAAA"
},
{
name: "",
values: [1],
color: "#CACACA"
}
],
skeletonConfig: Kl({
defaultConfig: e.value,
userConfig: {
useCssAnimation: !1,
table: { show: !1 },
startAnimation: {
show: !1
},
userOptions: { show: !1 },
style: {
chart: {
backgroundColor: "#99999930",
layout: {
labels: {
dataLabels: { show: !1 },
hollow: {
average: { show: !1 },
total: { show: !1 }
},
value: { show: !1 }
}
},
legend: {
backgroundColor: "transparent",
showValue: !1,
showPercentage: !1
},
title: {
color: "#1A1A1A",
subtitle: {
color: "#5A5A5A"
}
}
}
}
}
})
}), P = k(!0), me = k(0), Ft = k(!1);
let J = null;
function De(l = 1e3) {
return new Promise((a) => {
const t = performance.now();
function o(r) {
const d = r - t, $ = Math.min(
d / l,
1
), T = cl($);
me.value = T, $ < 1 ? J = requestAnimationFrame(o) : (me.value = 1, J = null, a());
}
J !== null && cancelAnimationFrame(J), me.value = 0, J = requestAnimationFrame(o);
});
}
Ne(
() => ne.value,
async (l) => {
if (l || Ft.value)
return;
const a = W.value === vt, t = e.value.startAnimation?.show;
if (!a && t) {
Ft.value = !0;
const o = e.value.startAnimation.durationMs || 1e3;
await De(o);
} else
me.value = 1;
P.value = !1;
},
{ immediate: !0 }
);
const { userOptionsVisible: qe, setUserOptionsVisibility: ht, keepUserOptionState: ft } = Co({ config: e.value }), { svgRef: de } = xo({ config: e.value.style.chart.title });
function yt() {
ht(!0);
}
function Be() {
ht(!1);
}
Ne(() => x.config, (l) => {
ne.value || (e.value = be()), qe.value = !e.value.userOptions.showOnChartHover, p(), rt.value += 1, it.value += 1, ct.value += 1, m.value.dataLabels.show = e.value.style.chart.layout.labels.dataLabels.show, m.value.showTable = e.value.table.show, m.value.showTooltip = e.value.style.chart.tooltip.show, n.value.height = e.value.style.chart.height, n.value.width = e.value.style.chart.width;
}, { deep: !0 });
const $e = g(() => {
const { top: l, right: a, bottom: t, left: o } = e.value.style.chart.padding;
return {
css: `padding:${l}px ${a}px ${t}px ${o}px`,
top: l,
right: a,
bottom: t,
left: o
};
}), { isPrinting: K, isImaging: Z, generatePdf: Ae, generateImage: _e } = po({
elementId: `donut__${c.value}`,
fileName: e.value.style.chart.title.text || "vue-ui-donut",
options: e.value.userOptions.print
}), gt = g(() => e.value.userOptions.show && !e.value.style.chart.title.text), Qe = g(() => Zl(e.value.customPalette)), m = k({
dataLabels: {
show: e.value.style.chart.layout.labels.dataLabels.show
},
showTable: e.value.table.show,
showTooltip: e.value.style.chart.tooltip.show
});
Ne(e, () => {
m.value = {
dataLabels: {
show: e.value.style.chart.layout.labels.dataLabels.show
},
showTable: e.value.table.show,
showTooltip: e.value.style.chart.tooltip.show
};
}, { immediate: !0 });
const n = k({
height: e.value.style.chart.height,
width: e.value.style.chart.width
}), ve = g(() => {
if (e.value.pie)
return F.value;
const l = e.value.style.chart.layout.donut.strokeWidth / 512, a = Math.min(n.value.width, n.value.height) * l, t = a > F.value ? F.value : a;
return Math.max(t, 12 * (1 + l));
}), It = $t, R = g(() => W.value.sort((l, a) => {
const t = Array.isArray(l.values) ? l.values.reduce((r, d) => r + d, 0) : l.value ?? 0, o = Array.isArray(a.values) ? a.values.reduce((r, d) => r + d, 0) : a.value ?? 0;
return l.ghost && !a.ghost ? 1 : a.ghost && !l.ghost ? -1 : o - t;
}).map((l, a) => ({
name: l.name,
color: ul(l.color) || Qe.value[a] || Ee[a] || Ee[a % Ee.length],
value: eo(l.values.reduce((t, o) => t + o, 0)),
absoluteValues: l.values,
comment: l.comment || "",
patternIndex: a,
seriesIndex: a,
ghost: !1,
pattern: `pattern_${c.value}_${a}`
})));
Ne(() => x.dataset, (l) => {
Array.isArray(l) && l.length > 0 && (ce.value = !1);
}, { immediate: !0 });
const H = Me(R.value);
Ne(() => R.value, (l) => {
H.value = l, requestAnimationFrame(B);
});
function Dt() {
return R.value.map((l) => ({
name: l.name,
color: l.color,
value: l.value
}));
}
const O = k([]), se = k(!1), ue = k(null);
function Je({ from: l, to: a, duration: t, onUpdate: o, onDone: r, easing: d = cl }) {
const $ = performance.now();
function T(E) {
const X = Math.min((E - $) / t, 1), G = d(X), Ye = l + (a - l) * G;
o(Ye, X), X < 1 ? requestAnimationFrame(T) : (o(a, 1), r && r());
}
requestAnimationFrame(T);
}
function Xe(l) {
const a = R.value.find((r, d) => d === l);
let o = H.value.find((r, d) => d === l).value;
if (O.value.includes(l)) {
let d = function() {
H.value = H.value.map(
(T, E) => l === E ? { ...T, value: r } : T
);
}, $ = function() {
se.value = !0, ue.value = l, Je({
from: o,
to: r,
duration: e.value.serieToggleAnimation.durationMs,
onUpdate: (T, E) => {
H.value = H.value.map(
(X, G) => l === G ? { ...X, value: T } : X
), requestAnimationFrame(B);
},
onDone: () => {
d(), se.value = !1, ue.value = null;
}
});
};
O.value = O.value.filter((T) => T !== l);
const r = a.value;
e.value.serieToggleAnimation.show && e.value.type === "classic" ? $() : (d(), requestAnimationFrame(B));
} else if (O.value.length < R.value.length - 1) {
let r = function() {
O.value.push(l), H.value = H.value.map(
($, T) => l === T ? { ...$, value: 0 } : $
);
}, d = function() {
se.value = !0, ue.value = l, Je({
from: o,
to: 0,
duration: e.value.serieToggleAnimation.durationMs,
onUpdate: ($, T) => {
H.value = H.value.map(
(E, X) => l === X ? { ...E, value: $ } : E
), requestAnimationFrame(B);
},
onDone: () => {
r(), requestAnimationFrame(B), se.value = !1, ue.value = null;
}
});
};
e.value.serieToggleAnimation.show && e.value.type === "classic" ? d() : r();
}
It("selectLegend", we.value.map((r) => ({
name: r.name,
color: r.color,
value: r.value
})));
}
function Ke(l) {
if (!R.value.length)
return e.value.debug && console.warn("VueUiDonut - There are no series to show."), null;
const a = R.value.find((t) => t.name === l);
return a || (e.value.debug && console.warn(`VueUiDonut - Series name not found "${l}"`), null);
}
function bl(l) {
const a = Ke(l);
a !== null && O.value.includes(a.seriesIndex) && Xe(a.seriesIndex);
}
function ml(l) {
const a = Ke(l);
a !== null && (O.value.includes(a.seriesIndex) || Xe(a.seriesIndex));
}
const wl = g(
() => W.value.reduce(
(l, a) => l + a.values.reduce((t, o) => t + o, 0),
0
)
), we = g(() => {
if (P.value && !ne.value) {
const l = me.value, a = R.value.map((o) => ({
...o,
value: o.value * l,
color: o.color,
ghost: !1
})), t = wl.value * (1 - l);
return t > 0 && a.push({
name: "__ghost__",
value: t,
color: "transparent",
ghost: !0
}), a;
} else
return H.value.forEach((l) => {
if ([null, void 0].includes(l.values))
return {
...l,
values: []
};
}), H.value.map((l, a) => ({
...l,
seriesIndex: a
})).filter((l, a) => !O.value.includes(a));
}), Bt = g(() => W.value.map((l, a) => {
const t = (l.values || []).reduce((r, d) => r + d, 0), o = t / W.value.map((r) => (r.values || []).reduce((d, $) => d + $, 0)).reduce((r, d) => r + d, 0);
return {
name: l.name,
color: ul(l.color) || Qe.value[a] || Ee[a] || Ee[a % Ee.length],
value: t,
shape: "circle",
patternIndex: a,
proportion: o
};
}).map((l, a) => {
const t = ge(e.value.style.chart.layout.labels.value.formatter, l.value, ie({
p: e.value.style.chart.layout.labels.dataLabels.prefix,
v: l.value,
s: e.value.style.chart.layout.labels.dataLabels.suffix,
r: e.value.style.chart.legend.roundingValue
}), { datapoint: l, index: a }), o = ge(e.value.style.chart.layout.labels.percentage.formatter, qt(l), ie({
v: qt(l),
s: "%",
r: e.value.style.chart.legend.roundingPercentage
})), r = Et({
val: t,
percentage: O.value.includes(a) ? `${Fl(l.proportion * 100)}%` : o,
showVal: e.value.style.chart.legend.showValue,
showPercentage: e.value.style.chart.legend.showPercentage,
config: e.value.style.chart.legend
});
return {
...l,
opacity: O.value.includes(a) ? 0.5 : 1,
segregate: () => !se.value && Xe(a),
isSegregated: O.value.includes(a),
display: `${l.name}${e.value.style.chart.legend.showPercentage || e.value.style.chart.legend.showValue ? ": " : ""}${r}`
};
})), kl = g(() => ({
cy: "donut-div-legend",
backgroundColor: e.value.style.chart.legend.backgroundColor,
color: e.value.style.chart.legend.color,
fontSize: e.value.style.chart.legend.fontSize,
paddingBottom: 12,
fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
})), F = g(() => {
const l = e.value.style.chart.layout.donut.radiusRatio, a = Math.max(0.1, Math.min(0.50001, l)), t = Math.min(n.value.width * a, n.value.height * a);
return Math.max(12, t);
}), U = g(() => rl({ series: we.value }, n.value.width / 2, n.value.height / 2, F.value, F.value, 1.99999, 2, 1, 360, 105.25, ve.value)), Cl = g(() => Math.abs(we.value.map((l) => l.value).reduce((l, a) => l + a, 0)) > 0), xl = g(() => rl({
series: [
{
value: 1,
color: e.value.style.chart.layout.donut.emptyFill,
name: "_",
seriesIndex: 0,
patternIndex: -1,
ghost: !1,
absoluteValues: [1]
}
]
}, n.value.width / 2, n.value.height / 2, F.value, F.value, 1.99999, 2, 1, 360, 105.25, ve.value)), re = g(() => U.value.filter((l) => !l.ghost)), v = g(() => {
const l = Math.max(...we.value.map((t) => t.value)), a = we.value.map((t) => t.value / l);
return to({
series: a,
center: {
x: n.value.width / 2,
y: n.value.height / 2
},
maxRadius: Math.min(n.value.width, n.value.height) / 3,
hasGhost: P.value
});
});
function Te(l) {
return l.x > n.value.width / 2 + 6 ? "start" : l.x < n.value.width / 2 - 6 ? "end" : "middle";
}
function $l(l) {
return l.middlePoint.y > n.value.height / 2 ? z({ initX: l.middlePoint.x, initY: l.middlePoint.y, offset: 100, centerX: n.value.width / 2, centerY: n.value.height / 2 }).y : z({ initX: l.middlePoint.x, initY: l.middlePoint.y, offset: 0, centerX: n.value.width / 2, centerY: n.value.height / 2 }).y - 100;
}
function q(l) {
return l.proportion * 100 > e.value.style.chart.layout.labels.dataLabels.hideUnderValue;
}
function Al(l, a) {
const t = e.value.style.chart.layout.labels.dataLabels.hideUnderValue, o = e.value.style.chart.layout.labels.dataLabels.smallArcClusterThreshold, d = (Tl.value[a] ?? l.proportion ?? 0) * 100;
return d > t && d <= o;
}
const { smallArcLayoutsClassic: Y } = So({
FINAL_CONFIG: e,
noGhostDonut: re,
svg: n,
padding: $e,
labels_inline_fontSize: oe,
minSize: F,
findArcMidpoint: co,
calcMarkerOffsetX: A,
calcMarkerOffsetY: Ce,
animatingIndex: ue,
segregated: O,
isSmallArc: Al
});
function Wt(l, a) {
const t = l.value / _l(a);
return isNaN(t) ? 0 : ge(
e.value.style.chart.layout.labels.percentage.formatter,
t * 100,
ie({
v: t * 100,
s: "%",
r: e.value.style.chart.layout.labels.percentage.rounding
}),
{ datapoint: l }
);
}
function _l(l) {
return [...l].map((a) => a.value).reduce((a, t) => a + t, 0);
}
const Q = g(() => we.value.map((l) => l.value).reduce((l, a) => l + a, 0)), Tl = g(() => {
const l = R.value.reduce((a, t) => a + t.value, 0);
return l <= 0 ? [] : R.value.map((a) => a.value / l);
}), zt = g(() => Q.value / we.value.length);
function qt(l) {
return se.value ? l.proportion * 100 : l.value / Q.value * 100;
}
const Ot = k(null), Ze = k(!1);
function he({ datapoint: l, seriesIndex: a }) {
e.value.events.datapointLeave && e.value.events.datapointLeave({ datapoint: l, seriesIndex: a }), S.value = !1, M.value = null;
}
function fe({ datapoint: l, relativeIndex: a, seriesIndex: t, show: o = !1 }) {
e.value.events.datapointEnter && e.value.events.datapointEnter({ datapoint: l, seriesIndex: t }), Ot.value = { datapoint: l, seriesIndex: t, config: e.value, series: R.value }, S.value = o, M.value = a;
let r = "";
const d = e.value.style.chart.tooltip.customFormat;
if (Ze.value = !1, io(d))
try {
const $ = d({
seriesIndex: t,
datapoint: l,
series: R.value,
config: e.value
});
typeof $ == "string" && (V.value = $, Ze.value = !0);
} catch {
console.warn("Custom format cannot be applied."), Ze.value = !1;
}
Ze.value || (r += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${l.name}</div>`, r += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 60 60" height="14" width="14"><circle cx="30" cy="30" r="30" stroke="none" fill="${l.color}"/>${Ve.pattern ? `<circle cx="30" cy="30" r="30" stroke="none" fill="url(#pattern_${c.value}_${t})"/>` : ""}</svg>`, r += `<b>${Et({
showVal: e.value.style.chart.tooltip.showValue,
showPercentage: e.value.style.chart.tooltip.showPercentage,
val: `<span>${ge(
e.value.style.chart.layout.labels.value.formatter,
l.value,
ie({
p: e.value.style.chart.layout.labels.dataLabels.prefix,
v: l.value,
s: e.value.style.chart.layout.labels.dataLabels.suffix,
r: e.value.style.chart.tooltip.roundingValue
}),
{
datapoint: l,
relativeIndex: a,
seriesIndex: t
}
)}</span>`,
percentage: ge(
e.value.style.chart.layout.labels.percentage.formatter,
l.proportion * 100,
ie({
v: l.proportion * 100,
s: "%",
r: e.value.style.chart.tooltip.roundingPercentage
}),
{
datapoint: l,
relativeIndex: a,
seriesIndex: t
}
),
config: e.value.style.chart.tooltip
})}</b></div>`, e.value.style.chart.comments.showInTooltip && l.comment && (r += `<div class="vue-data-ui-tooltip-comment" style="background:${l.color}20; padding: 6px; margin-bottom: 6px; margin-top:6px; border-left: 1px solid ${l.color}">${l.comment}</div>`), V.value = `<div>${r}</div>`);
}
function Ll(l, a) {
const t = Y.value[a];
if (t)
return {
textAnchor: t.textAnchor,
x: t.labelX,
y: t.labelY
};
const o = A(l, !0, 12);
return {
textAnchor: o.anchor,
x: o.x,
y: Ce(l)
};
}
function Sl(l, a, t) {
const { textAnchor: o, x: r } = Ll(l, a), d = bt(l), $ = `
<tspan
class="vue-data-ui-datalabel-inline"
fill="${e.value.style.chart.layout.labels.percentage.color}"
font-size="${t ? oe.value : xe.value}px"
style="font-weight:${e.value.style.chart.layout.labels.percentage.bold ? "bold" : ""}"
>${d}</tspan>
`, T = String(l.name ?? "").split(/\n/g);
let E = "";
return T.forEach((X, G) => {
G === 0 ? E += `
<tspan
class="${t ? "vue-data-ui-datalabel-inline" : "vue-data-ui-datalabel-name"}"
fill="${e.value.style.chart.layout.labels.name.color}"
font-size="${t ? oe.value : N.value}px"
style="font-weight:${e.value.style.chart.layout.labels.name.bold ? "bold" : ""}"
>${X}</tspan>
` : E += `
<tspan
class="${t ? "vue-data-ui-datalabel-inline" : "vue-data-ui-datalabel-name"}"
x="${r}"
dy="${(t ? oe.value : N.value) * 1.2}"
fill="${e.value.style.chart.layout.labels.name.color}"
font-size="${t ? oe.value : N.value}px"
style="font-weight:${e.value.style.chart.layout.labels.name.bold ? "bold" : ""}"
>${X}</tspan>
`;
}), o === "end" ? `${E}${$}` : `${$}${E}`;
}
function Ml(l, a) {
const t = v.value[a].middlePoint, o = Te(t), r = z({
initX: t.x,
initY: t.y,
offset: 42,
centerX: n.value.width / 2,
centerY: n.value.height / 2
}), d = r.x;
r.y;
const $ = bt(l), T = `
<tspan
class="vue-data-ui-datalabel-value"
fill="${e.value.style.chart.layout.labels.percentage.color}"
font-size="${xe.value}px"
style="font-weight:${e.value.style.chart.layout.labels.percentage.bold ? "bold" : "normal"}"
>${$}</tspan>
`, E = String(l.name ?? "").split(/\n/g);
let X = "";
return E.forEach((G, Ye) => {
Ye === 0 ? X += `
<tspan
class="vue-data-ui-datalabel-name"
fill="${e.value.style.chart.layout.labels.name.color}"
font-size="${N.value}px"
style="font-weight:${e.value.style.chart.layout.labels.name.bold ? "bold" : "normal"}"
>${G}</tspan>
` : X += `
<tspan
class="vue-data-ui-datalabel-name"
x="${d}"
dy="${N.value * 1.2}"
fill="${e.value.style.chart.layout.labels.name.color}"
font-size="${N.value}px"
style="font-weight:${e.value.style.chart.layout.labels.name.bold ? "bold" : "normal"}"
>${G}</tspan>
`;
}), o === "end" ? `${X}${T}` : `${T}${X}`;
}
function ze(l) {
return e.value.useBlurOnHover && ![null, void 0].includes(M.value) && M.value !== l ? `url(#blur_${c.value})` : "";
}
function Pl(l) {
if (!se.value || ue.value === null || l.seriesIndex !== ue.value)
return 1;
const a = (l.proportion ?? 0) * 100, t = e.value.style.chart.layout.labels.dataLabels.hideUnderValue, r = e.value.style.chart.layout.labels.dataLabels.smallArcClusterThreshold + 2, d = t;
return a >= r ? 1 : a <= d ? 0 : (a - d) / (r - d);
}
const Le = g(() => {
const l = we.value.map((t) => ({
name: t.name,
color: t.color
})), a = we.value.map((t) => t.value);
return { head: l, body: a };
});
function Yt(l = null) {
ql(() => {
const a = Le.value.head.map((r, d) => [[
r.name
], [Le.value.body[d]], [isNaN(Le.value.body[d] / Q.value) ? "-" : Le.value.body[d] / Q.value * 100]]), t = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(a), o = uo(t);
l ? l(o) : ro({ csvContent: o, title: e.value.style.chart.title.text || "vue-ui-donut" });
});
}
const pt = g(() => {
const l = [
' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>',
ie({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: Q.value, s: e.value.style.chart.layout.labels.dataLabels.suffix, r: e.value.table.td.roundingValue }),
"100%"
], a = Le.value.head.map((r, d) => [
{
color: r.color,
name: r.name || "-"
},
Le.value.body[d],
isNaN(Le.value.body[d] / Q.value) ? "-" : (Le.value.body[d] / Q.value * 100).toFixed(e.value.table.td.roundingPercentage) + "%"
]), t = {
th: {
backgroundColor: e.value.table.th.backgroundColor,
color: e.value.table.th.color,
outline: e.value.table.th.outline
},
td: {
backgroundColor: e.value.table.td.backgroundColor,
color: e.value.table.td.color,
outline: e.value.table.td.outline
},
breakpoint: e.value.table.responsiveBreakpoint
};
return {
colNames: [
e.value.table.columnNames.series,
e.value.table.columnNames.value,
e.value.table.columnNames.percentage
],
head: l,
body: a,
config: t
};
}), Oe = k(!1);
function Qt(l) {
Oe.value = l, ae.value += 1;
}
const Jt = g(() => /^((?!chrome|android).)*safari/i.test(navigator.userAgent));
function Fl(l) {
return vo({
num: l,
rounding: e.value.style.chart.legend.roundingPercentage
});
}
function Et({
val: l,
percentage: a,
showVal: t,
showPercentage: o,
config: r
}) {
return ho({
config: r,
val: l,
percentage: a,
showVal: t,
showPercentage: o
});
}
function bt(l) {
return Et({
val: ge(
e.value.style.chart.layout.labels.value.formatter,
l.value,
ie({
p: e.value.style.chart.layout.labels.dataLabels.prefix,
v: l.value,
s: e.value.style.chart.layout.labels.dataLabels.suffix,
r: e.value.style.chart.layout.labels.value.rounding
}),
{ datapoint: l }
),
percentage: Wt(l, re.value),
showVal: e.value.style.chart.layout.labels.value.show,
showPercentage: !0,
config: e.value.style.chart.layout.labels.dataLabels
});
}
function ye(l, a) {
e.value.events.datapointClick && e.value.events.datapointClick({ datapoint: l, seriesIndex: l.seriesIndex }), It("selectDatapoint", { datapoint: l, index: a });
}
function Kt() {
m.value.showTable = !m.value.showTable;
}
function Zt() {
m.value.dataLabels.show = !m.value.dataLabels.show;
}
function el() {
m.value.showTooltip = !m.value.showTooltip;
}
const mt = k(!1);
function Xt() {
mt.value = !mt.value;
}
async function Il({ scale: l = 2 } = {}) {
if (!L.value) return;
const { width: a, height: t } = L.value.getBoundingClientRect(), o = a / t, { imageUri: r, base64: d } = await $o({ domElement: L.value, base64: !0, img: !0, scale: l });
return {
imageUri: r,
base64: d,
title: e.value.style.chart.title.text,
width: a,
height: t,
aspectRatio: o
};
}
function Dl() {
if (!Fe.value) return;
const { x: l, y: a, width: t, height: o } = Fe.value.getBBox();
de.value && de.value.setAttribute("viewBox", `${l} ${a} ${t + Math.min(0, l)} ${o + Math.min(0, a)}`);
}
const et = g(() => {
const l = e.value.table.useDialog && !e.value.table.show, a = m.value.showTable;
return {
component: l ? St : At,
title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? `: ${e.value.style.chart.title.subtitle.text}` : ""}`,
props: l ? {
backgroundColor: e.value.table.th.backgroundColor,
color: e.value.table.th.color,
headerColor: e.value.table.th.color,
headerBg: e.value.table.th.backgroundColor,
isFullscreen: Oe.value,
fullscreenParent: L.value,
forcedWidth: Math.min(500, window.innerWidth * 0.8)
} : {
hideDetails: !0,
config: {
open: a,
maxHeight: 1e4,
body: {
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color
},
head: {
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color
}
}
}
};
});
Ne(() => m.value.showTable, (l) => {
e.value.table.show || (l && e.value.table.useDialog && Ie.value ? Ie.value.open() : "close" in Ie.value && Ie.value.close());
});
function tl() {
m.value.showTable = !1, je.value && je.value.setTableIconState(!1);
}
const Bl = g(() => Bt.value.map((l) => ({
...l,
name: l.display
}))), zl = g(() => e.value.style.chart.backgroundColor), Ol = g(() => e.value.style.chart.legend), Yl = g(() => e.value.style.chart.title), { exportSvg: El, getSvg: Xl } = wo({
svg: de,
title: Yl,
legend: Ol,
legendItems: Bl,
backgroundColor: zl
});
async function ll({ isCb: l }) {
if (l) {
const { blob: a, url: t, text: o, dataUrl: r } = await Xl();
e.value.userOptions.callbacks.svg({ blob: a, url: t, text: o, dataUrl: r });
} else
El();
}
return lt({
autoSize: Dl,
getData: Dt,
getImage: Il,
generatePdf: Ae,
generateCsv: Yt,
generateImage: _e,
generateSvg: ll,
hideSeries: ml,
showSeries: bl,
toggleTable: Kt,
toggleLabels: Zt,
toggleTooltip: el,
toggleAnnotator: Xt,
toggleFullscreen: Qt
}), (l, a) => (u(), i("div", {
ref_key: "donutChart",
ref: L,
class: Nt(`vue-data-ui-component vue-ui-donut ${Oe.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
style: I(`font-family:${e.value.style.fontFamily};width:100%; ${e.value.responsive ? "height:100%;" : ""} text-align:center;background:${e.value.style.chart.backgroundColor}`),
id: `donut__${c.value}`,
onMouseenter: yt,
onMouseleave: Be
}, [
e.value.userOptions.buttons.annotator && s(de) ? (u(), Pe(s(_t), {
key: 0,
color: e.value.style.chart.color,
backgroundColor: e.value.style.chart.backgroundColor,
active: mt.value,
svgRef: s(de),
onClose: Xt
}, {
"annotator-action-close": C(() => [
w(l.$slots, "annotator-action-close", {}, void 0, !0)
]),
"annotator-action-color": C(({ color: t }) => [
w(l.$slots, "annotator-action-color", ee(te({ color: t })), void 0, !0)
]),
"annotator-action-draw": C(({ mode: t }) => [
w(l.$slots, "annotator-action-draw", ee(te({ mode: t })), void 0, !0)
]),
"annotator-action-undo": C(({ disabled: t }) => [
w(l.$slots, "annotator-action-undo", ee(te({ disabled: t })), void 0, !0)
]),
"annotator-action-redo": C(({ disabled: t }) => [
w(l.$slots, "annotator-action-redo", ee(te({ disabled: t })), void 0, !0)
]),
"annotator-action-delete": C(({ disabled: t }) => [
w(l.$slots, "annotator-action-delete", ee(te({ disabled: t })), void 0, !0)
]),
_: 3
}, 8, ["color", "backgroundColor", "active", "svgRef"])) : f("", !0),
w(l.$slots, "userConfig", {}, void 0, !0),
gt.value ? (u(), i("div", {
key: 1,
ref_key: "noTitle",
ref: Ge,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : f("", !0),
e.value.style.chart.title.text ? (u(), i("div", {
key: 2,
ref_key: "chartTitle",
ref: st,
style: "width:100%;background:transparent;padding-bottom:24px"
}, [
(u(), Pe(_o, {
key: `title_${rt.value}`,
config: {
title: {
cy: "donut-div-title",
...e.value.style.chart.title
},
subtitle: {
cy: "donut-div-subtitle",
...e.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))
], 512)) : f("", !0),
b("div", {
id: `legend-top-${c.value}`
}, null, 8, Po),
e.value.userOptions.show && D.value && (s(ft) || s(qe)) ? (u(), Pe(s(Tt), {
ref_key: "userOptionsRef",
ref: je,
key: `user_option_${ae.value}`,
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
isPrinting: s(K),
isImaging: s(Z),
uid: c.value,
hasTooltip: e.value.style.chart.tooltip.show && e.value.userOptions.buttons.tooltip,
hasPdf: e.value.userOptions.buttons.pdf,
hasImg: e.value.userOptions.buttons.img,
hasSvg: e.value.userOptions.buttons.svg,
hasXls: e.value.userOptions.buttons.csv,
hasTable: e.value.userOptions.buttons.table,
hasLabel: e.value.userOptions.buttons.labels,
hasFullscreen: e.value.userOptions.buttons.fullscreen,
isFullscreen: Oe.value,
chartElement: L.value,
position: e.value.userOptions.position,
callbacks: e.value.userOptions.callbacks,
isTooltip: m.value.showTooltip,
titles: { ...e.value.userOptions.buttonTitles },
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: mt.value,
printScale: e.value.userOptions.print.scale,
tableDialog: e.value.table.useDialog,
onToggleFullscreen: Qt,
onGeneratePdf: s(Ae),
onGenerateCsv: Yt,
onGenerateImage: s(_e),
onGenerateSvg: ll,
onToggleTable: Kt,
onToggleLabels: Zt,
onToggleTooltip: el,
onToggleAnnotator: Xt,
style: I({ visibility: s(ft) ? s(qe) ? "visible" : "hidden" : "visible" })
}, Rt({ _: 2 }, [
l.$slots.menuIcon ? {
name: "menuIcon",
fn: C(({ isOpen: t, color: o }) => [
w(l.$slots, "menuIcon", ee(te({ isOpen: t, color: o })), void 0, !0)
]),
key: "0"
} : void 0,
l.$slots.optionTooltip ? {
name: "optionTooltip",
fn: C(() => [
w(l.$slots, "optionTooltip", {}, void 0, !0)
]),
key: "1"
} : void 0,
l.$slots.optionPdf ? {
name: "optionPdf",
fn: C(() => [
w(l.$slots, "optionPdf", {}, void 0, !0)
]),
key: "2"
} : void 0,
l.$slots.optionCsv ? {
name: "optionCsv",
fn: C(() => [
w(l.$slots, "optionCsv", {}, void 0, !0)
]),
key: "3"
} : void 0,
l.$slots.optionImg ? {
name: "optionImg",
fn: C(() => [
w(l.$slots, "optionImg", {}, void 0, !0)
]),
key: "4"
} : void 0,
l.$slots.optionSvg ? {
name: "optionSvg",
fn: C(() => [
w(l.$slots, "optionSvg", {}, void 0, !0)
]),
key: "5"
} : void 0,
l.$slots.optionTable ? {
name: "optionTable",
fn: C(() => [
w(l.$slots, "optionTable", {}, void 0, !0)
]),
key: "6"
} : void 0,
l.$slots.optionLabels ? {
name: "optionLabels",
fn: C(() => [
w(l.$slots, "optionLabels", {}, void 0, !0)
]),
key: "7"
} : void 0,
l.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: C(({ toggleFullscreen: t, isFullscreen: o }) => [
w(l.$slots, "optionFullscreen", ee(te({ toggleFullscreen: t, isFullscreen: o })), void 0, !0)
]),
key: "8"
} : void 0,
l.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: C(({ toggleAnnotator: t, isAnnotator: o }) => [
w(l.$slots, "optionAnnotator", ee(te({ toggleAnnotator: t, isAnnotator: o })), void 0, !0)
]),
key: "9"
} : void 0
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasSvg", "hasXls", "hasTable", "hasLabel", "hasFullscreen", "isFullscreen", "chartElement", "position", "callbacks", "isTooltip", "titles", "hasAnnotator", "isAnnotation", "printScale", "tableDialog", "onGeneratePdf", "onGenerateImage", "style"])) : f("", !0),
(u(), i("svg", {
ref_key: "svgRef",
ref: de,
xmlns: s(lo),
class: Nt({ "vue-data-ui-fullscreen--on": Oe.value, "vue-data-ui-fulscreen--off": !Oe.value, "vue-data-ui-svg": !0 }),
viewBox: `0 0 ${n.value.width <= 0 ? 10 : n.value.width} ${n.value.height <= 0 ? 10 : n.value.height}`,
style: I(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color};${$e.value.css}`)
}, [
b("g", {
ref_key: "G",
ref: Fe,
class: "vue-data-ui-g"
}, [
wt(s(Lt)),
l.$slots["chart-background"] ? (u(), i("foreignObject", {
key: 0,
x: 0,
y: 0,
width: n.value.width <= 0 ? 10 : n.value.width,
height: n.value.height <= 0 ? 10 : n.value.height,
style: {
pointerEvents: "none"
}
}, [
w(l.$slots, "chart-background", {}, void 0, !0)
], 8, Io)) : f("", !0),
e.value.type === "classic" && !isNaN(ve.value / F.value) ? (u(), i("defs", Do, [
e.value.style.chart.useGradient ? (u(), i("radialGradient", {
key: 0,
id: `gradient_${c.value}`
}, [
b("stop", {
offset: "0%",
"stop-color": s(xt)(e.value.style.chart.backgroundColor, 0),
"stop-opacity": "0"
}, null, 8, zo),
b("stop", {
offset: `${(1 - ve.value / F.value) * 100}%`,
"stop-color": s(xt)("#FFFFFF", 0),
"stop-opacity": "0"
}, null, 8, Oo),
b("stop", {
offset: `${(1 - ve.value / F.value / 2) * 100}%`,
"stop-color": s(xt)("#FFFFFF", e.value.style.chart.gradientIntensity)
}, null, 8, Yo),
b("stop", {
offset: "100%",
"stop-color": s(xt)(e.value.style.chart.backgroundColor, 0),
"stop-opacity": "0"
}, null, 8, Eo)
], 8, Bo)) : f("", !0)
])) : f("", !0),
e.value.type === "polar" ? (u(), i("defs", Xo, [
(u(!0), i(_, null, j(v.value, (t, o) => (u(), i("radialGradient", {
id: `polar_gradient_${o}_${c.value}`,
cx: (isNaN(t.middlePoint.x / n.value.width * 100) ? 0 : t.middlePoint.x / n.value.width * 100) + "%",
cy: (isNaN(t.middlePoint.y / n.value.height * 100) ? 0 : t.middlePoint.y / n.value.height * 100) + "%",
r: "62%"
}, [
b("stop", {
offset: "0%",
"stop-color": s(oo)(U.value[o].color, 0.05),
"stop-opacity": e.value.style.chart.gradientIntensity / 100
}, null, 8, Ro),
b("stop", {
offset: "100%",
"stop-color": U.value[o].color
}, null, 8, Vo)
], 8, No))), 256))
])) : f("", !0),
b("defs", null, [
b("filter", {
id: `blur_${c.value}`,
x: "-50%",
y: "-50%",
width: "200%",
height: "200%"
}, [
b("feGaussianBlur", {
in: "SourceGraphic",
stdDeviation: 2,
id: `blur_std_${c.value}`
}, null, 8, Ho),
a[5] || (a[5] = b("feColorMatrix", {
type: "saturate",
values: "0"
}, null, -1))
], 8, Uo),
b("filter", {
id: `shadow_${c.value}`,
"color-interpolation-filters": "sRGB"
}, [
b("feDropShadow", {
dx: "0",
dy: "0",
stdDeviation: "10",
"flood-opacity": "0.5",
"flood-color": e.value.style.chart.layout.donut.shadowColor
}, null, 8, jo)
], 8, Go),
b("filter", {
id: `drop_shadow_${c.value}`,
"color-interpolation-filters": "sRGB",
x: "-50%",
y: "-50%",
width: "200%",
height: "200%"
}, [
b("feDropShadow", {
dx: "0",
dy: "0",
stdDeviation: "3",
"flood-opacity": "1",
"flood-color": e.value.style.chart.layout.donut.shadowColor
}, null, 8, qo)
], 8, Wo)
]),
e.value.type === "classic" ? (u(!0), i(_, { key: 3 }, j(U.value.filter((t) => !t.ghost), (t, o) => (u(), i("g", null, [
q(t) && m.value.dataLabels.show ? (u(), i("path", {
key: 0,
d: s(Y)[o]?.connectorPath || s(ao)(
t,
{ x: n.value.width / 2, y: n.value.height / 2 },
16,
16,
!1,
!1,
ve.value,
12,
e.value.style.chart.layout.curvedMarkers
),
stroke: t.color,
"stroke-width": "1",
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none",
filter: ze(o)
}, null, 8, Qo)) : f("", !0)
]))), 256)) : f("", !0),
e.value.type === "polar" ? (u(!0), i(_, { key: 4 }, j(U.value.filter((t) => !t.ghost), (t, o) => (u(), i("g", null, [
q(t) && m.value.dataLabels.show ? (u(), i("path", {
key: 0,
d: `M ${s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 24, centerX: n.value.width / 2, centerY: n.value.height / 2 }).x},${s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 24, centerX: n.value.width / 2, centerY: n.value.height / 2 }).y} ${v.value[o].middlePoint.x},${v.value[o].middlePoint.y}`,
stroke: t.color,
"stroke-width": "1",
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none",
filter: ze(o),
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`
})
}, null, 12, Jo)) : f("", !0)
]))), 256)) : f("", !0),
e.value.type === "classic" && e.value.style.chart.layout.donut.useShadow ? (u(), i("circle", {
key: 5,
cx: n.value.width / 2,
cy: n.value.height / 2,
r: F.value <= 0 ? 10 : F.value,
fill: e.value.style.chart.backgroundColor,
filter: `url(#shadow_${c.value})`
}, null, 8, Ko)) : f("", !0),
l.$slots.pattern ? (u(), i("g", Zo, [
(u(!0), i(_, null, j(tt.dataset, (t, o) => (u(), i("defs", {
key: `pattern-${t.patternIndex}`
}, [
w(l.$slots, "pattern", Vt({ ref_for: !0 }, { seriesIndex: o, patternId: `pattern_${c.value}_${o}` }), void 0, !0)
]))), 128))
])) : f("", !0),
Q.value && e.value.type === "classic" ? (u(), i(_, { key: 7 }, [
(u(!0), i(_, null, j(re.value, (t, o) => (u(), i("path", {
stroke: e.value.style.chart.backgroundColor,
d: t.arcSlice,
fill: "#FFFFFF"
}, null, 8, ea))), 256)),
(u(!0), i(_, null, j(re.value, (t, o) => (u(), i("path", {
class: "vue-ui-donut-arc-path",
d: t.arcSlice,
fill: t.color,
stroke: e.value.style.chart.layout.donut.borderColorAuto ? e.value.style.chart.backgroundColor : e.value.style.chart.layout.donut.borderColor,
"stroke-width": e.value.style.chart.layout.donut.borderWidth,
filter: ze(o)
}, null, 8, ta))), 256)),
l.$slots.pattern ? (u(), i("g", la, [
(u(!0), i(_, null, j(re.value, (t, o) => (u(), i("path", {
class: "vue-ui-donut-arc-path",
d: t.arcSlice,
fill: `url(#${t.pattern})`,
stroke: e.value.style.chart.layout.donut.borderColorAuto ? e.value.style.chart.backgroundColor : e.value.style.chart.layout.donut.borderColor,
"stroke-width": e.value.style.chart.layout.donut.borderWidth,
filter: ze(o)
}, null, 8, oa))), 256))
])) : f("", !0)
], 64)) : f("", !0),
Q.value && e.value.type === "polar" ? (u(), i(_, { key: 8 }, [
U.value.length > 1 ? (u(), i("g", aa, [
(u(!0), i(_, null, j(re.value, (t, o) => (u(), i("path", {
stroke: e.value.style.chart.layout.donut.borderColorAuto ? e.value.style.chart.backgroundColor : e.value.style.chart.layout.donut.borderColor,
d: v.value[o].path,
fill: "#FFFFFF",
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`
})
}, null, 12, na))), 256)),
e.value.style.chart.layout.donut.useShadow ? (u(), i("g", sa, [
(u(!0), i(_, null, j(re.value, (t, o) => (u(), i("path", {
class: "vue-ui-donut-arc-path",
d: v.value[o].path,
fill: "transparent",
stroke: e.value.style.chart.layout.donut.borderColorAuto ? e.value.style.chart.backgroundColor : e.value.style.chart.layout.donut.borderColor,
"stroke-width": e.value.style.chart.layout.donut.borderWidth,
filter: `url(#drop_shadow_${c.value})`,
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`
})
}, null, 12, ua))), 256))
])) : f("", !0),
l.$slots.pattern ? (u(), i("g", ra, [
(u(!0), i(_, null, j(re.value, (t, o) => (u(), i("path", {
class: "vue-ui-donut-arc-path",
d: v.value[o].path,
fill: `url(#${t.pattern})`,
stroke: e.value.style.chart.layout.donut.borderColorAuto ? e.value.style.chart.backgroundColor : e.value.style.chart.layout.donut.borderColor,
"stroke-width": e.value.style.chart.layout.donut.borderWidth,
filter: ze(o),
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`,
transformOrigin: "center"
})
}, null, 12, ia))), 256))
])) : f("", !0),
(u(!0), i(_, null, j(re.value, (t, o) => (u(), i("path", {
class: "vue-ui-donut-arc-path",
d: v.value[o].path,
fill: e.value.style.chart.useGradient ? `url(#polar_gradient_${o}_${c.value})` : t.color,
stroke: e.value.style.chart.layout.donut.borderColorAuto ? e.value.style.chart.backgroundColor : e.value.style.chart.layout.donut.borderColor,
"stroke-width": e.value.style.chart.layout.donut.borderWidth,
filter: ze(o),
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`
})
}, null, 12, ca))), 256))
])) : (u(), i("g", da, [
l.$slots.pattern ? (u(), i("circle", {
key: 0,
cx: n.value.width / 2,
cy: n.value.height / 2,
r: F.value,
fill: `url(#pattern_${c.value}_${U.value[0].patternIndex})`,
stroke: e.value.style.chart.backgroundColor,
"stroke-width": e.value.style.chart.layout.donut.borderWidth
}, null, 8, va)) : f("", !0),
b("circle", {
cx: n.value.width / 2,
cy: n.value.height / 2,
r: F.value,
fill: e.value.style.chart.useGradient ? `url(#polar_gradient_0_${c.value})` : U.value[0].color,
stroke: e.value.style.chart.backgroundColor,
"stroke-width": e.value.style.chart.layout.donut.borderWidth
}, null, 8, ha)
]))
], 64)) : (u(), i(_, { key: 9 }, [
e.value.type === "classic" && !Cl.value ? (u(), i("g", fa, [
(u(!0), i(_, null, j(xl.value, (t, o) => (u(), i("path", {
class: "vue-ui-donut-arc-path",
d: t.arcSlice,
fill: t.color,
stroke: e.value.style.chart.backgroundColor,
"stroke-width": e.value.style.chart.layout.donut.borderWidth
}, null, 8, ya))), 256))
])) : f("", !0),
b("circle", {
cx: n.value.width / 2,
cy: n.value.height / 2,
r: F.value <= 0 ? 10 : F.value,
fill: "transparent",
stroke: e.value.style.chart.backgroundColor
}, null, 8, ga)
], 64)),
e.value.style.chart.useGradient && e.value.type === "classic" ? (u(), i("circle", {
key: 10,
cx: n.value.width / 2,
cy: n.value.height / 2,
r: (
/* This might require adjustments */
F.value <= 0 ? 10 : F.value
),
fill: `url(#gradient_${c.value})`
}, null, 8, pa)) : f("", !0),
b("circle", {
ref_key: "circle_hollow",
ref: Ue,
style: { pointerEvents: "none" },
fill: "none",
cx: n.value.width / 2,
cy: n.value.height / 2,
r: Math.max(0.1, ve.value * 1.7)
}, null, 8, ba),
Q.value ? (u(), i(_, { key: 11 }, [
U.value.length > 1 || e.value.type === "classic" ? (u(), i("g", ma, [
(u(!0), i(_, null, j(U.value.filter((t) => !t.ghost), (t, o) => (u(), i("path", {
d: e.value.type === "classic" ? t.arcSlice : v.value[o].path,
stroke: e.value.style.chart.layout.donut.borderColorAuto ? e.value.style.chart.backgroundColor : e.value.style.chart.layout.donut.borderColor,
fill: M.value === o ? e.value.style.chart.layout.donut.selectedColor : "transparent",
onMouseenter: (r) => fe({
datapoint: t,
relativeIndex: o,
seriesIndex: t.seriesIndex,
show: !0
}),
onMouseleave: (r) => he({ datapoint: t, seriesIndex: t.seriesIndex }),
onClick: (r) => ye(t, o)
}, null, 40, wa))), 256))
])) : (u(), i("g", ka, [
b("circle", {
cx: n.value.width / 2,
cy: n.value.height / 2,
r: F.value,
fill: "transparent",
onMouseenter: a[0] || (a[0] = (t) => fe({
datapoint: U.value[0],
relativeIndex: 0,
seriesIndex: U.value[0].seriesIndex,
show: !0
})),
onMouseleave: a[1] || (a[1] = (t) => he({ datapoint: U.value[0], seriesIndex: U.value[0].seriesIndex })),
onClick: a[2] || (a[2] = (t) => ye(U.value[0], l.i))
}, null, 40, Ca)
]))
], 64)) : f("", !0),
e.value.type === "classic" ? (u(), i("g", {
key: 12,
ref_key: "G_hollow",
ref: nt,
class: "vue-data-ui-donut-hollow-labels"
}, [
e.value.style.chart.layout.labels.hollow.total.show ? (u(), i("text", {
key: 0,
"text-anchor": "middle",
x: n.value.width / 2,
y: n.value.height / 2 - (e.value.style.chart.layout.labels.hollow.average.show ? e.value.style.chart.layout.labels.hollow.total.fontSize : 0) + e.value.style.chart.layout.labels.hollow.total.offsetY,
fill: e.value.style.chart.layout.labels.hollow.total.color,
"font-size": e.value.style.chart.layout.labels.hollow.total.fontSize,
style: I(`font-weight:${e.value.style.chart.layout.labels.hollow.total.bold ? "bold" : ""}`)
}, ke(e.value.style.chart.layout.labels.hollow.total.text), 13, xa)) : f("", !0),
e.value.style.chart.layout.labels.hollow.total.show ? (u(), i("text", {
key: 1,
"text-anchor": "middle",
x: n.value.width / 2,
y: n.value.height / 2 + e.value.style.chart.layout.labels.hollow.total.fontSize - (e.value.style.chart.layout.labels.hollow.average.show ? e.value.style.chart.layout.labels.hollow.total.fontSize : 0) + e.value.style.chart.layout.labels.hollow.total.value.offsetY,
fill: e.value.style.chart.layout.labels.hollow.total.value.color,
"font-size": e.value.style.chart.layout.labels.hollow.total.value.fontSize,
style: I(`font-weight:${e.value.style.chart.layout.labels.hollow.total.value.bold ? "bold" : ""}`)
}, ke(s(ge)(
e.value.style.chart.layout.labels.hollow.total.value.formatter,
Q.value,
s(ie)({
p: e.value.style.chart.layout.labels.hollow.total.value.prefix,
v: Q.value,
s: e.value.style.chart.layout.labels.hollow.total.value.suffix
})
)), 13, $a)) : f("", !0),
e.value.style.chart.layout.labels.hollow.average.show ? (u(), i("text", {
key: 2,
"text-anchor": "middle",
x: n.value.width / 2,
y: n.value.height / 2 + (e.value.style.chart.layout.labels.hollow.total.show ? e.value.style.chart.layout.labels.hollow.average.fontSize : 0) + e.value.style.chart.layout.labels.hollow.average.offsetY,
fill: e.value.style.chart.layout.labels.hollow.average.color,
"font-size": e.value.style.chart.layout.labels.hollow.average.fontSize,
style: I(`font-weight:${e.value.style.chart.layout.labels.hollow.average.bold ? "bold" : ""}`)
}, ke(e.value.style.chart.layout.labels.hollow.average.text), 13, Aa)) : f("", !0),
e.value.style.chart.layout.labels.hollow.average.show ? (u(), i("text", {
key: 3,
"text-anchor": "middle",
x: n.value.width / 2,
y: n.value.height / 2 + (e.value.style.chart.layout.labels.hollow.total.show ? e.value.style.chart.layout.labels.hollow.average.fontSize : 0) + e.value.style.chart.layout.labels.hollow.average.fontSize + e.value.style.chart.layout.labels.hollow.average.value.offsetY,
fill: e.value.style.chart.layout.labels.hollow.average.value.color,
"font-size": e.value.style.chart.layout.labels.hollow.average.value.fontSize,
style: I(`font-weight:${e.value.style.chart.layout.labels.hollow.average.value.bold ? "bold" : ""}`)
}, ke(se.value || P.value ? "--" : s(ge)(
e.value.style.chart.layout.labels.hollow.average.value.formatter,
zt.value,
s(ie)({
p: e.value.style.chart.layout.labels.hollow.average.value.prefix,
v: zt.value,
s: e.value.style.chart.layout.labels.hollow.average.value.suffix,
r: e.value.style.chart.layout.labels.hollow.average.value.rounding
})
)), 13, _a)) : f("", !0)
], 512)) : f("", !0),
(u(!0), i(_, null, j(re.value.filter((t) => !t.ghost), (t, o) => (u(), i("g", {
filter: ze(o),
class: Nt({ animated: e.value.useCssAnimation }),
key: t.seriesIndex,
opacity: Pl(t)
}, [
e.value.style.chart.layout.labels.dataLabels.useLabelSlots ? (u(), i("g", La, [
(u(), i("foreignObject", {
x: s(A)(t, !0).anchor === "end" ? s(A)(t).x - 120 : s(A)(t, !0).anchor === "middle" ? s(A)(t).x - 60 : s(A)(t).x,
y: s(Ce)(t) - (Jt.value ? 20 : 0),
width: "120",
height: "60",
style: { overflow: "visible" }
}, [
b("div", null, [
w(l.$slots, "dataLabel", Vt({ ref_for: !0 }, {
datapoint: t,
isBlur: !e.value.useBlurOnHover || [null, void 0].includes(M.value) || M.value === o,
isSafari: Jt.value,
isVisible: q(t) && m.value.dataLabels.show,
textAlign: s(A)(t, !0, 16, !0).anchor,
flexAlign: s(A)(t, !0, 16).anchor,
percentage: Wt(t, re.value)
}), void 0, !0)
])
], 8, Sa))
])) : (u(), i("g", Ma, [
e.value.type === "classic" ? (u(), i(_, { key: 0 }, [
q(t) && m.value.dataLabels.show ? (u(), i("circle", {
key: 0,
cx: s(Y)[o]?.markerX ?? s(A)(t).x,
cy: s(Y)[o]?.markerY ?? s(Ce)(t) - 3.5,
fill: t.color,
stroke: e.value.style.chart.backgroundColor,
"stroke-width": 1,
r: 3,
filter: !e.value.useBlurOnHover || [null, void 0].includes(M.value) || M.value === o ? "" : `url(#blur_${c.value})`,
onClick: (r) => ye(t, o),
onMouseenter: (r) => fe({
datapoint: t,
relativeIndex: o,
seriesIndex: t.seriesIndex,
show: !0
}),
onMouseleave: (r) => he({ datapoint: t, seriesIndex: t.seriesIndex })
}, null, 40, Pa)) : f("", !0),
e.value.style.chart.layout.labels.dataLabels.oneLine || s(Y)[o] ? kt((u(), i("text", {
key: 1,
class: "vue-data-ui-datalabel-inline",
"text-anchor": s(Y)[o]?.textAnchor || s(A)(t, !0, 12).anchor,
x: s(Y)[o]?.labelX ?? s(A)(t, !0, 12).x,
y: s(Y)[o]?.labelY ?? s(Ce)(t),
onClick: (r) => ye(t, o),
onMouseenter: (r) => fe({
datapoint: t,
relativeIndex: o,
seriesIndex: t.seriesIndex,
show: !0
}),
onMouseleave: (r) => he({ datapoint: t, seriesIndex: t.seriesIndex }),
innerHTML: Sl(t, o, !!s(Y)[o])
}, null, 40, Fa)), [
[Ct, q(t) && m.value.dataLabels.show]
]) : (u(), i(_, { key: 2 }, [
kt(b("text", {
class: "vue-data-ui-datalabel-value",
"text-anchor": s(Y)[o]?.textAnchor || s(A)(t, !0, 12).anchor,
x: s(Y)[o]?.labelX ?? s(A)(t, !0, 12).x,
y: s(Y)[o]?.labelY ?? s(Ce)(t),
fill: e.value.style.chart.layout.labels.percentage.color,
"font-size": xe.value + "px",
style: I(`font-weight:${e.value.style.chart.layout.labels.percentage.bold ? "bold" : ""}`),
onClick: (r) => ye(t, o),
onMouseenter: (r) => fe({
datapoint: t,
relativeIndex: o,
seriesIndex: t.seriesIndex,
show: !0
}),
onMouseleave: (r) => he({ datapoint: t, seriesIndex: t.seriesIndex })
}, ke(bt(t)), 45, Ia), [
[Ct, q(t) && m.value.dataLabels.show]
]),
kt(b("text", {
class: "vue-data-ui-datalabel-name",
"text-anchor": s(Y)[o]?.textAnchor || s(A)(t).anchor,
x: s(Y)[o]?.labelX ?? s(A)(t, !0, 12).x,
y: (s(Y)[o]?.labelY ?? s(Ce)(t)) + N.value * 1.2,
fill: e.value.style.chart.layout.labels.name.color,
"font-size": N.value + "px",
style: I(`font-weight:${e.value.style.chart.layout.labels.name.bold ? "bold" : ""}`),
onClick: (r) => ye(t, o),
onMouseenter: (r) => fe({
datapoint: t,
relativeIndex: o,
seriesIndex: t.seriesIndex,
show: !0
}),
onMouseleave: (r) => he({ datapoint: t, seriesIndex: t.seriesIndex }),
innerHTML: s(il)({
content: t.name,
fontSize: N.value,
fill: e.value.style.chart.layout.labels.name.color,
x: s(Y)[o]?.labelX ?? s(A)(t, !0, 12).x,
y: (s(Y)[o]?.labelY ?? s(Ce)(t)) + N.value
})
}, null, 44, Da), [
[Ct, q(t) && m.value.dataLabels.show]
])
], 64))
], 64)) : f("", !0),
e.value.type === "polar" ? (u(), i(_, { key: 1 }, [
q(t) && m.value.dataLabels.show ? (u(), i("circle", {
key: 0,
cx: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 24, centerX: n.value.width / 2, centerY: n.value.height / 2 }).x,
cy: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 24, centerX: n.value.width / 2, centerY: n.value.height / 2 }).y,
fill: t.color,
stroke: e.value.style.chart.backgroundColor,
"stroke-width": 1,
r: 3,
filter: !e.value.useBlurOnHover || [null, void 0].includes(M.value) || M.value === o ? "" : `url(#blur_${c.value})`,
onClick: (r) => ye(t, o),
onMouseenter: (r) => fe({
datapoint: t,
relativeIndex: o,
seriesIndex: t.seriesIndex,
show: !0
}),
onMouseleave: (r) => he({ datapoint: t, seriesIndex: t.seriesIndex }),
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`
})
}, null, 44, Ba)) : f("", !0),
e.value.style.chart.layout.labels.dataLabels.oneLine ? kt((u(), i("text", {
key: 1,
class: "vue-data-ui-datalabel-inline",
"text-anchor": Te(v.value[o].middlePoint),
x: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).x,
y: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).y,
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`
}),
onClick: (r) => ye(t, o),
onMouseenter: (r) => fe({
datapoint: t,
relativeIndex: o,
seriesIndex: t.seriesIndex,
show: !0
}),
onMouseleave: (r) => he({ datapoint: t, seriesIndex: t.seriesIndex }),
innerHTML: Ml(t, o)
}, null, 44, za)), [
[Ct, q(t) && m.value.dataLabels.show]
]) : (u(), i(_, { key: 2 }, [
q(t) && m.value.dataLabels.show ? (u(), i("text", {
key: 0,
class: "vue-data-ui-datalabel-value",
"text-anchor": Te(v.value[o].middlePoint),
x: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).x,
y: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).y,
fill: e.value.style.chart.layout.labels.percentage.color,
"font-size": xe.value,
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`,
fontWeight: e.value.style.chart.layout.labels.percentage.bold ? "bold" : "normal"
}),
onClick: (r) => ye(t, o),
onMouseenter: (r) => fe({
datapoint: t,
relativeIndex: o,
seriesIndex: t.seriesIndex,
show: !0
}),
onMouseleave: (r) => he({ datapoint: t, seriesIndex: t.seriesIndex })
}, ke(bt(t)), 45, Oa)) : f("", !0),
q(t) && m.value.dataLabels.show ? (u(), i("text", {
key: 1,
class: "vue-data-ui-datalabel-name",
"text-anchor": Te(v.value[o].middlePoint),
x: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).x,
y: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).y + N.value * 1.2,
fill: e.value.style.chart.layout.labels.name.color,
"font-size": N.value,
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`,
fontWeight: e.value.style.chart.layout.labels.name.bold ? "bold" : "normal"
}),
onClick: (r) => ye(t, o),
onMouseenter: (r) => fe({
datapoint: t,
relativeIndex: o,
seriesIndex: t.seriesIndex,
show: !0
}),
onMouseleave: (r) => he({ datapoint: t, seriesIndex: t.seriesIndex }),
innerHTML: s(il)({
content: t.name,
fontSize: xe.value,
fill: e.value.style.chart.layout.labels.name.color,
x: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).x,
y: s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).y + N.value * 1.2
})
}, null, 44, Ya)) : f("", !0)
], 64))
], 64)) : f("", !0)
])),
m.value.dataLabels.show && e.value.style.chart.comments.show && t.comment ? (u(), i("g", Ea, [
q(t) && e.value.type === "classic" ? (u(), i("foreignObject", {
key: 0,
x: e.value.style.chart.comments.offsetX + (s(A)(t, !0).anchor === "end" ? s(A)(t).x - e.value.style.chart.comments.width : s(A)(t, !0).anchor === "middle" ? s(A)(t).x - e.value.style.chart.comments.width / 2 : s(A)(t).x),
y: s(Ce)(t) + 24 + e.value.style.chart.comments.offsetY,
width: e.value.style.chart.comments.width,
height: "200",
style: { overflow: "visible", "pointer-events": "none" }
}, [
b("div", null, [
w(l.$slots, "plot-comment", {
plot: { ...t, textAlign: s(A)(t, !0, 16, !0).anchor, flexAlign: s(A)(t, !0, 16).anchor, isFirstLoad: P.value }
}, void 0, !0)
])
], 8, Xa)) : f("", !0),
q(t) && e.value.type === "polar" ? (u(), i("foreignObject", {
key: 1,
x: e.value.style.chart.comments.offsetX + (Te(v.value[o].middlePoint) === "end" ? s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).x - e.value.style.chart.comments.width : Te(v.value[o].middlePoint) === "middle" ? s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).x - e.value.style.chart.comments.width / 2 : s(z)({ initX: v.value[o].middlePoint.x, initY: v.value[o].middlePoint.y, offset: 42, centerX: n.value.width / 2, centerY: n.value.height / 2 }).x),
y: $l(v.value[o]) + e.value.style.chart.comments.offsetY,
width: e.value.style.chart.comments.width,
height: "200",
style: I({
transition: P.value || !e.value.serieToggleAnimation.show ? "none" : `all ${e.value.serieToggleAnimation.durationMs}ms ease-in-out`,
overflow: "visible",
pointerEvents: "none"
})
}, [
b("div", null, [
w(l.$slots, "plot-comment", {
plot: { ...t, textAlign: Te(v.value[o].middlePoint), flexAlign: Te(v.value[o].middlePoint), isFirstLoad: P.value }
}, void 0, !0)
])
], 12, Na)) : f("", !0)
])) : f("", !0)
], 10, Ta))), 128)),
w(l.$slots, "svg", { svg: n.value }, void 0, !0)
], 512)
], 14, Fo)),
l.$slots.watermark ? (u(), i("div", Ra, [
w(l.$slots, "watermark", ee(te({ isPrinting: s(K) || s(Z) })), void 0, !0)
])) : f("", !0),
b("div", {
id: `legend-bottom-${c.value}`
}, null, 8, Va),
dt.value ? (u(), Pe(jl, {
key: 5,
to: e.value.style.chart.legend.position === "top" ? `#legend-top-${c.value}` : `#legend-bottom-${c.value}`
}, [
b("div", {
ref_key: "chartLegend",
ref: ut
}, [
e.value.style.chart.legend.show ? (u(), Pe(To, {
key: `legend_${ct.value}`,
legendSet: Bt.value,
config: kl.value,
onClickMarker: a[3] || (a[3] = ({ i: t }) => Xe(t))
}, Rt({
item: C(({ legend: t, index: o }) => [
b("div", {
style: I(`opacity:${O.value.includes(o) ? 0.5 : 1}`),
onClick: (r) => t.segregate()
}, ke(t.display), 13, Ua)
]),
_: 2
}, [
l.$slots.pattern ? {
name: "legend-pattern",
fn: C(({ legend: t, index: o }) => [
wt(Ao, {
shape: t.shape,
radius: 30,
stroke: "none",
plot: { x: 30, y: 30 },
fill: `url(#pattern_${c.value}_${o})`
}, null, 8, ["shape", "fill"])
]),
key: "0"
} : void 0
]), 1032, ["legendSet", "config"])) : f("", !0),
w(l.$slots, "legend", { legend: Bt.value }, void 0, !0)
], 512)
], 8, ["to"])) : f("", !0),
l.$slots.source ? (u(), i("div", {
key: 6,
ref_key: "source",
ref: He,
dir: "auto"
}, [
w(l.$slots, "source", {}, void 0, !0)
], 512)) : f("", !0),
l.$slots.hollow ? (u(), i("div", Ha, [
w(l.$slots, "hollow", ee(te({
total: Q.value,
average: zt.value,
dataset: R.value
})), void 0, !0)
])) : f("", !0),
wt(s(Re), {
show: m.value.showTooltip && S.value,
backgroundColor: e.value.style.chart.tooltip.backgroundColor,
color: e.value.style.chart.tooltip.color,
fontSize: e.value.style.chart.tooltip.fontSize,
borderRadius: e.value.style.chart.tooltip.borderRadius,
borderColor: e.value.style.chart.tooltip.borderColor,
borderWidth: e.value.style.chart.tooltip.borderWidth,
backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
position: e.value.style.chart.tooltip.position,
offsetY: e.value.style.chart.tooltip.offsetY,
parent: L.value,
content: V.value,
isCustom: Ze.value,
isFullscreen: Oe.value,
smooth: e.value.style.chart.tooltip.smooth,
backdropFilter: e.value.style.chart.tooltip.backdropFilter,
smoothForce: e.value.style.chart.tooltip.smoothForce,
smoothSnapThreshold: e.value.style.chart.tooltip.smoothSnapThrehsold
}, {
"tooltip-before": C(() => [
w(l.$slots, "tooltip-before", ee(te({ ...Ot.value })), void 0, !0)
]),
"tooltip-after": C(() => [
w(l.$slots, "tooltip-after", ee(te({ ...Ot.value })), void 0, !0)
]),
_: 3
}, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isCustom", "isFullscreen", "smooth", "backdropFilter", "smoothForce", "smoothSnapThreshold"]),
D.value && e.value.userOptions.buttons.table ? (u(), Pe(Wl(et.value.component), Vt({ key: 8 }, et.value.props, {
ref_key: "tableUnit",
ref: Ie,
onClose: tl
}), Rt({
content: C(() => [
(u(), Pe(s(at), {
key: `table_${it.value}`,
colNames: pt.value.colNames,
head: pt.value.head,
body: pt.value.body,
config: pt.value.config,
title: e.value.table.useDialog ? "" : et.value.title,
withCloseButton: !e.value.table.useDialog,
onClose: tl
}, {
th: C(({ th: t }) => [
b("div", {
innerHTML: t,
style: { display: "flex", "align-items": "center" }
}, null, 8, Ga)
]),
td: C(({ td: t }) => [
nl(ke(t.name ? t.name : isNaN(Number(t)) ? t.includes("%") ? t : s(ge)(
e.value.style.chart.layout.labels.percentage.formatter,
t,
s(ie)({
v: t,
s: "%",
r: e.value.style.chart.layout.labels.percentage.rounding
})
) : s(ge)(
e.value.style.chart.layout.labels.value.formatter,
t,
s(ie)({
p: e.value.style.chart.layout.labels.dataLabels.prefix,
v: t,
s: e.value.style.chart.layout.labels.dataLabels.suffix,
r: e.value.style.chart.layout.labels.value.rounding
})
)), 1)
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title", "withCloseButton"]))
]),
_: 2
}, [
e.value.table.useDialog ? {
name: "title",
fn: C(() => [
nl(ke(et.value.title), 1)
]),
key: "0"
} : void 0,
e.value.table.useDialog ? {
name: "actions",
fn: C(() => [
b("button", {
tabindex: "0",
class: "vue-ui-user-options-button",
onClick: a[4] || (a[4] = (t) => Yt(e.value.userOptions.callbacks.csv))
}, [
wt(s(ot), {
name: "excel",
stroke: et.value.props.color
}, null, 8, ["stroke"])
])
]),
key: "1"
} : void 0
]), 1040)) : f("", !0),
s(ne) ? (u(), Pe(mo, { key: 9 })) : f("", !0)
], 46, Mo));
}
}, Wa = /* @__PURE__ */ Lo(ja, [["__scopeId", "data-v-62472871"]]), hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Wa
}, Symbol.toStringTag, { value: "Module" }));
export {
Wa as V,
hn as a,
vn as v
};