UNPKG

vue-data-ui

Version:

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

962 lines (961 loc) 46.2 kB
import { useCssVars as ct, useSlots as ht, computed as m, ref as i, watch as Ue, onMounted as Xe, onBeforeUnmount as pt, createElementBlock as r, openBlock as u, unref as d, normalizeStyle as c, normalizeClass as A, createBlock as B, createCommentVNode as p, renderSlot as b, createVNode as Y, createSlots as ce, withCtx as k, normalizeProps as X, guardReactiveProps as E, createElementVNode as n, toDisplayString as h, Fragment as H, renderList as W, mergeProps as yt, withKeys as gt, createTextVNode as ft } from "vue"; import { u as bt, c as mt, t as kt, p as R, a as _t, b as $t, o as Ee, e as K, v as N, d as he, i as le, f as D, X as wt, s as pe, w as xt, q as Ct, r as Tt, x as Lt, y as Nt } from "./index-BaaDnc4F.js"; import { t as Pt, u as St } from "./useResponsive-vZgZwV-S.js"; import { _ as Vt } from "./Title-D_MGglyN.js"; import { u as It, U as Ot } from "./usePrinter-y4-4tCWT.js"; import { _ as Ft } from "./Tooltip-HRgkF8HD.js"; import { L as He } from "./Legend-Be8mrJpb.js"; import Mt from "./vue-ui-skeleton-6RiQNJSb.js"; import zt from "./BaseIcon-rw8rKNKS.js"; import At from "./vue-ui-accordion-CF9kQTXq.js"; import { u as We } from "./useNestedProp-D8vQcOps.js"; import { _ as Bt } from "./PackageVersion-D9Lm1C1X.js"; import { P as Rt } from "./PenAndPaper-DR58HO_U.js"; import { u as Dt } from "./useUserOptionState-BIvW1Kz7.js"; import { _ as Ge } from "./Shape-BuwIrUMv.js"; import { u as Ut } from "./useChartAccessibility-BWojgys7.js"; import { _ as Xt } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const Et = ["id"], Ht = ["onClick"], Wt = ["xmlns", "viewBox"], Gt = ["width", "height"], jt = ["id"], qt = ["stop-color"], Yt = ["stop-color"], Kt = { key: 1 }, Jt = ["x", "y", "width", "height", "fill", "rx"], Qt = ["x", "y", "width", "height", "fill", "rx", "stroke", "stroke-width"], Zt = ["x", "y", "width", "height", "fill", "rx", "stroke", "stroke-width"], ea = ["x2", "y1", "y2", "stroke", "stroke-width"], ta = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], aa = ["x", "y", "text-anchor", "font-size", "fill", "font-weight"], la = ["x", "y", "font-size", "fill", "font-weight"], oa = ["x", "y", "font-size", "fill", "font-weight"], na = ["x", "y", "font-size", "fill", "font-weight"], ua = ["y", "width", "height", "fill", "onMouseenter"], sa = { key: 6, class: "vue-data-ui-watermark" }, ra = ["onClick"], ia = { style: "width:100%;padding-top: 36px;position:relative" }, da = { class: "vue-ui-data-table" }, va = { key: 0 }, ca = { style: { width: "100%" } }, ha = ["data-cell"], pa = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, ya = ["data-cell"], ga = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, fa = ["data-cell"], ba = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, ma = ["data-cell"], ka = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, _a = ["data-cell"], $a = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, wa = ["data-cell"], xa = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, Ca = ["data-cell"], Ta = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, La = { __name: "vue-ui-vertical-bar", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Array, default() { return []; } } }, emits: ["selectLegend"], setup(je, { expose: qe, emit: Ye }) { ct((a) => ({ e38fbd6e: a.tdo })); const { vue_ui_vertical_bar: Ke } = bt(), Je = ht(), T = je, J = m(() => !!T.dataset && T.dataset.length), C = i(mt()), Qe = i(null), oe = i(!1), ne = i(""), Q = i(0), Ze = i(null), ye = i(0), G = i(null), ge = i(null), ue = i(null), fe = i(null), be = i(null), me = i(0), se = i(0), et = Ye, e = m({ get: () => we(), set: (a) => a }), { userOptionsVisible: re, setUserOptionsVisibility: ke, keepUserOptionState: _e } = Dt({ config: e.value }), { svgRef: $e } = Ut({ config: e.value.style.chart.title }); function we() { const a = We({ userConfig: T.config, defaultConfig: Ke }); return a.theme ? { ...We({ userConfig: _t.vue_ui_vertical_bar[a.theme] || T.config, defaultConfig: a }), customPalette: kt[a.theme] || R } : a; } Ue(() => T.config, (a) => { e.value = we(), re.value = !e.value.userOptions.showOnChartHover, Ve(), me.value += 1, se.value += 1, v.value = e.value.style.chart.layout.bars.height, g.value = e.value.style.chart.layout.bars.gap, $.value.showTable = e.value.table.show, $.value.sortDesc = e.value.style.chart.layout.bars.sort === "desc", $.value.showTooltip = e.value.style.chart.tooltip.show; }, { deep: !0 }), Ue(() => T.dataset, ee, { deep: !0 }); const { isPrinting: xe, isImaging: Ce, generatePdf: Te, generateImage: Le } = It({ elementId: `vue-ui-vertical-bar_${C.value}`, fileName: e.value.style.chart.title.text || "vue-ui-vertical-bar" }), tt = m(() => e.value.userOptions.show && !e.value.style.chart.title.text), Ne = m(() => $t(e.value.customPalette)), Pe = i(null), Se = i(!1), at = m(() => e.value.table.responsiveBreakpoint), Z = i(null); Xe(() => { Ve(); }); function Ve() { if (Ee(T.dataset) && K({ componentName: "VueUiVerticalBar", type: "dataset" }), Q.value = T.dataset.flatMap((a) => a.children && a.children.length > 0 ? a.children.length : 1).reduce((a, l) => a + l, 0), lt(), e.value.responsive) { const a = Pt(() => { const { width: l, height: t } = St({ chart: G.value, title: e.value.style.chart.title.text ? ge.value : null, legend: e.value.style.chart.legend.show ? ue.value : null, source: fe.value, noTitle: be.value }); requestAnimationFrame(() => { Fe.value = l, v.value = t / Q.value - g.value * 2; }); }); Z.value = new ResizeObserver(a), Z.value.observe(G.value.parentNode); } } pt(() => { Z.value && Z.value.disconnect(); }); function lt() { new ResizeObserver((l) => { l.forEach((t) => { Se.value = t.contentRect.width < at.value; }); }).observe(Pe.value); } const $ = i({ showTable: e.value.table.show, sortDesc: e.value.style.chart.layout.bars.sort === "desc", showTooltip: e.value.style.chart.tooltip.show }), Ie = m(() => $.value.sortDesc), O = m(() => (T.dataset.forEach((a, l) => { !a.value && !a.children && K({ componentName: "VueUiVerticalBar", type: "datasetAttributeEmpty", property: `value (index ${l})` }), a.children && (Ee(a.children) ? K({ componentName: "VueUiVerticalBar", type: "datasetAttributeEmpty", property: `children (index ${l})` }) : a.children.forEach((t, o) => { [null, void 0].includes(t.name) && K({ componentName: "VueUiVerticalBar", type: "datasetSerieAttribute", property: "name", key: "children", index: o }); })); }), T.dataset.map((a, l) => { const t = `vertical_parent_${l}_${C.value}`, o = a.children && a.children.length > 0, _ = N(a.value ? a.value : o ? a.children.map((x) => x.value || 0).reduce((x, V) => x + V, 0) : 0), f = _ >= 0 ? 1 : -1; return { ...a, id: t, absoluteIndex: l, shape: "square", opacity: P.value.includes(t) ? 0.5 : 1, value: Math.abs(_), sign: f, hasChildren: o, isChild: !1, segregate: () => j(t), isSegregated: P.value.includes(t), color: he(a.color) || Ne.value[l] || R[l] || R[l % R.length], children: !a.children || !a.children.length ? [] : a.children.toSorted(te.value ? () => 0 : (x, V) => Ie.value ? V.value - x.value : x.value - V.value).map((x, V) => ({ ...x, value: N(Math.abs(x.value)), absoluteIndex: l, sign: x.value >= 0 ? 1 : -1, isChild: !0, parentId: t, parentName: a.name, parentValue: _, parentSign: f, id: `vertical_child_${l}_${V}_${C.value}`, childIndex: V, color: he(x.color) || he(a.color) || Ne.value[l] || R[l] || R[l % R.length] })).map((x, V) => ({ ...x, isFirstChild: V === 0, isLastChild: V === a.children.length - 1 })) }; }).toSorted(te.value ? () => 0 : (a, l) => Ie.value ? l.value - a.value : a.value - l.value))), Oe = m(() => ({ cy: "vertical-bar-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" : "" })), v = i(e.value.style.chart.layout.bars.height), g = i(e.value.style.chart.layout.bars.gap), ot = m(() => (v.value + g.value) * Q.value), Fe = i(512), y = m(() => ({ width: Fe.value, height: ot.value, padding: { top: 12, left: 128 + e.value.style.chart.layout.bars.offsetX, right: 64 + e.value.style.chart.layout.bars.paddingRight, bottom: 12 } })), s = m(() => ({ fullHeight: y.value.padding.top + y.value.padding.bottom + y.value.height, top: y.value.padding.top, left: y.value.padding.left, right: y.value.width - y.value.padding.right, bottom: y.value.padding.top + y.value.height, width: y.value.width - (y.value.padding.left + y.value.padding.right) })); function ee() { Q.value = F.value.flatMap((a) => a.children && a.children.length > 0 ? a.children.length : 1).reduce((a, l) => a + l, 0); } const P = i([]); function j(a) { P.value.includes(a) ? P.value = P.value.filter((l) => l !== a) : P.value.push(a), ee(), et("selectLegend", F.value); } const F = m(() => O.value.filter((a) => !P.value.includes(a.id))), S = m(() => F.value.map((a) => Math.abs(a.value)).reduce((a, l) => a + l, 0)); function Me(a, l = !1, t = 0) { return l ? D({ v: N(Math.abs(a) / S.value * 100), s: "%", r: t }) : Math.abs(a) / S.value; } const M = m(() => F.value.flatMap((a) => a.hasChildren ? a.children : a)), z = m(() => M.value.map((a) => a.sign).includes(-1)), nt = m(() => Math.max(...F.value.flatMap((a) => a.children && a.children.length ? Math.max(...a.children.map((l) => l.value)) : a.value))); function w(a) { const l = a / nt.value; return s.value.width / (z.value ? 2 : 1) * l; } function ut(a) { return w(a) + s.value.left; } function q(a, l) { const t = F.value.find((f) => f.id === a.parentId), o = s.value.top + (g.value + v.value) * l, _ = t.children.length * (g.value + v.value); return { y: o + _ / 2 - e.value.style.chart.layout.bars.parentLabels.fontSize, name: t.name, value: [void 0, NaN, null].includes(t.value) ? "" : t.sign === 1 ? t.value : -t.value, percentageToTotal: isNaN(t.value / S.value) ? "" : Me(t.value, !0, e.value.style.chart.layout.bars.dataLabels.percentage.roundingPercentage), sign: t.sign }; } function st() { return F.value; } const ie = i(null), de = i(null); function rt(a, l) { de.value = { datapoint: a, seriesIndex: l, series: O.value, config: e.value }, oe.value = !0, ie.value = a.id; let t = ""; const o = a.isChild ? a.parentName : a.name, _ = a.isChild ? a.name : "", f = e.value.style.chart.tooltip.customFormat; Lt(f) && Nt(() => f({ datapoint: a, series: O.value, config: e.value, seriesIndex: l })) ? ne.value = f({ datapoint: a, series: O.value, config: e.value, seriesIndex: l }) : (t += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;text-align:left;"> <div style="display:flex;align-items:center;gap:4px;"><svg viewBox="0 0 60 60" height="14" width="14"><rect x="0" y="0" height="60" width="60" rx="5" stroke="none" fill="${a.color}"/>${Je.pattern ? `<rect x="0" y="0" height="60" width="60" rx="5" stroke="none" fill="url(#pattern_${C.value}_${a.absoluteIndex})"/>` : ""}</svg> ${o}</div> ${_ ? `<div>${_}</div>` : ""} </div>`, e.value.style.chart.tooltip.showValue && (t += `<div>${e.value.translations.value}: <b>${le( e.value.style.chart.layout.bars.dataLabels.value.formatter, a.sign === 1 ? a.value : -a.value, D({ p: e.value.style.chart.tooltip.prefix, v: a.sign === 1 ? a.value : -a.value, s: e.value.style.chart.tooltip.suffix, r: e.value.style.chart.tooltip.roundingValue }), { datapoint: a, seriesIndex: l } )}</b></div>`), e.value.style.chart.tooltip.showPercentage && (t += `<div>${e.value.translations.percentageToTotal} : <b>${D({ v: Math.abs(a.value) / S.value * 100, s: "%", r: e.value.style.chart.tooltip.roundingPercentage })}</b></div>`, a.isChild && (t += `<div>${e.value.translations.percentageToSerie}: <b>${D({ v: Math.abs(a.value) / Math.abs(a.parentValue) * 100, s: "%", r: e.value.style.chart.tooltip.roundingPercentage })}</b></div>`)), ne.value = `<div style="text-align:left">${t}</div>`); } function ze(a, l, t, o) { if (!e.value.style.chart.layout.bars.dataLabels.value.show) return ""; const _ = le( e.value.style.chart.layout.bars.dataLabels.value.formatter, N(o === -1 && a >= 0 ? -a : a), D({ p: e.value.style.chart.layout.bars.dataLabels.value.prefix, v: N(o === -1 && a >= 0 ? -a : a), s: e.value.style.chart.layout.bars.dataLabels.value.suffix, r: e.value.style.chart.layout.bars.dataLabels.value.roundingValue }), { datapoint: l, seriesIndex: t } ), f = `(${Me(a, !0, e.value.style.chart.layout.bars.dataLabels.percentage.roundingPercentage)})`; return `${_}${e.value.style.chart.layout.bars.dataLabels.percentage.show ? ` ${f}` : ""}`; } const L = m(() => { const a = [ e.value.translations.parentName, e.value.translations.value, e.value.translations.percentageToTotal, e.value.translations.childName, e.value.translations.value, e.value.translations.percentageToSerie, e.value.translations.percentageToTotal ], l = M.value.map((t) => t.isChild ? t.isFirstChild ? { color: t.color, parentName: t.parentName, parentValue: t.parentValue, percentageToTotal: t.parentValue / S.value, childName: t.name, childValue: t.sign === 1 ? t.value : -t.value, childPercentageToParent: Math.abs(t.value) / Math.abs(t.parentValue), childPercentageToTotal: Math.abs(t.value) / S.value } : { color: "", parentName: "", parentValue: "", percentageToTotal: "", childName: t.name, childValue: t.sign === 1 ? t.value : -t.value, childPercentageToParent: Math.abs(t.value) / Math.abs(t.parentValue), childPercentageToTotal: Math.abs(t.value) / S.value } : { color: t.color, parentName: t.name, parentValue: t.sign === 1 ? t.value : -t.value, percentageToTotal: Math.abs(t.value) / S.value, childName: "", childValue: "", childPercentageToParent: "", childPercentageToTotal: "" }); return { head: a, body: l }; }); function Ae() { const a = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], l = L.value.head, t = L.value.body.map((f) => [ f.parentName, f.parentValue, f.percentageToTotal, f.childName, f.childValue, f.childPercentageToParent, f.childPercentageToTotal ]), o = a.concat([l]).concat(t), _ = Ct(o); Tt({ csvContent: _, title: e.value.style.chart.title.text || "vue-ui-vertical-bar" }); } const U = i(!1); function it(a) { U.value = a, ye.value += 1; } function Be() { $.value.showTable = !$.value.showTable; } const dt = i({ none: 0, asc: 1, desc: 2 }), I = i(0), te = i(!1); Xe(() => { ["none", "asc", "desc"].includes(e.value.style.chart.layout.bars.sort) || K({ componentName: "VueUiVerticalBar", type: "attributeWrongValue", property: "style.chart.layout.bars.sort", key: e.value.style.chart.layout.bars.sort }), I.value = dt.value[e.value.style.chart.layout.bars.sort], $.value.sortDesc = I.value === 2, te.value = I.value === 0; }); function vt() { I.value += 1, I.value > 2 && (I.value = 0); } function Re() { vt(), $.value.sortDesc = I.value === 2, te.value = I.value === 0, ee(); } function De() { $.value.showTooltip = !$.value.showTooltip; } const ae = i(!1); function ve() { ae.value = !ae.value; } return qe({ getData: st, recalculateHeight: ee, generatePdf: Te, generateCsv: Ae, generateImage: Le, toggleTable: Be, toggleSort: Re, toggleTooltip: De, toggleAnnotator: ve }), (a, l) => (u(), r("div", { class: A(`vue-ui-vertical-bar ${U.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`), ref_key: "verticalBarChart", ref: G, id: `vue-ui-vertical-bar_${C.value}`, style: c(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`), onMouseenter: l[5] || (l[5] = () => d(ke)(!0)), onMouseleave: l[6] || (l[6] = () => d(ke)(!1)) }, [ e.value.userOptions.buttons.annotator ? (u(), B(Rt, { key: 0, svgRef: d($e), backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, active: ae.value, onClose: ve }, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : p("", !0), tt.value ? (u(), r("div", { key: 1, ref_key: "noTitle", ref: be, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : p("", !0), e.value.style.chart.title.text ? (u(), r("div", { key: 2, ref_key: "chartTitle", ref: ge, style: "width:100%;background:transparent;padding-bottom:12px" }, [ (u(), B(Vt, { key: `title_${me.value}`, config: { title: { cy: "vertical-bar-div-title", ...e.value.style.chart.title }, subtitle: { cy: "vertical-bar-div-subtitle", ...e.value.style.chart.title.subtitle } } }, null, 8, ["config"])) ], 512)) : p("", !0), e.value.userOptions.show && J.value && (d(_e) || d(re)) ? (u(), B(Ot, { ref_key: "details", ref: Qe, key: `user_options_${ye.value}`, backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, isImaging: d(Ce), isPrinting: d(xe), uid: C.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, hasSort: e.value.userOptions.buttons.sort, hasFullscreen: e.value.userOptions.buttons.fullscreen, isFullscreen: U.value, isTooltip: $.value.showTooltip, titles: { ...e.value.userOptions.buttonTitles }, chartElement: G.value, position: e.value.userOptions.position, hasAnnotator: e.value.userOptions.buttons.annotator, isAnnotation: ae.value, onToggleFullscreen: it, onGeneratePdf: d(Te), onGenerateCsv: Ae, onGenerateImage: d(Le), onToggleTable: Be, onToggleSort: Re, onToggleTooltip: De, onToggleAnnotator: ve, style: c({ visibility: d(_e) ? d(re) ? "visible" : "hidden" : "visible" }) }, ce({ _: 2 }, [ a.$slots.menuIcon ? { name: "menuIcon", fn: k(({ isOpen: t, color: o }) => [ b(a.$slots, "menuIcon", X(E({ isOpen: t, color: o })), void 0, !0) ]), key: "0" } : void 0, a.$slots.optionTooltip ? { name: "optionTooltip", fn: k(() => [ b(a.$slots, "optionTooltip", {}, void 0, !0) ]), key: "1" } : void 0, a.$slots.optionPdf ? { name: "optionPdf", fn: k(() => [ b(a.$slots, "optionPdf", {}, void 0, !0) ]), key: "2" } : void 0, a.$slots.optionCsv ? { name: "optionCsv", fn: k(() => [ b(a.$slots, "optionCsv", {}, void 0, !0) ]), key: "3" } : void 0, a.$slots.optionImg ? { name: "optionImg", fn: k(() => [ b(a.$slots, "optionImg", {}, void 0, !0) ]), key: "4" } : void 0, a.$slots.optionTable ? { name: "optionTable", fn: k(() => [ b(a.$slots, "optionTable", {}, void 0, !0) ]), key: "5" } : void 0, a.$slots.optionLabels ? { name: "optionLabels", fn: k(() => [ b(a.$slots, "optionLabels", {}, void 0, !0) ]), key: "6" } : void 0, a.$slots.optionSort ? { name: "optionSort", fn: k(() => [ b(a.$slots, "optionSort", {}, void 0, !0) ]), key: "7" } : void 0, a.$slots.optionFullscreen ? { name: "optionFullscreen", fn: k(({ toggleFullscreen: t, isFullscreen: o }) => [ b(a.$slots, "optionFullscreen", X(E({ toggleFullscreen: t, isFullscreen: o })), void 0, !0) ]), key: "8" } : void 0, a.$slots.optionAnnotator ? { name: "optionAnnotator", fn: k(({ toggleAnnotator: t, isAnnotator: o }) => [ b(a.$slots, "optionAnnotator", X(E({ toggleAnnotator: t, isAnnotator: o })), void 0, !0) ]), key: "9" } : void 0 ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasSort", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : p("", !0), e.value.style.chart.legend.show && e.value.style.chart.legend.position === "top" ? (u(), r("div", { key: 4, ref_key: "chartLegend", ref: ue }, [ (u(), B(He, { key: `legend_top_${se.value}`, legendSet: O.value, config: Oe.value, onClickMarker: l[0] || (l[0] = ({ legend: t }) => j(t.id)) }, ce({ item: k(({ legend: t, index: o }) => [ n("div", { onClick: (_) => j(t.id), style: c(`opacity:${P.value.includes(t.id) ? 0.5 : 1}`) }, h(t.name) + ": " + h(d(le)( e.value.style.chart.layout.bars.dataLabels.value.formatter, t.value, d(D)({ p: e.value.style.chart.legend.prefix, v: t.value, s: e.value.style.chart.legend.suffix, r: e.value.style.chart.legend.roundingValue }), { datapoint: t, seriesIndex: o } )), 13, Ht) ]), _: 2 }, [ a.$slots.pattern ? { name: "legend-pattern", fn: k(({ legend: t, index: o }) => [ Y(Ge, { shape: t.shape, radius: 30, stroke: "none", plot: { x: 30, y: 30 }, fill: `url(#pattern_${C.value}_${o})` }, null, 8, ["shape", "fill"]) ]), key: "0" } : void 0 ]), 1032, ["legendSet", "config"])) ], 512)) : p("", !0), J.value ? (u(), r("svg", { key: 5, ref_key: "svgRef", ref: $e, xmlns: d(wt), class: A({ "vue-data-ui-fullscreen--on": U.value, "vue-data-ui-fulscreen--off": !U.value }), viewBox: `0 0 ${y.value.width <= 0 ? 10 : y.value.width} ${s.value.fullHeight <= 0 ? 10 : s.value.fullHeight}`, style: c(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`) }, [ Y(Bt), a.$slots["chart-background"] ? (u(), r("foreignObject", { key: 0, x: 0, y: 0, width: y.value.width <= 0 ? 10 : y.value.width, height: s.value.fullHeight <= 0 ? 10 : s.value.fullHeight, style: { pointerEvents: "none" } }, [ b(a.$slots, "chart-background", {}, void 0, !0) ], 8, Gt)) : p("", !0), (u(!0), r(H, null, W(M.value, (t, o) => (u(), r("linearGradient", { x1: "0%", y1: "0%", x2: "100%", y2: "0%", id: `vertical_bar_gradient_${C.value}_${o}` }, [ n("stop", { offset: "0%", "stop-color": t.color }, null, 8, qt), n("stop", { offset: "100%", "stop-color": d(pe)(d(xt)(t.color, 0.03), 100 - e.value.style.chart.layout.bars.gradientIntensity) }, null, 8, Yt) ], 8, jt))), 256)), a.$slots.pattern ? (u(), r("g", Kt, [ (u(!0), r(H, null, W(M.value, (t) => (u(), r("defs", null, [ b(a.$slots, "pattern", yt({ ref_for: !0 }, { seriesIndex: t.absoluteIndex, patternId: `pattern_${C.value}_${t.absoluteIndex}` }), void 0, !0) ]))), 256)) ])) : p("", !0), (u(!0), r(H, null, W(M.value, (t, o) => (u(), r("g", null, [ n("rect", { x: d(N)(z.value ? s.value.left + s.value.width / 2 - (t.sign === 1 ? 0 : w(t.value) <= 0 ? 1e-4 : w(t.value)) : s.value.left), y: s.value.top + (g.value + v.value) * o, width: d(N)(w(t.value) <= 0 ? 1e-4 : w(t.value)), height: v.value <= 0 ? 1e-4 : v.value, fill: e.value.style.chart.layout.bars.underlayerColor, rx: e.value.style.chart.layout.bars.borderRadius, class: A({ animated: e.value.useCssAnimation }) }, null, 10, Jt) ]))), 256)), (u(!0), r(H, null, W(M.value, (t, o) => (u(), r("g", null, [ n("rect", { x: d(N)(z.value ? s.value.left + s.value.width / 2 - (t.sign === 1 ? 0 : w(t.value) <= 0 ? 1e-4 : w(t.value)) : s.value.left), y: s.value.top + (g.value + v.value) * o, width: d(N)(w(t.value) <= 0 ? 1e-4 : w(t.value)), height: v.value <= 0 ? 1e-4 : v.value, fill: e.value.style.chart.layout.bars.useGradient ? `url(#vertical_bar_gradient_${C.value}_${o})` : d(pe)(t.color, e.value.style.chart.layout.bars.fillOpacity), rx: e.value.style.chart.layout.bars.borderRadius, stroke: e.value.style.chart.layout.bars.useStroke ? t.color : "none", "stroke-width": e.value.style.chart.layout.bars.useStroke ? e.value.style.chart.layout.bars.strokeWidth : 0, class: A({ animated: e.value.useCssAnimation }) }, null, 10, Qt), a.$slots.pattern ? (u(), r("rect", { key: 0, x: d(N)(z.value ? s.value.left + s.value.width / 2 - (t.sign === 1 ? 0 : w(t.value) <= 0 ? 1e-4 : w(t.value)) : s.value.left), y: s.value.top + (g.value + v.value) * o, width: d(N)(w(t.value) <= 0 ? 1e-4 : w(t.value)), height: v.value <= 0 ? 1e-4 : v.value, fill: `url(#pattern_${C.value}_${t.absoluteIndex})`, rx: e.value.style.chart.layout.bars.borderRadius, stroke: e.value.style.chart.layout.bars.useStroke ? t.color : "none", "stroke-width": e.value.style.chart.layout.bars.useStroke ? e.value.style.chart.layout.bars.strokeWidth : 0, class: A({ animated: e.value.useCssAnimation }) }, null, 10, Zt)) : p("", !0), (!t.isChild || t.isLastChild) && e.value.style.chart.layout.separators.show && o !== M.value.length - 1 ? (u(), r("line", { key: 1, x1: 0, x2: s.value.left, y1: v.value + g.value / 2 + s.value.top + (g.value + v.value) * o, y2: v.value + g.value / 2 + s.value.top + (g.value + v.value) * o, stroke: e.value.style.chart.layout.separators.color, "stroke-width": e.value.style.chart.layout.separators.strokeWidth, "stroke-linecap": "round" }, null, 8, ea)) : p("", !0), z.value && e.value.style.chart.layout.separators.show ? (u(), r("line", { key: 2, x1: s.value.left + s.value.width / 2, x2: s.value.left + s.value.width / 2, y1: s.value.top, y2: s.value.bottom, stroke: e.value.style.chart.layout.separators.color, "stroke-width": e.value.style.chart.layout.separators.strokeWidth, "stroke-linecap": "round" }, null, 8, ta)) : p("", !0), n("text", { x: z.value ? s.value.left + s.value.width / 2 + (t.sign === 1 ? -12 : 12) + (t.sign === 1 ? -e.value.style.chart.layout.bars.dataLabels.offsetX : e.value.style.chart.layout.bars.dataLabels.offsetX) : ut(t.value) + 3 + e.value.style.chart.layout.bars.dataLabels.offsetX, y: s.value.top + (g.value + v.value) * o + v.value / 2 + e.value.style.chart.layout.bars.dataLabels.fontSize / 2, "text-anchor": !z.value || t.sign === -1 ? "start" : "end", "font-size": e.value.style.chart.layout.bars.dataLabels.fontSize, fill: e.value.style.chart.layout.bars.dataLabels.color, "font-weight": e.value.style.chart.layout.bars.dataLabels.bold ? "bold" : "normal" }, h(ze(t.value, t, o, t.sign)), 9, aa), (t.isChild || !t.hasChildren) && e.value.style.chart.layout.bars.nameLabels.show ? (u(), r("text", { key: 3, "text-anchor": "end", x: s.value.left - 3 + e.value.style.chart.layout.bars.nameLabels.offsetX, y: s.value.top + (g.value + v.value) * o + v.value / 2 + e.value.style.chart.layout.bars.nameLabels.fontSize / 2, "font-size": e.value.style.chart.layout.bars.nameLabels.fontSize, fill: e.value.style.chart.layout.bars.nameLabels.color, "font-weight": e.value.style.chart.layout.bars.nameLabels.bold ? "bold" : "normal" }, h(t.name), 9, la)) : p("", !0), t.isChild && t.childIndex === 0 && e.value.style.chart.layout.bars.parentLabels.show ? (u(), r("text", { key: 4, x: 3 + e.value.style.chart.layout.bars.parentLabels.offsetX, y: q(t, o).y, "font-size": e.value.style.chart.layout.bars.parentLabels.fontSize, fill: e.value.style.chart.layout.bars.parentLabels.color, "font-weight": e.value.style.chart.layout.bars.parentLabels.bold ? "bold" : "normal", "text-anchor": "start" }, h(q(t, o).name), 9, oa)) : p("", !0), t.isChild && t.childIndex === 0 && e.value.style.chart.layout.bars.parentLabels.show ? (u(), r("text", { key: 5, x: 3 + e.value.style.chart.layout.bars.parentLabels.offsetX, y: q(t, o).y + e.value.style.chart.layout.bars.parentLabels.fontSize + 6, "font-size": e.value.style.chart.layout.bars.parentLabels.fontSize, fill: e.value.style.chart.layout.bars.parentLabels.color, "font-weight": e.value.style.chart.layout.bars.dataLabels.bold ? "bold" : "normal", "text-anchor": "start" }, h(ze(q(t, o).value), q(t, o), o, t.parentSign || t.sign), 9, na)) : p("", !0), n("rect", { x: 0, y: s.value.top + (g.value + v.value) * o - g.value / 2, width: y.value.width <= 0 ? 1e-4 : y.value.width, height: v.value + g.value <= 0 ? 1e-4 : v.value + g.value, fill: ie.value === t.id ? d(pe)(e.value.style.chart.layout.highlighter.color, e.value.style.chart.layout.highlighter.opacity) : "transparent", onMouseenter: (_) => rt(t, o), onMouseleave: l[1] || (l[1] = (_) => { Ze.value = null, oe.value = !1, ie.value = null; }) }, null, 40, ua) ]))), 256)), b(a.$slots, "svg", { svg: y.value }, void 0, !0) ], 14, Wt)) : p("", !0), a.$slots.watermark ? (u(), r("div", sa, [ b(a.$slots, "watermark", X(E({ isPrinting: d(xe) || d(Ce) })), void 0, !0) ])) : p("", !0), J.value ? p("", !0) : (u(), B(Mt, { key: 7, config: { type: "verticalBar", style: { backgroundColor: e.value.style.chart.backgroundColor, verticalBar: { axis: { color: "#CCCCCC" }, color: "#CCCCCC" } } } }, null, 8, ["config"])), e.value.style.chart.legend.show && e.value.style.chart.legend.position === "bottom" ? (u(), r("div", { key: 8, ref_key: "chartLegend", ref: ue }, [ (u(), B(He, { key: `legend_bottom_${se.value}`, legendSet: O.value, config: Oe.value, onClickMarker: l[2] || (l[2] = ({ legend: t }) => j(t.id)) }, ce({ item: k(({ legend: t, index: o }) => [ n("div", { onClick: (_) => j(t.id), style: c(`opacity:${P.value.includes(t.id) ? 0.5 : 1}`) }, h(t.name) + ": " + h(d(le)( e.value.style.chart.layout.bars.dataLabels.value.formatter, t.value, d(D)({ p: e.value.style.chart.legend.prefix, v: t.value, s: e.value.style.chart.legend.suffix, r: e.value.style.chart.legend.roundingValue }), { datapoint: t, seriesIndex: o } )), 13, ra) ]), _: 2 }, [ a.$slots.pattern ? { name: "legend-pattern", fn: k(({ legend: t, index: o }) => [ Y(Ge, { shape: t.shape, radius: 30, stroke: "none", plot: { x: 30, y: 30 }, fill: `url(#pattern_${C.value}_${o})` }, null, 8, ["shape", "fill"]) ]), key: "0" } : void 0 ]), 1032, ["legendSet", "config"])) ], 512)) : p("", !0), b(a.$slots, "legend", { legend: O.value }, void 0, !0), a.$slots.source ? (u(), r("div", { key: 9, ref_key: "source", ref: fe, dir: "auto" }, [ b(a.$slots, "source", {}, void 0, !0) ], 512)) : p("", !0), Y(Ft, { show: $.value.showTooltip && oe.value && P.value.length < T.dataset.length, 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: G.value, content: ne.value, isFullscreen: U.value, isCustom: e.value.style.chart.tooltip.customFormat && typeof e.value.style.chart.tooltip.customFormat == "function" }, { "tooltip-before": k(() => [ b(a.$slots, "tooltip-before", X(E({ ...de.value })), void 0, !0) ]), "tooltip-after": k(() => [ b(a.$slots, "tooltip-after", X(E({ ...de.value })), void 0, !0) ]), _: 3 }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]), J.value ? (u(), B(At, { 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: k(() => [ n("div", { ref_key: "tableContainer", ref: Pe, class: "vue-ui-vertical-bar-table atom-data-table" }, [ n("div", ia, [ n("div", { role: "button", tabindex: "0", style: c(`width:32px; position: absolute; top: 0; right:4px; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; width: 32px; cursor:pointer; background:${e.value.table.th.backgroundColor};`), onClick: l[3] || (l[3] = (t) => $.value.showTable = !1), onKeypress: l[4] || (l[4] = gt((t) => $.value.showTable = !1, ["enter"])) }, [ Y(zt, { name: "close", stroke: e.value.table.th.color, "stroke-width": 2 }, null, 8, ["stroke"]) ], 36), n("div", { style: { width: "100%", "container-type": "inline-size" }, class: A({ "vue-ui-responsive": Se.value }) }, [ n("table", da, [ n("caption", { style: c({ backgroundColor: e.value.table.th.backgroundColor, color: e.value.table.th.color, outline: e.value.table.th.outline }), class: "vue-ui-data-table__caption" }, [ ft(h(e.value.style.chart.title.text) + " ", 1), e.value.style.chart.title.subtitle.text ? (u(), r("span", va, h(e.value.style.chart.title.subtitle.text), 1)) : p("", !0) ], 4), n("thead", null, [ n("tr", { role: "row", style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color}`) }, [ (u(!0), r(H, null, W(L.value.head, (t) => (u(), r("th", { style: c(`outline:${e.value.table.th.outline}`) }, [ n("div", ca, h(t), 1) ], 4))), 256)) ], 4), n("tr", null, [ n("th", { style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`) }, null, 4), n("th", { style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`) }, "∑ " + h(e.value.table.td.prefix) + h(isNaN(S.value) ? "" : S.value.toFixed(e.value.table.td.roundingValue)) + h(e.value.table.td.suffix), 5), n("th", { style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline};text-align:right;padding-right:5px;font-weight:bold`) }, "100%", 4), n("th", { style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`) }, null, 4), n("th", { style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`) }, null, 4), n("th", { style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`) }, null, 4), n("th", { style: c(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`) }, null, 4) ]) ]), n("tbody", null, [ (u(!0), r(H, null, W(L.value.body, (t, o) => (u(), r("tr", { class: A({ "vue-ui-data-table__tbody__row": !0, "vue-ui-data-table__tbody__row-even": o % 2 === 0, "vue-ui-data-table__tbody__row-odd": o % 2 !== 0 }), style: c(`background:${e.value.table.td.backgroundColor};color:${e.value.table.td.color}`) }, [ n("td", { class: "vue-ui-data-table__tbody__td", style: c(`outline:${e.value.table.td.outline};font-variant-numeric: tabular-nums;`), "data-cell": L.value.head[0] ?? "" }, [ n("div", pa, [ t.color ? (u(), r("span", { key: 0, style: c(`color:${t.color};margin-right:3px`) }, "⬤", 4)) : p("", !0), n("span", null, h(t.parentName), 1) ]) ], 12, ha), n("td", { class: "vue-ui-data-table__tbody__td", style: c(`outline:${e.value.table.td.outline}`), "data-cell": L.value.head[1] ?? "" }, [ n("div", ga, h(e.value.table.td.prefix) + h(["", NaN, void 0].includes(t.parentValue) ? "" : t.parentValue.toFixed(e.value.table.td.roundingValue)) + h(e.value.table.td.suffix), 1) ], 12, ya), n("td", { class: "vue-ui-data-table__tbody__td", style: c(`outline:${e.value.table.td.outline}`), "data-cell": L.value.head[2] ?? "" }, [ n("div", ba, h(["", NaN, void 0].includes(t.percentageToTotal) ? "" : `${(t.percentageToTotal * 100).toFixed(e.value.table.td.roundingPercentage)}%`), 1) ], 12, fa), n("td", { class: "vue-ui-data-table__tbody__td", style: c(`outline:${e.value.table.td.outline}`), "data-cell": L.value.head[3] ?? "" }, [ n("div", ka, h(t.childName), 1) ], 12, ma), n("td", { class: "vue-ui-data-table__tbody__td", style: c(`outline:${e.value.table.td.outline}`), "data-cell": L.value.head[4] ?? "" }, [ n("div", $a, h(e.value.table.td.prefix) + h(["", NaN, void 0].includes(t.childValue) ? "" : t.childValue.toFixed(e.value.table.td.roundingValue)) + h(e.value.table.td.suffix), 1) ], 12, _a), n("td", { class: "vue-ui-data-table__tbody__td", style: c(`outline:${e.value.table.td.outline}`), "data-cell": L.value.head[5] ?? "" }, [ n("div", xa, h(["", NaN, void 0].includes(t.childPercentageToParent) ? "" : `${(t.childPercentageToParent * 100).toFixed(e.value.table.td.roundingPercentage)}%`), 1) ], 12, wa), n("td", { class: "vue-ui-data-table__tbody__td", style: c(`outline:${e.value.table.td.outline}`), "data-cell": L.value.head[6] ?? "" }, [ n("div", Ta, h(["", NaN, void 0].includes(t.childPercentageToTotal) ? "" : `${(t.childPercentageToTotal * 100).toFixed(e.value.table.td.roundingPercentage)}%`), 1) ], 12, Ca) ], 6))), 256)) ]) ]) ], 2) ]) ], 512) ]), _: 1 }, 8, ["config"])) : p("", !0) ], 46, Et)); } }, Wa = /* @__PURE__ */ Xt(La, [["__scopeId", "data-v-743d59c1"]]); export { Wa as default };