UNPKG

vue-data-ui

Version:

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

747 lines (746 loc) • 33.2 kB
import { defineAsyncComponent as $, computed as x, ref as d, watch as Be, shallowRef as ge, onMounted as Ee, onBeforeUnmount as Ue, createElementBlock as r, openBlock as u, unref as i, normalizeStyle as Y, normalizeClass as pe, createBlock as F, createCommentVNode as y, renderSlot as h, createVNode as be, createSlots as De, withCtx as f, normalizeProps as M, guardReactiveProps as P, createElementVNode as v, Fragment as R, renderList as B, toDisplayString as C, createTextVNode as xe, nextTick as Ge } from "vue"; import { u as Ve, c as We, a as Xe, o as je, e as He, v as c, X as Ye, s as q, w as me, i as T, f as A, q as qe, r as Je, x as Ke, y as Qe } from "./index-BLtEpj8j.js"; import { t as Ze, u as et } from "./useResponsive-DfdjqQps.js"; import { u as we } from "./useNestedProp-Bw1KcAmj.js"; import { u as tt } from "./usePrinter-DnRwTdvS.js"; import { u as lt } from "./useUserOptionState-BIvW1Kz7.js"; import { u as at } from "./useChartAccessibility-9icAAmYg.js"; import ot from "./Title-DkG60EPg.js"; import st from "./img-D-vWHxhM.js"; import { _ as it } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const ut = ["id"], rt = ["xmlns", "viewBox"], nt = ["x", "y", "width", "height"], vt = ["id"], dt = ["stop-color"], yt = ["stop-color"], ht = ["id"], ct = ["stop-color"], ft = ["stop-color"], gt = ["x", "y", "width", "height", "fill", "rx"], pt = ["x", "y", "width", "height", "fill", "rx"], bt = ["x", "y", "width", "height", "fill", "rx"], xt = ["x", "y", "width", "height", "fill", "rx"], mt = { key: 0 }, wt = ["x", "y", "fill", "font-size", "font-weight"], kt = ["x", "y", "fill", "font-size", "font-weight"], _t = { key: 1 }, Ct = ["x", "y", "font-size", "fill", "font-weight"], $t = { key: 2 }, Tt = { key: 0 }, At = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Lt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], St = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], zt = ["x", "y", "font-size", "fill", "font-weight"], Ot = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], It = ["x", "y", "font-size", "fill", "font-weight"], Ft = ["x", "y", "font-size", "fill", "font-weight"], Mt = ["x", "y", "width", "height", "fill", "onMouseover"], Pt = { key: 5, class: "vue-data-ui-watermark" }, Rt = { __name: "vue-ui-age-pyramid", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Array, default() { return []; } } }, setup(J, { expose: ke }) { const _e = $(() => import("./vue-ui-accordion-B6Svdk-2.js")), Ce = $(() => import("./DataTable-CS_V_Adx.js")), $e = $(() => import("./PackageVersion-CnRyWKP-.js")), Te = $(() => import("./PenAndPaper-7BWf7zgA.js")), Ae = $(() => import("./vue-ui-skeleton-CsMU8DwQ.js")), Le = $(() => import("./Tooltip-CuHsd1IQ.js")), Se = $(() => import("./UserOptions-DGw0HvSp.js")), { vue_ui_age_pyramid: ze } = Ve(), g = J, E = x(() => !!g.dataset && g.dataset.length), w = d(We()), Oe = d(null), V = d(!1), W = d(""), U = d(null), K = d(0), k = d(null), Q = d(null), Z = d(null), ee = d(null), te = d(0), le = d(0), e = x({ get: () => ie(), set: (t) => t }), { userOptionsVisible: X, setUserOptionsVisibility: ae, keepUserOptionState: oe } = lt({ config: e.value }), { svgRef: se } = at({ config: e.value.style.title }); function ie() { const t = we({ userConfig: g.config, defaultConfig: ze }); return t.theme ? { ...we({ userConfig: Xe.vue_ui_age_pyramid[t.theme] || g.config, defaultConfig: t }) } : t; } Be(() => g.config, (t) => { e.value = ie(), X.value = !e.value.userOptions.showOnChartHover, ue(), te.value += 1, le.value += 1, m.value.showTable = e.value.table.show, m.value.showTooltip = e.value.style.tooltip.show; }, { deep: !0 }); const _ = ge(null), L = ge(null); Ee(() => { ue(); }); function ue() { if (je(g.dataset) && He({ componentName: "VueUiAgePyramid", type: "dataset" }), e.value.responsive) { const t = Ze(() => { const { width: s, height: l } = et({ chart: k.value, title: e.value.style.title.text ? Q.value : null, source: Z.value, noTitle: ee.value }); requestAnimationFrame(() => { p.value.width = s, p.value.height = l; }); }); _.value && (L.value && _.value.unobserve(L.value), _.value.disconnect()), _.value = new ResizeObserver(t), L.value = k.value.parentNode, _.value.observe(L.value); } } Ue(() => { _.value && (L.value && _.value.unobserve(L.value), _.value.disconnect()); }); const { isPrinting: re, isImaging: ne, generatePdf: ve, generateImage: de } = tt({ elementId: `vue-ui-age-pyramid_${w.value}`, fileName: e.value.style.title.text || "vue-ui-age-pyramid", options: e.value.userOptions.print }), Ie = x(() => e.value.userOptions.show && !e.value.style.title.text), m = d({ showTable: e.value.table.show, showTooltip: e.value.style.tooltip.show }), p = d({ height: e.value.style.height, width: e.value.style.width }), o = x(() => { const t = p.value.width - e.value.style.layout.padding.right - e.value.style.layout.padding.left, s = e.value.style.layout.padding.left, l = p.value.width - e.value.style.layout.padding.right; return { top: e.value.style.layout.padding.top, left: s, right: l, bottom: p.value.height - e.value.style.layout.padding.bottom, width: t, height: p.value.height - e.value.style.layout.padding.top - e.value.style.layout.padding.bottom, centerX: e.value.style.layout.padding.left + t / 2, leftChart: { width: t / 2 - e.value.style.layout.centerSlit.width, right: s + t / 2 - e.value.style.layout.centerSlit.width }, rightChart: { width: t / 2 - e.value.style.layout.centerSlit.width, left: s + t / 2 + e.value.style.layout.centerSlit.width } }; }), Fe = x(() => g.dataset.map((t) => e.value.style.layout.dataLabels.yAxis.display === "age" ? t[1] : t[0])), S = x(() => { const t = Me(N.value / 5), s = [], l = []; for (let a = 0; a <= 5; a += 1) { const n = t * a, b = t * (a - 5); s.push({ value: n, x: o.value.left + o.value.width / 2 + e.value.style.layout.centerSlit.width + n / N.value * o.value.leftChart.width }), l.push({ value: Math.abs(b), x: o.value.left + o.value.width / 2 + b / N.value * o.value.leftChart.width - e.value.style.layout.centerSlit.width }); } return { right: s, left: l }; }); function Me(t) { if (t === 0) return 0; const l = 10 ** Math.floor(Math.log10(Math.abs(t))); let a; return t < 0, a = Math.round(t / l) * l, a; } const N = x(() => Math.max(...g.dataset.flatMap((t) => t.slice(-2).map((s) => c(s))))), z = x(() => g.dataset.length), Pe = x(() => g.dataset.map((t) => ({ segment: t[0], age: t[1], left: { value: t[2], proportionToMax: t[2] / N.value }, right: { value: t[3], proportionToMax: t[3] / N.value } }))), O = x(() => Pe.value.map((t, s) => { const l = o.value.top + o.value.height / z.value * s, a = o.value.height / z.value - e.value.style.layout.bars.gap; return { segment: t.segment, age: t.age, left: { ...t.left, y: l, color: e.value.style.layout.bars.left.color, x: o.value.leftChart.right - t.left.proportionToMax * o.value.leftChart.width, width: c(t.left.proportionToMax * o.value.leftChart.width), height: a }, right: { ...t.right, y: l, color: e.value.style.layout.bars.right.color, x: o.value.rightChart.left, width: c(t.right.proportionToMax * o.value.rightChart.width), height: a } }; })), j = d(null); function Re(t, s) { U.value = t, j.value = { datapoint: s, seriesIndex: t, series: O.value, config: e.value }; const l = e.value.style.tooltip.customFormat; if (Ke(l) && Qe(() => l({ seriesIndex: t, datapoint: { segment: s[0], index: s[1], left: s[2], right: s[3] }, series: O.value, config: e.value }))) W.value = l({ seriesIndex: t, datapoint: { segment: s[0], index: s[1], left: s[2], right: s[3] }, series: O.value, config: e.value }); else { let a = ""; const n = O.value[t]; a += `<div><b>${n.segment}</b></div>`, a += `<div>${e.value.translations.age}: ${T( e.value.style.layout.dataLabels.yAxis.formatter, c(n.age), A({ v: c(n.age) }), { datapoint: s, seriesIndex: t } )}</div>`, a += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}">`, a += '<div style="display:flex; flex-direction:row;gap:12px">', a += `<div style="display:flex;flex-direction:column;align-items:center;justify-content:center"><svg viewBox="0 0 12 12" height="12" width="12"><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.underlayer}"/><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_left_${w.value})` : e.value.style.layout.bars.left.color}"/></svg><div>${e.value.translations.female}</div><div><b>${T( e.value.style.layout.dataLabels.xAxis.formatter, c(n.left.value), A({ v: c(n.left.value) }), { datapoint: s, seriesIndex: t } )}</b></div></div>`, a += `<div style="display:flex;flex-direction:column;align-items:center;justify-content:center"><svg viewBox="0 0 12 12" height="12" width="12"><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.underlayer}"/><rect stroke="none" x="0" y="0" height="12" width="12" rx="2" fill="${e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_right_${w.value})` : e.value.style.layout.bars.right.color}"/></svg><div>${e.value.translations.male}</div><div><b>${T( e.value.style.layout.dataLabels.xAxis.formatter, c(n.right.value), A({ v: c(n.right.value) }), { datapoint: s, seriesIndex: t } )}</b></div></div>`, a += "</div>", a += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}"><div>${e.value.translations.total}</div><div><b>${T( e.value.style.layout.dataLabels.xAxis.formatter, c(n.right.value) + c(n.left.value), A({ v: c(n.right.value) + c(n.left.value) }), { datapoint: s, seriesIndex: t } )}</b></div></div>`, a += "</div>", W.value = `<div>${a}</div>`; } V.value = !0; } function ye(t = null) { Ge(() => { const s = [e.value.translations.year, e.value.translations.age, e.value.translations.female, e.value.translations.male, e.value.translations.total], l = g.dataset.map((b) => [ b[0], b[1], b[2], b[3], b[2] + b[3] ]), a = [[e.value.style.title.text], [e.value.style.title.subtitle.text], [[""], [""], [""]]].concat([s]).concat(l), n = qe(a); t ? t(n) : Je({ csvContent: n, title: e.value.style.title.text || "vue-ui-heatmap" }); }); } const D = x(() => { const t = [ e.value.translations.year, e.value.translations.age, e.value.translations.female, e.value.translations.male, e.value.translations.total ], s = g.dataset.map((a) => [ a[0], a[1], a[2].toLocaleString(), a[3].toLocaleString(), (a[2] + a[3]).toLocaleString() ]), l = { 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: s, config: l, colNames: t }; }), I = d(!1); function he(t) { I.value = t, K.value += 1; } function ce() { m.value.showTable = !m.value.showTable; } function fe() { m.value.showTooltip = !m.value.showTooltip; } const G = d(!1); function H() { G.value = !G.value; } async function Ne({ scale: t = 2 } = {}) { if (!k.value) return; const { width: s, height: l } = k.value.getBoundingClientRect(), a = s / l, { imageUri: n, base64: b } = await st({ domElement: k.value, base64: !0, img: !0, scale: t }); return { imageUri: n, base64: b, title: e.value.style.title.text, width: s, height: l, aspectRatio: a }; } return ke({ getImage: Ne, generatePdf: ve, generateCsv: ye, generateImage: de, toggleTable: ce, toggleTooltip: fe, toggleAnnotator: H, toggleFullscreen: he }), (t, s) => (u(), r("div", { class: pe(`vue-ui-age-pyramid ${I.value ? "vue-data-ui-wrapper-fullscreen" : ""}`), ref_key: "agePyramid", ref: k, id: `vue-ui-age-pyramid_${w.value}`, style: Y(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.backgroundColor};${e.value.responsive ? "height:100%" : ""}`), onMouseenter: s[2] || (s[2] = () => i(ae)(!0)), onMouseleave: s[3] || (s[3] = () => i(ae)(!1)) }, [ e.value.userOptions.buttons.annotator ? (u(), F(i(Te), { key: 0, svgRef: i(se), backgroundColor: e.value.style.backgroundColor, color: e.value.style.color, active: G.value, onClose: H }, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : y("", !0), Ie.value ? (u(), r("div", { key: 1, ref_key: "noTitle", ref: ee, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : y("", !0), e.value.style.title.text ? (u(), r("div", { key: 2, ref_key: "chartTitle", ref: Q, style: "width:100%;background:transparent" }, [ (u(), F(ot, { key: `title_${te.value}`, config: { title: { cy: "pyramid-div-title", ...e.value.style.title }, subtitle: { cy: "pyramid-div-subtitle", ...e.value.style.title.subtitle } } }, null, 8, ["config"])) ], 512)) : y("", !0), e.value.userOptions.show && E.value && (i(oe) || i(X)) ? (u(), F(i(Se), { ref_key: "details", ref: Oe, key: `user_options_${K.value}`, backgroundColor: e.value.style.backgroundColor, color: e.value.style.color, isImaging: i(ne), isPrinting: i(re), uid: w.value, hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.tooltip.show, hasPdf: e.value.userOptions.buttons.pdf, hasXls: e.value.userOptions.buttons.csv, hasImg: e.value.userOptions.buttons.img, hasTable: e.value.userOptions.buttons.table, hasFullscreen: e.value.userOptions.buttons.fullscreen, isFullscreen: I.value, isTooltip: m.value.showTooltip, titles: { ...e.value.userOptions.buttonTitles }, chartElement: k.value, position: e.value.userOptions.position, hasAnnotator: e.value.userOptions.buttons.annotator, isAnnotation: G.value, callbacks: e.value.userOptions.callbacks, printScale: e.value.userOptions.print.scale, onToggleFullscreen: he, onGeneratePdf: i(ve), onGenerateCsv: ye, onGenerateImage: i(de), onToggleTable: ce, onToggleTooltip: fe, onToggleAnnotator: H, style: Y({ visibility: i(oe) ? i(X) ? "visible" : "hidden" : "visible" }) }, De({ _: 2 }, [ t.$slots.menuIcon ? { name: "menuIcon", fn: f(({ isOpen: l, color: a }) => [ h(t.$slots, "menuIcon", M(P({ isOpen: l, color: a })), void 0, !0) ]), key: "0" } : void 0, t.$slots.optionTooltip ? { name: "optionTooltip", fn: f(() => [ h(t.$slots, "optionTooltip", {}, void 0, !0) ]), key: "1" } : void 0, t.$slots.optionPdf ? { name: "optionPdf", fn: f(() => [ h(t.$slots, "optionPdf", {}, void 0, !0) ]), key: "2" } : void 0, t.$slots.optionCsv ? { name: "optionCsv", fn: f(() => [ h(t.$slots, "optionCsv", {}, void 0, !0) ]), key: "3" } : void 0, t.$slots.optionImg ? { name: "optionImg", fn: f(() => [ h(t.$slots, "optionImg", {}, void 0, !0) ]), key: "4" } : void 0, t.$slots.optionTable ? { name: "optionTable", fn: f(() => [ h(t.$slots, "optionTable", {}, void 0, !0) ]), key: "5" } : void 0, t.$slots.optionFullscreen ? { name: "optionFullscreen", fn: f(({ toggleFullscreen: l, isFullscreen: a }) => [ h(t.$slots, "optionFullscreen", M(P({ toggleFullscreen: l, isFullscreen: a })), void 0, !0) ]), key: "6" } : void 0, t.$slots.optionAnnotator ? { name: "optionAnnotator", fn: f(({ toggleAnnotator: l, isAnnotator: a }) => [ h(t.$slots, "optionAnnotator", M(P({ toggleAnnotator: l, isAnnotator: a })), void 0, !0) ]), key: "7" } : void 0 ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "onGeneratePdf", "onGenerateImage", "style"])) : y("", !0), E.value ? (u(), r("svg", { key: 4, ref_key: "svgRef", ref: se, xmlns: i(Ye), class: pe({ "vue-data-ui-fullscreen--on": I.value, "vue-data-ui-fulscreen--off": !I.value }), viewBox: `0 0 ${p.value.width <= 0 ? 10 : p.value.width} ${p.value.height <= 0 ? 10 : p.value.height}`, style: Y(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.color}`) }, [ be(i($e)), t.$slots["chart-background"] ? (u(), r("foreignObject", { key: 0, x: o.value.left, y: o.value.top, width: Math.max(0.1, o.value.width), height: Math.max(0.1, o.value.height), style: { pointerEvents: "none" } }, [ h(t.$slots, "chart-background", {}, void 0, !0) ], 8, nt)) : y("", !0), v("defs", null, [ v("linearGradient", { id: `age_pyramid_left_${w.value}`, x1: "0%", y1: "0%", x2: "100%", y2: "0%" }, [ v("stop", { offset: "0%", "stop-color": e.value.style.layout.bars.left.color }, null, 8, dt), v("stop", { offset: "100%", "stop-color": i(q)(i(me)(e.value.style.layout.bars.left.color, e.value.style.layout.bars.gradient.shiftHue), 100 - e.value.style.layout.bars.gradient.intensity) }, null, 8, yt) ], 8, vt), v("linearGradient", { id: `age_pyramid_right_${w.value}`, x1: "0%", y1: "0%", x2: "100%", y2: "0%" }, [ v("stop", { offset: "0%", "stop-color": i(q)(i(me)(e.value.style.layout.bars.right.color, e.value.style.layout.bars.gradient.shiftHue), 100 - e.value.style.layout.bars.gradient.intensity) }, null, 8, ct), v("stop", { offset: "100%", "stop-color": e.value.style.layout.bars.right.color }, null, 8, ft) ], 8, ht) ]), (u(!0), r(R, null, B(O.value, (l, a) => (u(), r("g", null, [ v("rect", { x: l.left.x, y: l.left.y, width: i(c)(l.left.width <= 0 ? 1e-4 : l.left.width), height: l.left.height <= 0 ? 1e-4 : l.left.height, fill: e.value.style.layout.bars.gradient.underlayer, rx: e.value.style.layout.bars.borderRadius }, null, 8, gt), v("rect", { x: l.left.x, y: l.left.y, width: l.left.width <= 0 ? 1e-4 : l.left.width, height: l.left.height <= 0 ? 1e-4 : l.left.height, fill: e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_left_${w.value})` : l.left.color, rx: e.value.style.layout.bars.borderRadius }, null, 8, pt), v("rect", { x: l.right.x, y: l.right.y, width: l.right.width <= 0 ? 1e-4 : l.right.width, height: l.right.height <= 0 ? 1e-4 : l.right.height, fill: e.value.style.layout.bars.gradient.underlayer, rx: e.value.style.layout.bars.borderRadius }, null, 8, bt), v("rect", { x: l.right.x, y: l.right.y, width: l.right.width <= 0 ? 1e-4 : l.right.width, height: l.right.height <= 0 ? 1e-4 : l.right.height, fill: e.value.style.layout.bars.gradient.show ? `url(#age_pyramid_right_${w.value})` : l.right.color, rx: e.value.style.layout.bars.borderRadius }, null, 8, xt) ]))), 256)), v("g", null, [ e.value.style.layout.dataLabels.sideTitles.show ? (u(), r("g", mt, [ v("text", { x: o.value.left, y: o.value.top + e.value.style.layout.dataLabels.sideTitles.offsetY, fill: e.value.style.layout.dataLabels.sideTitles.useSideColor ? e.value.style.layout.bars.left.color : e.value.style.layout.dataLabels.sideTitles.color, "font-size": e.value.style.layout.dataLabels.sideTitles.fontSize, "text-anchor": "start", "font-weight": e.value.style.layout.dataLabels.sideTitles.bold ? "bold" : "normal" }, C(e.value.translations.female), 9, wt), v("text", { x: o.value.right, y: o.value.top + e.value.style.layout.dataLabels.sideTitles.offsetY, fill: e.value.style.layout.dataLabels.sideTitles.useSideColor ? e.value.style.layout.bars.right.color : e.value.style.layout.dataLabels.sideTitles.color, "font-size": e.value.style.layout.dataLabels.sideTitles.fontSize, "text-anchor": "end", "font-weight": e.value.style.layout.dataLabels.sideTitles.bold ? "bold" : "normal" }, C(e.value.translations.male), 9, kt) ])) : y("", !0), e.value.style.layout.dataLabels.yAxis.show ? (u(), r("g", _t, [ (u(!0), r(R, null, B(Fe.value, (l, a) => (u(), r(R, null, [ a % e.value.style.layout.dataLabels.yAxis.showEvery === 0 ? (u(), r("text", { key: 0, x: o.value.centerX, y: o.value.top + o.value.height / z.value * a + e.value.style.layout.dataLabels.yAxis.fontSize / 3, "text-anchor": "middle", "font-size": e.value.style.layout.dataLabels.yAxis.fontSize, fill: e.value.style.layout.dataLabels.yAxis.color, "font-weight": e.value.style.layout.dataLabels.yAxis.bold ? "bold" : "normal" }, C(i(T)( e.value.style.layout.dataLabels.yAxis.formatter, l, i(A)({ v: l }), { datapoint: l, seriesIndex: a } )), 9, Ct)) : y("", !0) ], 64))), 256)) ])) : y("", !0), e.value.style.layout.dataLabels.xAxis.show ? (u(), r("g", $t, [ e.value.style.layout.grid.show ? (u(), r("g", Tt, [ v("line", { x1: S.value.right[0].x, x2: S.value.right.at(-1).x, y1: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2, y2: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2, stroke: e.value.style.layout.grid.stroke, "stroke-width": e.value.style.layout.grid.strokeWidth, "stroke-linecap": "round" }, null, 8, At), v("line", { x1: S.value.left[0].x, x2: S.value.left.at(-1).x, y1: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2, y2: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2, stroke: e.value.style.layout.grid.stroke, "stroke-width": e.value.style.layout.grid.strokeWidth, "stroke-linecap": "round" }, null, 8, Lt) ])) : y("", !0), (u(!0), r(R, null, B(S.value.right, (l, a) => (u(), r("g", null, [ e.value.style.layout.grid.show ? (u(), r("line", { key: 0, x1: l.x, x2: l.x, y1: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2, y2: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 4, stroke: e.value.style.layout.grid.stroke, "stroke-width": e.value.style.layout.grid.strokeWidth, "stroke-linecap": "round" }, null, 8, St)) : y("", !0), v("text", { x: l.x, y: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize * 2, "font-size": e.value.style.layout.dataLabels.xAxis.fontSize, fill: e.value.style.layout.dataLabels.xAxis.color, "text-anchor": "middle", "font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal" }, C(i(T)( e.value.style.layout.dataLabels.xAxis.formatter, l.value / e.value.style.layout.dataLabels.xAxis.scale, i(A)({ v: l.value / e.value.style.layout.dataLabels.xAxis.scale }), { datapoint: l, seriesIndex: a } )), 9, zt) ]))), 256)), (u(!0), r(R, null, B(S.value.left, (l, a) => (u(), r("g", null, [ e.value.style.layout.grid.show ? (u(), r("line", { key: 0, x1: l.x, x2: l.x, y1: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 2, y2: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize / 4, stroke: e.value.style.layout.grid.stroke, "stroke-width": e.value.style.layout.grid.strokeWidth, "stroke-linecap": "round" }, null, 8, Ot)) : y("", !0), v("text", { x: l.x, y: o.value.bottom + e.value.style.layout.dataLabels.xAxis.fontSize * 2, "font-size": e.value.style.layout.dataLabels.xAxis.fontSize, fill: e.value.style.layout.dataLabels.xAxis.color, "text-anchor": "middle", "font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal" }, C(i(T)( e.value.style.layout.dataLabels.xAxis.formatter, l.value / e.value.style.layout.dataLabels.xAxis.scale, i(A)({ v: l.value / e.value.style.layout.dataLabels.xAxis.scale }), { datapoint: l, seriesIndex: a } )), 9, It) ]))), 256)), v("text", { x: o.value.right, y: p.value.height, "text-anchor": "end", "font-size": e.value.style.layout.dataLabels.xAxis.fontSize, fill: e.value.style.layout.dataLabels.xAxis.color, "font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal" }, C(e.value.style.layout.dataLabels.xAxis.translation), 9, Ft) ])) : y("", !0) ]), (u(!0), r(R, null, B(J.dataset, (l, a) => (u(), r("g", null, [ v("rect", { x: o.value.left, y: o.value.top + o.value.height / z.value * a - e.value.style.layout.bars.gap / 2, width: o.value.width <= 0 ? 1e-4 : o.value.width, height: o.value.height / z.value <= 0 ? 1e-4 : o.value.height / z.value, fill: U.value !== null && U.value === a ? i(q)(e.value.style.highlighter.color, e.value.style.highlighter.opacity) : "transparent", onMouseover: (n) => Re(a, l), onMouseleave: s[0] || (s[0] = (n) => { U.value = null, V.value = !1; }) }, null, 40, Mt) ]))), 256)), h(t.$slots, "svg", { svg: p.value }, void 0, !0) ], 14, rt)) : y("", !0), t.$slots.watermark ? (u(), r("div", Pt, [ h(t.$slots, "watermark", M(P({ isPrinting: i(re) || i(ne) })), void 0, !0) ])) : y("", !0), E.value ? y("", !0) : (u(), F(i(Ae), { key: 6, config: { type: "pyramid", style: { backgroundColor: e.value.style.backgroundColor, pyramid: { color: "#CCCCCC" } } } }, null, 8, ["config"])), h(t.$slots, "legend", { legend: O.value }, void 0, !0), t.$slots.source ? (u(), r("div", { key: 7, ref_key: "source", ref: Z, dir: "auto" }, [ h(t.$slots, "source", {}, void 0, !0) ], 512)) : y("", !0), be(i(Le), { show: m.value.showTooltip && V.value, backgroundColor: e.value.style.tooltip.backgroundColor, color: e.value.style.tooltip.color, borderRadius: e.value.style.tooltip.borderRadius, borderColor: e.value.style.tooltip.borderColor, borderWidth: e.value.style.tooltip.borderWidth, fontSize: e.value.style.tooltip.fontSize, backgroundOpacity: e.value.style.tooltip.backgroundOpacity, position: e.value.style.tooltip.position, offsetY: e.value.style.tooltip.offsetY, parent: k.value, content: W.value, isFullscreen: I.value, isCustom: e.value.style.tooltip.customFormat && typeof e.value.style.tooltip.customFormat == "function" }, { "tooltip-before": f(() => [ h(t.$slots, "tooltip-before", M(P({ ...j.value })), void 0, !0) ]), "tooltip-after": f(() => [ h(t.$slots, "tooltip-after", M(P({ ...j.value })), void 0, !0) ]), _: 3 }, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]), E.value ? (u(), F(i(_e), { key: 8, hideDetails: "", config: { open: m.value.showTable, maxHeight: 1e4, body: { backgroundColor: e.value.style.backgroundColor, color: e.value.style.color }, head: { backgroundColor: e.value.style.backgroundColor, color: e.value.style.color } } }, { content: f(() => [ (u(), F(i(Ce), { key: `table_${le.value}`, colNames: D.value.colNames, head: D.value.head, body: D.value.body, config: D.value.config, title: `${e.value.style.title.text}${e.value.style.title.subtitle.text ? ` : ${e.value.style.title.subtitle.text}` : ""}`, onClose: s[1] || (s[1] = (l) => m.value.showTable = !1) }, { th: f(({ th: l }) => [ xe(C(l), 1) ]), td: f(({ td: l }) => [ xe(C(l), 1) ]), _: 1 }, 8, ["colNames", "head", "body", "config", "title"])) ]), _: 1 }, 8, ["config"])) : y("", !0) ], 46, ut)); } }, Ht = /* @__PURE__ */ it(Rt, [["__scopeId", "data-v-fb8f7a5f"]]); export { Ht as default };