UNPKG

vue-data-ui

Version:

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

1,039 lines (1,035 loc) 78 kB
import { defineAsyncComponent as ue, computed as D, ref as $, toRefs as _l, watch as Fe, shallowRef as Dt, onMounted as Ml, onBeforeUnmount as Bl, createElementBlock as c, openBlock as i, unref as y, normalizeStyle as ie, normalizeClass as Ft, createBlock as se, createCommentVNode as b, createElementVNode as C, createVNode as we, withCtx as T, renderSlot as F, normalizeProps as K, guardReactiveProps as Q, createSlots as zt, Fragment as Z, renderList as le, toDisplayString as G, Teleport as Sl, resolveDynamicComponent as Ll, mergeProps as Tl, createTextVNode as Et, nextTick as Dl } from "vue"; import { c as Fl, t as zl, i as El, j as de, o as Pt, g as Ke, k as Pl, l as Ot, ai as Ol, m as Qe, ak as Nl, A as Wl, s as ze, X as Il, aj as Xl, a as ve, U as q, d as oe, v as Yl, r as Rl, y as jl, _ as Ul } from "./lib-BwysEpWI.js"; import { t as Vl, u as Gl } from "./useResponsive-DfdjqQps.js"; import { u as ql, a as et } from "./useNestedProp-OFRiX4kU.js"; import { u as Hl, B as Zl } from "./BaseScanner-BMpwQAfz.js"; import { u as Jl } from "./usePrinter-BJzHDpYF.js"; import { u as Kl } from "./useSvgExport-ByUukOZt.js"; import { u as Ql } from "./useThemeCheck-DGJ31Vi5.js"; import { u as eo } from "./useUserOptionState-BIvW1Kz7.js"; import { u as to } from "./useChartAccessibility-9icAAmYg.js"; import lo from "./Legend-D6z73edh.js"; import oo from "./Title-DGnfNZuO.js"; import { _ as tt } from "./Shape-DAHhCEdg.js"; import ao from "./img-DKigoPDs.js"; import { _ as so } from "./_plugin-vue_export-helper-CHgC5LLL.js"; const Nt = { style: { backgroundColor: "#1A1A1A", color: "#CCCCCC", layout: { axis: { stroke: "#5A5A5A" }, marginalBars: { fill: "#5A5A5A" }, plots: { stroke: "#1A1A1A", selectors: { stroke: "#5A5A5A", labels: { color: "#CCCCCC" }, markers: { stroke: "#1A1A1A", fill: "#5A5A5A" } } }, correlation: { label: { color: "#CCCCCC" } }, dataLabels: { xAxis: { color: "#CCCCCC" }, yAxis: { color: "#CCCCCC" } } }, 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" } } }, Wt = { style: { backgroundColor: "#FFF8E1", color: "#424242", layout: { axis: { stroke: "#5D403790" }, marginalBars: { fill: "#5D4037" }, plots: { stroke: "#FFF8E1", selectors: { stroke: "#5D4037", labels: { color: "#424242" }, markers: { stroke: "#FFF8E1", fill: "#D32F2F" } } }, correlation: { label: { color: "#424242" } }, dataLabels: { xAxis: { color: "#424242" }, yAxis: { color: "#424242" } } }, 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" } } }, It = { style: { backgroundColor: "#1E1E1E", color: "#BDBDBD", layout: { axis: { stroke: "#5D4037" }, marginalBars: { fill: "#D32F2F" }, plots: { stroke: "#1E1E1E", selectors: { stroke: "#BDBDBD", labels: { color: "#BDBDBD" }, markers: { stroke: "#BDBDBD", fill: "#D32F2F" } } }, correlation: { label: { color: "#BDBDBD" } }, dataLabels: { xAxis: { color: "#BDBDBD" }, yAxis: { color: "#BDBDBD" } } }, 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" } } }, Xt = { style: { backgroundColor: "#1A1A1A", color: "#99AA99", layout: { axis: { stroke: "#334C33" }, marginalBars: { fill: "#66CC66" }, plots: { stroke: "#1A1A1A", selectors: { stroke: "#66CC66", labels: { color: "#AACCAA" }, markers: { stroke: "#66CC66", fill: "#1A1A1A" } } }, correlation: { label: { color: "#AACCAA" } }, dataLabels: { xAxis: { color: "#AACCAA" }, yAxis: { color: "#AACCAA" } } }, 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" } } }, Yt = { style: { backgroundColor: "#fbfafa", color: "#8A9892", layout: { axis: { stroke: "transparent" }, marginalBars: { fill: "#B0B9A8" }, plots: { stroke: "#fbfafa", selectors: { stroke: "#4F5B75", labels: { color: "#928A98" }, markers: { stroke: "#4F5B75", fill: "#fbfafa" } } }, correlation: { label: { color: "#928A98" } }, dataLabels: { xAxis: { color: "#928A98" }, yAxis: { color: "#928A98" } } }, 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" } } }, Rt = { style: { backgroundColor: "#f6f6fb", color: "#50606C", layout: { axis: { stroke: "#92B0B5" }, marginalBars: { fill: "#ABB1BC" }, plots: { stroke: "#fbfafa", selectors: { stroke: "#4F5B75", labels: { color: "#404C4D" }, markers: { stroke: "#4F5B75", fill: "#f6f6fb" } } }, correlation: { label: { color: "#61747E" } }, dataLabels: { xAxis: { color: "#61747E" }, yAxis: { color: "#61747E" } } }, 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" } } }, jt = { default: {}, dark: Nt, celebration: Wt, celebrationNight: It, hack: Xt, zen: Yt, concrete: Rt }, Pa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, celebration: Wt, celebrationNight: It, concrete: Rt, dark: Nt, default: jt, hack: Xt, zen: Yt }, Symbol.toStringTag, { value: "Module" })), no = ["id"], ro = ["id"], uo = ["xmlns", "viewBox"], io = ["width", "height"], vo = { key: 1 }, co = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], yo = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], ho = { key: 2 }, fo = ["id"], go = ["stop-color"], po = ["stop-color"], mo = ["id"], bo = ["stop-color"], ko = ["stop-color"], xo = ["x", "y", "width", "height", "fill", "stroke", "stroke-width", "rx"], Co = ["x", "y", "width", "height", "onMouseenter"], Ao = { key: 2, style: { "pointer-events": "none" } }, wo = ["x", "y", "width", "height", "fill", "fill-opacity"], $o = ["x1", "x2", "y2", "stroke", "stroke-dasharray", "stroke-width"], _o = ["x1", "x2", "y2", "stroke", "stroke-dasharray", "stroke-width"], Mo = ["x", "y", "height", "width", "fill", "stroke", "stroke-width", "rx"], Bo = ["x", "y", "width", "height", "onMouseenter"], So = { key: 2, style: { "pointer-events": "none" } }, Lo = ["x", "y", "width", "height", "fill", "fill-opacity"], To = ["x1", "x2", "y1", "y2", "stroke", "stroke-dasharray", "stroke-width"], Do = ["x1", "x2", "y1", "y2", "stroke", "stroke-dasharray", "stroke-width"], Fo = { key: 0, style: { "pointer-events": "none" } }, zo = ["d", "stroke", "stroke-width"], Eo = ["d", "stroke", "stroke-width"], Po = ["d", "stroke", "stroke-width"], Oo = ["d", "stroke", "stroke-width"], No = { key: 3 }, Wo = ["points", "fill", "stroke-width", "stroke-dasharray", "stroke"], Io = { key: 0 }, Xo = ["cx", "cy", "r", "fill", "stroke", "stroke-width", "onMouseover", "onMouseleave", "onClick"], Yo = { key: 1 }, Ro = ["clip-path"], jo = ["d", "fill", "stroke", "stroke-width", "stroke-opacity"], Uo = { key: 0, style: { "pointer-events": "none" } }, Vo = ["x", "y", "width", "height"], Go = { key: 6, style: { "pointer-events": "none !important" } }, qo = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], Ho = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], Zo = ["x", "y", "font-size", "fill", "font-weight", "text-anchor"], Jo = ["x", "y", "font-size", "fill", "font-weight"], Ko = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], Qo = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], ea = ["x", "y", "font-size", "fill", "font-weight", "text-anchor"], ta = ["id", "transform", "font-size", "font-weight", "fill"], la = ["font-size", "fill", "transform"], oa = ["transform", "font-size", "fill"], aa = ["x", "y", "font-size", "fill"], sa = ["x", "y", "font-size", "fill"], na = ["font-size", "font-weight", "fill", "x", "y"], ra = ["id"], ua = ["x", "y", "width", "height"], ia = { key: 11, style: { pointerEvents: "none" } }, va = ["x1", "x2", "y1", "y2", "stroke-dasharray", "stroke", "stroke-width", "clip-path"], ca = ["x", "y", "fill", "font-size", "font-weight"], ya = { key: 4, class: "vue-data-ui-watermark" }, da = ["id"], ha = ["onClick"], fa = { key: 0, style: { width: "100%", display: "flex", "align-items": "center", "justify-content": "center" } }, ga = { viewBox: "0 0 20 20", height: "20", width: "20", style: { overflow: "hidden", background: "transparent" } }, pa = { key: 0 }, ma = ["innerHTML"], ba = { __name: "vue-ui-scatter", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Array, default() { return []; } } }, setup(Ut, { expose: Vt }) { const Gt = ue(() => import("./Tooltip-TDyKgLB6.js")), qt = ue(() => import("./BaseIcon-4i3dd7Ty.js")), Ht = ue(() => import("./vue-ui-accordion-DUuwVsuJ.js")), Zt = ue(() => import("./DataTable-WrXCJkfE.js")), Jt = ue(() => import("./PenAndPaper-DxIUvoQ8.js")), Kt = ue(() => import("./UserOptions-CzJWRC4s.js")), Qt = ue(() => import("./PackageVersion-BLzm8l_I.js")), el = ue(() => import("./BaseDraggableDialog-CAJxIF6g.js")), { vue_ui_scatter: tl } = ql(), { isThemeValid: ll, warnInvalidTheme: ol } = Ql(), ee = Ut, lt = D(() => !!ee.dataset && ee.dataset.length), X = $(Fl()), Ee = $(!1), Pe = $(""), ot = $(0), ae = $(null), at = $(null), st = $(null), nt = $(null), rt = $(null), ut = $(0), it = $(0), vt = $(0), W = $([]), ct = $(!1), pe = $(null), me = $(null), be = $(null), Oe = $(null), Ne = $(null), al = $(null), sl = $(null), We = $(null), e = $(Re()); function nl(l = 100, o = 0.8, t = {}) { const { meanX: a = 0, sdX: s = 1, meanY: r = 0, sdY: u = 1, seed: f } = t; let v = (f ?? Math.floor(Math.random() * 2 ** 31)) >>> 0; const p = () => (v = v * 1664525 + 1013904223 >>> 0, v / 2 ** 32), S = () => { let m = 0, N = 0; for (; m === 0; ) m = p(); for (; N === 0; ) N = p(); return Math.sqrt(-2 * Math.log(m)) * Math.cos(2 * Math.PI * N); }, d = l / 2, w = Array.from({ length: d }, S), O = Array.from({ length: d }, S), _ = (m) => m.reduce((N, Ae) => N + Ae, 0) / m.length, z = _(w), Y = _(O); for (let m = 0; m < d; m += 1) w[m] -= z, O[m] -= Y; const L = (m, N) => m.reduce((Ae, De, Je) => Ae + De * N[Je], 0), A = (m) => L(m, m), h = L(O, w) / A(w), B = O.map((m, N) => m - h * w[N]), V = A(w) / d, J = A(B) / d, re = Math.sqrt((1 - o * o) * V / J), j = w.map((m, N) => o * m + re * B[N]), ye = w.concat(w.map((m) => -m)), Ze = j.concat(j.map((m) => -m)), xe = (m) => Math.sqrt(A(m) / m.length), fe = (m, N, Ae) => { const De = xe(m); return m.map((Je) => Ae + (De ? Je / De * N : 0)); }, ge = fe(ye, s, a), Ce = fe(Ze, u, r); for (let m = ge.length - 1; m > 0; m -= 1) { const N = Math.floor(p() * (m + 1)); [ge[m], ge[N]] = [ge[N], ge[m]], [Ce[m], Ce[N]] = [Ce[N], Ce[m]]; } return ge.map((m, N) => ({ x: m, y: Ce[N] })); } const { loading: yt, FINAL_DATASET: Ie, manualLoading: Xe } = Hl({ ..._l(ee), FINAL_CONFIG: e, prepareConfig: Re, skeletonDataset: [ { name: "", color: "#999999", values: nl(100, 0.5, { seed: 42 }) } ], skeletonConfig: zl({ defaultConfig: e.value, userConfig: { userOptions: { show: !1 }, table: { show: !1 }, useCssAnimation: !1, style: { backgroundColor: "#99999930", layout: { axis: { stroke: "#6A6A6A" }, correlation: { label: { show: !1 } }, dataLabels: { xAxis: { show: !1 }, yAxis: { show: !1 } }, marginalBars: { fill: "#99999960" }, padding: { top: 12, right: 12, bottom: 12, left: 12 }, plots: { stroke: "#6A6A6A" } }, legend: { backgroundColor: "transparent" } } } }) }), { userOptionsVisible: Ye, setUserOptionsVisibility: dt, keepUserOptionState: ht } = eo({ config: e.value }), { svgRef: $e } = to({ config: e.value.style.title }); function Re() { const l = et({ userConfig: ee.config, defaultConfig: tl }), o = l.theme; if (!o) return l; if (!ll.value(l)) return ol(l), l; const t = et({ userConfig: jt[o] || ee.config, defaultConfig: l }), a = et({ userConfig: ee.config, defaultConfig: t }); return { ...a, customPalette: a.customPalette.length ? a.customPalette : El[o] || de }; } Fe(() => ee.config, (l) => { yt.value || (e.value = Re()), Ye.value = !e.value.userOptions.showOnChartHover, gt(), ut.value += 1, it.value += 1, vt.value += 1, H.value.showTable = e.value.table.show, H.value.showTooltip = e.value.style.tooltip.show, ft.value && e.value.usePerformanceMode && console.warn(`VueUiScatter : You are using performance mode - downsampling is disabled in this mode, all plots are rendered - plot significance is not active in this mode (all plots have the same opacity) - Depending on plot density, shapes might not display a border (stroke) to avoid fuzziness ℹ️ To remove this warning, set config.debug to false.`); }, { deep: !0 }), Fe(() => ee.dataset, (l) => { Array.isArray(l) && l.length > 0 && (Xe.value = !1); }, { deep: !0 }); const ne = Dt(null), he = Dt(null); Ml(() => { ct.value = !0, gt(); }); const ft = D(() => !!e.value.debug); function gt() { if (Pt(ee.dataset) && (Ke({ componentName: "VueUiScatter", type: "dataset", debug: ft.value }), Xe.value = !0), Pt(ee.dataset) || (Xe.value = e.value.loading), e.value.responsive) { const l = Vl(() => { const { width: o, height: t } = Gl({ chart: ae.value, title: e.value.style.title.text ? at.value : null, legend: e.value.style.legend.show ? st.value : null, source: nt.value, noTitle: rt.value }); requestAnimationFrame(() => { I.value.width = o, I.value.height = t; }); }); ne.value && (he.value && ne.value.unobserve(he.value), ne.value.disconnect()), ne.value = new ResizeObserver(l), he.value = ae.value.parentNode, ne.value.observe(he.value); } } Bl(() => { ne.value && (he.value && ne.value.unobserve(he.value), ne.value.disconnect()); }); const { isPrinting: pt, isImaging: mt, generatePdf: bt, generateImage: kt } = Jl({ elementId: `vue-ui-scatter_${X.value}`, fileName: e.value.style.title.text || "vue-ui-scatter", options: e.value.userOptions.print }), rl = D(() => e.value.userOptions.show && !e.value.style.title.text), xt = D(() => Pl(e.value.customPalette)), H = $({ showTable: e.value.table.show, showTooltip: e.value.style.tooltip.show }); Fe(e, () => { H.value = { showTable: e.value.table.show, showTooltip: e.value.style.tooltip.show }; }, { immediate: !0 }); const I = $({ height: e.value.style.layout.height, width: e.value.style.layout.width }), _e = D(() => e.value.style.layout.marginalBars.show ? e.value.style.layout.marginalBars.size + e.value.style.layout.marginalBars.offset : 0), n = D(() => { let l = 0, o = 0; return Ne.value && (l = Ne.value.getBBox().width + 6), We.value && (o = We.value.getBBox().height + 6), { top: e.value.style.layout.padding.top + _e.value + e.value.style.layout.dataLabels.yAxis.fontSize * 2, right: I.value.width - e.value.style.layout.padding.right - _e.value - 6, bottom: I.value.height - e.value.style.layout.padding.bottom - o, left: e.value.style.layout.padding.left + l, height: I.value.height - e.value.style.layout.padding.top - e.value.style.layout.padding.bottom - _e.value - o - e.value.style.layout.dataLabels.yAxis.fontSize * 2, width: I.value.width - e.value.style.layout.padding.left - e.value.style.layout.padding.right - _e.value - l - 6 }; }), E = D(() => { Ie.value.forEach((s, r) => { Ot({ datasetObject: s, requiredAttributes: ["values"] }).forEach((u) => { Ke({ componentName: "VueUiScatter", type: "datasetSerieAttribute", property: u, index: r }); }), s.values && s.values.forEach((u, f) => { Ot({ datasetObject: u, requiredAttributes: ["x", "y"] }).forEach((v) => { Ke({ componentName: "VueUiScatter", type: "datasetSerieAttribute", property: `values.${v}`, index: `${r} - ${f}` }); }); }); }); const l = Math.min(...te.value.filter((s) => !W.value.includes(s.id)).flatMap((s) => s.values.map((r) => r.x))), o = Math.max(...te.value.filter((s) => !W.value.includes(s.id)).flatMap((s) => s.values.map((r) => r.x))), t = Math.min(...te.value.filter((s) => !W.value.includes(s.id)).flatMap((s) => s.values.map((r) => r.y))), a = Math.max(...te.value.filter((s) => !W.value.includes(s.id)).flatMap((s) => s.values.map((r) => r.y))); return { xMin: l >= 0 ? 0 : l, xMax: o, yMin: t >= 0 ? 0 : t, yMax: a }; }), P = D(() => ({ x: n.value.left + Math.abs(E.value.xMin) / (E.value.xMax + Math.abs(E.value.xMin)) * n.value.width, y: n.value.bottom - Math.abs(E.value.yMin) / (E.value.yMax + Math.abs(E.value.yMin)) * n.value.height })), te = D(() => Ie.value.map((l, o) => { const t = `cluster_${X.value}_${o}`; return { ...l, values: Ol({ data: l.values, threshold: e.value.usePerformanceMode ? l.values.length + 1 : e.value.downsample.threshold }), id: t, color: l.color ? l.color : xt.value[o] || de[o] || de[o % de.length], opacity: W.value.includes(t) ? 0.5 : 1, shape: l.shape ?? "circle", segregate: () => Se(t), isSegregated: W.value.includes(t) }; })), ul = D(() => ({ cy: "scatter-div-legend", backgroundColor: e.value.style.legend.backgroundColor, color: e.value.style.legend.color, fontSize: e.value.style.legend.fontSize, paddingBottom: 12, fontWeight: e.value.style.legend.bold ? "bold" : "" })), Me = D(() => te.value.map((l, o) => ({ ...l, plots: l.values.map((t) => ({ x: n.value.left + (t.x + Math.abs(E.value.xMin)) / (E.value.xMax + Math.abs(E.value.xMin)) * n.value.width, y: n.value.bottom - (t.y + Math.abs(E.value.yMin)) / (E.value.yMax + Math.abs(E.value.yMin)) * n.value.height, v: { ...t, name: t.name || "" }, clusterName: l.name, color: l.color ? l.color : xt.value[o] || de[o] || de[o % de.length], id: `plot_${X.value}_${Math.random()}`, weight: t.weight ?? e.value.style.layout.plots.radius })) })).filter((l) => !W.value.includes(l.id))), U = D(() => { const o = ({ m: t, b: a, rect: s, verticalX: r = null }) => { const { left: u, right: f, top: v, bottom: p } = s, S = [], d = (A, h) => { Number.isFinite(A) && Number.isFinite(h) && S.push({ x: A, y: h }); }, w = ({ x: A, y: h }) => A >= u - 1e-9 && A <= f + 1e-9 && h >= v - 1e-9 && h <= p + 1e-9; r !== null ? r >= u - 1e-9 && r <= f + 1e-9 && (d(r, v), d(r, p)) : Number.isFinite(t) && (d(u, t * u + a), d(f, t * f + a), Math.abs(t) > 1e-9 ? (d((v - a) / t, v), d((p - a) / t, p)) : a >= v - 1e-9 && a <= p + 1e-9 && (d(u, a), d(f, a))); const O = S.filter(w), _ = []; for (const A of O) _.some((h) => Math.abs(h.x - A.x) < 1e-6 && Math.abs(h.y - A.y) < 1e-6) || _.push(A); if (_.length < 2) return null; let z = _[0], Y = _[1], L = 0; for (let A = 0; A < _.length; A += 1) for (let h = A + 1; h < _.length; h += 1) { const B = _[A].x - _[h].x, V = _[A].y - _[h].y, J = B * B + V * V; J > L && (L = J, z = _[A], Y = _[h]); } return { x1: z.x, y1: z.y, x2: Y.x, y2: Y.y }; }; return Me.value.map((t) => { const a = t.plots.length, s = t.plots.reduce((h, B) => h + B.x, 0) / a, r = t.plots.reduce((h, B) => h + B.y, 0) / a; let u = 0, f = 0; for (const h of t.plots) { const B = h.x - s, V = h.y - r; u += B * V, f += B * B; } let v, p, S = null; f < 1e-9 ? (S = s, v = 1 / 0, p = null) : (v = u / f, p = r - v * s); let d, w; S !== null ? (d = 1 / 0, w = null) : (d = v, w = p); const O = t.plots.every((h) => h.v && typeof h.v.x == "number" && typeof h.v.y == "number"); let _ = NaN; if (a >= 2) { let h = 0, B = 0; O ? (h = t.plots.reduce((j, ye) => j + ye.v.x, 0) / a, B = t.plots.reduce((j, ye) => j + ye.v.y, 0) / a) : (h = s, B = -r); let V = 0, J = 0, re = 0; for (const j of t.plots) { const ye = O ? j.v.x : j.x, Ze = O ? j.v.y : -j.y, xe = ye - h, fe = Ze - B; V += xe * fe, J += xe * xe, re += fe * fe; } if (J >= 1e-9 && re >= 1e-9) { const j = V / Math.sqrt(J * re); _ = Math.max(-1, Math.min(1, j)); } } const z = o({ m: d, b: w, rect: n.value, verticalX: S }); if (!z) return { ...t, correlation: null, label: null, plots: t.plots.map((h) => ({ ...h, deviation: 0, shape: t.shape, color: Qe(t.color) })) }; const Y = (z.x1 + z.x2) / 2, L = (z.y1 + z.y2) / 2, A = { x: Y, y: L }; return { ...t, color: Qe(t.color), correlation: { ...z, coefficient: _ }, label: A, plots: t.plots.map((h) => { let B, V; S !== null ? (B = S, V = h.y) : Math.abs(d) < 1e-9 ? (B = h.x, V = w) : (B = (h.x + d * h.y - d * w) / (1 + d * d), V = (d * h.x + d * d * h.y + w) / (1 + d * d)); const J = h.x - B, re = h.y - V, j = Math.sqrt(J * J + re * re); return { ...h, deviation: j, shape: t.shape, color: Qe(t.color) }; }) }; }); }), Ct = D(() => Math.max(...U.value.flatMap((l) => l.plots.map((o) => Math.abs(o.deviation))))); function il() { return U.value; } function At(l, o) { const t = Array.isArray(l) ? l.flatMap((L) => L.plots.map((A) => ({ x: A.x, y: A.y }))) : l.plots.map((L) => ({ x: L.x, y: L.y })); let a = 1 / 0, s = -1 / 0, r = 1 / 0, u = -1 / 0; t.forEach(({ x: L, y: A }) => { a = Math.min(a, L), s = Math.max(s, L), r = Math.min(r, A), u = Math.max(u, A); }); const f = s - a, v = u - r, p = f / o, S = v / o, d = Array(o).fill(0), w = Array(o).fill(0); t.forEach(({ x: L, y: A }) => { const h = Math.floor((L - a) / p), B = Math.floor((A - r) / S); d[h] || (d[h] = 0), w[B] || (w[B] = 0), d[h] += 1, w[B] += 1; }); const O = [], _ = []; for (let L = 0; L < o; L += 1) O.push(a + (L + 0.5) * p), _.push(r + (L + 0.5) * S); const z = Math.max(...d), Y = Math.max(...w); return { x: d, y: w, avgX: O, avgY: _, maxX: z, maxY: Y }; } const k = D(() => e.value.style.layout.marginalBars.tranches), M = D(() => At(Me.value, k.value)), vl = D(() => { const l = n.value.top - e.value.style.layout.marginalBars.offset, o = n.value.right + e.value.style.layout.marginalBars.offset; return Me.value.map((t) => { const a = At(t, k.value); return { coords: a, dX: Wl(a.avgX.map((s, r) => ({ x: s, y: l - a.x[r] / a.maxX * e.value.style.layout.marginalBars.size }))), dY: Nl(a.avgY.map((s, r) => ({ y: s, x: o + e.value.style.layout.marginalBars.size * a.y[r] / a.maxY }))), color: t.color, id: t.id }; }); }), R = $(void 0), g = $(null), je = $(null); function Ue(l, o) { R.value = l.id, g.value = l; let t = ""; e.value.events.datapointEnter && e.value.events.datapointEnter({ datapoint: l, seriesIndex: o }), je.value = { datapoint: l, seriesIndex: o, series: U.value, config: e.value }; const a = e.value.style.tooltip.customFormat; jl(a) && Ul(() => a({ datapoint: l, seriesIndex: o, series: U.value, config: e.value })) ? Pe.value = a({ datapoint: l, seriesIndex: o, series: U.value, config: e.value }) : (l.clusterName && (t += `<div style="display:flex;gap:3px;align-items:center">${l.clusterName}</div>`), l.v.name && (t += `<div>${l.v.name}</div>`), t += `<div style="text-align:left;margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}">`, t += `<div>${e.value.style.layout.dataLabels.xAxis.name}: <b>${isNaN(l.v.x) ? "-" : ve( e.value.style.layout.plots.selectors.labels.x.formatter, l.v.x, oe({ p: e.value.style.tooltip.prefix, v: l.v.x, s: e.value.style.tooltip.suffix, r: e.value.style.tooltip.roundingValue }), { datapoint: l, seriesIndex: o } )}</b></div>`, t += `<div>${e.value.style.layout.dataLabels.yAxis.name}: <b>${isNaN(l.v.y) ? "-" : ve( e.value.style.layout.plots.selectors.labels.y.formatter, l.v.y, oe({ p: e.value.style.tooltip.prefix, v: l.v.y, s: e.value.style.tooltip.suffix, r: e.value.style.tooltip.roundingValue }), { datapoint: l, seriesIndex: o } )}</b></div>`, t += `${e.value.style.layout.plots.deviation.translation}: <b>${oe({ v: l.deviation, r: e.value.style.layout.plots.deviation.roundingValue })}</b>`, t += "</div>", Pe.value = `<div>${t}</div>`), Ee.value = !0; } function Be(l, o) { e.value.events.datapointLeave && e.value.events.datapointLeave({ datapoint: l, seriesIndex: o }), Ee.value = !1, R.value = void 0, g.value = null; } function Ve(l, o) { e.value.events.datapointClick && e.value.events.datapointClick({ datapoint: l, seriesIndex: o }); } function Se(l) { W.value.includes(l) ? W.value = W.value.filter((o) => o !== l) : W.value.length < Ie.value.length - 1 && W.value.push(l); } function wt(l) { if (!te.value.length) return e.value.debug && console.warn("VueUiScatter - There are no series to show."), null; const o = te.value.find((t) => t.name === l); return o || (e.value.debug && console.warn(`VueUiScatter - Series name not found "${l}"`), null); } function cl(l) { const o = wt(l); o !== null && W.value.includes(o.id) && Se(o.id); } function yl(l) { const o = wt(l); o !== null && (W.value.includes(o.id) || Se(o.id)); } function Ge(l = null) { Dl(() => { const o = ["", e.value.table.translations.correlationCoefficient, e.value.table.translations.nbrPlots, `${e.value.style.layout.dataLabels.xAxis.name} ${e.value.table.translations.average}`, `${e.value.style.layout.dataLabels.yAxis.name} ${e.value.table.translations.average}`], t = U.value.map((r) => [ r.name, r.correlation.coefficient, r.plots.length, r.plots.map((u) => u.v.x).reduce((u, f) => u + f, 0) / r.plots.length, r.plots.map((u) => u.v.y).reduce((u, f) => u + f, 0) / r.plots.length ]), a = [[e.value.style.title.text], [e.value.style.title.subtitle.text], [[""], [""], [""]]].concat([o]).concat(t), s = Yl(a); l ? l(s) : Rl({ csvContent: s, title: e.value.style.title.text || "vue-ui-heatmap" }); }); } const Le = D(() => { const l = [ e.value.table.translations.series, e.value.table.translations.correlationCoefficient, e.value.table.translations.nbrPlots, `${e.value.style.layout.dataLabels.xAxis.name} ${e.value.table.translations.average}`, `${e.value.style.layout.dataLabels.yAxis.name} ${e.value.table.translations.average}` ], o = U.value.map((a) => [ { shape: a.shape, content: a.name, color: a.color }, Number((a.correlation.coefficient ?? 0).toFixed(e.value.table.td.roundingValue)).toLocaleString(), a.plots.length.toLocaleString(), Number((a.plots.map((s) => s.v.x ?? 0).reduce((s, r) => s + r, 0) / a.plots.length).toFixed(e.value.table.td.roundingAverage)).toLocaleString(), Number((a.plots.map((s) => s.v.y ?? 0).reduce((s, r) => s + r, 0) / a.plots.length).toFixed(e.value.table.td.roundingAverage)).toLocaleString() ]), t = { 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: t, colNames: l }; }), ce = $(!1); function $t(l) { ce.value = l, ot.value += 1; } function _t() { H.value.showTable = !H.value.showTable; } function Mt() { H.value.showTooltip = !H.value.showTooltip; } const Te = $(!1); function qe() { Te.value = !Te.value; } async function dl({ scale: l = 2 } = {}) { if (!ae.value) return; const { width: o, height: t } = ae.value.getBoundingClientRect(), a = o / t, { imageUri: s, base64: r } = await ao({ domElement: ae.value, base64: !0, img: !0, scale: l }); return { imageUri: s, base64: r, title: e.value.style.title.text, width: o, height: t, aspectRatio: a }; } function hl(l) { pe.value = l, e.value.style.layout.marginalBars.highlighter.highlightBothAxes && (me.value = M.value.y.length - 2 - l); } function fl(l) { me.value = l, e.value.style.layout.marginalBars.highlighter.highlightBothAxes && (pe.value = l); } function He() { pe.value = null, me.value = null; } const Bt = { circle: 1, square: 1, diamond: 1, triangle: 1.2, star: 1.3, pentagon: 1.3, hexagon: 1.3 }, x = (l) => l.toFixed(3); function gl({ shape: l = "circle", cx: o, cy: t, r: a }) { if (!e.value.usePerformanceMode) return ""; const s = Bt[l] * a; switch (l) { case "circle": { const r = x(o - s), u = x(t), f = x(o + s), v = x(s); return `M ${r} ${u} A ${v} ${v} 0 1 0 ${f} ${u} A ${v} ${v} 0 1 0 ${r} ${u} Z`; } case "square": { const r = x(o - s), u = x(t - s), f = x(o + s), v = x(t + s); return `M ${r} ${u} L ${f} ${u} L ${f} ${v} L ${r} ${v} Z`; } case "diamond": { const r = x(o), u = x(t); return `M ${r} ${x(t - s)} L ${x(o + s)} ${u} L ${r} ${x(t + s)} L ${x(o - s)} ${u} Z`; } case "triangle": { const r = s * Math.sqrt(3), u = o, f = t - 2 / 3 * r, v = o - s, p = t + 1 / 3 * r, S = o + s, d = p; return `M ${x(u)} ${x(f)} L ${x(v)} ${x(p)} L ${x(S)} ${x(d)} Z`; } case "star": { const r = s, u = s * 0.5, f = []; for (let p = 0; p < 10; p += 1) { const S = (-90 + p * 36) * Math.PI / 180, d = p % 2 === 0 ? r : u; f.push([o + d * Math.cos(S), t + d * Math.sin(S)]); } let v = `M ${x(f[0][0])} ${x(f[0][1])}`; for (let p = 1; p < f.length; p += 1) v += ` L ${x(f[p][0])} ${x(f[p][1])}`; return v + " Z"; } case "pentagon": { const u = []; for (let v = 0; v < 5; v += 1) { const p = (-90 + v * 72) * Math.PI / 180; u.push([o + s * Math.cos(p), t + s * Math.sin(p)]); } let f = `M ${x(u[0][0])} ${x(u[0][1])}`; for (let v = 1; v < 5; v += 1) f += ` L ${x(u[v][0])} ${x(u[v][1])}`; return f + " Z"; } case "hexagon": { const u = []; for (let v = 0; v < 6; v += 1) { const p = (-60 + v * 60) * Math.PI / 180; u.push([o + s * Math.cos(p), t + s * Math.sin(p)]); } let f = `M ${x(u[0][0])} ${x(u[0][1])}`; for (let v = 1; v < 6; v += 1) f += ` L ${x(u[v][0])} ${x(u[v][1])}`; return f + " Z"; } default: { const r = x(o - s), u = x(t), f = x(o + s), v = x(s); return `M ${r} ${u} A ${v} ${v} 0 1 0 ${f} ${u} A ${v} ${v} 0 1 0 ${r} ${u} Z`; } } } const pl = D(() => { if (!e.value.usePerformanceMode) return [""]; const { left: l, right: o, top: t, bottom: a } = n.value, s = Math.max(1, (o - l) * (a - t)), r = (d) => d / s * 1e4, u = 2.5, f = 1e3, v = e.value.style.layout.plots.stroke, p = e.value.style.layout.plots.strokeWidth, S = e.value.style.layout.plots.opacity; return U.value.map((d) => { const w = []; for (const _ of d.plots) { const z = _.x, Y = _.y; if (z < l || z > o || Y < t || Y > a) continue; const L = Math.max(e.value.style.layout.plots.radius, _.weight); w.push(gl({ shape: d.shape || "circle", cx: z, cy: Y, r: L })); } if (!w.length) return null; const O = r(d.plots.length) > u || d.plots.length > f; return { id: d.id, d: w.join(""), fill: ze(d.color, S * 100), stroke: O ? "none" : v, strokeWidth: O ? 0 : p, strokeOpacity: 1 }; }).filter(Boolean); }); function ml() { return e.value.usePerformanceMode ? (l) => { const o = $e.value; if (!o) return; const t = o.createSVGPoint(); t.x = l.clientX, t.y = l.clientY; const a = o.getScreenCTM(); if (!a) return; const s = a.inverse(), r = t.matrixTransform(s), u = 8, f = u * u; let v = null, p = 1 / 0, S = -1; if (U.value.forEach((d, w) => { d.plots.forEach((O) => { const _ = O.x - r.x, z = O.y - r.y, Y = _ * _ + z * z; Y <= f && Y < p && (p = Y, v = O, S = w); }); }), v) R.value !== v.id && (R.value = v.id, Ue(v, S)); else if (R.value) { const d = g.value; R.value = void 0, Be(d, S); } } : () => null; } const St = ml(); function bl() { if (R.value) { const l = g.value; R.value = void 0, Be(l, null); } } function kl(l) { const o = g.value; if (o) { const t = U.value.findIndex((a) => a.id === o.clusterId); Ve(o, t >= 0 ? t : 0); } } const ke = D(() => { const l = e.value.table.useDialog && !e.value.table.show, o = H.value.showTable; return { component: l ? el : Ht, title: `${e.value.style.title.text}${e.value.style.title.subtitle.text ? `: ${e.value.style.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: ce.value, fullscreenParent: ae.value, forcedWidth: Math.min(800, window.innerWidth * 0.8) } : { hideDetails: !0, config: { open: o, maxHeight: 1e4, body: { backgroundColor: e.value.style.backgroundColor, color: e.value.style.color }, head: { backgroundColor: e.value.style.backgroundColor, color: e.value.style.color } } } }; }); Fe(() => H.value.showTable, (l) => { e.value.table.show || (l && e.value.table.useDialog && be.value ? be.value.open() : "close" in be.value && be.value.close()); }); function Lt() { H.value.showTable = !1, Oe.value && Oe.value.setTableIconState(!1); } const xl = D(() => e.value.style.backgroundColor), Cl = D(() => e.value.style.legend), Al = D(() => e.value.style.title), { exportSvg: wl, getSvg: $l } = Kl({ svg: $e, title: Al, legend: Cl, legendItems: te, backgroundColor: xl }); async function Tt({ isCb: l }) { if (l) { const { blob: o, url: t, text: a, dataUrl: s } = await $l(); e.value.userOptions.callbacks.svg({ blob: o, url: t, text: a, dataUrl: s }); } else wl(); } return Vt({ getData: il, getImage: dl, generatePdf: bt, generateCsv: Ge, generateImage: kt, generateSvg: Tt, hideSeries: yl, showSeries: cl, toggleTable: _t, toggleTooltip: Mt, toggleAnnotator: qe, toggleFullscreen: $t }), (l, o) => (i(), c("div", { class: Ft(`vue-data-ui-component vue-ui-scatter ${ce.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`), ref_key: "scatterChart", ref: ae, id: `vue-ui-scatter_${X.value}`, style: ie(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`), onMouseenter: o[5] || (o[5] = () => y(dt)(!0)), onMouseleave: o[6] || (o[6] = () => y(dt)(!1)) }, [ e.value.userOptions.buttons.annotator ? (i(), se(y(Jt), { key: 0, svgRef: y($e), backgroundColor: e.value.style.backgroundColor, color: e.value.style.color, active: Te.value, onClose: qe }, { "annotator-action-close": T(() => [ F(l.$slots, "annotator-action-close", {}, void 0, !0) ]), "annotator-action-color": T(({ color: t }) => [ F(l.$slots, "annotator-action-color", K(Q({ color: t })), void 0, !0) ]), "annotator-action-draw": T(({ mode: t }) => [ F(l.$slots, "annotator-action-draw", K(Q({ mode: t })), void 0, !0) ]), "annotator-action-undo": T(({ disabled: t }) => [ F(l.$slots, "annotator-action-undo", K(Q({ disabled: t })), void 0, !0) ]), "annotator-action-redo": T(({ disabled: t }) => [ F(l.$slots, "annotator-action-redo", K(Q({ disabled: t })), void 0, !0) ]), "annotator-action-delete": T(({ disabled: t }) => [ F(l.$slots, "annotator-action-delete", K(Q({ disabled: t })), void 0, !0) ]), _: 3 }, 8, ["svgRef", "backgroundColor", "color", "active"])) : b("", !0), rl.value ? (i(), c("div", { key: 1, ref_key: "noTitle", ref: rt, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : b("", !0), e.value.style.title.text ? (i(), c("div", { key: 2, ref_key: "chartTitle", ref: at, style: "width:100%;background:transparent" }, [ (i(), se(oo, { key: `title_${ut.value}`, config: { title: { cy: "scatter-div-title", ...e.value.style.title }, subtitle: { cy: "scatter-div-subtitle", ...e.value.style.title.subtitle } } }, null, 8, ["config"])) ], 512)) : b("", !0), C("div", { id: `legend-top-${X.value}` }, null, 8, ro), e.value.userOptions.show && lt.value && (y(ht) || y(Ye)) ? (i(), se(y(Kt), { ref_key: "userOptionsRef", ref: Oe, key: `user_options_${ot.value}`, backgroundColor: e.value.style.backgroundColor, color: e.value.style.color, isImaging: y(mt), isPrinting: y(pt), uid: X.value, hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.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, hasFullscreen: e.value.userOptions.buttons.fullscreen, isTooltip: H.value.showTooltip, isFullscreen: ce.value, titles: { ...e.value.userOptions.buttonTitles }, chartElement: ae.value, position: e.value.userOptions.position, hasAnnotator: e.value.userOptions.buttons.annotator, isAnnotation: Te.value, callbacks: e.value.userOptions.callbacks, printScale: e.value.userOptions.print.scale, tableDialog: e.value.table.useDialog, onToggleFullscreen: $t, onGeneratePdf: y(bt), onGenerateCsv: Ge, onGenerateImage: y(kt), onGenerateSvg: Tt, onToggleTable: _t, onToggleTooltip: Mt, onToggleAnnotator: qe, style: ie({ visibility: y(ht) ? y(Ye) ? "visible" : "hidden" : "visible" }) }, zt({ _: 2 }, [ l.$slots.menuIcon ? { name: "menuIcon", fn: T(({ isOpen: t, color: a }) => [ F(l.$slots, "menuIcon", K(Q({ isOpen: t, color: a })), void 0, !0) ]), key: "0" } : void 0, l.$slots.optionTooltip ? { name: "optionTooltip", fn: T(() => [ F(l.$slots, "optionTooltip", {}, void 0, !0) ]), key: "1" } : void 0, l.$slots.optionPdf ? { name: "optionPdf", fn: T(() => [ F(l.$slots, "optionPdf", {}, void 0, !0) ]), key: "2" } : void 0, l.$slots.optionCsv ? { name: "optionCsv", fn: T(() => [ F(l.$slots, "optionCsv", {}, void 0, !0) ]), key: "3" } : void 0, l.$slots.optionImg ? { name: "optionImg", fn: T(() => [ F(l.$slots, "optionImg", {}, void 0, !0) ]), key: "4" } : void 0, l.$slots.optionSvg ? { name: "optionSvg", fn: T(() => [ F(l.$slots, "optionSvg", {}, void 0, !0) ]), key: "5" } : void 0, l.$slots.optionTable ? { name: "optionTable", fn: T(() => [ F(l.$slots, "optionTable", {}, void 0, !0) ]), key: "6" } : void 0, l.$slots.optionFullscreen ? { name: "optionFullscreen", fn: T(({ toggleFullscreen: t, isFullscreen: a }) => [ F(l.$slots, "optionFullscreen", K(Q({ toggleFullscreen: t, isFullscreen: a })), void 0, !0) ]), key: "7" } : void 0, l.$slots.optionAnnotator ? { name: "optionAnnotator", fn: T(({ toggleAnnotator: t, isAnnotator: a }) => [ F(l.$slots, "optionAnnotator", K(Q({ toggleAnnotator: t, isAnnotator: a })), void 0, !0) ]), key: "8" } : void 0 ]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasSvg", "hasXls", "hasTable", "hasFullscreen", "isTooltip", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "tableDialog", "onGeneratePdf", "onGenerateImage", "style"])) : b("", !0), (i(), c("svg", { ref_key: "svgRef", ref: $e, xmlns: y(Il), class: Ft({ "vue-data-ui-fullscreen--on": ce.value, "vue-data-ui-fulscreen--off": !ce.value, animated: e.value.useCssAnimation }), viewBox: `0 0 ${I.value.width <= 0 ? 10 : I.value.width} ${I.value.height <= 0 ? 10 : I.value.height}`, style: ie(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.color}`), onMouseleave: He }, [ we(y(Qt)), l.$slots["chart-background"] ? (i(), c("foreignObject", { key: 0, x: 0, y: 0, width: I.value.width <= 0 ? 10 : I.value.width, height: I.value.height <= 0 ? 10 : I.value.height, style: { pointerEvents: "none" } }, [ F(l.$slots, "chart-background", {}, void 0, !0) ], 8, io)) : b("", !0), e.value.style.layout.axis.show ? (i(), c("g", vo, [ C("line", { x1: P.value.x, x2: P.value.x, y1: n.value.top, y2: n.value.bottom, stroke: e.value.style.layout.axis.stroke, "stroke-width": e.value.style.layout.axis.strokeWidth, "stroke-linecap": "round" }, null, 8, co), C("line", { x1: n.value.left, x2: n.value.right, y1: P.value.y, y2: P.value.y, stroke: e.value.style.layout.axis.stroke, "stroke-width": e.value.style.layout.axis.strokeWidth, "stroke-linecap": "round" }, null, 8, yo) ])) : b("", !0), e.value.style.layout.marginalBars.show ? (i(), c("g", ho, [ C("defs", null, [ C("linearGradient", { id: `marginal_x_${X.value}`, x1: "0%", y1: "0%", x2: "0%", y2: "100%" }, [ C("stop", { offset: "0%", "stop-color": e.value.style.layout.marginalBars.fill }, null, 8, go), C("stop", { offset: "100%", "stop-color": e.value.style.backgroundColor }, null, 8, po) ], 8, fo), C("linearGradient", { id: `marginal_y_${X.value}`, x1: "0%", x2: "100%", y1: "0%", y2: "0%" }, [ C("stop", { offset: "0%", "stop-color": e.value.style.backgroundColor }, null, 8, bo), C("stop", { offset: "100%", "stop-color": e.value.style.layout.marginalBars.fill }, null, 8, ko) ], 8, mo) ]), (i(!0), c(Z, null, le(M.value.x, (t, a) => (i(), c("g", null, [ t && M.value.avgX[a] ? (i(), c("rect", { key: 0, x: M.value.avgX[a] - n.value.width / k.value / 2, y: n.value.top - e.value.style.layout.marginalBars.offset - t / M.value.maxX * e.value.style.layout.marginalBars.size, width: n.value.width / k.value <= 0 ? 1e-4 : n.value.width / k.value, height: t / M.value.maxX * e.value.style.layout.marginalBars.size <= 0 ? 1e-4 : t / M.value.maxX * e.value.style.layout.marginalBars.size, fill: e.value.style.layout.marginalBars.useGradient ? `url(#marginal_x_${X.value})` : e.value.style.layout.marginalBars.fill, style: ie([`opacity:${e.value.style.layout.marginalBars.opacity}`, { "pointer-events": "none" }]), stroke: e.value.style.backgroundColor, "stroke-width": e.value.style.layout.marginalBars.strokeWidth, rx: e.value.style.layout.marginalBars.borderRadius }, null, 12, xo)) : b("", !0), M.value.avgX[a] ? (i(), c("rect", { key: 1, x: M.value.avgX[a] - n.value.width / k.value / 2, y: n.value.top - e.value.style.layout.marginalBars.offset - e.value.style.layout.marginalBars.size, width: n.value.width / k.value <= 0 ? 1e-4 : n.value.width / k.value, height: Math.max(0.1, e.value.style.layout.marginalBars.size), fill: "transparent", onMouseenter: (s) => hl(a), onMouseleave: o[0] || (o[0] = (s) => He()) }, null, 40, Co)) : b("", !0), M.value.avgX[a] && pe.value != null && pe.value === a ? (i(), c("g", Ao, [ C("rect", { x: M.value.avgX[a] - n.value.width / k.value / 2, y: n.value.t