UNPKG

vue-data-ui

Version:

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

731 lines (730 loc) 29.5 kB
import { computed as p, ref as i, watch as He, onMounted as Ye, onBeforeUnmount as Qe, createElementBlock as n, openBlock as r, unref as c, normalizeStyle as W, normalizeClass as M, createBlock as $, createCommentVNode as d, createElementVNode as _, createVNode as ee, createSlots as Je, withCtx as y, renderSlot as f, normalizeProps as N, guardReactiveProps as S, Fragment as T, renderList as P, toDisplayString as U, createTextVNode as xe, nextTick as Ke } from "vue"; import { u as Ze, c as et, t as tt, p as x, a as at, o as ot, e as I, b as lt, g as Ae, d as Oe, P as Fe, v as rt, i as Ne, f as V, X as st, s as te, w as nt, Q as Se, q as ut, r as it, x as ct, y as dt } from "./index-BaaDnc4F.js"; import { t as vt, u as ht } from "./useResponsive-vZgZwV-S.js"; import { _ as pt } from "./Title-D_MGglyN.js"; import { u as gt, U as ft } from "./usePrinter-y4-4tCWT.js"; import { _ as yt } from "./Tooltip-HRgkF8HD.js"; import mt from "./vue-ui-sparkbar-msGI6wfO.js"; import { L as bt } from "./Legend-Be8mrJpb.js"; import { D as kt } from "./DataTable-DvwmNjb-.js"; import Ct from "./vue-ui-skeleton-6RiQNJSb.js"; import wt from "./vue-ui-accordion-CF9kQTXq.js"; import { u as Ie } from "./useNestedProp-D8vQcOps.js"; import { _ as $t } from "./PackageVersion-D9Lm1C1X.js"; import { P as _t } from "./PenAndPaper-DR58HO_U.js"; import { u as Tt } from "./useUserOptionState-BIvW1Kz7.js"; import { u as Pt } from "./useChartAccessibility-BWojgys7.js"; import { _ as xt } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const At = ["id"], Ot = ["xmlns", "viewBox"], Ft = ["width", "height"], Nt = ["id"], St = ["stop-color"], It = ["stop-color"], Rt = { key: 1 }, Lt = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], zt = { key: 0 }, Mt = ["d", "stroke", "stroke-width"], Ut = ["d", "stroke", "stroke-width"], Vt = { key: 2 }, Et = ["x", "y", "text-anchor", "font-size", "fill", "onMouseenter"], Bt = ["points", "stroke", "stroke-width"], Dt = ["points", "stroke", "stroke-width", "fill"], Gt = { key: 3 }, Wt = ["cx", "cy", "fill", "r", "stroke"], Xt = { key: 5, class: "vue-data-ui-watermark" }, jt = ["onClick"], qt = { key: 0, style: { "max-width": "200px", margin: "0 auto" } }, Ht = { __name: "vue-ui-radar", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Object, default() { return {}; } } }, emits: ["selectLegend"], setup(Re, { expose: Le, emit: ze }) { const { vue_ui_radar: Me } = Ze(), g = Re, R = p(() => !!g.dataset && Object.keys(g.dataset).length), w = i(et()), Ue = i(null), X = i(!1), j = i(""), ae = i(0), L = i(null), oe = i(null), le = i(null), re = i(null), se = i(null), ne = i(0), ue = i(0), ie = i(0), e = p({ get: () => he(), set: (t) => t }), { userOptionsVisible: q, setUserOptionsVisibility: ce, keepUserOptionState: de } = Tt({ config: e.value }), { svgRef: ve } = Pt({ config: e.value.style.chart.title }); function he() { const t = Ie({ userConfig: g.config, defaultConfig: Me }); return t.theme ? { ...Ie({ userConfig: at.vue_ui_radar[t.theme] || g.config, defaultConfig: t }), customPalette: tt[t.theme] || x } : t; } He(() => g.config, (t) => { e.value = he(), q.value = !e.value.userOptions.showOnChartHover, pe(), ne.value += 1, ue.value += 1, ie.value += 1, b.value.dataLabels.show = e.value.style.chart.layout.labels.dataLabels.show, b.value.showTable = e.value.table.show, b.value.showTooltip = e.value.style.chart.tootlip.show; }, { deep: !0 }); const E = i(null); function pe() { if (ot(g.dataset) && I({ componentName: "VueUiRadar", type: "dataset" }), e.value.responsive) { const t = vt(() => { const { width: a, height: o } = ht({ chart: L.value, title: e.value.style.chart.title.text ? oe.value : null, legend: e.value.style.chart.legend.show ? le.value : null, source: re.value, noTitle: se.value }); requestAnimationFrame(() => { u.value.width = a, u.value.height = o; }); }); E.value = new ResizeObserver(t), E.value.observe(L.value.parentNode); } } Ye(() => { pe(); }), Qe(() => { E.value && E.value.disconnect(); }); const { isPrinting: ge, isImaging: fe, generatePdf: ye, generateImage: me } = gt({ elementId: `vue-ui-radar_${w.value}`, fileName: e.value.style.chart.title.text || "vue-ui-radar" }), Ve = p(() => e.value.userOptions.show && !e.value.style.chart.title.text), be = p(() => lt(e.value.customPalette)), b = i({ dataLabels: { show: e.value.style.chart.layout.labels.dataLabels.show }, showTable: e.value.table.show, showTooltip: e.value.style.chart.tooltip.show }), Ee = p(() => ({ style: { backgroundColor: "#FFFFFF00", animation: { show: e.value.style.chart.tooltip.animation.show, animationFrames: e.value.style.chart.tooltip.animation.animationFrames }, labels: { fontSize: e.value.style.chart.tooltip.fontSize, name: { color: e.value.style.chart.tooltip.color } }, gutter: { backgroundColor: "#CCCCCC", opacity: 30 } } })), u = i({ height: 312, width: 512 }), Be = ze, v = i([]), z = i(null), A = i(!1); function ke(t) { A.value = !0, v.value.includes(t) ? (z.value = t, v.value = v.value.filter((a) => a !== t), setTimeout(() => { A.value = !1, z.value = null; }, 500)) : (v.value.push(t), setTimeout(() => { A.value = !1; }, 500)), Be("selectLegend", O.value.filter((a, o) => !v.value.includes(o)).map((a) => ({ name: a.name, color: a.color, proportion: a.totalProportion }))); } function De() { return O.value.map((t) => ({ name: t.name, color: t.color, proportion: t.totalProportion })); } const m = p(() => [null, void 0].includes(g.dataset.categories) ? (I({ componentName: "VueUiRadar", type: "datasetAttribute", property: "categories ({ name: string; prefix?: string; suffix?: string}[])" }), []) : (g.dataset.categories.length === 0 ? I({ componentName: "VueUiRadar", type: "datasetAttributeEmpty", property: "categories" }) : g.dataset.categories.forEach((t, a) => { Ae({ datasetObject: t, requiredAttributes: ["name"] }).forEach((o) => { I({ componentName: "VueUiRadar", type: "datasetAttribute", property: `category.${o} at index ${a}`, index: a }); }); }), [null, void 0].includes(g.dataset.series) ? I({ componentName: "VueUiRadar", type: "datasetAttribute", property: "series ({ name: string; values: number[]; color?: string; target: number}[])" }) : g.dataset.series.forEach((t, a) => { Ae({ datasetObject: t, requiredAttributes: ["name", "values", "target"] }).forEach((o) => { I({ componentName: "VueUiRadar", type: "datasetSerieAttribute", key: "series", property: o, index: a }); }); }), g.dataset.categories.map((t, a) => ({ name: t.name, categoryId: `radar_category_${w.value}_${a}`, color: Oe(t.color) || be.value[a] || x[a] || x[a % x.length], prefix: t.prefix ?? "", suffix: t.suffix ?? "" })))), k = p(() => R.value ? g.dataset.series.map((t, a) => ({ ...t, color: Oe(t.color) || be.value[a] || x[a] || x[a % x.length], serieId: `radar_serie_${w.value}_${a}`, formatter: t.formatter || null })) : []), Ce = p(() => Math.max(...k.value.flatMap((t) => t.values))), we = p(() => k.value.length), H = p(() => Math.min(u.value.width, u.value.height) / 3), $e = p(() => Fe({ plot: { x: u.value.width / 2, y: u.value.height / 2 }, radius: H.value, sides: we.value, rotation: 0 })), Ge = p(() => { const t = []; for (let a = 0; a < H.value; a += H.value / e.value.style.chart.layout.grid.graduations) t.push(a); return t; }), C = p(() => $e.value.coordinates.map((t, a) => { const o = k.value[a].values.map((l) => We({ centerX: u.value.width / 2, centerY: u.value.height / 2, apexX: t.x, apexY: t.y, proportion: l / (k.value[a].target || Ce.value) })); return { ...t, ...k.value[a], plots: o }; })); function Y({ x: t, y: a }) { let o = "middle"; return t = Math.round(t), a = Math.round(a), t > u.value.width / 2 && (t += 12, o = "start"), t < u.value.width / 2 && (t -= 12, o = "end"), a > u.value.height / 2 && (a += 20), a < u.value.height / 2 && (a -= 12), a === u.value.height / 2 && (a += 4), { x: t, y: a, anchor: o }; } function We({ centerX: t, centerY: a, apexX: o, apexY: l, proportion: s }) { return { x: t + (o - t) * s, y: a + (l - a) * s }; } const O = p(() => { const t = k.value.map((a, o) => a.values.map((l) => l / (a.target || Ce.value))); return m.value.map((a, o) => ({ ...a, totalProportion: rt(t.map((l) => l[o]).reduce((l, s) => l + s, 0) / k.value.length), shape: "circle", opacity: v.value.includes(o) ? 0.5 : 1, segregate: () => ke(o), isSegregated: v.value.includes(o) })); }), Xe = p(() => ({ cy: "radar-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" : "" })), B = p(() => { const t = [ { name: e.value.translations.datapoint, color: "" }, { name: e.value.translations.target, color: "" }, ...O.value ], a = g.dataset.series.map((l) => [ l.name, Ne( l.formatter, l.target, V({ p: l.prefix, v: l.target, s: l.suffix, r: e.value.table.td.roundingValue }) ), ...l.values.map((s, h) => `${Ne( l.formatter, s, V({ p: m.value[h].prefix, v: s, s: m.value[h].suffix, r: e.value.table.td.roundingValue }) )} (${isNaN(s / l.target) ? "" : V({ v: s / l.target * 100, s: "%", r: e.value.table.td.roundingPercentage })})`) ]), o = { 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 { head: t, body: a, config: o, colNames: t }; }), D = i(null), Q = i([]), J = i(null); function je(t, a) { Q.value = [], D.value = a, X.value = !0; let o = ""; J.value = { datapoint: t, seriesIndex: a, series: { categories: m.value, datapoints: k.value, radar: C.value }, config: e.value }; const l = e.value.style.chart.tooltip.customFormat; if (ct(l) && dt(() => l({ seriesIndex: a, datapoint: t, series: { categories: m.value, datapoints: k.value, radar: C.value }, config: e.value }))) j.value = l({ seriesIndex: a, datapoint: t, series: { categories: m.value, datapoints: k.value, radar: C.value }, config: e.value }); else { o += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${t.name}</div>`; for (let s = 0; s < t.values.length; s += 1) v.value.includes(s) || Q.value.push({ name: m.value[s].name, value: t.values[s] / t.target * 100, color: m.value[s].color, suffix: "%)", prefix: `${V({ p: m.value[s].prefix ?? "", v: t.values[s], s: m.value[s].suffix ?? "", r: e.value.style.chart.tooltip.roundingValue })} (`, rounding: e.value.style.chart.tooltip.roundingPercentage, formatter: t.formatter }); j.value = o; } } function _e() { Ke(() => { const t = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], a = [[""], [e.value.translations.target], ...O.value.flatMap((h) => [[h.name], ["%"]])], o = g.dataset.series.map((h, Yt) => [h.name, h.target, ...h.values.flatMap((Z) => [ Z, isNaN(Z / h.target) ? "" : Z / h.target * 100 ])]), l = t.concat([a]).concat(o), s = ut(l); it({ csvContent: s, title: e.value.style.chart.title.text || "vue-ui-radar" }); }); } const F = i(!1); function qe(t) { F.value = t, ae.value += 1; } function Te() { b.value.showTable = !b.value.showTable; } function Pe() { b.value.showTooltip = !b.value.showTooltip; } const G = i(!1); function K() { G.value = !G.value; } return Le({ getData: De, generatePdf: ye, generateCsv: _e, generateImage: me, toggleTable: Te, toggleTooltip: Pe, toggleAnnotator: K }), (t, a) => (r(), n("div", { class: M(`vue-ui-radar ${F.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`), ref_key: "radarChart", ref: L, id: `vue-ui-radar_${w.value}`, style: W(`font-family:${e.value.style.fontFamily};width:100%; ${e.value.responsive ? "height: 100%;" : ""} text-align:center;background:${e.value.style.chart.backgroundColor}`), onMouseenter: a[3] || (a[3] = () => c(ce)(!0)), onMouseleave: a[4] || (a[4] = () => c(ce)(!1)) }, [ e.value.userOptions.buttons.annotator ? (r(), $(_t, { key: 0, svgRef: c(ve), backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, active: G.value, onClose: K }, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : d("", !0), Ve.value ? (r(), n("div", { key: 1, ref_key: "noTitle", ref: se, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : d("", !0), e.value.style.chart.title.text ? (r(), n("div", { key: 2, ref_key: "chartTitle", ref: oe, style: "width:100%;background:transparent;padding-bottom:12px" }, [ (r(), $(pt, { key: `title_${ne.value}`, config: { title: { cy: "radar-div-title", ...e.value.style.chart.title }, subtitle: { cy: "radar-div-subtitle", ...e.value.style.chart.title.subtitle } } }, null, 8, ["config"])) ], 512)) : d("", !0), e.value.userOptions.show && R.value && (c(de) || c(q)) ? (r(), $(ft, { ref_key: "details", ref: Ue, key: `user_options_${ae.value}`, backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, isImaging: c(fe), isPrinting: c(ge), uid: w.value, hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show, hasPdf: e.value.userOptions.buttons.pdf, hasImg: e.value.userOptions.buttons.img, hasXls: e.value.userOptions.buttons.csv, hasTable: e.value.userOptions.buttons.table, hasFullscreen: e.value.userOptions.buttons.fullscreen, isFullscreen: F.value, isTooltip: b.value.showTooltip, titles: { ...e.value.userOptions.buttonTitles }, chartElement: L.value, position: e.value.userOptions.position, hasAnnotator: e.value.userOptions.buttons.annotator, isAnnotation: G.value, onToggleFullscreen: qe, onGeneratePdf: c(ye), onGenerateCsv: _e, onGenerateImage: c(me), onToggleTable: Te, onToggleTooltip: Pe, onToggleAnnotator: K, style: W({ visibility: c(de) ? c(q) ? "visible" : "hidden" : "visible" }) }, Je({ _: 2 }, [ t.$slots.menuIcon ? { name: "menuIcon", fn: y(({ isOpen: o, color: l }) => [ f(t.$slots, "menuIcon", N(S({ isOpen: o, color: l })), void 0, !0) ]), key: "0" } : void 0, t.$slots.optionTooltip ? { name: "optionTooltip", fn: y(() => [ f(t.$slots, "optionTooltip", {}, void 0, !0) ]), key: "1" } : void 0, t.$slots.optionPdf ? { name: "optionPdf", fn: y(() => [ f(t.$slots, "optionPdf", {}, void 0, !0) ]), key: "2" } : void 0, t.$slots.optionCsv ? { name: "optionCsv", fn: y(() => [ f(t.$slots, "optionCsv", {}, void 0, !0) ]), key: "3" } : void 0, t.$slots.optionImg ? { name: "optionImg", fn: y(() => [ f(t.$slots, "optionImg", {}, void 0, !0) ]), key: "4" } : void 0, t.$slots.optionTable ? { name: "optionTable", fn: y(() => [ f(t.$slots, "optionTable", {}, void 0, !0) ]), key: "5" } : void 0, t.$slots.optionFullscreen ? { name: "optionFullscreen", fn: y(({ toggleFullscreen: o, isFullscreen: l }) => [ f(t.$slots, "optionFullscreen", N(S({ toggleFullscreen: o, isFullscreen: l })), void 0, !0) ]), key: "6" } : void 0, t.$slots.optionAnnotator ? { name: "optionAnnotator", fn: y(({ toggleAnnotator: o, isAnnotator: l }) => [ f(t.$slots, "optionAnnotator", N(S({ toggleAnnotator: o, isAnnotator: l })), void 0, !0) ]), key: "7" } : void 0 ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : d("", !0), R.value ? (r(), n("svg", { key: 4, ref_key: "svgRef", ref: ve, xmlns: c(st), class: M({ "vue-data-ui-fullscreen--on": F.value, "vue-data-ui-fulscreen--off": !F.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}`) }, [ ee($t), t.$slots["chart-background"] ? (r(), 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" } }, [ f(t.$slots, "chart-background", {}, void 0, !0) ], 8, Ft)) : d("", !0), _("defs", null, [ (r(!0), n(T, null, P(m.value, (o, l) => (r(), n("radialGradient", { cx: "50%", cy: "50%", r: "50%", fx: "50%", fy: "50%", id: `radar_gradient_${w.value}_${l}` }, [ _("stop", { offset: "0%", "stop-color": c(te)(c(nt)(o.color, 0.05), e.value.style.chart.layout.dataPolygon.opacity) }, null, 8, St), _("stop", { offset: "100%", "stop-color": c(te)(o.color, e.value.style.chart.layout.dataPolygon.opacity) }, null, 8, It) ], 8, Nt))), 256)) ]), e.value.style.chart.layout.grid.show ? (r(), n("g", Rt, [ (r(!0), n(T, null, P(C.value, (o) => (r(), n("line", { x1: u.value.width / 2, y1: u.value.height / 2, x2: o.x, y2: o.y, stroke: e.value.style.chart.layout.grid.stroke, "stroke-width": e.value.style.chart.layout.grid.strokeWidth }, null, 8, Lt))), 256)), e.value.style.chart.layout.grid.graduations > 0 ? (r(), n("g", zt, [ (r(!0), n(T, null, P(Ge.value, (o) => (r(), n("path", { d: c(Fe)({ plot: { x: u.value.width / 2, y: u.value.height / 2 }, radius: o, sides: we.value, rotation: 0 }).path, fill: "none", stroke: e.value.style.chart.layout.grid.stroke, "stroke-width": e.value.style.chart.layout.grid.strokeWidth }, null, 8, Mt))), 256)) ])) : d("", !0) ])) : d("", !0), _("path", { d: $e.value.path, fill: "none", stroke: e.value.style.chart.layout.outerPolygon.stroke, "stroke-width": e.value.style.chart.layout.outerPolygon.strokeWidth, "stroke-linejoin": "round", "stroke-linecap": "round" }, null, 8, Ut), e.value.style.chart.layout.labels.dataLabels.show ? (r(), n("g", Vt, [ (r(!0), n(T, null, P(C.value, (o, l) => (r(), n("text", { x: Y(o).x, y: Y(o).y, "text-anchor": Y(o).anchor, "font-size": e.value.style.chart.layout.labels.dataLabels.fontSize, fill: e.value.style.chart.layout.labels.dataLabels.color, onMouseenter: (s) => je(o, l), onMouseleave: a[0] || (a[0] = (s) => { X.value = !1, D.value = null; }) }, U(o.name), 41, Et))), 256)) ])) : d("", !0), (r(!0), n(T, null, P(m.value, (o, l) => (r(), n("g", null, [ _("g", null, [ e.value.useCssAnimation || !e.value.useCssAnimation && !v.value.includes(l) ? (r(), n("polygon", { key: 0, points: c(Se)(C.value.map((s) => s.plots[l]), !1, !0), stroke: e.value.style.chart.backgroundColor, "stroke-width": e.value.style.chart.layout.dataPolygon.strokeWidth + 1, fill: "none", class: M({ "animated-out": v.value.includes(l) && e.value.useCssAnimation, "animated-in": A.value && z.value === l && e.value.useCssAnimation }) }, null, 10, Bt)) : d("", !0), e.value.useCssAnimation || !e.value.useCssAnimation && !v.value.includes(l) ? (r(), n("polygon", { key: 1, points: c(Se)(C.value.map((s) => s.plots[l]), !1, !0), stroke: o.color, "stroke-width": e.value.style.chart.layout.dataPolygon.strokeWidth, fill: e.value.style.chart.layout.dataPolygon.transparent ? "transparent" : e.value.style.chart.layout.dataPolygon.useGradient ? `url(#radar_gradient_${w.value}_${l})` : c(te)(o.color, e.value.style.chart.layout.dataPolygon.opacity), class: M({ "animated-out": v.value.includes(l) && e.value.useCssAnimation, "animated-in": A.value && z.value === l && e.value.useCssAnimation }) }, null, 10, Dt)) : d("", !0) ]) ]))), 256)), e.value.style.chart.layout.plots.show ? (r(), n("g", Gt, [ (r(!0), n(T, null, P(C.value, (o, l) => (r(), n("g", null, [ (r(!0), n(T, null, P(o.plots, (s, h) => (r(), n("circle", { cx: s.x, cy: s.y, fill: v.value.includes(h) ? "transparent" : m.value[h].color, r: D.value !== null && D.value === l ? e.value.style.chart.layout.plots.radius * 1.6 : e.value.style.chart.layout.plots.radius, stroke: v.value.includes(h) ? "transparent" : e.value.style.chart.backgroundColor, "stroke-width": 0.5, class: M({ "animated-out": v.value.includes(h) && e.value.useCssAnimation, "animated-in": A.value && z.value === h && e.value.useCssAnimation }) }, null, 10, Wt))), 256)) ]))), 256)) ])) : d("", !0), f(t.$slots, "svg", { svg: u.value }, void 0, !0) ], 14, Ot)) : d("", !0), t.$slots.watermark ? (r(), n("div", Xt, [ f(t.$slots, "watermark", N(S({ isPrinting: c(ge) || c(fe) })), void 0, !0) ])) : d("", !0), R.value ? d("", !0) : (r(), $(Ct, { key: 6, config: { type: "radar", style: { backgroundColor: e.value.style.chart.backgroundColor, radar: { grid: { color: e.value.style.chart.layout.outerPolygon.stroke }, shapes: { color: e.value.style.chart.layout.outerPolygon.stroke } } } } }, null, 8, ["config"])), _("div", { ref_key: "chartLegend", ref: le }, [ e.value.style.chart.legend.show ? (r(), $(bt, { key: `legend_${ie.value}`, legendSet: O.value, config: Xe.value, onClickMarker: a[1] || (a[1] = ({ i: o }) => ke(o)) }, { item: y(({ legend: o, index: l }) => [ _("div", { onClick: (s) => o.segregate(), style: W(`opacity:${v.value.includes(l) ? 0.5 : 1}`) }, U(o.name) + ": " + U(c(V)({ v: o.totalProportion * 100, s: "%", r: e.value.style.chart.legend.roundingPercentage })), 13, jt) ]), _: 1 }, 8, ["legendSet", "config"])) : f(t.$slots, "legend", { key: 1, legend: O.value }, void 0, !0) ], 512), t.$slots.source ? (r(), n("div", { key: 7, ref_key: "source", ref: re, dir: "auto" }, [ f(t.$slots, "source", {}, void 0, !0) ], 512)) : d("", !0), ee(yt, { show: b.value.showTooltip && X.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, backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity, fontSize: e.value.style.chart.tooltip.fontSize, position: e.value.style.chart.tooltip.position, offsetY: e.value.style.chart.tooltip.offsetY, parent: L.value, content: j.value, isFullscreen: F.value, isCustom: e.value.style.chart.tooltip.customFormat && typeof e.value.style.chart.tooltip.customFormat == "function" }, { "tooltip-before": y(() => [ f(t.$slots, "tooltip-before", N(S({ ...J.value })), void 0, !0) ]), "tooltip-after": y(() => [ ["function"].includes(typeof e.value.style.chart.tooltip.customFormat) ? d("", !0) : (r(), n("div", qt, [ ee(mt, { dataset: Q.value, config: Ee.value, backgroundOpacity: 0 }, null, 8, ["dataset", "config"]) ])), f(t.$slots, "tooltip-after", N(S({ ...J.value })), void 0, !0) ]), _: 3 }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "fontSize", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]), R.value ? (r(), $(wt, { key: 8, hideDetails: "", config: { open: b.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: y(() => [ (r(), $(kt, { key: `table_${ue.value}`, colNames: B.value.colNames, head: B.value.head, body: B.value.body, config: B.value.config, title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`, onClose: a[2] || (a[2] = (o) => b.value.showTable = !1) }, { th: y(({ th: o }) => [ xe(U(o.name), 1) ]), td: y(({ td: o }) => [ xe(U(o), 1) ]), _: 1 }, 8, ["colNames", "head", "body", "config", "title"])) ]), _: 1 }, 8, ["config"])) : d("", !0) ], 46, At)); } }, ha = /* @__PURE__ */ xt(Ht, [["__scopeId", "data-v-b932bce9"]]); export { ha as default };