UNPKG

vue-data-ui

Version:

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

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