UNPKG

vue-data-ui

Version:

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

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