UNPKG

vue-data-ui

Version:

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

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