vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
740 lines (739 loc) • 31.8 kB
JavaScript
import { defineAsyncComponent as R, useSlots as it, ref as r, computed as f, toRefs as vt, watch as le, shallowRef as Ne, onMounted as ct, onBeforeUnmount as dt, createElementBlock as d, openBlock as i, unref as s, normalizeStyle as S, normalizeClass as B, createBlock as F, createCommentVNode as b, createElementVNode as $, createVNode as ae, createSlots as Le, withCtx as g, renderSlot as h, normalizeProps as D, guardReactiveProps as M, Fragment as oe, renderList as se, mergeProps as ht, Teleport as pt, toDisplayString as E, createTextVNode as gt, nextTick as ft } from "vue";
import { u as yt, c as Ve, t as mt, a as bt, p as P, b as kt, o as Re, f as ne, g as wt, d as Ct, G as $t, e as De, i as N, X as Tt, s as _t, x as xt, h as X, k as Me, v as At, w as Ft, y as It, z as Ot } from "./index-q-LPw2IT.js";
import { t as St, u as Pt } from "./useResponsive-DfdjqQps.js";
import { u as Nt } from "./usePrinter-DX7efa1s.js";
import { u as Lt, B as Vt } from "./useLoading-D7YHNtLX.js";
import { u as ze } from "./useNestedProp-04aFeUYu.js";
import { u as Rt } from "./useUserOptionState-BIvW1Kz7.js";
import { u as Dt } from "./useChartAccessibility-9icAAmYg.js";
import Mt from "./Legend-DcDSkq99.js";
import zt from "./Title-B55R8CAZ.js";
import { _ as Bt } from "./Shape-DHIaJs9G.js";
import Et from "./img-Ctts6JQb.js";
import { _ as Ut } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Wt = ["id"], Gt = ["id"], Ht = ["xmlns", "viewBox"], jt = ["width", "height"], Xt = ["id"], Yt = ["stop-color"], qt = ["stop-color"], Jt = { key: 1 }, Kt = ["stroke", "cx", "cy", "r", "fill"], Qt = ["stroke", "stroke-width", "cx", "cy", "r", "fill"], Zt = ["stroke", "stroke-width", "cx", "cy", "r", "fill"], el = ["cx", "cy", "r", "onMouseenter", "onMouseleave", "onClick"], tl = {
key: 4,
class: "vue-data-ui-watermark"
}, ll = ["id"], al = ["onClick"], ol = ["innerHTML"], sl = {
__name: "vue-ui-rings",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectLegend"],
setup(Be, { expose: Ee, emit: Ue }) {
const We = R(() => import("./vue-ui-accordion-D46i_gkB.js")), Ge = R(() => import("./DataTable-rj9-mAwF.js")), He = R(() => import("./PackageVersion-5ZjKSIei.js")), je = R(() => import("./PenAndPaper-BJ0hcgsa.js")), Xe = R(() => import("./Tooltip-BMOddG-M.js")), Ye = R(() => import("./UserOptions-DVzyjG-W.js")), { vue_ui_rings: qe } = yt(), Je = it(), k = Be, I = r(!1), ue = f(() => !!k.dataset && k.dataset.length), y = r(Ve()), Ke = r(null), U = r(!1), Y = r(""), T = r(null), re = r(0), _ = r(null), ie = r(null), ve = r(null), ce = r(null), de = r(null), he = r(0), pe = r(0), ge = r(0), q = r(!1), fe = r(!1), e = r(K()), { loading: O, FINAL_DATASET: ye, manualLoading: W } = Lt({
...vt(k),
FINAL_CONFIG: e,
prepareConfig: K,
skeletonDataset: [
{ name: "_", values: [13], color: "#808080" },
{ name: "_", values: [8], color: "#969696" },
{ name: "_", values: [5], color: "#ADADAD" },
{ name: "_", values: [3], color: "#C4C4C4" },
{ name: "_", values: [2], color: "#DBDBDB" }
],
skeletonConfig: mt({
defaultConfig: e.value,
userConfig: {
userOptions: { show: !1 },
table: { show: !1 },
style: {
chart: {
backgroundColor: "#99999930",
layout: {
rings: {
stroke: "#6A6A6A",
gradient: {
underlayerColor: "#FFFFFF"
}
}
},
legend: {
backgroundColor: "transparent"
}
}
}
}
})
}), { userOptionsVisible: J, setUserOptionsVisibility: me, keepUserOptionState: be } = Rt({ config: e.value }), { svgRef: ke } = Dt({ config: e.value.style.chart.title });
function K() {
const t = ze({
userConfig: k.config,
defaultConfig: qe
});
return t.theme ? {
...ze({
userConfig: kt.vue_ui_rings[t.theme] || k.config,
defaultConfig: t
}),
customPalette: bt[t.theme] || P
} : t;
}
le(() => k.config, (t) => {
O.value || (e.value = K()), J.value = !e.value.userOptions.showOnChartHover, we(), he.value += 1, pe.value += 1, ge.value += 1, w.value.showTable = e.value.table.show, w.value.showTooltip = e.value.style.chart.tooltip.show;
}, { deep: !0 }), le(() => k.dataset, (t) => {
Array.isArray(t) && t.length > 0 && (W.value = !1);
}, { deep: !0 });
const x = Ne(null), L = Ne(null);
ct(() => {
fe.value = !0, we();
});
const Q = f(() => !!e.value.debug);
function we() {
if (Re(k.dataset) ? (ne({
componentName: "VueUiRings",
type: "dataset",
debug: Q.value
}), W.value = !0) : k.dataset.forEach((t, a) => {
t.values.length || (ne({
componentName: "VueUiRings",
type: "dataset",
debug: Q.value
}), W.value = !0), wt({
datasetObject: t,
requiredAttributes: ["name", "values"]
}).forEach((l) => {
ne({
componentName: "VueUiRings",
type: "datasetSerieAttribute",
property: l,
index: a,
debug: Q.value
});
});
}), Re(k.dataset) || (W.value = e.value.loading), e.value.responsive) {
const t = St(() => {
q.value = !0;
const { width: a, height: l } = Pt({
chart: _.value,
title: e.value.style.chart.title.text ? ie.value : null,
legend: e.value.style.chart.legend.show ? ve.value : null,
source: ce.value,
noTitle: de.value
});
requestAnimationFrame(() => {
n.value.width = a, n.value.height = l - 12, q.value = !1;
});
});
x.value && (L.value && x.value.unobserve(L.value), x.value.disconnect()), x.value = new ResizeObserver(t), L.value = _.value.parentNode, x.value.observe(L.value);
}
setTimeout(() => {
I.value = !0;
}, 600);
}
dt(() => {
x.value && (L.value && x.value.unobserve(L.value), x.value.disconnect());
});
const { isPrinting: Ce, isImaging: $e, generatePdf: Te, generateImage: _e } = Nt({
elementId: `rings_${y.value}`,
fileName: e.value.style.chart.title.text || "vue-ui-rings",
options: e.value.userOptions.print
}), Qe = f(() => e.value.userOptions.show && !e.value.style.chart.title.text), xe = f(() => Ct(e.value.customPalette)), w = r({
showTable: e.value.table.show,
showTooltip: e.value.style.chart.tooltip.show
});
le(e, () => {
w.value = {
showTable: e.value.table.show,
showTooltip: e.value.style.chart.tooltip.show
};
}, { immediate: !0 });
const n = r({
height: 360,
width: 360
}), Ze = f(() => Math.min(n.value.height, n.value.width)), et = Ue, m = r([]);
function Z(t) {
m.value.includes(t) ? m.value = m.value.filter((a) => a !== t) : m.value.push(t), et("selectLegend", p.value.map((a) => ({
name: a.name,
color: a.color,
value: a.value
})));
}
const tt = f(() => Math.max(
...G.value.filter((t) => !m.value.includes(t.uid)).map(({ value: t }) => t)
));
function Ae(t) {
return t / tt.value;
}
const G = f(() => ye.value.map(({ values: t, name: a, color: l = null }, o) => {
const u = $t(t).reduce((v, z) => v + z, 0);
return {
name: a,
color: l || De(l) || xe.value[o] || P[o] || P[o % P.length],
value: u,
proportion: u / ye.value.map((v) => (v.values || []).reduce((z, rt) => z + rt, 0)).reduce((v, z) => v + z, 0),
uid: Ve(),
absoluteIndex: o
};
})), Fe = f(() => G.value.map((t) => ({
...t,
shape: "circle",
opacity: m.value.includes(t.uid) ? 0.5 : 1,
segregate: () => Z(t.uid),
isSegregated: m.value.includes(t.uid)
})).toSorted((t, a) => a.value - t.value)), lt = f(() => ({
cy: "rings-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" : ""
})), C = f(() => G.value.filter((t) => !m.value.includes(t.uid)).map(({ value: t }) => t).reduce((t, a) => t + a, 0)), p = f(() => G.value.filter((t) => !m.value.includes(t.uid)).map(({ name: t, value: a, color: l = null, uid: o, absoluteIndex: u }, v) => ({
absoluteIndex: u,
uid: o,
name: t,
color: l || De(l) || xe.value[v] || P[v] || P[v % P.length],
value: a,
proportion: Ae(a),
percentage: a / C.value * 100,
strokeWidth: e.value.style.chart.layout.rings.strokeWidth * Ae(a)
})).toSorted((t, a) => a.value - t.value));
function at() {
return p.value.map(
({ name: t, color: a, value: l, absoluteValues: o, percentage: u }) => ({
name: t,
color: a,
value: l,
absoluteValues: o,
percentage: u
})
);
}
const c = f(() => Ze.value - e.value.style.chart.layout.rings.strokeWidth * 2);
function ot(t, a) {
e.value.events.datapointClick && e.value.events.datapointClick({ datapoint: t, seriesIndex: a });
}
function st(t, a) {
T.value = null, U.value = !1, e.value.events.datapointLeave && e.value.events.datapointLeave({ datapoint: t, seriesIndex: a });
}
const ee = r(null);
function nt(t, a) {
if (e.value.events.datapointEnter && e.value.events.datapointEnter({ datapoint: t, seriesIndex: a }), m.value.length === k.dataset.length) return;
ee.value = {
datapoint: t,
seriesIndex: a,
series: p.value,
config: e.value
}, T.value = a;
const l = p.value[a], o = e.value.style.chart.tooltip.customFormat;
if (It(o) && Ot(() => o({
seriesIndex: a,
datapoint: t,
series: p.value,
config: e.value
})))
Y.value = o({
seriesIndex: a,
datapoint: t,
series: p.value,
config: e.value
});
else {
let u = "";
u += `<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>`, u += `<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}" />${Je.pattern ? `<circle cx="30" cy="30" r="30" stroke="none" fill="url(#pattern_${y.value}_${t.absoluteIndex})" />` : ""}</svg>`, e.value.style.chart.tooltip.showValue && (u += `<b>${Me(
e.value.style.chart.layout.labels.dataLabels.formatter,
l.value,
N({
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: t, seriesIndex: a }
)}
</b>`), e.value.style.chart.tooltip.showPercentage && (e.value.style.chart.tooltip.showValue ? u += `<span>(${N({
v: l.value / C.value * 100,
s: "%",
r: e.value.style.chart.tooltip.roundingPercentage
})})</span></div>` : u += `<b>${N({
v: l.value / C.value * 100,
s: "%",
r: e.value.style.chart.tooltip.roundingPercentage
})}</b></div>`), Y.value = u;
}
U.value = !0;
}
const A = f(() => {
const t = p.value.map((l) => ({
name: l.name,
color: l.color
})), a = p.value.map((l) => l.value);
return { head: t, body: a };
}), H = f(() => {
const t = [
' <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>',
N({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: C.value, s: e.value.style.chart.layout.labels.dataLabels.suffix, r: e.value.table.td.roundingValue }),
"100%"
], a = A.value.head.map((u, v) => [
{
color: u.color,
name: u.name
},
N({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: A.value.body[v], s: e.value.style.chart.layout.labels.dataLabels.suffix, r: e.value.table.td.roundingValue }),
isNaN(A.value.body[v] / C.value) ? "-" : (A.value.body[v] / C.value * 100).toFixed(e.value.table.td.roundingPercentage) + "%"
]), l = {
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
}, o = [
e.value.table.columnNames.series,
e.value.table.columnNames.value,
e.value.table.columnNames.percentage
];
return {
head: t,
body: a,
config: l,
colNames: o
};
});
function Ie(t = null) {
ft(() => {
const a = A.value.head.map((u, v) => [[
u.name
], [A.value.body[v]], [isNaN(A.value.body[v] / C.value) ? "-" : A.value.body[v] / C.value * 100]]), l = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(a), o = At(l);
t ? t(o) : Ft({ csvContent: o, title: e.value.style.chart.title.text || "vue-ui-rings" });
});
}
const V = r(!1);
function Oe(t) {
V.value = t, re.value += 1;
}
function Se() {
w.value.showTable = !w.value.showTable;
}
function Pe() {
w.value.showTooltip = !w.value.showTooltip;
}
const j = r(!1);
function te() {
j.value = !j.value;
}
async function ut({ scale: t = 2 } = {}) {
if (!_.value) return;
const { width: a, height: l } = _.value.getBoundingClientRect(), o = a / l, { imageUri: u, base64: v } = await Et({ domElement: _.value, base64: !0, img: !0, scale: t });
return {
imageUri: u,
base64: v,
title: e.value.style.chart.title.text,
width: a,
height: l,
aspectRatio: o
};
}
return Ee({
getData: at,
getImage: ut,
generatePdf: Te,
generateCsv: Ie,
generateImage: _e,
toggleTable: Se,
toggleTooltip: Pe,
toggleAnnotator: te,
toggleFullscreen: Oe
}), (t, a) => (i(), d("div", {
ref_key: "ringsChart",
ref: _,
class: B(`vue-ui-rings ${V.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
style: S(`font-family:${e.value.style.fontFamily};text-align:center;width:100%;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`),
id: `rings_${y.value}`,
onMouseleave: a[2] || (a[2] = (l) => {
T.value = null, U.value = !1, s(me)(!1);
}),
onMouseenter: a[3] || (a[3] = () => s(me)(!0))
}, [
e.value.userOptions.buttons.annotator ? (i(), F(s(je), {
key: 0,
svgRef: s(ke),
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
active: j.value,
onClose: te
}, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : b("", !0),
Qe.value ? (i(), d("div", {
key: 1,
ref_key: "noTitle",
ref: de,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : b("", !0),
e.value.style.chart.title.text ? (i(), d("div", {
key: 2,
ref_key: "chartTitle",
ref: ie,
style: "width:100%;background:transparent"
}, [
(i(), F(zt, {
key: `title_${he.value}`,
config: {
title: {
cy: "rings-div-title",
...e.value.style.chart.title
},
subtitle: {
cy: "rings-div-subtitle",
...e.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))
], 512)) : b("", !0),
$("div", {
id: `legend-top-${y.value}`
}, null, 8, Gt),
e.value.userOptions.show && ue.value && (s(be) || s(J)) ? (i(), F(s(Ye), {
ref_key: "details",
ref: Ke,
key: `user_options_${re.value}`,
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
isPrinting: s(Ce),
isImaging: s($e),
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,
hasFullscreen: e.value.userOptions.buttons.fullscreen,
isTooltip: w.value.showTooltip,
isFullscreen: V.value,
titles: { ...e.value.userOptions.buttonTitles },
chartElement: _.value,
position: e.value.userOptions.position,
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: j.value,
callbacks: e.value.userOptions.callbacks,
printScale: e.value.userOptions.print.scale,
onToggleFullscreen: Oe,
onGeneratePdf: s(Te),
onGenerateCsv: Ie,
onGenerateImage: s(_e),
onToggleTable: Se,
onToggleTooltip: Pe,
onToggleAnnotator: te,
style: S({
visibility: s(be) ? s(J) ? "visible" : "hidden" : "visible"
})
}, Le({ _: 2 }, [
t.$slots.menuIcon ? {
name: "menuIcon",
fn: g(({ isOpen: l, color: o }) => [
h(t.$slots, "menuIcon", D(M({ isOpen: l, color: o })), void 0, !0)
]),
key: "0"
} : void 0,
t.$slots.optionTooltip ? {
name: "optionTooltip",
fn: g(() => [
h(t.$slots, "optionTooltip", {}, void 0, !0)
]),
key: "1"
} : void 0,
t.$slots.optionPdf ? {
name: "optionPdf",
fn: g(() => [
h(t.$slots, "optionPdf", {}, void 0, !0)
]),
key: "2"
} : void 0,
t.$slots.optionCsv ? {
name: "optionCsv",
fn: g(() => [
h(t.$slots, "optionCsv", {}, void 0, !0)
]),
key: "3"
} : void 0,
t.$slots.optionImg ? {
name: "optionImg",
fn: g(() => [
h(t.$slots, "optionImg", {}, void 0, !0)
]),
key: "4"
} : void 0,
t.$slots.optionTable ? {
name: "optionTable",
fn: g(() => [
h(t.$slots, "optionTable", {}, void 0, !0)
]),
key: "5"
} : void 0,
t.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: g(({ toggleFullscreen: l, isFullscreen: o }) => [
h(t.$slots, "optionFullscreen", D(M({ toggleFullscreen: l, isFullscreen: o })), void 0, !0)
]),
key: "6"
} : void 0,
t.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: g(({ toggleAnnotator: l, isAnnotator: o }) => [
h(t.$slots, "optionAnnotator", D(M({ toggleAnnotator: l, isAnnotator: o })), void 0, !0)
]),
key: "7"
} : void 0
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasFullscreen", "isTooltip", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "onGeneratePdf", "onGenerateImage", "style"])) : b("", !0),
(i(), d("svg", {
ref_key: "svgRef",
ref: ke,
xmlns: s(Tt),
class: B({ "vue-data-ui-fullscreen--on": V.value, "vue-data-ui-fulscreen--off": !V.value, resizing: q.value || s(O) }),
viewBox: `0 0 ${n.value.width <= 0 ? 10 : n.value.width} ${n.value.height <= 0 ? 10 : n.value.height}`,
style: S(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`)
}, [
ae(s(He)),
t.$slots["chart-background"] ? (i(), d("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"
}
}, [
h(t.$slots, "chart-background", {}, void 0, !0)
], 8, jt)) : b("", !0),
$("defs", null, [
(i(!0), d(oe, null, se(p.value, (l, o) => (i(), d("radialGradient", {
cx: "50%",
cy: "30%",
r: "50%",
fx: "50%",
fy: "50%",
id: `gradient_${y.value}_${o}`
}, [
$("stop", {
offset: "0%",
"stop-color": s(_t)(s(xt)(l.color, 0.05), 100 - e.value.style.chart.layout.rings.gradient.intensity)
}, null, 8, Yt),
$("stop", {
offset: "100%",
"stop-color": l.color
}, null, 8, qt)
], 8, Xt))), 256))
]),
t.$slots.pattern ? (i(), d("g", Jt, [
(i(!0), d(oe, null, se(p.value, (l) => (i(), d("defs", null, [
h(t.$slots, "pattern", ht({ ref_for: !0 }, { seriesIndex: l.absoluteIndex, patternId: `pattern_${y.value}_${l.absoluteIndex}` }), void 0, !0)
]))), 256))
])) : b("", !0),
(i(!0), d(oe, null, se(p.value, (l, o) => (i(), d("g", null, [
$("circle", {
class: B({
"vue-ui-rings-item": I.value && e.value.useCssAnimation,
"vue-rings-item-onload": !I.value && e.value.useCssAnimation && !s(O),
"vue-ui-rings-opacity": T.value !== null && T.value !== o
}),
style: S(`animation-delay:${o * 100}ms`),
stroke: e.value.style.chart.layout.rings.stroke,
cx: n.value.width / 2,
cy: o === 0 ? n.value.height / 2 : n.value.height / 2 + c.value * p.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (o + 1),
r: s(X)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
fill: e.value.style.chart.layout.rings.gradient.underlayerColor
}, null, 14, Kt),
$("circle", {
class: B({
"vue-ui-rings-item": I.value && e.value.useCssAnimation,
"vue-rings-item-onload": !I.value && e.value.useCssAnimation && !s(O),
"vue-ui-rings-shadow": e.value.style.chart.layout.rings.useShadow,
"vue-ui-rings-blur": T.value !== null && T.value !== o
}),
style: S(`animation-delay:${o * 100}ms`),
stroke: e.value.style.chart.layout.rings.stroke,
"stroke-width": l.strokeWidth < 0.5 ? 0.5 : l.strokeWidth,
cx: n.value.width / 2,
cy: o === 0 ? n.value.height / 2 : n.value.height / 2 + c.value * p.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (o + 1),
r: s(X)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
fill: e.value.style.chart.layout.rings.gradient.show ? `url(#gradient_${y.value}_${o})` : l.color
}, null, 14, Qt),
t.$slots.pattern ? (i(), d("circle", {
key: 0,
class: B({
"vue-ui-rings-item": I.value && e.value.useCssAnimation,
"vue-rings-item-onload": !I.value && e.value.useCssAnimation && !s(O),
"vue-ui-rings-shadow": e.value.style.chart.layout.rings.useShadow,
"vue-ui-rings-blur": T.value !== null && T.value !== o
}),
style: S(`animation-delay:${o * 100}ms`),
stroke: e.value.style.chart.layout.rings.stroke,
"stroke-width": l.strokeWidth < 0.5 ? 0.5 : l.strokeWidth,
cx: n.value.width / 2,
cy: o === 0 ? n.value.height / 2 : n.value.height / 2 + c.value * p.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (o + 1),
r: s(X)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
fill: `url(#pattern_${y.value}_${l.absoluteIndex})`
}, null, 14, Zt)) : b("", !0),
$("circle", {
stroke: "none",
cx: n.value.width / 2,
cy: o === 0 ? n.value.height / 2 : n.value.height / 2 + c.value * p.value[0].proportion / 2 - c.value * l.proportion / 2 - 2 * (o + 1),
r: s(X)(c.value * l.proportion / 2 * 0.9 <= 0 ? 1e-4 : c.value * l.proportion / 2 * 0.9),
fill: "transparent",
onMouseenter: (u) => nt(l, o),
onMouseleave: (u) => st(l, o),
onClick: (u) => ot(l, o)
}, null, 40, el)
]))), 256)),
h(t.$slots, "svg", { svg: n.value }, void 0, !0)
], 14, Ht)),
t.$slots.watermark ? (i(), d("div", tl, [
h(t.$slots, "watermark", D(M({ isPrinting: s(Ce) || s($e) })), void 0, !0)
])) : b("", !0),
$("div", {
id: `legend-bottom-${y.value}`
}, null, 8, ll),
fe.value ? (i(), F(pt, {
key: 5,
to: e.value.style.chart.legend.position === "top" ? `#legend-top-${y.value}` : `#legend-bottom-${y.value}`
}, [
$("div", {
ref_key: "chartLegend",
ref: ve
}, [
e.value.style.chart.legend.show ? (i(), F(Mt, {
key: `legend_${ge.value}`,
legendSet: Fe.value,
config: lt.value,
onClickMarker: a[0] || (a[0] = ({ legend: l }) => Z(l.uid))
}, Le({
item: g(({ legend: l, index: o }) => [
s(O) ? b("", !0) : (i(), d("div", {
key: 0,
onClick: (u) => Z(l.uid),
style: S(`opacity:${m.value.includes(l.uid) ? 0.5 : 1}`)
}, E(l.name) + E(e.value.style.chart.legend.showPercentage || e.value.style.chart.legend.showValue ? ":" : "") + " " + E(e.value.style.chart.legend.showValue ? s(Me)(
e.value.style.chart.layout.labels.dataLabels.formatter,
l.value,
s(N)({
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, seriesIndex: o }
) : "") + " " + E(e.value.style.chart.legend.showPercentage ? m.value.includes(l.uid) ? `${e.value.style.chart.legend.showValue ? "(" : ""}- %${e.value.style.chart.legend.showValue ? ")" : ""}` : `${e.value.style.chart.legend.showValue ? "(" : ""}${isNaN(l.value / C.value) ? "-" : s(N)({
v: l.value / C.value * 100,
s: "%",
r: e.value.style.chart.legend.roundingPercentage
})}${e.value.style.chart.legend.showValue ? ")" : ""}` : ""), 13, al))
]),
_: 2
}, [
t.$slots.pattern ? {
name: "legend-pattern",
fn: g(({ legend: l, index: o }) => [
ae(Bt, {
shape: l.shape,
radius: 30,
stroke: "none",
plot: { x: 30, y: 30 },
fill: `url(#pattern_${y.value}_${o})`
}, null, 8, ["shape", "fill"])
]),
key: "0"
} : void 0
]), 1032, ["legendSet", "config"])) : h(t.$slots, "legend", {
key: 1,
legend: Fe.value
}, void 0, !0)
], 512)
], 8, ["to"])) : b("", !0),
t.$slots.source ? (i(), d("div", {
key: 6,
ref_key: "source",
ref: ce,
dir: "auto"
}, [
h(t.$slots, "source", {}, void 0, !0)
], 512)) : b("", !0),
ae(s(Xe), {
show: w.value.showTooltip && U.value && m.value.length < k.dataset.length,
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: _.value,
content: Y.value,
isFullscreen: V.value,
isCustom: e.value.style.chart.tooltip.customFormat && typeof e.value.style.chart.tooltip.customFormat == "function",
smooth: e.value.style.chart.tooltip.smooth,
backdropFilter: e.value.style.chart.tooltip.backdropFilter
}, {
"tooltip-before": g(() => [
h(t.$slots, "tooltip-before", D(M({ ...ee.value })), void 0, !0)
]),
"tooltip-after": g(() => [
h(t.$slots, "tooltip-after", D(M({ ...ee.value })), void 0, !0)
]),
_: 3
}, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom", "smooth", "backdropFilter"]),
ue.value ? (i(), F(s(We), {
key: 7,
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: g(() => [
(i(), F(s(Ge), {
key: `table_${pe.value}`,
colNames: H.value.colNames,
head: H.value.head,
body: H.value.body,
config: H.value.config,
title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
onClose: a[1] || (a[1] = (l) => w.value.showTable = !1)
}, {
th: g(({ th: l }) => [
$("div", {
innerHTML: l,
style: { display: "flex", "align-items": "center" }
}, null, 8, ol)
]),
td: g(({ td: l }) => [
gt(E(l.name || l), 1)
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title"]))
]),
_: 1
}, 8, ["config"])) : b("", !0),
s(O) ? (i(), F(Vt, { key: 8 })) : b("", !0)
], 46, Wt));
}
}, bl = /* @__PURE__ */ Ut(sl, [["__scopeId", "data-v-1b4eaf1a"]]);
export {
bl as default
};