UNPKG

vue-data-ui

Version:

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

1,122 lines • 72.5 kB
import { defineAsyncComponent as N, computed as g, ref as b, toRefs as It, watch as xe, shallowRef as ot, onMounted as Ht, onBeforeUnmount as Ut, createElementBlock as n, openBlock as s, unref as i, normalizeStyle as A, normalizeClass as B, createBlock as E, createCommentVNode as h, createElementVNode as d, createVNode as ne, withCtx as f, renderSlot as p, normalizeProps as T, guardReactiveProps as z, createSlots as ut, Fragment as S, renderList as Y, toDisplayString as k, Teleport as Qt, resolveDynamicComponent as Gt, mergeProps as jt, createTextVNode as st, nextTick as rt } from "vue"; import { c as nt, t as Jt, i as Zt, j as Ce, o as Kt, g as G, k as el, m as tl, ai as ll, a as P, d as R, X as al, s as ie, h as ol, aj as ul, $ as sl, x as rl, v as nl, r as il, y as vl, _ as cl } from "./lib-BwysEpWI.js"; import { t as dl, u as hl } from "./useResponsive-DfdjqQps.js"; import { u as bl, a as ke } from "./useNestedProp-OFRiX4kU.js"; import { u as yl, B as fl } from "./BaseScanner-BMpwQAfz.js"; import { u as pl } from "./usePrinter-BJzHDpYF.js"; import { u as gl } from "./useSvgExport-ByUukOZt.js"; import { u as ml } from "./useThemeCheck-DGJ31Vi5.js"; import { u as xl } from "./useUserOptionState-BIvW1Kz7.js"; import { u as Cl } from "./useChartAccessibility-9icAAmYg.js"; import kl from "./img-DKigoPDs.js"; import $l from "./Title-DGnfNZuO.js"; import { _ as it } from "./Shape-DAHhCEdg.js"; import Ll from "./Legend-D6z73edh.js"; import { _ as wl } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const vt = { style: { chart: { backgroundColor: "#1A1A1A", color: "#CCCCCC", layout: { labels: { quadrantLabels: { tl: { color: "#CCCCCC" }, tr: { color: "#CCCCCC" }, br: { color: "#CCCCCC" }, bl: { color: "#CCCCCC" } }, plotLabels: { color: "#CCCCCC" }, axisLabels: { color: { positive: "#CCCCCC", negative: "#CCCCCC" } } }, grid: { stroke: "#5A5A5A", graduations: { stroke: "#5A5A5A" } }, plots: { outlineColor: "#1A1A1A" } }, legend: { backgroundColor: "#1A1A1A", color: "#CCCCCC" }, title: { color: "#CCCCCC", subtitle: { color: "#757575" } }, tooltip: { backgroundColor: "#1A1A1A", backgroundOpacity: 70, color: "#CCCCCC", borderColor: "#5A5A5A" } } }, table: { th: { backgroundColor: "#1A1A1A", color: "#CCCCCC" }, td: { backgroundColor: "#1A1A1A", color: "#CCCCCC" } } }, ct = { style: { chart: { backgroundColor: "#FFF8E1", color: "#424242", layout: { labels: { quadrantLabels: { tl: { color: "#5D4037" }, tr: { color: "#5D4037" }, br: { color: "#5D4037" }, bl: { color: "#5D4037" } }, plotLabels: { color: "#424242" }, axisLabels: { color: { positive: "#757575", negative: "#757575" } } }, grid: { stroke: "#5D403790", graduations: { stroke: "#5D403780", roundingForce: 0, fill: !1 } }, plots: { outlineColor: "#FFF8E1" }, areas: { opacity: 20 } }, legend: { backgroundColor: "#FFF8E1", color: "#424242" }, title: { color: "#424242", subtitle: { color: "#757575" } }, tooltip: { backgroundColor: "#FFECB3", backgroundOpacity: 30, color: "#424242", borderColor: "#FF8A65" } } }, table: { th: { backgroundColor: "#FFF8E1", color: "#424242" }, td: { backgroundColor: "#FFF8E1", color: "#424242" } } }, dt = { style: { chart: { backgroundColor: "#1E1E1E", color: "#BDBDBD", layout: { labels: { quadrantLabels: { tl: { color: "#FF6B6B90" }, tr: { color: "#FF6B6B90" }, br: { color: "#FF6B6B90" }, bl: { color: "#FF6B6B90" } }, plotLabels: { color: "#BDBDBD" }, axisLabels: { color: { positive: "#757575", negative: "#757575" } } }, grid: { stroke: "#5D403790", graduations: { stroke: "#5D403780", roundingForce: 0, fill: !1 } }, plots: { outlineColor: "#1E1E1E" }, areas: { opacity: 20 } }, legend: { backgroundColor: "#1E1E1E", color: "#BDBDBD" }, title: { color: "#FFF8E1", subtitle: { color: "#BDBDBD" } }, tooltip: { backgroundColor: "#1E1E1E", backgroundOpacity: 30, color: "#FFF8E1", borderColor: "#FF8A65" } } }, table: { th: { backgroundColor: "#1E1E1E", color: "#BDBDBD" }, td: { backgroundColor: "#1E1E1E", color: "#BDBDBD" } } }, ht = { style: { chart: { backgroundColor: "#1A1A1A", color: "#99AA99", layout: { labels: { quadrantLabels: { tl: { color: "#99AA99" }, tr: { color: "#99AA99" }, br: { color: "#99AA99" }, bl: { color: "#99AA99" } }, plotLabels: { color: "#99CC99" }, axisLabels: { color: { positive: "#66CC66", negative: "#66CC66" } } }, grid: { stroke: "#334C33", graduations: { stroke: "#333333", roundingForce: 0, fill: !1 } }, plots: { outlineColor: "#1A1A1A" }, areas: { opacity: 20 } }, legend: { backgroundColor: "#1A1A1A", color: "#99AA99" }, title: { color: "#66CC66", subtitle: { color: "#99AA99" } }, tooltip: { backgroundColor: "#2A2F2A", color: "#AACCAA", borderColor: "#66CC66" } } }, table: { th: { backgroundColor: "#1A1A1A", color: "#99AA99" }, td: { backgroundColor: "#1A1A1A", color: "#AACCAA" } } }, bt = { style: { chart: { backgroundColor: "#fbfafa", color: "#8A9892", layout: { labels: { quadrantLabels: { tl: { color: "#8A9892" }, tr: { color: "#8A9892" }, br: { color: "#8A9892" }, bl: { color: "#8A9892" } }, plotLabels: { color: "#8A9892" }, axisLabels: { color: { positive: "#99AA99", negative: "#C09E85" } } }, grid: { stroke: "#D2E0DB", graduations: { steps: 2, color: "#D2E0DB", stroke: "#D2E0DB", roundingForce: 256 } }, plots: { outlineColor: "#fbfafa" }, areas: { opacity: 40 } }, legend: { backgroundColor: "#fbfafa", color: "#99AA99" }, title: { color: "#8A9892", subtitle: { color: "#99AA99" } }, tooltip: { backgroundColor: "#fbfafa", color: "#8A9892" } } }, table: { th: { backgroundColor: "#fbfafa", color: "#8F837A" }, td: { backgroundColor: "#fbfafa", color: "#8F837A" } } }, yt = { style: { chart: { backgroundColor: "#f6f6fb", color: "#50606C", layout: { labels: { quadrantLabels: { tl: { color: "#61747E" }, tr: { color: "#61747E" }, br: { color: "#61747E" }, bl: { color: "#61747E" } }, plotLabels: { color: "#50606C" }, axisLabels: { color: { positive: "#4A6A75", negative: "#7E8F7E" } } }, grid: { stroke: "#9AA7B0", graduations: { color: "#DEE1DE", stroke: "#DEE1DE", roundingForce: 0 } }, plots: { outlineColor: "#fbfafa" }, areas: { opacity: 40 } }, legend: { backgroundColor: "#f6f6fb", color: "#61747E" }, title: { color: "#50606C", subtitle: { color: "#718890" } }, tooltip: { backgroundColor: "#f6f6fb", color: "#50606C" } } }, table: { th: { backgroundColor: "#f6f6fb", color: "#50606C" }, td: { backgroundColor: "#f6f6fb", color: "#50606C" } } }, ft = { default: {}, dark: vt, celebration: ct, celebrationNight: dt, hack: ht, zen: bt, concrete: yt }, Ua = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, celebration: ct, celebrationNight: dt, concrete: yt, dark: vt, default: ft, hack: ht, zen: bt }, Symbol.toStringTag, { value: "Module" })), Al = ["id"], _l = ["id"], Sl = ["xmlns", "viewBox", "id"], ql = ["x", "y", "width", "height"], Tl = ["id"], zl = ["stop-color"], Fl = ["stop-color"], Bl = { key: 1 }, Wl = ["fill", "x", "y", "height", "width", "stroke-width", "stroke", "rx"], Xl = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], Dl = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], El = { key: 2 }, Yl = ["points", "fill"], Ol = ["points", "fill"], Ml = ["points", "fill"], Nl = ["points", "fill"], Pl = { key: 3 }, Rl = ["y", "fill", "font-size"], Vl = ["x", "y", "fill", "font-size"], Il = ["x", "y", "fill", "font-size"], Hl = ["y", "fill", "font-size"], Ul = { key: 4 }, Ql = ["x", "y", "font-size", "fill"], Gl = ["x", "y", "font-size", "fill"], jl = ["x", "y", "font-size", "fill"], Jl = ["id", "font-size", "transform", "fill"], Zl = ["id", "font-size", "transform", "fill"], Kl = ["id", "font-size", "transform", "fill"], ea = { key: 5 }, ta = ["fill", "points"], la = ["x", "y", "width", "height"], aa = ["x", "y", "width", "height"], oa = ["x", "y", "width", "height"], ua = ["x", "y", "width", "height"], sa = { key: 0, style: { "pointer-events": "none" } }, ra = ["x", "y", "font-size", "fill"], na = ["x", "y", "font-size", "fill", "innerHTML"], ia = { key: 0 }, va = ["x", "y", "onMouseover", "onMouseleave", "onClick"], ca = { key: 8, class: "vue-ui-dna" }, da = ["points", "fill"], ha = ["points", "fill"], ba = ["points", "fill"], ya = ["points", "fill"], fa = { key: 9 }, pa = ["x", "y", "font-size", "fill", "font-weight"], ga = { key: 10 }, ma = ["x", "y", "fill"], xa = ["x", "y", "fill"], Ca = ["x", "y", "fill"], ka = ["x", "y", "fill"], $a = ["stroke", "d"], La = ["stroke", "d"], wa = { key: 4, class: "vue-data-ui-watermark" }, Aa = ["id"], _a = ["onClick"], Sa = { key: 0, height: "14", width: "14", viewBox: "0 0 20 20" }, qa = ["innerHTML"], Ta = { __name: "vue-ui-quadrant", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Array, default() { return []; } } }, emits: ["selectPlot", "selectSide", "selectLegend"], setup(pt, { expose: gt, emit: mt }) { const xt = N(() => import("./Tooltip-TDyKgLB6.js")), Ct = N(() => import("./BaseIcon-4i3dd7Ty.js")), kt = N(() => import("./vue-ui-accordion-DUuwVsuJ.js")), $t = N(() => import("./DataTable-WrXCJkfE.js")), Lt = N(() => import("./PenAndPaper-DxIUvoQ8.js")), wt = N(() => import("./UserOptions-CzJWRC4s.js")), At = N(() => import("./PackageVersion-BLzm8l_I.js")), _t = N(() => import("./BaseDraggableDialog-CAJxIF6g.js")), { vue_ui_quadrant: St } = bl(), { isThemeValid: qt, warnInvalidTheme: Tt } = ml(), W = pt, $e = g(() => !!W.dataset && W.dataset.length), L = b(nt()), ve = mt, ce = b(!1), de = b(""), Le = b(0), x = b(!1), X = b(null), we = b(null), Ae = b(null), _e = b(null), Se = b(null), qe = b(0), Te = b(0), ze = b(0), Fe = b(!1), j = b(null), he = b(null), e = b(fe()), { loading: Be, FINAL_DATASET: We } = yl({ ...It(W), FINAL_CONFIG: e, prepareConfig: fe, callback: () => { Promise.resolve().then(async () => { await rt(), C.value.showTable = e.value.table.show; }); }, skeletonDataset: [ { name: "_", shape: "circle", color: "#CACACA", series: [ { name: "_", x: -6, y: -4 }, { name: "_", x: -5, y: -2 }, { name: "_", x: -4, y: -1 }, { name: "_", x: -3, y: -0.5 }, { name: "_", x: -2, y: -0.25 }, { name: "_", x: -1, y: -0.135 }, { name: "_", x: 0, y: 0 }, { name: "_", x: 1, y: 0.135 }, { name: "_", x: 2, y: 0.25 }, { name: "_", x: 3, y: 0.5 }, { name: "_", x: 4, y: 1 }, { name: "_", x: 5, y: 2 }, { name: "_", x: 6, y: 4 } ] } ], skeletonConfig: Jt({ defaultConfig: e.value, userConfig: { userOptions: { show: !1 }, table: { show: !1 }, style: { chart: { backgroundColor: "#99999930", layout: { grid: { stroke: "#6A6A6A", graduations: { stroke: "#6A6A6A", color: "#6A6A6A90" }, xAxis: { auto: !0 }, yAxis: { auto: !0 } }, labels: { quadrantLabels: { show: !1 }, plotLabels: { show: !1 }, axisLabels: { show: !1 } }, plots: { outlineColor: "#6A6A6A" } }, legend: { backgroundColor: "transparent" } } } } }) }), { userOptionsVisible: be, setUserOptionsVisibility: Xe, keepUserOptionState: De } = xl({ config: e.value }), { svgRef: ye } = Cl({ config: e.value.style.chart.title }); function fe() { const l = ke({ userConfig: W.config, defaultConfig: St }), o = l.theme; if (!o) return l; if (!qt.value(l)) return Tt(l), l; const a = ke({ userConfig: ft[o] || W.config, defaultConfig: l }), u = ke({ userConfig: W.config, defaultConfig: a }); return { ...u, customPalette: u.customPalette.length ? u.customPalette : Zt[o] || Ce }; } xe(() => W.config, (l) => { e.value = fe(), be.value = !e.value.userOptions.showOnChartHover, Ee(), qe.value += 1, Te.value += 1, ze.value += 1, C.value.plotLabels.show = e.value.style.chart.layout.labels.plotLabels.show, C.value.showTable = e.value.table.show, C.value.showTooltip = e.value.style.chart.tooltip.show; }, { deep: !0 }); const O = ot(null), H = ot(null), U = g(() => e.value.debug); function Ee() { if (Kt(W.dataset) ? G({ componentName: "VueUiQuadrant", type: "dataset", debug: U.value }) : W.dataset.forEach((l, o) => { [null, void 0].includes(l.name) && G({ componentName: "VueUiQuadrant", type: "datasetSerieAttribute", property: "name", index: o, debug: U.value }), [null, void 0].includes(l.series) ? G({ componentName: "VueUiQuadrant", type: "datasetSerieAttribute", property: "series", index: o, debug: U.value }) : l.series.forEach((a, u) => { [null, void 0].includes(a.name) && G({ componentName: "VueUiQuadrant", type: "datasetSerieAttribute", property: "name", key: "series", index: u, debug: U.value }); }); }), e.value.responsive) { const l = dl(() => { const { width: o, height: a } = hl({ chart: X.value, title: e.value.style.chart.title.text ? we.value : null, legend: e.value.style.chart.legend.show ? Ae.value : null, source: _e.value, noTitle: Se.value }); $.value = 48, requestAnimationFrame(() => { t.value.height = a, t.value.usableHeight = a - $.value * 2, t.value.width = o, t.value.usableWidth = o - $.value * 2, t.value.top = $.value, t.value.left = $.value, t.value.right = o - $.value, t.value.bottom = a - $.value, t.value.centerX = o / 2, t.value.centerY = a - a / 2, t.value.padding = $.value; }); }); O.value && (H.value && O.value.unobserve(H.value), O.value.disconnect()), O.value = new ResizeObserver(l), H.value = X.value.parentNode, O.value.observe(H.value); } } Ht(() => { Fe.value = !0, Ee(); }), Ut(() => { O.value && (H.value && O.value.unobserve(H.value), O.value.disconnect()); }); const { isPrinting: Ye, isImaging: Oe, generatePdf: Me, generateImage: Ne } = pl({ elementId: `vue-ui-quadrant_${L.value}`, fileName: e.value.style.chart.title.text || "vue-ui-quadrant", options: e.value.userOptions.print }), zt = g(() => e.value.userOptions.show && !e.value.style.chart.title.text), Pe = g(() => el(e.value.customPalette)), C = b({ plotLabels: { show: e.value.style.chart.layout.labels.plotLabels.show }, showTable: e.value.table.show, showTooltip: e.value.style.chart.tooltip.show }), $ = b(48), t = b({ height: e.value.style.chart.height, usableHeight: e.value.style.chart.height - $.value * 2, width: e.value.style.chart.width, usableWidth: e.value.style.chart.width - $.value * 2, top: $.value, left: $.value, right: e.value.style.chart.width - $.value, bottom: e.value.style.chart.height - $.value, centerX: e.value.style.chart.width / 2, centerY: e.value.style.chart.height - e.value.style.chart.height / 2, padding: $.value }), v = b({ ...JSON.parse(JSON.stringify(t.value)), startX: 0, startY: 0 }); xe(() => t.value, (l) => { l && (v.value = { ...JSON.parse(JSON.stringify(t.value)), startX: 0, startY: 0 }); }, { deep: !0 }); const c = b(null), V = g(() => { switch (c.value) { case "TL": return { x: v.value.startX + v.value.width / 2, y: v.value.height, text: e.value.style.chart.layout.labels.quadrantLabels.tl.text || "Top Left", fontSize: e.value.style.chart.layout.labels.quadrantLabels.tl.fontSize, fill: e.value.style.chart.layout.labels.quadrantLabels.tl.color, bold: e.value.style.chart.layout.labels.quadrantLabels.tl.bold }; case "TR": return { x: v.value.startX + v.value.width / 2, y: v.value.height, text: e.value.style.chart.layout.labels.quadrantLabels.tr.text || "Top Right", fontSize: e.value.style.chart.layout.labels.quadrantLabels.tr.fontSize, fill: e.value.style.chart.layout.labels.quadrantLabels.tr.color, bold: e.value.style.chart.layout.labels.quadrantLabels.tr.bold }; case "BR": return { x: v.value.startX + v.value.width / 2, y: v.value.height * 1.678, text: e.value.style.chart.layout.labels.quadrantLabels.br.text || "Bottom Right", fontSize: e.value.style.chart.layout.labels.quadrantLabels.br.fontSize, fill: e.value.style.chart.layout.labels.quadrantLabels.br.color, bold: e.value.style.chart.layout.labels.quadrantLabels.br.bold }; case "BL": return { x: v.value.startX + v.value.width / 2, y: v.value.height * 1.678, text: e.value.style.chart.layout.labels.quadrantLabels.bl.text || "Bottom Left", fontSize: e.value.style.chart.layout.labels.quadrantLabels.bl.fontSize, fill: e.value.style.chart.layout.labels.quadrantLabels.bl.color, bold: e.value.style.chart.layout.labels.quadrantLabels.bl.bold }; default: return { x: 0, y: 0, text: "", fontSize: 0, fill: "none", bold: !1 }; } }), Ft = b(null), le = b(!1); function J({ targetX: l, targetY: o, targetW: a, targetH: u, side: r }) { c.value && ee(r); const y = { x: l - v.value.startX, y: o - v.value.startY, w: a - v.value.width, h: u - v.value.height }, m = e.value.zoomAnimationFrames; let D = 0; function at() { le.value = !0, v.value.startX += y.x / m, v.value.startY += y.y / m, v.value.width += y.w / m, v.value.height += y.h / m, D += 1, D < m ? Ft.value = requestAnimationFrame(at) : le.value = !1; } at(); } function M(l) { if (!le.value) if (x.value && c.value === l) J({ targetX: 0, targetY: 0, targetW: t.value.width, targetH: t.value.height }), c.value = null, x.value = !1; else { switch (c.value = l, l) { case "TL": J({ targetX: 0, targetY: 0, targetW: t.value.width / 2 + t.value.left, targetH: t.value.height / 2 + t.value.top, side: "tl" }); break; case "TR": J({ targetX: t.value.width / 2 - t.value.left, targetY: 0, targetW: t.value.width / 2 + t.value.left, targetH: t.value.height / 2 + t.value.top, side: "tr" }); break; case "BR": J({ targetX: t.value.width / 2 - t.value.left, targetY: t.value.height / 2 - t.value.top, targetW: t.value.width / 2 + t.value.left, targetH: t.value.height / 2 + t.value.top, side: "br" }); break; case "BL": J({ targetX: 0, targetY: t.value.height / 2 - t.value.top, targetW: t.value.width / 2 + t.value.left, targetH: t.value.height / 2 + t.value.top, side: "bl" }); break; default: v.value.startX = 0, v.value.startY = 0, v.value.width = t.value.width, v.value.height = t.value.height; break; } x.value = !0; } } const Bt = g(() => { const l = e.value.style.chart.layout.grid.graduations.steps, o = t.value.usableWidth / (l * 2), a = t.value.top, u = []; for (let r = 0; r < l; r += 1) u.push({ x: t.value.padding + o * r, y: a + t.value.usableHeight * (r / l / 2), height: t.value.usableHeight * (1 - r / l), width: t.value.usableWidth * (1 - r / l), opacity: Math.round((r + 1) / l * 20) }); return u; }), _ = g(() => { let l = e.value.style.chart.layout.grid.xAxis.max, o = e.value.style.chart.layout.grid.xAxis.min, a = e.value.style.chart.layout.grid.yAxis.max, u = e.value.style.chart.layout.grid.yAxis.min; return e.value.style.chart.layout.grid.xAxis.auto && (l = Math.max(...Q.value.flatMap((r) => r.series.map((y) => y.x))), o = Math.min(...Q.value.flatMap((r) => r.series.map((y) => y.x)))), e.value.style.chart.layout.grid.yAxis.auto && (a = Math.max(...Q.value.flatMap((r) => r.series.map((y) => y.y))), u = Math.min(...Q.value.flatMap((r) => r.series.map((y) => y.y)))), { x: { max: l, min: o }, y: { max: a, min: u } }; }), F = b([]), Q = g(() => We.value.map((l, o) => ({ ...l, series: ll({ data: l.series, threshold: e.value.downsample.threshold }), id: `cat_${o}_${L.value}`, color: tl(l.color) || Pe.value[o] || Ce[o] }))), Wt = g(() => Q.value.filter((l) => !F.value.includes(l.id))), Xt = g(() => Q.value.map((l, o) => ({ ...l, shape: l.shape || "circle", series: l.series.map((a) => ({ ...a, x: Re(a.x), y: Ve(a.y), xValue: a.x, yValue: a.y, quadrantSide: He({ x: a.x, y: a.y }), categoryName: l.name, shape: l.shape, color: l.color })) }))), q = g(() => (We.value.forEach((l, o) => { l.series.forEach((a, u) => { [null, void 0].includes(a.x) && G({ componentName: "VueUiQuadrant", type: "datasetSerieAttribute", property: "x", key: "series", index: u, debug: U.value }), [null, void 0].includes(a.y) && G({ componentName: "VueUiQuadrant", type: "datasetSerieAttribute", property: "y", key: "series", index: u, debug: U.value }); }); }), Wt.value.map((l, o) => ({ ...l, shape: l.shape || "circle", color: l.color || Pe.value[o] || Ce[o], series: l.series.map((a) => ({ ...a, x: Re(a.x), y: Ve(a.y), xValue: a.x, yValue: a.y, quadrantSide: He({ x: a.x, y: a.y }), categoryName: l.name, shape: l.shape, color: l.color, uid: nt() })) })))); function Re(l) { if (l >= 0) { const o = l / _.value.x.max; return t.value.centerX + t.value.usableWidth / 2 * o; } else { const o = Math.abs(l) / Math.abs(_.value.x.min); return t.value.centerX - t.value.usableWidth / 2 * o; } } function Ve(l) { if (l >= 0) { const o = l / _.value.y.max; return t.value.centerY + (1 - t.value.usableHeight / 2 * o); } else { const o = Math.abs(l) / Math.abs(_.value.y.min); return t.value.centerY - (1 - t.value.usableHeight / 2 * o); } } const ae = g(() => { const l = q.value.flatMap((m) => m.series.map((D) => ({ x: D.xValue, y: D.yValue, name: D.name, category: D.categoryName, quadrantSide: D.quadrantSide, sideName: e.value.style.chart.layout.labels.quadrantLabels[D.quadrantSide].text, color: m.color, shape: m.shape }))), o = e.value.style.chart.layout.grid.xAxis.name || "x", a = e.value.style.chart.layout.grid.yAxis.name || "y", u = [e.value.translations.category, e.value.translations.item, o, a, e.value.translations.side], r = l.map((m) => [m.category, m.name, m.x, m.y, m.sideName || m.quadrantSide]), y = l.map((m) => ({ shape: m.shape, color: m.color })); return { head: u, body: r, itsShapes: y, tableData: l }; }), oe = g(() => { const l = ae.value.head, o = ae.value.tableData.map((u) => [ { shape: u.shape, color: u.color, name: u.category }, u.name, P( e.value.style.chart.layout.labels.plotLabels.x.formatter, u.x, R({ v: u.x, r: e.value.style.chart.layout.labels.plotLabels.rounding }) ), P( e.value.style.chart.layout.labels.plotLabels.y.formatter, u.y, R({ v: u.y, r: e.value.style.chart.layout.labels.plotLabels.rounding }) ), u.sideName || u.quadrantSide ]), a = { th: { backgroundColor: e.value.table.th.backgroundColor, color: e.value.table.th.color, outline: e.value.table.th.outline }, td: { backgroundColor: e.value.table.td.backgroundColor, color: e.value.table.td.color, outline: e.value.table.td.outline }, breakpoint: e.value.table.responsiveBreakpoint }; return { head: l, body: o, config: a, colNames: l }; }); function Z(l) { F.value.includes(l) ? F.value = F.value.filter((a) => a !== l) : F.value.push(l); const o = je(); ve("selectLegend", o); } const K = g(() => Xt.value.map((l) => ({ name: l.name, shape: l.shape, color: l.color, id: l.id, opacity: F.value.includes(l.id) ? 0.5 : 1, segregate: () => Z(l.id), isSegregated: F.value.includes(l.id) }))); function Ie(l) { if (!K.value.length) return e.value.debug && console.warn("VueUiQuadrant - There are no series to show."), null; const o = K.value.find((a) => a.name === l); return o || (e.value.debug && console.warn(`VueUiQuadrant - Series name not found "${l}"`), null); } function Dt(l) { const o = Ie(l); o !== null && F.value.includes(o.id) && Z(o.id); } function Et(l) { const o = Ie(l); o !== null && (F.value.includes(o.id) || Z(o.id)); } const Yt = g(() => ({ cy: "quadrant-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" : "" })); function He(l) { switch (!0) { case (l.x >= 0 && l.y >= 0): return "tr"; case (l.x >= 0 && l.y < 0): return "br"; case (l.x < 0 && l.y < 0): return "bl"; case (l.x < 0 && l.y >= 0): return "tl"; default: return ""; } } const ue = b(null), se = b(null), pe = b(null); function Ue(l, o, a) { e.value.events.datapointEnter && e.value.events.datapointEnter({ datapoint: o, seriesIndex: a }), ue.value = o.uid, se.value = { color: l.color, shape: l.shape }, pe.value = { datapoint: o, seriesIndex: a, series: q.value, config: e.value }, ce.value = !0; const u = e.value.style.chart.tooltip.customFormat; if (vl(u) && cl(() => u({ seriesIndex: a, datapoint: o, series: q.value, config: e.value }))) de.value = u({ seriesIndex: a, datapoint: o, series: q.value, config: e.value }); else { let r = ""; o.quadrantSide && (r += `<div style="color:${e.value.style.chart.layout.labels.quadrantLabels[o.quadrantSide].color};font-weight:${e.value.style.chart.layout.labels.quadrantLabels[o.quadrantSide].bold ? "bold" : "400"}">${e.value.style.chart.layout.labels.quadrantLabels[o.quadrantSide].text}</div>`), r += `<div>${l.name}</div>`, r += `<div style="padding-bottom:6px;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};margin-bottom:3px">${o.name}</div>`, r += `<div>${e.value.style.chart.layout.grid.xAxis.name ? e.value.style.chart.layout.grid.xAxis.name : "x"}: <b>${P( e.value.style.chart.layout.labels.plotLabels.x.formatter, o.xValue, R({ v: o.xValue, r: e.value.style.chart.tooltip.roundingValue }), { datapoint: o, category: l, categoryIndex: a } )}</b></div>`, r += `<div>${e.value.style.chart.layout.grid.yAxis.name ? e.value.style.chart.layout.grid.yAxis.name : "y"}: <b>${P( e.value.style.chart.layout.labels.plotLabels.y.formatter, o.yValue, R({ v: o.yValue, r: e.value.style.chart.tooltip.roundingValue }), { datapoint: o, category: l, categoryIndex: a } )}</b></div>`, de.value = `<div style="text-align:left;font-size:${e.value.style.chart.tooltip.fontSize}px">${r}</div>`; } } function Qe(l, o) { ce.value = !1, ue.value = null, se.value = null, e.value.events.datapointLeave && e.value.events.datapointLeave({ datapoint: l, seriesIndex: o }); } function Ge(l, o, a) { e.value.events.datapointClick && e.value.events.datapointClick({ datapoint: o, seriesIndex: a }); const u = { category: l.name, shape: l.shape, itemName: o.name, x: o.xValue, y: o.yValue, quadrantSide: o.quadrantSide, sideName: e.value.style.chart.layout.labels.quadrantLabels[o.quadrantSide].text }; ve("selectPlot", u); } function ee(l) { if (!l) return; const o = q.value.flatMap((u) => u.series.filter((r) => r.quadrantSide === l).map((r) => ({ category: r.categoryName, itemName: r.name, x: r.xValue, y: r.yValue }))), a = { quadrantSide: l, sideName: e.value.style.chart.layout.labels.quadrantLabels[l].text, items: [...o] }; ve("selectSide", a); } const w = g(() => ({ TL: { tl: { x: t.value.left + t.value.usableWidth / 4 - 20, y: 0, fill: e.value.style.chart.layout.labels.quadrantLabels.tl.color }, tr: { x: t.value.left + t.value.usableWidth / 4, y: 0, fill: e.value.style.chart.layout.labels.quadrantLabels.tr.color }, br: { x: t.value.left + t.value.usableWidth / 4, y: 20, fill: e.value.style.chart.layout.labels.quadrantLabels.br.color }, bl: { x: t.value.left + t.value.usableWidth / 4 - 20, y: 20, fill: e.value.style.chart.layout.labels.quadrantLabels.bl.color }, crosshairs: { horizontal: `M ${t.value.left + t.value.usableWidth / 4 - 20},20 ${t.value.left + t.value.usableWidth / 4 + 20},20`, vertical: `M ${t.value.left + t.value.usableWidth / 4},0 ${t.value.left + t.value.usableWidth / 4},40` } }, TR: { tl: { x: t.value.centerX + t.value.usableWidth / 4 - 20, y: 0, fill: e.value.style.chart.layout.labels.quadrantLabels.tl.color }, tr: { x: t.value.centerX + t.value.usableWidth / 4, y: 0, fill: e.value.style.chart.layout.labels.quadrantLabels.tr.color }, br: { x: t.value.centerX + t.value.usableWidth / 4, y: 20, fill: e.value.style.chart.layout.labels.quadrantLabels.br.color }, bl: { x: t.value.centerX + t.value.usableWidth / 4 - 20, y: 20, fill: e.value.style.chart.layout.labels.quadrantLabels.bl.color }, crosshairs: { horizontal: `M ${t.value.centerX + t.value.usableWidth / 4 - 20},20 ${t.value.centerX + t.value.usableWidth / 4 + 20},20`, vertical: `M ${t.value.centerX + t.value.usableWidth / 4},0 ${t.value.centerX + t.value.usableWidth / 4},40` } }, BR: { tl: { x: t.value.centerX + t.value.usableWidth / 4 - 20, y: t.value.centerY - 48, fill: e.value.style.chart.layout.labels.quadrantLabels.tl.color }, tr: { x: t.value.centerX + t.value.usableWidth / 4, y: t.value.centerY - 48, fill: e.value.style.chart.layout.labels.quadrantLabels.tr.color }, br: { x: t.value.centerX + t.value.usableWidth / 4, y: t.value.centerY - 28, fill: e.value.style.chart.layout.labels.quadrantLabels.br.color }, bl: { x: t.value.centerX + t.value.usableWidth / 4 - 20, y: t.value.centerY - 28, fill: e.value.style.chart.layout.labels.quadrantLabels.bl.color }, crosshairs: { horizontal: `M ${t.value.centerX + t.value.usableWidth / 4 - 20},${t.value.centerY - 28} ${t.value.centerX + t.value.usableWidth / 4 + 20},${t.value.centerY - 28}`, vertical: `M ${t.value.centerX + t.value.usableWidth / 4},${t.value.centerY - 48} ${t.value.centerX + t.value.usableWidth / 4},${t.value.centerY - 8}` } }, BL: { tl: { x: t.value.left + t.value.usableWidth / 4 - 20, y: t.value.centerY - 48, fill: e.value.style.chart.layout.labels.quadrantLabels.tl.color }, tr: { x: t.value.left + t.value.usableWidth / 4, y: t.value.centerY - 48, fill: e.value.style.chart.layout.labels.quadrantLabels.tr.color }, br: { x: t.value.left + t.value.usableWidth / 4, y: t.value.centerY - 28, fill: e.value.style.chart.layout.labels.quadrantLabels.br.color }, bl: { x: t.value.left + t.value.usableWidth / 4 - 20, y: t.value.centerY - 28, fill: e.value.style.chart.layout.labels.quadrantLabels.bl.color }, crosshairs: { horizontal: `M ${t.value.left + t.value.usableWidth / 4 - 20},${t.value.centerY - 28} ${t.value.left + t.value.usableWidth / 4 + 20},${t.value.centerY - 28}`, vertical: `M ${t.value.left + t.value.usableWidth / 4},${t.value.centerY - 48} ${t.value.left + t.value.usableWidth / 4},${t.value.centerY - 8}` } } })); function je() { return q.value.map((l) => ({ color: l.color, name: l.name, shape: l.shape, series: l.series.map((o) => ({ name: o.name, x: o.xValue, y: o.yValue, quadrantSide: o.quadrantSide, sideName: e.value.style.chart.layout.labels.quadrantLabels[o.quadrantSide].text })) })); } function ge(l = null) { rt(() => { const o = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], a = ae.value.head, u = ae.value.body, r = o.concat([a]).concat(u), y = nl(r); l ? l(y) : il({ csvContent: y, title: e.value.style.chart.title.text || "vue-ui-quadrant" }); }); } const I = b(!1); function Je(l) { I.value = l, Le.value += 1; } function Ze() { C.value.showTable = !C.value.showTable; } function Ke() { C.value.plotLabels.show = !C.value.plotLabels.show; } function et() { C.value.showTooltip = !C.value.showTooltip; } const re = b(!1); function me() { re.value = !re.value; } async function Ot({ scale: l = 2 } = {}) { if (!X.value) return; const { width: o, height: a } = X.value.getBoundingClientRect(), u = o / a, { imageUri: r, base64: y } = await kl({ domElement: X.value, base64: !0, img: !0, scale: l }); return { imageUri: r, base64: y, title: e.value.style.chart.title.text, width: o, height: a, aspectRatio: u }; } const te = g(() => { const l = e.value.table.useDialog && !e.value.table.show, o = C.value.showTable; return { component: l ? _t : kt, title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? `: ${e.value.style.chart.title.subtitle.text}` : ""}`, props: l ? { backgroundColor: e.value.table.th.backgroundColor, color: e.value.table.th.color, headerColor: e.value.table.th.color, headerBg: e.value.table.th.backgroundColor, isFullscreen: I.value, fullscreenParent: X.value, forcedWidth: Math.min(800, window.innerWidth * 0.8) } : { hideDetails: !0, config: { open: o, 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 } } } }; }); xe(() => C.value.showTable, (l) => { e.value.table.show || (l && e.value.table.useDialog && j.value ? j.value.open() : "close" in j.value && j.value.close()); }); function tt() { C.value.showTable = !1, he.value && he.value.setTableIconState(!1); } const Mt = g(() => e.value.style.chart.backgroundColor), Nt = g(() => e.value.style.chart.legend), Pt = g(() => e.value.style.chart.title), { exportSvg: Rt, getSvg: Vt } = gl({ svg: ye, title: Pt, legend: Nt, legendItems: K, backgroundColor: Mt }); async function lt({ isCb: l }) { if (l) { const { blob: o, url: a, text: u, dataUrl: r } = await Vt(); e.value.userOptions.callbacks.svg({ blob: o, url: a, text: u, dataUrl: r }); } else Rt(); } return gt({ getData: je, getImage: Ot, generatePdf: Me, generateCsv: ge, generateImage: Ne, generateSvg: lt, hideSeries: Et, showSeries: Dt, toggleTable: Ze, toggleLabels: Ke, toggleTooltip: et, toggleAnnotator: me, toggleFullscreen: Je }), (l, o) => (s(), n("div", { class: B(`vue-data-ui-component vue-ui-quadrant ${I.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`), ref_key: "quadrantChart", ref: X, id: `vue-ui-quadrant_${L.value}`, style: A(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`), onMouseenter: o[14] || (o[14] = () => i(Xe)(!0)), onMouseleave: o[15] || (o[15] = () => i(Xe)(!1)) }, [ e.value.userOptions.buttons.annotator ? (s(), E(i(Lt), { key: 0, svgRef: i(ye), backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, active: re.value, onClose: me }, { "annotator-action-close": f(() => [ p(l.$slots, "annotator-action-close", {}, void 0, !0) ]), "annotator-action-color": f(({ color: a }) => [ p(l.$slots, "annotator-action-color", T(z({ color: a })), void 0, !0) ]), "annotator-action-draw": f(({ mode: a }) => [ p(l.$slots, "annotator-action-draw", T(z({ mode: a })), void 0, !0) ]), "annotator-action-undo": f(({ disabled: a }) => [ p(l.$slots, "annotator-action-undo", T(z({ disabled: a })), void 0, !0) ]), "annotator-action-redo": f(({ disabled: a }) => [ p(l.$slots, "annotator-action-redo", T(z({ disabled: a })), void 0, !0) ]), "annotator-action-delete": f(({ disabled: a }) => [ p(l.$slots, "annotator-action-delete", T(z({ disabled: a })), void 0, !0) ]), _: 3 }, 8, ["svgRef", "backgroundColor", "color", "active"])) : h("", !0), zt.value ? (s(), n("div", { key: 1, ref_key: "noTitle", ref: Se, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : h("", !0), e.value.style.chart.title.text ? (s(), n("div", { key: 2, ref_key: "chartTitle", ref: we, style: "width:100%;background:transparent;padding-bottom:12px" }, [ (s(), E($l, { key: `table_${qe.value}`, config: { title: { cy: "quadrant-title", ...e.value.style.chart.title }, subtitle: { cy: "quadrant-subtitle", ...e.value.style.chart.title.subtitle } } }, null, 8, ["config"])) ], 512)) : h("", !0), d("div", { id: `legend-top-${L.value}` }, null, 8, _l), e.value.userOptions.show && $e.value && (i(De) || i(be)) ? (s(), E(i(wt), { ref_key: "userOptionsRef", ref: he, key: `user_options_${Le.value}`, backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, isImaging: i(Oe), isPrinting: i(Ye), uid: L.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, hasSvg: e.value.userOptions.buttons.svg, hasXls: e.value.userOptions.buttons.csv, hasTable: e.value.userOptions.buttons.table, hasLabel: e.value.userOptions.buttons.labels, hasFullscreen: e.value.userOptions.buttons.fullscreen, isFullscreen: I.value, isTooltip: C.value.showTooltip, titles: { ...e.value.userOptions.buttonTitles }, chartElement: X.value, position: e.value.userOptions.position, hasAnnotator: e.value.userOptions.buttons.annotator, isAnnotation: re.value, callbacks: e.value.userOptions.callbacks, printScale: e.value.userOptions.print.scale, tableDialog: e.value.table.useDialog, onToggleFullscreen: Je, onGeneratePdf: i(Me), onGenerateCsv: ge, onGenerateImage: i(Ne), onGenerateSvg: lt, onToggleTable: Ze, onToggleLabels: Ke, onToggleTooltip: et, onToggleAnnotator: me, style: A({ visibility: i(De) ? i(be) ? "visible" : "hidden" : "visible" }) }, ut({ _: 2 }, [ l.$slots.menuIcon ? { name: "menuIcon", fn: f(({ isOpen: a, color: u }) => [ p(l.$slots, "menuIcon", T(z({ isOpen: a, color: u })), void 0, !0) ]), key: "0" } : void 0, l.$slots.optionTooltip ? { name: "optionTooltip", fn: f(() => [ p(l.$slots, "optionTooltip", {}, void 0, !0) ]), key: "1" } : void 0, l.$slots.optionPdf ? { name: "optionPdf", fn: f(() => [ p(l.$slots, "optionPdf", {}, void 0, !0) ]), key: "2" } : void 0, l.$slots.optionCsv ? { name: "optionCsv", fn: f(() => [ p(l.$slots, "optionCsv", {}, void 0, !0) ]), key: "3" } : void 0, l.$slots.optionImg ? { name: "optionImg", fn: f(() => [ p(l.$slots, "optionImg", {}, void 0, !0) ]), key: "4" } : void 0, l.$slots.optionSvg ? { name: "optionSvg", fn: f(() => [ p(l.$slots, "optionSvg", {}, void 0, !0) ]), key: "5" } : void 0, l.$slots.optionTable ? { name: "optionTable", fn: f(() => [ p(l.$slots, "optionTable", {}, void 0, !0) ]), key: "6" } : void 0, l.$slots.optionLabels ? { name: "optionLabels", fn: f(() => [ p(l.$slots, "optionLabels", {}, void 0, !0) ]), key: "7" } : void 0, l.$slots.optionFullscreen ? { name: "optionFullscreen", fn: f(({ toggleFullscreen: a, isFullscreen: u }) => [ p(l.$slots, "optionFullscreen", T(z({ toggleFullscreen: a, isFullscreen: u })), void 0, !0) ]), key: "8" } : void 0, l.$slots.optionAnnotator ? { name: "optionAnnotator", fn: f(({ toggleAnnotator: a, isAnnotator: u }) => [ p(l.$slots, "optionAnnotator", T(z({ toggleAnnotator: a, isAnnotator: u })), void 0, !0) ]), key: "9" } : void 0 ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasSvg", "hasXls", "hasTable", "hasLabel", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "tableDialog", "onGeneratePdf", "onGenerateImage", "style"])) : h("", !0), (s(), n("svg", { ref_key: "svgRef", ref: ye, xmlns: i(al), class: B({ "vue-data-ui-fullscreen--on": I.value, "vue-data-ui-fulscreen--off": !I.value }), viewBox: `${v.value.startX} ${v.value.startY} ${v.value.width} ${v.value.height}`, style: A(`max-width:100%;overflow:hidden;background:transparent;color:${e.value.style.chart.color}`), id: `svg_${L.value}` }, [ ne(i(At)), l.$slots["chart-background"] ? (s(), n("foreignObject", { key: 0, x: v.value.startX, y: v.value.startY, width: v.value.width, height: v.value.height, style: { pointerEvents: "none" } }, [ p(l.$slots, "chart-background", {}, void 0, !0) ], 8, ql)) : h("", !0), d("defs", null, [ (s(!0), n(S, null, Y(q.value, (a, u) => (s(), n("radialGradient", { cx: "50%", cy: "50%", r: "50%", fx: "50%", fy: "50%", id: `quadrant_gradient_${L.value}_${u}` }, [ d("stop", { offset: "0%", "stop-color": i(ie)(i(ol)(a.color, 0.05), e.value.style.chart.layout.areas.opacity) }, null, 8, zl), d("stop", { offset: "100%", "stop-color": i(ie)(a.color, e.value.style.chart.layout.areas.opacity) }, null, 8, Fl) ], 8, Tl))), 256)) ]), e.value.style.chart.layout.grid.graduations.show ? (s(), n("g", Bl, [ (s(!0), n(S, null, Y(Bt.value, (a) => (s(), n("rect", { fill: e.value.style.chart.layout.grid.graduations.fill ? i(ie)(e.value.style.chart.layout.grid.graduations.color, a.opacity) : "none", x: a.x, y: a.y, height: a.height <= 0 ? 1e-3 : a.height, width: a.width <= 0 ? 1e-3 : a.width, "stroke-width": e.value.style.chart.layout.grid.graduations.strokeWidth, stroke: e.value.style.chart.layout.grid.graduations.stroke, rx: e.value.style.chart.layout.grid.graduations.roundingForce }, null, 8, Wl))), 256)) ])) : h("", !0), d("line", { x1: t.value.left, y1: t.value.centerY, x2: t.value.right, y2: t.value.centerY, stroke: e.value.style.chart.layout.grid.stroke, "stroke-width": e.value.style.chart.layout.grid.strokeWidth }, null, 8, Xl), d("line", { x1: t.value.centerX, y1: t.value.top, x2: t.value.centerX, y2: t.value.bottom, stroke: e.value.style.chart.layout.grid.stroke, "stroke-width": e.value.style.chart.layout.grid.strokeWidth }, null, 8, Dl), e.value.style.chart.layout.grid.showArrows ? (s(), n("g", El, [ d("polygon", { points: `${t.value.right - 8},${t.value.centerY - 6} ${t.value.right},${t.value.centerY} ${t.value.right - 8},${t.value.centerY + 6}`, fill: e.value.style.chart.layout.grid.stroke, stroke: "none" }, null, 8, Yl), d("polygon", { points: `${t.value.left + 8},${t.value.centerY - 6} ${t.value.left},${t.value.centerY} ${t.value.left + 8},${t.value.centerY + 6}`, fill: e.value.style.chart.layout.grid.stroke, stroke: "none" }, null, 8, Ol), d("polygon", { points: `${t.value.centerX - 6},${t.value.top + 8} ${t.value.centerX},${t.value.top} ${t.value.centerX + 6},${t.value.top + 8}`, fill: e.value.style.chart.layout.grid.stroke, stroke: "none" }, null, 8, Ml), d("polygon", { points: `${t.value.centerX - 6},${t.value.bottom - 8} ${t.value.centerX},${t.value.bottom} ${t.value.centerX + 6},${t.value.bottom - 8}`, fill: e.value.style.chart.layout.grid.stroke, stroke: "none" }, null, 8, Nl) ])) : h("", !0), e.value.style.chart.layout.labels.quadrantLabels.show && !x.value ? (s(), n("g", Pl, [ e.value.style.chart.layout.labels.quadrantLabels.tl.text ? (s(), n("text", { key: 0, x: 0, y: t.value.top - t.value.padding /