UNPKG

vue-data-ui

Version:

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

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