vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
1,138 lines (1,137 loc) • 44.7 kB
JavaScript
import { computed as k, ref as v, watch as Ze, onMounted as je, nextTick as et, onBeforeUnmount as Tt, createElementBlock as r, openBlock as n, unref as i, normalizeStyle as se, normalizeClass as R, createBlock as U, createCommentVNode as g, createVNode as tt, createSlots as Ft, withCtx as _, renderSlot as L, normalizeProps as E, guardReactiveProps as G, createElementVNode as m, Fragment as T, renderList as S, toDisplayString as V, withDirectives as lt, vShow as at, createTextVNode as ue } from "vue";
import { u as Ot, c as St, t as It, p as _e, a as At, H as D, o as Nt, e as Y, b as Vt, d as Pt, m as ot, f as F, X as Dt, s as st, J as zt, k as Le, n as X, i as J, x as ut, q as Mt, r as Rt, y as Ut, R as nt } from "./index-CO-5OgQA.js";
import { t as Bt, u as Et } from "./useResponsive-Cw4oZ8sQ.js";
import { _ as Gt } from "./Title-CxubvuEh.js";
import { u as Yt, U as Xt } from "./usePrinter-DldU0tBx.js";
import { D as Ht } from "./DataTable-CVSajw4G.js";
import { _ as Wt } from "./Tooltip-C0W6IWVK.js";
import { L as qt } from "./Legend-B61dtd8W.js";
import Jt from "./vue-ui-skeleton-BeEBd4CC.js";
import Kt from "./vue-ui-accordion-RRHvINsj.js";
import { u as rt } from "./useNestedProp-D8sa_wYF.js";
import { _ as Qt } from "./PackageVersion-DqsC6J9R.js";
import { _ as Zt } from "./PenAndPaper-Bqjmruhh.js";
import { u as jt } from "./useUserOptionState-BIvW1Kz7.js";
import { u as el } from "./useChartAccessibility-BWojgys7.js";
import { _ as tl } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const ll = ["id"], al = ["xmlns", "viewBox"], ol = ["width", "height"], sl = ["id"], ul = ["offset", "stop-color"], nl = ["offset", "stop-opacity"], rl = ["id"], il = ["id"], dl = ["id"], cl = ["flood-color"], vl = ["d", "fill", "stroke", "stroke-width", "filter"], fl = { key: 1 }, hl = ["d", "fill"], pl = { key: 2 }, yl = ["x", "y", "font-size", "font-weight", "fill"], bl = { key: 3 }, gl = ["filter"], ml = ["opacity", "text-anchor", "x", "y", "fill", "font-size", "font-weight"], $l = ["opacity", "text-anchor", "x", "y", "fill", "font-size", "font-weight"], wl = ["text-anchor", "x", "y", "fill", "font-size", "font-weight"], kl = ["d", "fill", "onMouseenter", "onClick"], _l = {
key: 5,
class: "vue-data-ui-watermark"
}, Ll = {
key: 0,
class: "vue-ui-nested-donuts-legend-title"
}, xl = ["onClick"], Cl = ["innerHTML"], Tl = {
__name: "vue-ui-nested-donuts",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectLegend", "selectDatapoint"],
setup(it, { expose: dt, emit: ct }) {
const { vue_ui_nested_donuts: vt } = Ot(), x = it, K = k(() => !!x.dataset && x.dataset.length), y = v(St()), ne = v(!1), re = v(""), ft = v(null), xe = v(0), H = v(null), Ce = v(null), ie = v(null), Te = v(null), Fe = v(null), Oe = v(0), Se = v(0), Ie = v(0), z = v(!0), M = v([]), W = v([]), B = v(!1);
function ht(l) {
B.value = l, xe.value += 1;
}
const e = k({
get: () => Pe(),
set: (l) => l
}), { userOptionsVisible: de, setUserOptionsVisibility: Ae, keepUserOptionState: Ne } = jt({ config: e.value }), { svgRef: Ve } = el({
config: e.value.style.chart.title
});
function Pe() {
const l = rt({
userConfig: x.config,
defaultConfig: vt
});
return l.theme ? {
...rt({
userConfig: At.vue_ui_nested_donuts[l.theme] || x.config,
defaultConfig: l
}),
customPalette: It[l.theme] || _e
} : l;
}
Ze(
() => x.config,
(l) => {
e.value = Pe(), de.value = !e.value.userOptions.showOnChartHover, ce(), Oe.value += 1, Se.value += 1, Ie.value += 1, w.value.dataLabels.show = e.value.style.chart.layout.labels.dataLabels.show, w.value.showTable = e.value.table.show, w.value.showTooltip = e.value.style.chart.tooltip.show;
},
{ deep: !0 }
);
const De = k(() => {
const { top: l, right: s, bottom: a, left: o } = e.value.style.chart.padding;
return {
css: `padding:${l}px ${s}px ${a}px ${o}px`,
top: l,
right: s,
bottom: a,
left: o
};
});
function pt(l, s = 1e3, a = 50) {
return new Promise((o) => {
const t = l.length;
M.value = Array(t).fill(0), W.value = [];
let u = 0;
l.forEach((c, p) => {
setTimeout(() => {
const N = performance.now();
function C(d) {
const f = Math.min((d - N) / s, 1), O = nt(f), ge = c * O;
M.value[p] = ge, M.value = [...M.value];
const ae = [];
let q = 0;
x.dataset.forEach((oe, me) => {
const _t = oe.series.reduce(
(we, ke) => we + D(ke.values).reduce((xt, Ct) => xt + Ct, 0),
0
), Lt = M.value.slice(q, q + oe.series.length).reduce((we, ke) => we + ke, 0), $e = _t - Lt;
$e > 1e-3 && ae.push({
name: "__ghost__",
arcOf: oe.name,
arcOfId: `${y.value}_${me}`,
id: `ghost_${y.value}_${me}`,
seriesIndex: -1,
datasetIndex: me,
color: "transparent",
value: $e,
fullValue: $e,
absoluteValues: [],
ghost: !0
}), q += oe.series.length;
}), W.value = ae, f < 1 ? requestAnimationFrame(C) : (u += 1, u === t && o());
}
requestAnimationFrame(C);
}, p * a);
});
});
}
je(async () => {
var l;
if (ce(), (l = e.value.startAnimation) != null && l.show) {
const a = x.dataset.flatMap((o) => o.series).map(
(o) => D(o.values).reduce((t, u) => t + u, 0)
);
M.value = a.map(() => 0), z.value = !0, W.value = x.dataset.map((o, t) => {
const u = o.series.reduce(
(c, p) => c + D(p.values).reduce((N, C) => N + C, 0),
0
);
return {
name: "__ghost__",
arcOf: o.name,
arcOfId: `${y.value}_${t}`,
id: `ghost_${y.value}_${t}`,
seriesIndex: -1,
datasetIndex: t,
color: "transparent",
value: u,
fullValue: u,
absoluteValues: [],
ghost: !0
};
}), await et(), pt(
a,
e.value.startAnimation.durationMs,
e.value.startAnimation.staggerMs
).then(() => {
z.value = !1, W.value = [];
});
} else
z.value = !1;
});
const Q = v(null);
je(() => {
ce();
});
function ce() {
if (Nt(x.dataset) && Y({
componentName: "VueUiNestedDonuts",
type: "dataset"
}), e.value.responsive) {
const l = Bt(() => {
const { width: s, height: a } = Et({
chart: H.value,
title: e.value.style.chart.title.text ? Ce.value : null,
legend: e.value.style.chart.legend.show ? ie.value : null,
source: Te.value,
noTitle: Fe.value,
padding: De.value
});
requestAnimationFrame(() => {
h.value.width = s, h.value.height = a;
});
});
Q.value = new ResizeObserver(l), Q.value.observe(H.value.parentNode);
}
}
Tt(() => {
Q.value && Q.value.disconnect();
});
const { isPrinting: ze, isImaging: Me, generatePdf: Re, generateImage: Ue } = Yt({
elementId: `nested_donuts_${y.value}`,
fileName: e.value.style.chart.title.text || "vue-ui-nested-donuts",
options: e.value.userOptions.print
}), yt = k(() => e.value.userOptions.show && !e.value.style.chart.title.text), bt = k(() => Vt(e.value.customPalette)), w = v({
dataLabels: {
show: e.value.style.chart.layout.labels.dataLabels.show
},
showTable: e.value.table.show,
showTooltip: e.value.style.chart.tooltip.show
}), h = v({
height: 512,
width: 512
}), Be = ct;
function gt({ datapoint: l, index: s }) {
Be("selectDatapoint", { datapoint: l, index: s });
}
function Ee({
from: l,
to: s,
duration: a,
onUpdate: o,
onDone: t,
easing: u = nt
}) {
const c = performance.now();
function p(N) {
const C = Math.min((N - c) / a, 1), d = u(C), f = l + (s - l) * d;
o(f, C), C < 1 ? requestAnimationFrame(p) : (o(s, 1), t && t());
}
requestAnimationFrame(p);
}
const $ = v([]), I = k(() => {
x.dataset.forEach((s, a) => {
[null, void 0].includes(s.name) && Y({
componentName: "VueUiNestedDonuts",
type: "datasetSerieAttribute",
property: "name",
index: a
}), [null, void 0].includes(s.series) ? Y({
componentName: "VueUiNestedDonuts",
type: "datasetSerieAttribute",
property: "series",
index: a
}) : s.series.length === 0 ? Y({
componentName: "VueUiNestedDonuts",
type: "datasetAttributeEmpty",
property: `series at index ${a}`
}) : s.series.forEach((o, t) => {
[null, void 0].includes(o.name) && Y({
componentName: "VueUiNestedDonuts",
type: "datasetSerieAttribute",
property: "name",
index: t,
key: "serie"
}), [null, void 0].includes(o.values) && Y({
componentName: "VueUiNestedDonuts",
type: "datasetSerieAttribute",
property: "values",
index: t,
key: "serie"
});
});
});
let l = 0;
return x.dataset.map((s, a) => ({
...s,
total: s.series.filter((o) => !$.value.includes(o.id)).map((o) => D(o.values).reduce((t, u) => t + u, 0)).reduce((o, t) => o + t, 0),
datasetIndex: a,
id: `${y.value}_${a}`,
series: s.series.map((o, t) => {
const u = D(o.values).reduce((c, p) => c + p, 0);
return {
name: o.name,
arcOf: s.name,
arcOfId: `${y.value}_${a}`,
id: `${y.value}_${a}_${t}`,
seriesIndex: t,
datasetIndex: a,
color: Pt(o.color) || bt.value[t] || _e[t % _e.length],
value: z.value ? M.value[l++] ?? 0 : u,
absoluteValues: o.values || []
};
})
}));
}), A = k(() => Math.min(h.value.height, h.value.width) * (e.value.style.chart.layout.donut.strokeWidth / 512)), Ge = k(() => [...I.value].map((l, s) => {
const a = l.series.filter((o) => !$.value.includes(o.id)).map((o) => o.value).reduce((o, t) => o + t, 0);
return {
...l,
total: a,
series: l.series.filter((o) => !$.value.includes(o.id)).map((o) => ({
...o,
proportion: o.value / a
}))
};
}));
function mt(l, s, a) {
let o = 0;
for (let t = 0; t < l.length; t += 1)
a.includes(l[t]) && (o += 1);
return o < s;
}
const b = v(Ge.value);
Ze(
() => Ge.value,
(l) => b.value = l
);
function ve(l) {
var C;
Be("selectLegend", l);
const s = x.dataset.flatMap(
(d, f) => d.series.map((O, ge) => ({
value: D(O.values).reduce((ae, q) => ae + q, 0),
id: `${y.value}_${f}_${ge}`,
arcOfId: `${y.value}_${f}`
}))
).find((d) => d.id === l.id);
if (!s) return;
const a = ((C = I.value.flatMap((d) => d.series).find((d) => d.id === l.id)) == null ? void 0 : C.value) ?? 0, o = b.value.flatMap((d) => d.series).find((d) => d.id === l.id);
let u = o ? o.value : 0;
const c = I.value.find(
(d) => d.id === s.arcOfId
);
if (!c) return;
const p = c.series.map((d) => d.id), N = mt(
p,
p.length - 1,
$.value
);
$.value.includes(l.id) ? ($.value = $.value.filter((d) => d !== l.id), e.value.serieToggleAnimation.show ? Ee({
from: u,
to: a,
duration: e.value.serieToggleAnimation.durationMs,
onUpdate: (d) => {
b.value = b.value.map((f) => ({
...f,
series: f.series.map((O) => O.id === l.id ? { ...O, value: d } : O)
}));
}
}) : b.value = b.value.map((d) => ({
...d,
series: d.series.map((f) => f.id === l.id ? { ...f, value: a } : f)
}))) : N && (e.value.serieToggleAnimation.show ? Ee({
from: u,
to: 0,
duration: e.value.serieToggleAnimation.durationMs,
onUpdate: (d) => {
b.value = b.value.map((f) => ({
...f,
series: f.series.map((O) => O.id === l.id ? { ...O, value: d } : O)
}));
},
onDone: () => {
$.value.push(l.id);
}
}) : (b.value = b.value.map((d) => ({
...d,
series: d.series.map((f) => f.id === l.id ? { ...f, value: 0 } : f)
})), $.value.push(l.id)));
}
const fe = k(() => A.value / I.value.length * e.value.style.chart.layout.donut.spacingRatio), Ye = k(() => b.value.map((l, s) => A.value - s * A.value / I.value.length)), Z = k(() => b.value.map((l, s) => {
const a = A.value - s * A.value / b.value.length, o = z.value ? W.value.find((u) => u.datasetIndex === s) : null, t = [...l.series, ...o ? [o] : []].map((u) => ({
...u,
value: u.value < 1e-3 ? 1e-3 : u.value
}));
return {
...l,
radius: a,
donut: ot(
{ series: t },
h.value.width / 2,
h.value.height / 2,
a,
a,
1.99999,
2,
1,
360,
105.25,
fe.value
)
};
})), Xe = k(() => [...I.value].map((l, s) => {
const a = s * A.value / I.value.length;
return {
sizeRatio: a,
donut: ot(
{ series: [{ value: 1 }] },
h.value.width / 2,
h.value.height / 2,
A.value - a,
A.value - a,
1.99999,
2,
1,
360,
105.25,
A.value / I.value.length * e.value.style.chart.layout.donut.spacingRatio
)[0]
};
})), He = v(null), j = v(null), ee = v(null), he = v(null);
function $t({ datapoint: l, _relativeIndex: s, seriesIndex: a }) {
He.value = l.arcOfId, j.value = l.id, ee.value = a, he.value = {
datapoint: l,
seriesIndex: a,
series: b.value,
config: e.value
};
const o = e.value.style.chart.tooltip.customFormat;
if (ut(o) && Ut(
() => o({
seriesIndex: a,
datapoint: l,
series: b.value,
config: e.value
})
))
re.value = o({
seriesIndex: a,
datapoint: l,
series: b.value,
config: e.value
});
else {
let t = "";
if (e.value.style.chart.tooltip.showAllItemsAtIndex && $.value.length === 0) {
const u = b.value.map((c) => c.series.find((p) => p.seriesIndex === a));
u.forEach((c, p) => {
if (!c) return "";
t += `
<div style="display:flex; flex-direction: column; justify-content:flex-start; align-items:flex-start;padding:6px 0; ${p < u.length - 1 ? `border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor}` : ""}">
<div style="display:flex; flex-direction: row; gap: 3px; justify-content:flex-start; align-items:center;">
<svg viewBox="0 0 20 20" height="${e.value.style.chart.tooltip.fontSize}" width="${e.value.style.chart.tooltip.fontSize}">
<circle cx="10" cy="10" r="10" fill="${c.color}"/>
</svg>
<span>
${c.arcOf ?? ""} - ${c.name}
</span>
</div>
<span>
${e.value.style.chart.tooltip.showValue ? `<b>${J(
e.value.style.chart.layout.labels.dataLabels.formatter,
l.value,
F({
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, seriesIndex: a }
)}
</b>` : ""}
${e.value.style.chart.tooltip.showPercentage ? `(${F({
v: c.proportion * 100,
s: "%",
r: e.value.style.chart.tooltip.roundingPercentage
})})` : ""}
</span>
</div>
`;
});
} else
t += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${l.arcOf ?? ""} - ${l.name}</div>`, t += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${l.color}"/></svg>`, e.value.style.chart.tooltip.showValue && (t += `<b>${J(
e.value.style.chart.layout.labels.dataLabels.formatter,
l.value,
F({
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, seriesIndex: a }
)}</b>`), e.value.style.chart.tooltip.showPercentage && (e.value.style.chart.tooltip.showValue ? t += `<span>(${F({
v: l.proportion * 100,
s: "%",
r: e.value.style.chart.tooltip.roundingPercentage
})})</span></div>` : t += `<b>${F({
v: l.proportion * 100,
s: "%",
r: e.value.style.chart.tooltip.roundingPercentage
})}</b></div>`);
re.value = `<div style="font-size:${e.value.style.chart.tooltip.fontSize}px">${t}</div>`;
}
ne.value = !0;
}
function pe(l) {
return l.proportion * 100 > e.value.style.chart.layout.labels.dataLabels.hideUnderValue;
}
function We(l, s) {
if (!e.value.useBlurOnHover)
return "";
if (e.value.style.chart.tooltip.showAllItemsAtIndex && $.value.length === 0)
return [null, void 0].includes(ee.value) || ee.value === s ? "" : `url(#blur_${y.value})`;
if (!e.value.style.chart.tooltip.showAllItemsAtIndex || $.value.length)
return [null, void 0].includes(j.value) || j.value === l.id ? "" : `url(#blur_${y.value})`;
}
const ye = k(() => I.value.map((l, s) => {
const a = l.series.filter(
(t) => !$.value.includes(t.id)
), o = z.value ? a.map((t) => {
const u = x.dataset[s].series.findIndex(
(c) => c.name === t.name
);
return D(
x.dataset[s].series[u].values
).reduce((c, p) => c + p, 0);
}).reduce((t, u) => t + u, 0) : a.map((t) => t.value).reduce((t, u) => t + u, 0);
return l.series.map((t, u) => {
const c = D(x.dataset[s].series[u].values).reduce(
(N, C) => N + C,
0
), p = z.value ? c : t.value;
return {
name: t.name,
color: t.color,
value: p,
shape: "circle",
arcOf: t.arcOf,
id: t.id,
seriesIndex: u,
datasetIndex: s,
total: o,
opacity: $.value.includes(t.id) ? 0.5 : 1,
segregate: () => ve(t),
isSegregated: $.value.includes(t.id)
};
});
})), wt = k(() => ({
cy: "nested-donuts-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" : ""
})), P = k(() => {
const l = b.value.flatMap((a) => a.series.map((o) => ({
name: `${a.name} - ${o.name}`,
color: o.color,
total: a.total
}))), s = b.value.flatMap((a) => a.series.map((o) => o.value));
return { head: l, body: s };
});
function qe() {
et(() => {
const l = P.value.head.map((o, t) => [
[o.name],
[P.value.body[t]],
[
isNaN(P.value.body[t] / o.total) ? "-" : P.value.body[t] / o.total * 100
]
]), s = [
[e.value.style.chart.title.text],
[e.value.style.chart.title.subtitle.text],
[[""], ["val"], ["%"]]
].concat(l), a = Mt(s);
Rt({
csvContent: a,
title: e.value.style.chart.title.text || "vue-ui-nested-donuts"
});
});
}
const te = k(() => {
const l = [
e.value.table.columnNames.series,
e.value.table.columnNames.value,
e.value.table.columnNames.percentage
], s = P.value.head.map((t, u) => {
const c = F({
p: e.value.style.chart.layout.labels.dataLabels.prefix,
v: P.value.body[u],
s: e.value.style.chart.layout.labels.dataLabels.suffix,
r: e.value.table.td.roundingValue
});
return [
{
color: t.color,
name: t.name
},
c,
isNaN(P.value.body[u] / t.total) ? "-" : F({
v: P.value.body[u] / t.total * 100,
s: "%",
r: e.value.table.td.roundingPercentage
})
];
}), a = {
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: s,
config: a
};
});
function kt() {
return I.value;
}
function Je() {
w.value.showTable = !w.value.showTable;
}
function Ke() {
w.value.dataLabels.show = !w.value.dataLabels.show;
}
function Qe() {
w.value.showTooltip = !w.value.showTooltip;
}
const le = v(!1);
function be() {
le.value = !le.value;
}
return dt({
getData: kt,
generatePdf: Re,
generateCsv: qe,
generateImage: Ue,
toggleTable: Je,
toggleLabels: Ke,
toggleTooltip: Qe,
toggleAnnotator: be
}), (l, s) => (n(), r("div", {
ref_key: "nestedDonutsChart",
ref: H,
class: R(`vue-ui-nested-donuts ${B.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
style: se(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor}`),
id: `nested_donuts_${y.value}`,
onMouseenter: s[3] || (s[3] = () => i(Ae)(!0)),
onMouseleave: s[4] || (s[4] = () => i(Ae)(!1))
}, [
e.value.userOptions.buttons.annotator ? (n(), U(Zt, {
key: 0,
svgRef: i(Ve),
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
active: le.value,
onClose: be
}, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : g("", !0),
yt.value ? (n(), r("div", {
key: 1,
ref_key: "noTitle",
ref: Fe,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : g("", !0),
e.value.style.chart.title.text ? (n(), r("div", {
key: 2,
ref_key: "chartTitle",
ref: Ce
}, [
(n(), U(Gt, {
key: `title_${Oe.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)) : g("", !0),
e.value.userOptions.show && K.value && (i(Ne) || i(de)) ? (n(), U(Xt, {
ref: "details",
key: `user_option_${xe.value}`,
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
isPrinting: i(ze),
isImaging: i(Me),
uid: y.value,
hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
hasPdf: e.value.userOptions.buttons.pdf,
hasXls: e.value.userOptions.buttons.csv,
hasImg: e.value.userOptions.buttons.img,
hasTable: e.value.userOptions.buttons.table,
hasLabel: e.value.userOptions.buttons.labels,
hasFullscreen: e.value.userOptions.buttons.fullscreen,
isFullscreen: B.value,
isTooltip: w.value.showTooltip,
titles: { ...e.value.userOptions.buttonTitles },
chartElement: H.value,
position: e.value.userOptions.position,
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: le.value,
onToggleFullscreen: ht,
onGeneratePdf: i(Re),
onGenerateCsv: qe,
onGenerateImage: i(Ue),
onToggleTable: Je,
onToggleLabels: Ke,
onToggleTooltip: Qe,
onToggleAnnotator: be,
style: se({
visibility: i(Ne) ? i(de) ? "visible" : "hidden" : "visible"
})
}, Ft({ _: 2 }, [
l.$slots.menuIcon ? {
name: "menuIcon",
fn: _(({ isOpen: a, color: o }) => [
L(l.$slots, "menuIcon", E(G({ isOpen: a, color: o })), void 0, !0)
]),
key: "0"
} : void 0,
l.$slots.optionTooltip ? {
name: "optionTooltip",
fn: _(() => [
L(l.$slots, "optionTooltip", {}, void 0, !0)
]),
key: "1"
} : void 0,
l.$slots.optionPdf ? {
name: "optionPdf",
fn: _(() => [
L(l.$slots, "optionPdf", {}, void 0, !0)
]),
key: "2"
} : void 0,
l.$slots.optionCsv ? {
name: "optionCsv",
fn: _(() => [
L(l.$slots, "optionCsv", {}, void 0, !0)
]),
key: "3"
} : void 0,
l.$slots.optionImg ? {
name: "optionImg",
fn: _(() => [
L(l.$slots, "optionImg", {}, void 0, !0)
]),
key: "4"
} : void 0,
l.$slots.optionTable ? {
name: "optionTable",
fn: _(() => [
L(l.$slots, "optionTable", {}, void 0, !0)
]),
key: "5"
} : void 0,
l.$slots.optionLabels ? {
name: "optionLabels",
fn: _(() => [
L(l.$slots, "optionLabels", {}, void 0, !0)
]),
key: "6"
} : void 0,
l.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: _(({ toggleFullscreen: a, isFullscreen: o }) => [
L(l.$slots, "optionFullscreen", E(G({ toggleFullscreen: a, isFullscreen: o })), void 0, !0)
]),
key: "7"
} : void 0,
l.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: _(({ toggleAnnotator: a, isAnnotator: o }) => [
L(l.$slots, "optionAnnotator", E(G({ toggleAnnotator: a, isAnnotator: o })), void 0, !0)
]),
key: "8"
} : void 0
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasLabel", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : g("", !0),
K.value ? (n(), r("svg", {
key: 4,
ref_key: "svgRef",
ref: Ve,
xmlns: i(Dt),
class: R({
"vue-data-ui-fullscreen--on": B.value,
"vue-data-ui-fulscreen--off": !B.value
}),
viewBox: `0 0 ${h.value.width <= 0 ? 1e-3 : h.value.width} ${h.value.height < 0 ? 1e-3 : h.value.height}`,
style: se(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color};${De.value.css}`)
}, [
tt(Qt),
l.$slots["chart-background"] ? (n(), r("foreignObject", {
key: 0,
x: 0,
y: 0,
width: h.value.width <= 0 ? 1e-3 : h.value.width,
height: h.value.height < 0 ? 1e-3 : h.value.height,
style: {
pointerEvents: "none"
}
}, [
L(l.$slots, "chart-background", {}, void 0, !0)
], 8, ol)) : g("", !0),
m("defs", null, [
(n(!0), r(T, null, S(Xe.value, (a, o) => (n(), r("radialGradient", {
id: `radial_${y.value}_${o}`
}, [
s[5] || (s[5] = m("stop", {
offset: "0%",
"stop-color": "#FFFFFF",
"stop-opacity": "0"
}, null, -1)),
m("stop", {
offset: `${(1 - fe.value / Ye.value[o]) * 100}%`,
"stop-color": i(st)("#FFFFFF", 0),
"stop-opacity": "0"
}, null, 8, ul),
m("stop", {
offset: `${(1 - fe.value / Ye.value[o] / 2) * 100}%`,
"stop-color": "#FFFFFF",
"stop-opacity": e.value.style.chart.gradientIntensity / 100
}, null, 8, nl),
s[6] || (s[6] = m("stop", {
offset: "100%",
"stop-color": "#FFFFFF",
"stop-opacity": "0"
}, null, -1))
], 8, sl))), 256))
]),
m("defs", null, [
m("filter", {
id: `blur_${y.value}`,
x: "-50%",
y: "-50%",
width: "200%",
height: "200%"
}, [
m("feGaussianBlur", {
in: "SourceGraphic",
stdDeviation: 2,
id: `blur_std_${y.value}`
}, null, 8, il),
s[7] || (s[7] = m("feColorMatrix", {
type: "saturate",
values: "0"
}, null, -1))
], 8, rl),
m("filter", {
id: `shadow_${y.value}`,
"color-interpolation-filters": "sRGB"
}, [
m("feDropShadow", {
dx: "0",
dy: "0",
stdDeviation: "10",
"flood-opacity": "0.5",
"flood-color": e.value.style.chart.layout.donut.shadowColor
}, null, 8, cl)
], 8, dl)
]),
(n(!0), r(T, null, S(Z.value, (a, o) => (n(), r("g", null, [
(n(!0), r(T, null, S(a.donut.filter((t) => !t.ghost), (t, u) => (n(), r("g", null, [
m("path", {
class: "vue-ui-donut-arc-path",
d: t.arcSlice,
fill: i(st)(t.color, 80),
stroke: e.value.style.chart.backgroundColor,
"stroke-width": e.value.style.chart.layout.donut.borderWidth,
filter: We(t, u)
}, null, 8, vl)
]))), 256))
]))), 256)),
e.value.style.chart.useGradient ? (n(), r("g", fl, [
(n(!0), r(T, null, S(Xe.value, (a, o) => (n(), r("g", null, [
m("path", {
d: a.donut.arcSlice,
fill: `url(#radial_${y.value}_${o})`,
stroke: "transparent",
"stroke-width": "0"
}, null, 8, hl)
]))), 256))
])) : g("", !0),
e.value.style.chart.layout.labels.dataLabels.showDonutName ? (n(), r("g", pl, [
(n(!0), r(T, null, S(Z.value, (a, o) => (n(), r("g", null, [
(n(!0), r(T, null, S(a.donut, (t, u) => (n(), r("g", null, [
u === 0 && h.value.width && h.value.height ? (n(), r("text", {
key: 0,
class: R({ animated: e.value.useCssAnimation }),
x: h.value.width / 2,
y: t.startY - e.value.style.chart.layout.labels.dataLabels.fontSize + e.value.style.chart.layout.labels.dataLabels.donutNameOffsetY,
"text-anchor": "middle",
"font-size": e.value.style.chart.layout.labels.dataLabels.fontSize,
"font-weight": e.value.style.chart.layout.labels.dataLabels.boldDonutName ? "bold" : "normal",
fill: e.value.style.chart.layout.labels.dataLabels.color
}, V(e.value.style.chart.layout.labels.dataLabels.donutNameAbbreviation ? i(zt)({
source: a.name,
length: e.value.style.chart.layout.labels.dataLabels.donutNameMaxAbbreviationSize
}) : a.name), 11, yl)) : g("", !0)
]))), 256))
]))), 256))
])) : g("", !0),
e.value.style.chart.layout.labels.dataLabels.show ? (n(), r("g", bl, [
(n(!0), r(T, null, S(Z.value, (a, o) => (n(), r("g", null, [
(n(!0), r(T, null, S(a.donut.filter((t) => !t.ghost), (t, u) => (n(), r("g", {
filter: We(t, u)
}, [
lt(m("text", {
class: R({ animated: e.value.useCssAnimation }),
opacity: pe(t) ? 1 : 0,
"text-anchor": i(X)(t, !0).anchor,
x: i(X)(
t,
!1,
e.value.style.chart.layout.labels.dataLabels.offsetX
).x || 0,
y: i(Le)(
t,
e.value.style.chart.layout.labels.dataLabels.offsetY,
e.value.style.chart.layout.labels.dataLabels.offsetY
),
fill: e.value.style.chart.layout.labels.dataLabels.useSerieColor ? t.color : e.value.style.chart.layout.labels.dataLabels.color,
"font-size": e.value.style.chart.layout.labels.dataLabels.fontSize,
"font-weight": e.value.style.chart.layout.labels.dataLabels.boldPercentage ? "bold" : "normal"
}, V(i(F)({
v: t.proportion * 100,
s: "%",
r: e.value.style.chart.layout.labels.dataLabels.roundingPercentage
})), 11, ml), [
[
at,
w.value.dataLabels.show && e.value.style.chart.layout.labels.dataLabels.showPercentage
]
]),
lt(m("text", {
class: R({ animated: e.value.useCssAnimation }),
opacity: pe(t) ? 1 : 0,
"text-anchor": i(X)(t, !0).anchor,
x: i(X)(
t,
!1,
e.value.style.chart.layout.labels.dataLabels.offsetX
).x || 0,
y: i(Le)(
t,
e.value.style.chart.layout.labels.dataLabels.offsetY,
e.value.style.chart.layout.labels.dataLabels.offsetY
) + e.value.style.chart.layout.labels.dataLabels.fontSize,
fill: e.value.style.chart.layout.labels.dataLabels.useSerieColor ? t.color : e.value.style.chart.layout.labels.dataLabels.color,
"font-size": e.value.style.chart.layout.labels.dataLabels.fontSize,
"font-weight": e.value.style.chart.layout.labels.dataLabels.boldValue ? "bold" : "normal"
}, " (" + V(i(J)(
e.value.style.chart.layout.labels.dataLabels.formatter,
t.value,
i(F)({
p: e.value.style.chart.layout.labels.dataLabels.prefix,
v: t.value,
s: e.value.style.chart.layout.labels.dataLabels.suffix,
r: e.value.style.chart.layout.labels.dataLabels.roundingValue
}),
{ datapoint: t, seriesIndex: o, datapointIndex: u }
)) + ") ", 11, $l), [
[
at,
w.value.dataLabels.show && e.value.style.chart.layout.labels.dataLabels.showPercentage && e.value.style.chart.layout.labels.dataLabels.showValue
]
]),
pe(t) && w.value.dataLabels.show && !e.value.style.chart.layout.labels.dataLabels.showPercentage && e.value.style.chart.layout.labels.dataLabels.showValue ? (n(), r("text", {
key: 0,
class: R({ animated: e.value.useCssAnimation }),
"text-anchor": i(X)(t, !0).anchor,
x: i(X)(
t,
!1,
e.value.style.chart.layout.labels.dataLabels.offsetX
).x || 0,
y: i(Le)(
t,
e.value.style.chart.layout.labels.dataLabels.offsetY,
e.value.style.chart.layout.labels.dataLabels.offsetY
),
fill: e.value.style.chart.layout.labels.dataLabels.useSerieColor ? t.color : e.value.style.chart.layout.labels.dataLabels.color,
"font-size": e.value.style.chart.layout.labels.dataLabels.fontSize,
"font-weight": e.value.style.chart.layout.labels.dataLabels.boldValue ? "bold" : "normal"
}, V(i(J)(
e.value.style.chart.layout.labels.dataLabels.formatter,
t.value,
i(F)({
p: e.value.style.chart.layout.labels.dataLabels.prefix,
v: t.value,
s: e.value.style.chart.layout.labels.dataLabels.suffix,
r: e.value.style.chart.layout.labels.dataLabels.roundingValue
}),
{ datapoint: t, seriesIndex: o, datapointIndex: u }
)), 11, wl)) : g("", !0)
], 8, gl))), 256))
]))), 256))
])) : g("", !0),
(n(!0), r(T, null, S(Z.value, (a, o) => (n(), r("g", null, [
(n(!0), r(T, null, S(a.donut, (t, u) => (n(), r("g", null, [
m("path", {
d: t.arcSlice,
fill: ft.value === o ? "rgba(0,0,0,0.1)" : "transparent",
onMouseenter: (c) => $t({
datapoint: t,
seriesIndex: t.seriesIndex
}),
onClick: (c) => gt({ datapoint: t, index: u }),
onMouseleave: s[0] || (s[0] = (c) => {
ne.value = !1, He.value = null, j.value = null, ee.value = null;
})
}, null, 40, kl)
]))), 256))
]))), 256)),
L(l.$slots, "svg", { svg: h.value }, void 0, !0)
], 14, al)) : g("", !0),
l.$slots.watermark ? (n(), r("div", _l, [
L(l.$slots, "watermark", E(G({ isPrinting: i(ze) || i(Me) })), void 0, !0)
])) : g("", !0),
K.value ? g("", !0) : (n(), U(Jt, {
key: 6,
config: {
type: "donut",
style: {
backgroundColor: e.value.style.chart.backgroundColor,
donut: {
color: "#CCCCCC"
}
}
}
}, null, 8, ["config"])),
tt(Wt, {
show: w.value.showTooltip && ne.value,
backgroundColor: e.value.style.chart.tooltip.backgroundColor,
color: e.value.style.chart.tooltip.color,
borderRadius: e.value.style.chart.tooltip.borderRadius,
borderColor: e.value.style.chart.tooltip.borderColor,
borderWidth: e.value.style.chart.tooltip.borderWidth,
fontSize: e.value.style.chart.tooltip.fontSize,
backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
position: e.value.style.chart.tooltip.position,
offsetY: e.value.style.chart.tooltip.offsetY,
parent: H.value,
content: re.value,
isFullscreen: B.value,
isCustom: i(ut)(e.value.style.chart.tooltip.customFormat)
}, {
"tooltip-before": _(() => [
L(l.$slots, "tooltip-before", E(G({ ...he.value })), void 0, !0)
]),
"tooltip-after": _(() => [
L(l.$slots, "tooltip-after", E(G({ ...he.value })), void 0, !0)
]),
_: 3
}, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
e.value.style.chart.legend.show ? (n(), r("div", {
key: 7,
ref_key: "chartLegend",
ref: ie,
class: R({ "vue-ui-nested-donuts-legend": ye.value.length > 1 })
}, [
(n(!0), r(T, null, S(ye.value, (a, o) => (n(), U(qt, {
key: `legend_${o}_${Ie.value}`,
legendSet: a,
config: wt.value,
onClickMarker: s[1] || (s[1] = ({ legend: t }) => ve(t))
}, {
legendTitle: _(({ titleSet: t }) => [
t[0] && t[0].arcOf ? (n(), r("div", Ll, V(t[0].arcOf), 1)) : g("", !0)
]),
item: _(({ legend: t, index: u }) => [
m("div", {
onClick: (c) => ve(t),
style: se(`opacity:${$.value.includes(t.id) ? 0.5 : 1}`)
}, [
ue(V(t.name) + ": " + V(i(J)(
e.value.style.chart.layout.labels.dataLabels.formatter,
t.value,
i(F)({
p: e.value.style.chart.layout.labels.dataLabels.prefix,
v: t.value,
s: e.value.style.chart.layout.labels.dataLabels.suffix,
r: e.value.style.chart.legend.roundingValue
}),
{ datapoint: t, seriesIndex: u }
)) + " ", 1),
$.value.includes(t.id) ? (n(), r(T, { key: 1 }, [
ue(" ( - % ) ")
], 64)) : (n(), r(T, { key: 0 }, [
ue(" (" + V(isNaN(t.value / t.total) ? "-" : i(F)({
v: t.value / t.total * 100,
s: "%",
r: e.value.style.chart.legend.roundingPercentage
})) + ") ", 1)
], 64))
], 12, xl)
]),
_: 2
}, 1032, ["legendSet", "config"]))), 128))
], 2)) : g("", !0),
e.value.style.chart.legend.show ? g("", !0) : (n(), r("div", {
key: 8,
ref_key: "chartLegend",
ref: ie
}, [
L(l.$slots, "legend", { legend: ye.value }, void 0, !0)
], 512)),
l.$slots.source ? (n(), r("div", {
key: 9,
ref_key: "source",
ref: Te,
dir: "auto"
}, [
L(l.$slots, "source", {}, void 0, !0)
], 512)) : g("", !0),
K.value ? (n(), U(Kt, {
key: 10,
hideDetails: "",
config: {
open: w.value.showTable,
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
}
}
}, {
content: _(() => [
(n(), U(Ht, {
key: `table_${Se.value}`,
colNames: te.value.colNames,
head: te.value.head,
body: te.value.body,
config: te.value.config,
title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
onClose: s[2] || (s[2] = (a) => w.value.showTable = !1)
}, {
th: _(({ th: a }) => [
m("div", {
innerHTML: a,
style: { display: "flex", "align-items": "center" }
}, null, 8, Cl)
]),
td: _(({ td: a }) => [
ue(V(a.name || a), 1)
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title"]))
]),
_: 1
}, 8, ["config"])) : g("", !0)
], 46, ll));
}
}, Yl = /* @__PURE__ */ tl(Tl, [["__scopeId", "data-v-3bc36ce2"]]);
export {
Yl as default
};