UNPKG

vue-data-ui

Version:

A user-empowering data visualization Vue 3 components library for eloquent data storytelling

1,060 lines (1,059 loc) 54.4 kB
import { useSlots as vt, computed as _, ref as d, onMounted as ct, onBeforeUnmount as dt, watch as Ue, createElementBlock as u, openBlock as o, unref as n, normalizeStyle as z, normalizeClass as de, createBlock as R, createCommentVNode as i, renderSlot as g, createElementVNode as p, createVNode as he, createSlots as je, withCtx as x, normalizeProps as H, guardReactiveProps as E, Fragment as b, renderList as F, mergeProps as We, toDisplayString as C, createTextVNode as He, nextTick as ht } from "vue"; import { u as yt, o as ft, e as Ee, g as pt, c as gt, b as bt, d as qe, p as U, m as mt, H as wt, f as O, X as kt, s as Z, w as _t, j as xt, I as L, i as A, k as ee, n as w, t as $t, a as Ct, q as Pt, r as St, x as Ft } from "./index-CHWA6Lnw.js"; import { t as Lt, u as Tt } from "./useResponsive-vZgZwV-S.js"; import { _ as zt } from "./Title-BwZtefYd.js"; import { u as Ot, U as Yt } from "./usePrinter-DibtVl2x.js"; import { D as At } from "./DataTable-B4YF6guk.js"; import { _ as Nt } from "./Tooltip-eCCz9HFo.js"; import { L as Xt } from "./Legend-BMXzxIhA.js"; import It from "./vue-ui-skeleton-BSUFPx4a.js"; import Dt from "./vue-ui-accordion-gHGrRoVr.js"; import { u as Je } from "./useNestedProp-ByBiJC9_.js"; import { _ as Mt } from "./PackageVersion-DcMafJMi.js"; import { P as Bt } from "./PenAndPaper-ljJaW1FE.js"; import { u as Vt } from "./useUserOptionState-BIvW1Kz7.js"; import { _ as Gt } from "./Shape-Bs9E3f4-.js"; import { u as Rt } from "./useChartAccessibility-BWojgys7.js"; import { _ as Ut } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const jt = ["id"], Wt = ["xmlns", "viewBox"], Ht = ["width", "height"], Et = { key: 1 }, qt = ["id"], Jt = ["stop-color"], Kt = ["offset", "stop-color"], Qt = ["offset", "stop-color"], Zt = ["stop-color"], el = { key: 2 }, tl = ["id", "cx", "cy"], ll = ["stop-color", "stop-opacity"], al = ["stop-color"], ol = ["id"], ul = ["id"], sl = ["id"], nl = ["flood-color"], rl = ["id"], il = ["flood-color"], vl = ["d", "stroke", "filter"], cl = ["x1", "y1", "x2", "y2", "stroke", "filter"], dl = ["cx", "cy", "r", "fill", "filter"], hl = { key: 6 }, yl = ["stroke", "d"], fl = { key: 0 }, pl = ["d", "fill", "stroke", "stroke-width", "filter"], gl = ["d", "fill", "stroke", "stroke-width", "filter"], bl = { key: 0 }, ml = ["stroke", "d"], wl = { key: 0 }, kl = ["d", "stroke", "stroke-width", "filter"], _l = { key: 1 }, xl = ["d", "fill", "stroke", "stroke-width", "filter"], $l = ["d", "fill", "stroke", "stroke-width", "filter"], Cl = { key: 1 }, Pl = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], Sl = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], Fl = ["cx", "cy", "r", "stroke"], Ll = ["cx", "cy", "r", "fill"], Tl = { key: 0 }, zl = ["d", "fill", "onMouseenter", "onClick"], Ol = { key: 1 }, Yl = ["cx", "cy", "r", "fill"], Al = ["x", "y", "fill", "font-size"], Nl = ["x", "y", "fill", "font-size"], Xl = ["x", "y", "fill", "font-size"], Il = ["x", "y", "fill", "font-size"], Dl = ["filter"], Ml = { key: 0 }, Bl = ["x", "y"], Vl = { key: 1 }, Gl = ["cx", "cy", "fill", "stroke", "filter", "onClick"], Rl = ["cx", "cy", "fill", "stroke", "filter", "onClick"], Ul = ["text-anchor", "x", "y", "fill", "font-size", "onClick"], jl = ["text-anchor", "x", "y", "fill", "font-size", "onClick"], Wl = ["text-anchor", "x", "y", "fill", "font-size", "onClick"], Hl = ["text-anchor", "x", "y", "fill", "font-size", "onClick"], El = { key: 2 }, ql = ["x", "y", "width"], Jl = ["x", "y", "width"], Kl = { key: 5, class: "vue-data-ui-watermark" }, Ql = ["onClick"], Zl = { key: 0, style: { "font-variant-numeric": "tabular-nums" } }, ea = { key: 1 }, ta = ["innerHTML"], la = { __name: "vue-ui-donut", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Array, default() { return []; } } }, emits: ["selectLegend", "selectDatapoint"], setup(Ke, { expose: Qe, emit: Ze }) { const { vue_ui_donut: et } = yt(), tt = vt(), N = Ke, q = _({ get() { return !!N.dataset && N.dataset.length; }, set(l) { return l; } }), J = d(null), ye = d(null), fe = d(null), te = d(null), pe = d(null), ge = d(null), be = d(0), me = d(0), we = d(0); ct(() => { ke(); }), dt(() => { te.value && te.value.disconnect(); }); function ke() { if (ft(N.dataset) ? Ee({ componentName: "VueUiDonut", type: "dataset" }) : N.dataset.forEach((l, r) => { pt({ datasetObject: l, requiredAttributes: ["name", "values"] }).forEach((t) => { q.value = !1, Ee({ componentName: "VueUiDonut", type: "datasetSerieAttribute", property: t, index: r }); }); }), e.value.responsive) { const l = Lt(() => { const { width: r, height: t } = Tt({ chart: J.value, title: e.value.style.chart.title.text ? ye.value : null, legend: e.value.style.chart.legend.show ? fe.value : null, source: pe.value, noTitle: ge.value }); requestAnimationFrame(() => { s.value.width = r, s.value.height = t; }); }); te.value = new ResizeObserver(l), te.value.observe(J.value.parentNode); } } const y = d(gt()), lt = d(null), le = d(!1), ue = d(""), P = d(null), _e = d(0); function xe() { const l = Je({ userConfig: N.config, defaultConfig: et }); return l.theme ? { ...Je({ userConfig: Ct.vue_ui_donut[l.theme] || N.config, defaultConfig: l }), customPalette: $t[l.theme] || U } : l; } const e = _({ get: () => xe(), set: (l) => l }), { userOptionsVisible: se, setUserOptionsVisibility: $e, keepUserOptionState: Ce } = Vt({ config: e.value }), { svgRef: ne } = Rt({ config: e.value.style.chart.title }); Ue(() => N.config, (l) => { e.value = xe(), se.value = !e.value.userOptions.showOnChartHover, ke(), be.value += 1, me.value += 1, we.value += 1, f.value.dataLabels.show = e.value.style.chart.layout.labels.dataLabels.show, f.value.showTable = e.value.table.show, f.value.showTooltip = e.value.style.chart.tooltip.show; }, { deep: !0 }); const { isPrinting: Pe, isImaging: Se, generatePdf: Fe, generateImage: Le } = Ot({ elementId: `donut__${y.value}`, fileName: e.value.style.chart.title.text || "vue-ui-donut" }), at = _(() => e.value.userOptions.show && !e.value.style.chart.title.text), Te = _(() => bt(e.value.customPalette)), f = d({ dataLabels: { show: e.value.style.chart.layout.labels.dataLabels.show }, showTable: e.value.table.show, showTooltip: e.value.style.chart.tooltip.show }), s = d({ height: 360, width: 512 }), K = _(() => { const l = e.value.style.chart.layout.donut.strokeWidth / 512, r = s.value.width * l, t = r > $.value ? $.value : r; return t < 24 ? 24 : t; }), ze = Ze, B = _(() => N.dataset.map((l, r) => ({ name: l.name, color: qe(l.color) || Te.value[r] || U[r] || U[r % U.length], value: l.values.reduce((t, a) => t + a, 0), absoluteValues: l.values, comment: l.comment || "", patternIndex: r }))), T = d(B.value); Ue(() => B.value, (l) => T.value = l); function ot() { return B.value.map((l) => ({ name: l.name, color: l.color, value: l.value })); } const X = d([]), Oe = d(null), Ye = d(null), V = d(!1); function Ae(l) { const r = B.value.find((v, m) => m === l), t = T.value.find((v, m) => m === l); let a = t.value; if (X.value.includes(l)) { let m = function() { a > v ? (cancelAnimationFrame(Oe.value), T.value = T.value.map((k, ce) => l === ce ? { ...k, value: v } : k), V.value = !1) : (V.value = !0, a += v * 0.025, T.value = T.value.map((k, ce) => l === ce ? { ...k, value: a } : k), Oe.value = requestAnimationFrame(m)); }; X.value = X.value.filter((k) => k !== l); const v = r.value; m(); } else if (X.value.length < B.value.length - 1) { let v = function() { a < t.value / 100 ? (cancelAnimationFrame(Ye.value), X.value.push(l), T.value = T.value.map((m, k) => l === k ? { ...m, value: 0 } : m), V.value = !1) : (V.value = !0, a /= 1.1, T.value = T.value.map((m, k) => l === k ? { ...m, value: a } : m), Ye.value = requestAnimationFrame(v)); }; v(); } ze("selectLegend", I.value.map((v) => ({ name: v.name, color: v.color, value: v.value }))); } const I = _(() => (T.value.forEach((l, r) => { if ([null, void 0].includes(l.values)) return { ...l, values: [] }; }), T.value.map((l, r) => ({ ...l, seriesIndex: r })).filter((l, r) => !X.value.includes(r)))), Ne = _(() => N.dataset.map((l, r) => ({ name: l.name, color: qe(l.color) || Te.value[r] || U[r] || U[r % U.length], value: (l.values || []).reduce((t, a) => t + a, 0), shape: "circle", patternIndex: r })).map((l, r) => ({ ...l, proportion: l.value / N.dataset.map((t) => (t.values || []).reduce((a, v) => a + v, 0)).reduce((t, a) => t + a, 0), opacity: X.value.includes(r) ? 0.5 : 1, segregate: () => !V.value && Ae(r), isSegregated: X.value.includes(r) }))), ut = _(() => ({ 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" : "" })), $ = _(() => { const l = Math.min(s.value.width / 3, s.value.height / 3); return l < 55 ? 55 : l; }), h = _(() => mt({ series: I.value }, s.value.width / 2, s.value.height / 2, $.value, $.value, 1.99999, 2, 1, 360, 105.25, K.value)), c = _(() => { const l = Math.max(...I.value.map((t) => t.value)), r = I.value.map((t) => t.value / l); return wt({ series: r, center: { x: s.value.width / 2, y: s.value.height / 2 }, maxRadius: Math.min(s.value.width, s.value.height) / 3 }); }); function j(l) { return l.x > s.value.width / 2 + 6 ? "start" : l.x < s.value.width / 2 - 6 ? "end" : "middle"; } function st(l) { return l.middlePoint.y > s.value.height / 2 ? L({ initX: l.middlePoint.x, initY: l.middlePoint.y, offset: 100, centerX: s.value.width / 2, centerY: s.value.height / 2 }).y : L({ initX: l.middlePoint.x, initY: l.middlePoint.y, offset: 0, centerX: s.value.width / 2, centerY: s.value.height / 2 }).y - 100; } function Y(l) { return l.proportion * 100 > e.value.style.chart.layout.labels.dataLabels.hideUnderValue; } function re(l, r) { const t = l.value / nt(r); return isNaN(t) ? 0 : A( e.value.style.chart.layout.labels.percentage.formatter, t * 100, O({ v: t * 100, s: "%", r: e.value.style.chart.layout.labels.percentage.rounding }), { datapoint: l } ); } function nt(l) { return [...l].map((r) => r.value).reduce((r, t) => r + t, 0); } const S = _(() => I.value.map((l) => l.value).reduce((l, r) => l + r, 0)), Xe = _(() => S.value / I.value.length), Ie = _(() => (l) => V.value ? l.proportion * 100 : l.value / S.value * 100), ie = d(null), Q = d(!1); function De({ datapoint: l, relativeIndex: r, seriesIndex: t, show: a = !1 }) { ie.value = { datapoint: l, seriesIndex: t, config: e.value, series: B.value }, le.value = a, P.value = r; let v = ""; const m = e.value.style.chart.tooltip.customFormat; if (Q.value = !1, Ft(m)) try { const k = m({ seriesIndex: t, datapoint: l, series: B.value, config: e.value }); typeof k == "string" && (ue.value = k, Q.value = !0); } catch { console.warn("Custom format cannot be applied."), Q.value = !1; } if (!Q.value) { if (v += `<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>`, v += `<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}"/>${tt.pattern ? `<circle cx="30" cy="30" r="30" stroke="none" fill="url(#pattern_${y.value}_${t})"/>` : ""}</svg>`, e.value.style.chart.tooltip.showValue && (v += `<b>${A( e.value.style.chart.layout.labels.value.formatter, l.value, O({ 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: r, seriesIndex: t } )}</b>`), e.value.style.chart.tooltip.showPercentage) { const k = A( e.value.style.chart.layout.labels.percentage.formatter, l.proportion * 100, O({ v: l.proportion * 100, s: "%", r: e.value.style.chart.tooltip.roundingPercentage }), { datapoint: l, relativeIndex: r, seriesIndex: t } ); e.value.style.chart.tooltip.showValue ? v += `<span>(${k})</span></div>` : v += `<b>${k}</b></div>`; } e.value.style.chart.comments.showInTooltip && l.comment && (v += `<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>`), ue.value = `<div>${v}</div>`; } } function G(l) { return e.value.useBlurOnHover && ![null, void 0].includes(P.value) && P.value !== l ? `url(#blur_${y.value})` : ""; } const D = _(() => { const l = I.value.map((t) => ({ name: t.name, color: t.color })), r = I.value.map((t) => t.value); return { head: l, body: r }; }); function Me() { ht(() => { const l = D.value.head.map((a, v) => [[ a.name ], [D.value.body[v]], [isNaN(D.value.body[v] / S.value) ? "-" : D.value.body[v] / S.value * 100]]), r = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(l), t = Pt(r); St({ csvContent: t, title: e.value.style.chart.title.text || "vue-ui-donut" }); }); } const ae = _(() => { 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>', O({ p: e.value.style.chart.layout.labels.dataLabels.prefix, v: S.value, s: e.value.style.chart.layout.labels.dataLabels.suffix, r: e.value.table.td.roundingValue }), "100%" ], r = D.value.head.map((v, m) => [ { color: v.color, name: v.name }, D.value.body[m], isNaN(D.value.body[m] / S.value) ? "-" : (D.value.body[m] / S.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: r, config: t }; }), W = d(!1); function rt(l) { W.value = l, _e.value += 1; } const Be = _(() => /^((?!chrome|android).)*safari/i.test(navigator.userAgent)); function it(l) { return l.toFixed(e.value.style.chart.legend.roundingPercentage).split("").map((r) => "-").join(""); } function M(l, r) { ze("selectDatapoint", { datapoint: l, index: r }); } function Ve() { f.value.showTable = !f.value.showTable; } function Ge() { f.value.dataLabels.show = !f.value.dataLabels.show; } function Re() { f.value.showTooltip = !f.value.showTooltip; } const oe = d(!1); function ve() { oe.value = !oe.value; } return Qe({ getData: ot, generatePdf: Fe, generateCsv: Me, generateImage: Le, toggleTable: Ve, toggleLabels: Ge, toggleTooltip: Re, toggleAnnotator: ve }), (l, r) => (o(), u("div", { ref_key: "donutChart", ref: J, class: de(`vue-ui-donut ${W.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`), style: z(`font-family:${e.value.style.fontFamily};width:100%; ${e.value.responsive ? "height:100%;" : ""} text-align:center;background:${e.value.style.chart.backgroundColor}`), id: `donut__${y.value}`, onMouseenter: r[6] || (r[6] = () => n($e)(!0)), onMouseleave: r[7] || (r[7] = () => n($e)(!1)) }, [ e.value.userOptions.buttons.annotator && n(ne) ? (o(), R(Bt, { key: 0, color: e.value.style.chart.color, backgroundColor: e.value.style.chart.backgroundColor, active: oe.value, svgRef: n(ne), onClose: ve }, null, 8, ["color", "backgroundColor", "active", "svgRef"])) : i("", !0), g(l.$slots, "userConfig", {}, void 0, !0), at.value ? (o(), u("div", { key: 1, ref_key: "noTitle", ref: ge, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : i("", !0), e.value.style.chart.title.text ? (o(), u("div", { key: 2, ref_key: "chartTitle", ref: ye, style: "width:100%;background:transparent;padding-bottom:24px" }, [ (o(), R(zt, { key: `title_${be.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)) : i("", !0), e.value.userOptions.show && q.value && (n(Ce) || n(se)) ? (o(), R(Yt, { ref_key: "details", ref: lt, key: `user_option_${_e.value}`, backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, isPrinting: n(Pe), isImaging: n(Se), uid: y.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, 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: W.value, chartElement: J.value, position: e.value.userOptions.position, isTooltip: f.value.showTooltip, titles: { ...e.value.userOptions.buttonTitles }, hasAnnotator: e.value.userOptions.buttons.annotator, isAnnotation: oe.value, onToggleFullscreen: rt, onGeneratePdf: n(Fe), onGenerateCsv: Me, onGenerateImage: n(Le), onToggleTable: Ve, onToggleLabels: Ge, onToggleTooltip: Re, onToggleAnnotator: ve, style: z({ visibility: n(Ce) ? n(se) ? "visible" : "hidden" : "visible" }) }, je({ _: 2 }, [ l.$slots.menuIcon ? { name: "menuIcon", fn: x(({ isOpen: t, color: a }) => [ g(l.$slots, "menuIcon", H(E({ isOpen: t, color: a })), void 0, !0) ]), key: "0" } : void 0, l.$slots.optionTooltip ? { name: "optionTooltip", fn: x(() => [ g(l.$slots, "optionTooltip", {}, void 0, !0) ]), key: "1" } : void 0, l.$slots.optionPdf ? { name: "optionPdf", fn: x(() => [ g(l.$slots, "optionPdf", {}, void 0, !0) ]), key: "2" } : void 0, l.$slots.optionCsv ? { name: "optionCsv", fn: x(() => [ g(l.$slots, "optionCsv", {}, void 0, !0) ]), key: "3" } : void 0, l.$slots.optionImg ? { name: "optionImg", fn: x(() => [ g(l.$slots, "optionImg", {}, void 0, !0) ]), key: "4" } : void 0, l.$slots.optionTable ? { name: "optionTable", fn: x(() => [ g(l.$slots, "optionTable", {}, void 0, !0) ]), key: "5" } : void 0, l.$slots.optionLabels ? { name: "optionLabels", fn: x(() => [ g(l.$slots, "optionLabels", {}, void 0, !0) ]), key: "6" } : void 0, l.$slots.optionFullscreen ? { name: "optionFullscreen", fn: x(({ toggleFullscreen: t, isFullscreen: a }) => [ g(l.$slots, "optionFullscreen", H(E({ toggleFullscreen: t, isFullscreen: a })), void 0, !0) ]), key: "7" } : void 0, l.$slots.optionAnnotator ? { name: "optionAnnotator", fn: x(({ toggleAnnotator: t, isAnnotator: a }) => [ g(l.$slots, "optionAnnotator", H(E({ toggleAnnotator: t, isAnnotator: a })), void 0, !0) ]), key: "8" } : void 0 ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasLabel", "hasFullscreen", "isFullscreen", "chartElement", "position", "isTooltip", "titles", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : i("", !0), q.value ? (o(), u("svg", { key: 4, ref_key: "svgRef", ref: ne, xmlns: n(kt), class: de({ "vue-data-ui-fullscreen--on": W.value, "vue-data-ui-fulscreen--off": !W.value }), viewBox: `0 0 ${s.value.width <= 0 ? 10 : s.value.width} ${s.value.height <= 0 ? 10 : s.value.height}`, style: z(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color}`) }, [ he(Mt), l.$slots["chart-background"] ? (o(), u("foreignObject", { key: 0, x: 0, y: 0, width: s.value.width <= 0 ? 10 : s.value.width, height: s.value.height <= 0 ? 10 : s.value.height, style: { pointerEvents: "none" } }, [ g(l.$slots, "chart-background", {}, void 0, !0) ], 8, Ht)) : i("", !0), e.value.type === "classic" ? (o(), u("defs", Et, [ e.value.style.chart.useGradient ? (o(), u("radialGradient", { key: 0, id: `gradient_${y.value}` }, [ p("stop", { offset: "0%", "stop-color": n(Z)(e.value.style.chart.backgroundColor, 0), "stop-opacity": "0" }, null, 8, Jt), p("stop", { offset: `${(1 - K.value / $.value) * 100}%`, "stop-color": n(Z)("#FFFFFF", 0), "stop-opacity": "0" }, null, 8, Kt), p("stop", { offset: `${(1 - K.value / $.value / 2) * 100}%`, "stop-color": n(Z)("#FFFFFF", e.value.style.chart.gradientIntensity) }, null, 8, Qt), p("stop", { offset: "100%", "stop-color": n(Z)(e.value.style.chart.backgroundColor, 0), "stop-opacity": "0" }, null, 8, Zt) ], 8, qt)) : i("", !0) ])) : i("", !0), e.value.type === "polar" ? (o(), u("defs", el, [ (o(!0), u(b, null, F(c.value, (t, a) => (o(), u("radialGradient", { id: `polar_gradient_${a}_${y.value}`, cx: t.middlePoint.x / s.value.width * 100 + "%", cy: t.middlePoint.y / s.value.height * 100 + "%", r: "62%" }, [ p("stop", { offset: "0%", "stop-color": n(_t)(h.value[a].color, 0.05), "stop-opacity": e.value.style.chart.gradientIntensity / 100 }, null, 8, ll), p("stop", { offset: "100%", "stop-color": h.value[a].color }, null, 8, al) ], 8, tl))), 256)) ])) : i("", !0), p("defs", null, [ p("filter", { id: `blur_${y.value}`, x: "-50%", y: "-50%", width: "200%", height: "200%" }, [ p("feGaussianBlur", { in: "SourceGraphic", stdDeviation: 2, id: `blur_std_${y.value}` }, null, 8, ul), r[8] || (r[8] = p("feColorMatrix", { type: "saturate", values: "0" }, null, -1)) ], 8, ol), p("filter", { id: `shadow_${y.value}`, "color-interpolation-filters": "sRGB" }, [ p("feDropShadow", { dx: "0", dy: "0", stdDeviation: "10", "flood-opacity": "0.5", "flood-color": e.value.style.chart.layout.donut.shadowColor }, null, 8, nl) ], 8, sl), p("filter", { id: `drop_shadow_${y.value}`, "color-interpolation-filters": "sRGB", x: "-50%", y: "-50%", width: "200%", height: "200%" }, [ p("feDropShadow", { dx: "0", dy: "0", stdDeviation: "3", "flood-opacity": "1", "flood-color": e.value.style.chart.layout.donut.shadowColor }, null, 8, il) ], 8, rl) ]), e.value.type === "classic" ? (o(!0), u(b, { key: 3 }, F(h.value, (t, a) => (o(), u("g", null, [ Y(t) && f.value.dataLabels.show ? (o(), u("path", { key: 0, d: n(xt)(t, { x: s.value.width / 2, y: s.value.height / 2 }, 16, 16, !1, !1, K.value), stroke: t.color, "stroke-width": "1", "stroke-linecap": "round", "stroke-linejoin": "round", fill: "none", filter: G(a) }, null, 8, vl)) : i("", !0) ]))), 256)) : i("", !0), e.value.type === "polar" ? (o(!0), u(b, { key: 4 }, F(h.value, (t, a) => (o(), u("g", null, [ Y(t) && f.value.dataLabels.show ? (o(), u("line", { key: 0, x1: n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 24, centerX: s.value.width / 2, centerY: s.value.height / 2 }).x, y1: n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 24, centerX: s.value.width / 2, centerY: s.value.height / 2 }).y, x2: c.value[a].middlePoint.x, y2: c.value[a].middlePoint.y, stroke: t.color, "stroke-width": "1", "stroke-linecap": "round", "stroke-linejoin": "round", fill: "none", filter: G(a) }, null, 8, cl)) : i("", !0) ]))), 256)) : i("", !0), e.value.type === "classic" && e.value.style.chart.layout.donut.useShadow ? (o(), u("circle", { key: 5, cx: s.value.width / 2, cy: s.value.height / 2, r: $.value <= 0 ? 10 : $.value, fill: e.value.style.chart.backgroundColor, filter: `url(#shadow_${y.value})` }, null, 8, dl)) : i("", !0), l.$slots.pattern ? (o(), u("g", hl, [ (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("defs", null, [ g(l.$slots, "pattern", We({ ref_for: !0 }, { ...t, patternId: `pattern_${y.value}_${t.patternIndex}` }), void 0, !0) ]))), 256)) ])) : i("", !0), S.value && e.value.type === "classic" ? (o(), u(b, { key: 7 }, [ (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("path", { stroke: e.value.style.chart.backgroundColor, d: t.arcSlice, fill: "#FFFFFF" }, null, 8, yl))), 256)), l.$slots.pattern ? (o(), u("g", fl, [ (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("path", { class: "vue-ui-donut-arc-path", d: t.arcSlice, fill: `url(#pattern_${y.value}_${t.patternIndex})`, stroke: e.value.style.chart.backgroundColor, "stroke-width": e.value.style.chart.layout.donut.borderWidth, filter: G(a) }, null, 8, pl))), 256)) ])) : i("", !0), (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("path", { class: "vue-ui-donut-arc-path", d: t.arcSlice, fill: n(Z)(t.color, 80), stroke: e.value.style.chart.backgroundColor, "stroke-width": e.value.style.chart.layout.donut.borderWidth, filter: G(a) }, null, 8, gl))), 256)) ], 64)) : i("", !0), S.value && e.value.type === "polar" ? (o(), u(b, { key: 8 }, [ h.value.length > 1 ? (o(), u("g", bl, [ (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("path", { stroke: e.value.style.chart.backgroundColor, d: c.value[a].path, fill: "#FFFFFF" }, null, 8, ml))), 256)), e.value.style.chart.layout.donut.useShadow ? (o(), u("g", wl, [ (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("path", { class: "vue-ui-donut-arc-path", d: c.value[a].path, fill: "transparent", stroke: e.value.style.chart.backgroundColor, "stroke-width": e.value.style.chart.layout.donut.borderWidth, filter: `url(#drop_shadow_${y.value})` }, null, 8, kl))), 256)) ])) : i("", !0), l.$slots.pattern ? (o(), u("g", _l, [ (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("path", { class: "vue-ui-donut-arc-path", d: c.value[a].path, fill: `url(#pattern_${y.value}_${t.patternIndex})`, stroke: e.value.style.chart.backgroundColor, "stroke-width": e.value.style.chart.layout.donut.borderWidth, filter: G(a) }, null, 8, xl))), 256)) ])) : i("", !0), (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("path", { class: "vue-ui-donut-arc-path", d: c.value[a].path, fill: e.value.style.chart.useGradient ? `url(#polar_gradient_${a}_${y.value})` : t.color, stroke: e.value.style.chart.backgroundColor, "stroke-width": e.value.style.chart.layout.donut.borderWidth, filter: G(a) }, null, 8, $l))), 256)) ])) : (o(), u("g", Cl, [ l.$slots.pattern ? (o(), u("circle", { key: 0, cx: s.value.width / 2, cy: s.value.height / 2, r: $.value, fill: `url(#pattern_${y.value}_${h.value[0].patternIndex})`, stroke: e.value.style.chart.backgroundColor, "stroke-width": e.value.style.chart.layout.donut.borderWidth }, null, 8, Pl)) : i("", !0), p("circle", { cx: s.value.width / 2, cy: s.value.height / 2, r: $.value, fill: e.value.style.chart.useGradient ? `url(#polar_gradient_0_${y.value})` : h.value[0].color, stroke: e.value.style.chart.backgroundColor, "stroke-width": e.value.style.chart.layout.donut.borderWidth }, null, 8, Sl) ])) ], 64)) : (o(), u("circle", { key: 9, cx: s.value.width / 2, cy: s.value.height / 2, r: $.value <= 0 ? 10 : $.value, fill: "transparent", stroke: e.value.style.chart.backgroundColor }, null, 8, Fl)), e.value.style.chart.useGradient && e.value.type === "classic" ? (o(), u("circle", { key: 10, cx: s.value.width / 2, cy: s.value.height / 2, r: ( /* This might require adjustments */ $.value <= 0 ? 10 : $.value ), fill: `url(#gradient_${y.value})` }, null, 8, Ll)) : i("", !0), S.value ? (o(), u(b, { key: 11 }, [ h.value.length > 1 || e.value.type === "classic" ? (o(), u("g", Tl, [ (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("path", { d: e.value.type === "classic" ? t.arcSlice : c.value[a].path, fill: P.value === a ? "rgba(0,0,0,0.1)" : "transparent", onMouseenter: (v) => De({ datapoint: t, relativeIndex: a, seriesIndex: t.seriesIndex, show: !0 }), onMouseleave: r[0] || (r[0] = (v) => { le.value = !1, P.value = null; }), onClick: (v) => M(t, a) }, null, 40, zl))), 256)) ])) : (o(), u("g", Ol, [ p("circle", { cx: s.value.width / 2, cy: s.value.height / 2, r: $.value, fill: P.value === l.i ? "rgba(0,0,0,0.1)" : "transparent", onMouseenter: r[1] || (r[1] = (t) => De({ datapoint: h.value[0], relativeIndex: 0, seriesIndex: h.value[0].seriesIndex, show: !0 })), onMouseleave: r[2] || (r[2] = (t) => { le.value = !1, P.value = null; }), onClick: r[3] || (r[3] = (t) => M(h.value[0], l.i)) }, null, 40, Yl) ])) ], 64)) : i("", !0), e.value.type === "classic" ? (o(), u(b, { key: 12 }, [ e.value.style.chart.layout.labels.hollow.total.show ? (o(), u("text", { key: 0, "text-anchor": "middle", x: s.value.width / 2, y: s.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: z(`font-weight:${e.value.style.chart.layout.labels.hollow.total.bold ? "bold" : ""}`) }, C(e.value.style.chart.layout.labels.hollow.total.text), 13, Al)) : i("", !0), e.value.style.chart.layout.labels.hollow.total.show ? (o(), u("text", { key: 1, "text-anchor": "middle", x: s.value.width / 2, y: s.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: z(`font-weight:${e.value.style.chart.layout.labels.hollow.total.value.bold ? "bold" : ""}`) }, C(n(A)( e.value.style.chart.layout.labels.hollow.total.value.formatter, S.value, n(O)({ p: e.value.style.chart.layout.labels.hollow.total.value.prefix, v: S.value, s: e.value.style.chart.layout.labels.hollow.total.value.suffix }) )), 13, Nl)) : i("", !0), e.value.style.chart.layout.labels.hollow.average.show ? (o(), u("text", { key: 2, "text-anchor": "middle", x: s.value.width / 2, y: s.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: z(`font-weight:${e.value.style.chart.layout.labels.hollow.average.bold ? "bold" : ""}`) }, C(e.value.style.chart.layout.labels.hollow.average.text), 13, Xl)) : i("", !0), e.value.style.chart.layout.labels.hollow.average.show ? (o(), u("text", { key: 3, "text-anchor": "middle", x: s.value.width / 2, y: s.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: z(`font-weight:${e.value.style.chart.layout.labels.hollow.average.value.bold ? "bold" : ""}`) }, C(V.value ? "--" : n(A)( e.value.style.chart.layout.labels.hollow.average.value.formatter, Xe.value, n(O)({ p: e.value.style.chart.layout.labels.hollow.average.value.prefix, v: Xe.value, s: e.value.style.chart.layout.labels.hollow.average.value.suffix, r: e.value.style.chart.layout.labels.hollow.average.value.rounding }) )), 13, Il)) : i("", !0) ], 64)) : i("", !0), (o(!0), u(b, null, F(h.value, (t, a) => (o(), u("g", { filter: G(a), class: de({ animated: e.value.useCssAnimation }) }, [ e.value.style.chart.layout.labels.dataLabels.useLabelSlots ? (o(), u("g", Ml, [ (o(), u("foreignObject", { x: n(w)(t, !0).anchor === "end" ? n(w)(t).x - 120 : n(w)(t, !0).anchor === "middle" ? n(w)(t).x - 60 : n(w)(t).x, y: n(ee)(t) - (Be.value ? 20 : 0), width: "120", height: "60", style: { overflow: "visible" } }, [ p("div", null, [ g(l.$slots, "dataLabel", We({ ref_for: !0 }, { datapoint: t, isBlur: !e.value.useBlurOnHover || [null, void 0].includes(P.value) || P.value === a, isSafari: Be.value, isVisible: Y(t) && f.value.dataLabels.show, textAlign: n(w)(t, !0, 16, !0).anchor, flexAlign: n(w)(t, !0, 16).anchor, percentage: re(t, h.value) }), void 0, !0) ]) ], 8, Bl)) ])) : (o(), u("g", Vl, [ e.value.type === "classic" ? (o(), u(b, { key: 0 }, [ Y(t) && f.value.dataLabels.show ? (o(), u("circle", { key: 0, cx: n(w)(t).x, cy: n(ee)(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(P.value) || P.value === a ? "" : `url(#blur_${y.value})`, onClick: (v) => M(t, a) }, null, 8, Gl)) : i("", !0) ], 64)) : i("", !0), e.value.type === "polar" ? (o(), u(b, { key: 1 }, [ Y(t) && f.value.dataLabels.show ? (o(), u("circle", { key: 0, cx: n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 24, centerX: s.value.width / 2, centerY: s.value.height / 2 }).x, cy: n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 24, centerX: s.value.width / 2, centerY: s.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(P.value) || P.value === a ? "" : `url(#blur_${y.value})`, onClick: (v) => M(t, a) }, null, 8, Rl)) : i("", !0) ], 64)) : i("", !0), e.value.type === "classic" ? (o(), u(b, { key: 2 }, [ Y(t) && f.value.dataLabels.show ? (o(), u("text", { key: 0, "text-anchor": n(w)(t, !0, 12).anchor, x: n(w)(t, !0, 12).x, y: n(ee)(t), fill: e.value.style.chart.layout.labels.percentage.color, "font-size": e.value.style.chart.layout.labels.percentage.fontSize, style: z(`font-weight:${e.value.style.chart.layout.labels.percentage.bold ? "bold" : ""}`), onClick: (v) => M(t, a) }, C(re(t, h.value)) + " " + C(e.value.style.chart.layout.labels.value.show ? `(${n(A)( e.value.style.chart.layout.labels.value.formatter, t.value, n(O)({ 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.value.rounding }), { datapoint: t } )})` : ""), 13, Ul)) : i("", !0), Y(t) && f.value.dataLabels.show ? (o(), u("text", { key: 1, "text-anchor": n(w)(t).anchor, x: n(w)(t, !0, 12).x, y: n(ee)(t) + e.value.style.chart.layout.labels.percentage.fontSize, fill: e.value.style.chart.layout.labels.name.color, "font-size": e.value.style.chart.layout.labels.name.fontSize, style: z(`font-weight:${e.value.style.chart.layout.labels.name.bold ? "bold" : ""}`), onClick: (v) => M(t, a) }, C(t.name), 13, jl)) : i("", !0) ], 64)) : i("", !0), e.value.type === "polar" ? (o(), u(b, { key: 3 }, [ Y(t) && f.value.dataLabels.show ? (o(), u("text", { key: 0, "text-anchor": j(c.value[a].middlePoint), x: n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 42, centerX: s.value.width / 2, centerY: s.value.height / 2 }).x, y: n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 42, centerX: s.value.width / 2, centerY: s.value.height / 2 }).y, fill: e.value.style.chart.layout.labels.percentage.color, "font-size": e.value.style.chart.layout.labels.percentage.fontSize, style: z(`font-weight:${e.value.style.chart.layout.labels.percentage.bold ? "bold" : ""}`), onClick: (v) => M(t, a) }, C(re(t, h.value)) + " " + C(e.value.style.chart.layout.labels.value.show ? `(${n(A)( e.value.style.chart.layout.labels.value.formatter, t.value, n(O)({ 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.value.rounding }), { datapoint: t } )})` : ""), 13, Wl)) : i("", !0), Y(t) && f.value.dataLabels.show ? (o(), u("text", { key: 1, "text-anchor": j(c.value[a].middlePoint), x: n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 42, centerX: s.value.width / 2, centerY: s.value.height / 2 }).x, y: n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 42, centerX: s.value.width / 2, centerY: s.value.height / 2 }).y + e.value.style.chart.layout.labels.percentage.fontSize, fill: e.value.style.chart.layout.labels.name.color, "font-size": e.value.style.chart.layout.labels.name.fontSize, style: z(`font-weight:${e.value.style.chart.layout.labels.name.bold ? "bold" : ""}`), onClick: (v) => M(t, a) }, C(t.name), 13, Hl)) : i("", !0) ], 64)) : i("", !0) ])), f.value.dataLabels.show && e.value.style.chart.comments.show && t.comment ? (o(), u("g", El, [ Y(t) && e.value.type === "classic" ? (o(), u("foreignObject", { key: 0, x: e.value.style.chart.comments.offsetX + (n(w)(t, !0).anchor === "end" ? n(w)(t).x - e.value.style.chart.comments.width : n(w)(t, !0).anchor === "middle" ? n(w)(t).x - e.value.style.chart.comments.width / 2 : n(w)(t).x), y: n(ee)(t) + 24 + e.value.style.chart.comments.offsetY, width: e.value.style.chart.comments.width, height: "200", style: { overflow: "visible", "pointer-events": "none" } }, [ p("div", null, [ g(l.$slots, "plot-comment", { plot: { ...t, textAlign: n(w)(t, !0, 16, !0).anchor, flexAlign: n(w)(t, !0, 16).anchor } }, void 0, !0) ]) ], 8, ql)) : i("", !0), Y(t) && e.value.type === "polar" ? (o(), u("foreignObject", { key: 1, x: e.value.style.chart.comments.offsetX + (j(c.value[a].middlePoint) === "end" ? n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 42, centerX: s.value.width / 2, centerY: s.value.height / 2 }).x - e.value.style.chart.comments.width : j(c.value[a].middlePoint) === "middle" ? n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 42, centerX: s.value.width / 2, centerY: s.value.height / 2 }).x - e.value.style.chart.comments.width / 2 : n(L)({ initX: c.value[a].middlePoint.x, initY: c.value[a].middlePoint.y, offset: 42, centerX: s.value.width / 2, centerY: s.value.height / 2 }).x), y: st(c.value[a]) + e.value.style.chart.comments.offsetY, width: e.value.style.chart.comments.width, height: "200", style: { overflow: "visible", "pointer-events": "none" } }, [ p("div", null, [ g(l.$slots, "plot-comment", { plot: { ...t, textAlign: j(c.value[a].middlePoint), flexAlign: j(c.value[a].middlePoint) } }, void 0, !0) ]) ], 8, Jl)) : i("", !0) ])) : i("", !0) ], 10, Dl))), 256)), g(l.$slots, "svg", { svg: s.value }, void 0, !0) ], 14, Wt)) : i("", !0), l.$slots.watermark ? (o(), u("div", Kl, [ g(l.$slots, "watermark", H(E({ isPrinting: n(Pe) || n(Se) })), void 0, !0) ])) : i("", !0), q.value ? i("", !0) : (o(), R(It, { key: 6, config: { type: "donut", style: { backgroundColor: e.value.style.chart.backgroundColor, donut: { color: "#CCCCCC", strokeWidth: K.value * 0.8 } } } }, null, 8, ["config"])), p("div", { ref_key: "chartLegend", ref: fe }, [ e.value.style.chart.legend.show ? (o(), R(Xt, { key: `legend_${we.value}`, legendSet: Ne.value, config: ut.value, onClickMarker: r[4] || (r[4] = ({ i: t }) => Ae(t)) }, je({ item: x(({ legend: t, index: a }) => [ p("div", { style: z(`opacity:${X.value.includes(a) ? 0.5 : 1}`), onClick: (v) => t.segregate() }, [ He(C(t.name) + ": " + C(n(A)( e.value.style.chart.layout.labels.value.formatter, t.value, n(O)({ 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, index: a } )) + " ", 1), X.value.includes(a) ? (o(), u("span", ea, " ( " + C(it(t.proportion * 100)) + " % ) ", 1)) : (o(), u("span", Zl, " (" + C(isNaN(t.value / S.value) ? "-" : n(A)( e.value.style.chart.layout.labels.percentage.formatter, Ie.value(t),