vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
1,638 lines • 87.1 kB
JavaScript
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
import { $ as t, Bt as n, D as r, F as i, Gt as a, Jt as o, Kt as s, P as c, Pt as l, S as u, Tt as d, X as f, _ as p, _t as m, b as h, ct as ee, i as g, jt as te, pt as ne, q as re, t as ie, tt as ae, v as oe, w as se, xt as ce } from "./lib-Bttd6u5E.js";
import { n as le, t as ue } from "./useHints-Dq_w2E8B.js";
import { t as de } from "./useConfig-D3scuR88.js";
import { t as fe } from "./usePrinter-DN5bYhTG.js";
import { n as pe, t as me } from "./BaseScanner-DZvpgOjM.js";
import { t as he } from "./useSvgExport-DH-FfcqQ.js";
import { t as ge } from "./useNestedProp-vPNvh7rV.js";
import { t as _e } from "./useThemeCheck-C43Tcqmk.js";
import { t as ve } from "./useTransitions-g_zBREk2.js";
import { t as ye } from "./img-Bnokohej.js";
import { n as be } from "./Title-BE3qg9xl.js";
import { t as xe } from "./Shape-C21CMlWS.js";
import { t as Se } from "./_plugin-vue_export-helper-B3ysoDQm.js";
import { l as Ce, t as we } from "./useResponsive-ZtArZtUf.js";
import { t as Te } from "./DefGrad-DVBqDjhO.js";
import { t as Ee } from "./BaseLegendToggle-DZVucLnv.js";
import { t as De } from "./A11yDataTable-DdRsVULz.js";
import { t as Oe } from "./useUserOptionState-DK-_1ddE.js";
import { t as ke } from "./useChartAccessibility-DYqac8yF.js";
import { t as Ae } from "./Legend-CQxUgOd-.js";
import { t as je } from "./vue_ui_scatter-I0POnicu.js";
import { Fragment as _, Teleport as Me, computed as v, createBlock as y, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createSlots as Ne, createTextVNode as Pe, createVNode as Fe, defineAsyncComponent as C, guardReactiveProps as w, mergeProps as Ie, nextTick as Le, normalizeClass as Re, normalizeProps as T, normalizeStyle as E, onBeforeUnmount as ze, onMounted as Be, openBlock as D, ref as O, renderList as k, renderSlot as A, resolveDynamicComponent as Ve, shallowRef as He, toDisplayString as j, toRefs as Ue, unref as M, watch as We, withCtx as N } from "vue";
//#region src/components/vue-ui-scatter.vue
var Ge = /* @__PURE__ */ e({ default: () => gn }), Ke = ["id"], qe = ["id"], Je = {
key: 0,
class: "sr-only",
"aria-live": "polite",
"aria-atomic": "true"
}, Ye = ["id"], Xe = { style: { position: "relative" } }, Ze = [
"xmlns",
"aria-describedby",
"viewBox"
], Qe = ["width", "height"], $e = { key: 1 }, et = [
"x1",
"x2",
"y1",
"y2",
"stroke",
"stroke-width"
], tt = [
"x1",
"x2",
"y1",
"y2",
"stroke",
"stroke-width"
], nt = { key: 2 }, rt = [
"x1",
"x2",
"y1",
"y2",
"stroke",
"stroke-width"
], it = ["opacity"], at = [
"stroke",
"stroke-width",
"d"
], ot = [
"transform",
"font-size",
"fill",
"stroke"
], st = { key: 4 }, ct = [
"x1",
"x2",
"y1",
"y2",
"stroke",
"stroke-width"
], lt = ["opacity"], ut = [
"d",
"stroke",
"stroke-width"
], dt = [
"transform",
"font-size",
"fill",
"stroke"
], ft = { key: 6 }, pt = [
"x",
"y",
"width",
"height",
"fill",
"stroke",
"stroke-width",
"rx"
], mt = [
"x",
"y",
"width",
"height",
"onMouseenter"
], ht = {
key: 2,
style: { "pointer-events": "none" }
}, gt = [
"x",
"y",
"width",
"height",
"fill",
"fill-opacity"
], _t = [
"x1",
"x2",
"y2",
"stroke",
"stroke-dasharray",
"stroke-width"
], vt = [
"x1",
"x2",
"y2",
"stroke",
"stroke-dasharray",
"stroke-width"
], yt = [
"x",
"y",
"height",
"width",
"fill",
"stroke",
"stroke-width",
"rx"
], bt = [
"x",
"y",
"width",
"height",
"onMouseenter"
], xt = {
key: 2,
style: { "pointer-events": "none" }
}, St = [
"x",
"y",
"width",
"height",
"fill",
"fill-opacity"
], Ct = [
"x1",
"x2",
"y1",
"y2",
"stroke",
"stroke-dasharray",
"stroke-width"
], wt = [
"x1",
"x2",
"y1",
"y2",
"stroke",
"stroke-dasharray",
"stroke-width"
], Tt = {
key: 0,
style: { "pointer-events": "none" }
}, Et = [
"d",
"stroke",
"stroke-width"
], Dt = [
"d",
"stroke",
"stroke-width"
], Ot = [
"d",
"stroke",
"stroke-width"
], kt = [
"d",
"stroke",
"stroke-width"
], At = { key: 7 }, jt = [
"points",
"fill",
"stroke-width",
"stroke-dasharray",
"stroke"
], Mt = {
key: 0,
class: "vue-ui-scatter-datapoint"
}, Nt = [
"cx",
"cy",
"r",
"fill",
"stroke",
"stroke-width",
"onMouseover",
"onMouseleave",
"onClick"
], Pt = { key: 1 }, Ft = [
"transform",
"font-size",
"fill",
"onMouseover",
"onMouseleave",
"onClick"
], It = ["clip-path"], Lt = [
"d",
"fill",
"stroke",
"stroke-width",
"stroke-opacity"
], Rt = {
key: 0,
style: { "pointer-events": "none" }
}, zt = [
"x",
"y",
"width",
"height"
], Bt = {
key: 0,
style: { "pointer-events": "none !important" }
}, Vt = [
"x1",
"x2",
"y1",
"y2",
"stroke",
"stroke-width",
"stroke-dasharray"
], Ht = [
"x1",
"x2",
"y1",
"y2",
"stroke",
"stroke-width",
"stroke-dasharray"
], Ut = [
"x",
"y",
"font-size",
"fill",
"font-weight",
"text-anchor"
], Wt = [
"x",
"y",
"font-size",
"fill",
"font-weight"
], Gt = [
"x",
"y",
"font-size",
"fill"
], Kt = [
"x",
"y",
"font-size",
"fill"
], qt = [
"cx",
"cy",
"r",
"fill",
"stroke",
"stroke-width"
], Jt = [
"cx",
"cy",
"r",
"fill",
"stroke",
"stroke-width"
], Yt = [
"x",
"y",
"font-size",
"fill",
"font-weight",
"text-anchor"
], Xt = [
"id",
"transform",
"font-size",
"font-weight",
"fill"
], Zt = [
"font-size",
"fill",
"transform"
], Qt = [
"transform",
"font-size",
"fill"
], $t = [
"x",
"y",
"font-size",
"fill"
], en = [
"x",
"y",
"font-size",
"fill"
], tn = [
"font-size",
"font-weight",
"fill",
"x",
"y"
], nn = ["id"], rn = [
"x",
"y",
"width",
"height"
], an = {
key: 14,
style: { pointerEvents: "none" }
}, on = [
"x1",
"x2",
"y1",
"y2",
"stroke-dasharray",
"stroke",
"stroke-width",
"clip-path"
], sn = [
"x",
"y",
"fill",
"font-size",
"font-weight"
], cn = {
key: 0,
style: {
position: "absolute",
top: "100%",
left: "0",
width: "100%"
},
"data-dom-to-png-ignore": "",
"aria-hidden": "true"
}, ln = {
key: 6,
class: "vue-data-ui-watermark"
}, un = ["id"], dn = ["onClick"], fn = {
key: 0,
style: {
width: "100%",
display: "flex",
"align-items": "center",
"justify-content": "center"
}
}, pn = {
viewBox: "0 0 20 20",
height: "20",
width: "20",
style: {
overflow: "hidden",
background: "transparent"
}
}, mn = { key: 0 }, hn = ["innerHTML"], gn = /*#__PURE__*/ Se({
__name: "vue-ui-scatter",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["copyAlt", "selectLegend"],
setup(e, { expose: Se, emit: Ge }) {
let gn = C(() => import("./Tooltip-DhjyfHwz.js")), _n = C(() => import("./BaseIcon-BfndwIWE.js").then((e) => e.n)), vn = C(() => import("./vue-ui-accordion-BxGriZik.js").then((e) => e.n)), yn = C(() => import("./DataTable-BbKgJ5UI.js")), bn = C(() => import("./PenAndPaper-DAE-tnEQ.js").then((e) => e.t)), xn = C(() => import("./UserOptions-Dt98of5H.js").then((e) => e.n)), Sn = C(() => import("./PackageVersion-D6d8SCp9.js").then((e) => e.t)), Cn = C(() => import("./BaseDraggableDialog-LoqqwRtV.js").then((e) => e.n)), { vue_ui_scatter: wn } = de(), { isThemeValid: Tn, warnInvalidTheme: En } = _e(), P = e, Dn = Ge, On = v(() => !!P.dataset && P.dataset.length), F = O(re()), kn = O(!1), An = O(""), jn = O(0), I = O(null), Mn = O(null), Nn = O(null), Pn = O(null), Fn = O(null), In = O(0), Ln = O(0), Rn = O(0), L = O([]), zn = O(!1), Bn = O(null), Vn = O(null), Hn = O(null), Un = O(null), Wn = O(!1), Gn = O(!1), Kn = O(null), qn = O(null), Jn = O(null), Yn = O(null), Xn = O(null), Zn = O(null), Qn = O(null), $n = O({
x: 0,
y: 0
}), er = O("pointer"), tr = O(!1), nr = O(null), R = O(mr());
le({
config: () => R.value,
dataset: () => P.dataset,
component: "VueUiScatter",
rules: [ue.emptyArray, {
test: (e) => e.length > 6,
message: [
"👀 The number of series (clusters) is > 6. Consider:",
"",
"",
"▶️ Using filters to let users choose a maximum number of series (clusters) to display."
]
}]
});
let { transitionEnabled: rr } = ve({
config: () => R.value.transitions,
dataset: () => P.dataset
}), ir = v(() => R.value.userOptions.useCursorPointer);
function ar(e = 100, t = .8, n = {}) {
let { meanX: r = 0, sdX: i = 1, meanY: a = 0, sdY: o = 1, seed: s } = n, c = (s ?? Math.floor(Math.random() * 2 ** 31)) >>> 0, l = () => (c = c * 1664525 + 1013904223 >>> 0, c / 2 ** 32), u = () => {
let e = 0, t = 0;
for (; e === 0;) e = l();
for (; t === 0;) t = l();
return Math.sqrt(-2 * Math.log(e)) * Math.cos(2 * Math.PI * t);
}, d = e / 2, f = Array.from({ length: d }, u), p = Array.from({ length: d }, u), m = (e) => e.reduce((e, t) => e + t, 0) / e.length, h = m(f), ee = m(p);
for (let e = 0; e < d; e += 1) f[e] -= h, p[e] -= ee;
let g = (e, t) => e.reduce((e, n, r) => e + n * t[r], 0), te = (e) => g(e, e), ne = g(p, f) / te(f), re = p.map((e, t) => e - ne * f[t]), ie = te(f) / d, ae = te(re) / d, oe = Math.sqrt((1 - t * t) * ie / ae), se = f.map((e, n) => t * e + oe * re[n]), ce = f.concat(f.map((e) => -e)), le = se.concat(se.map((e) => -e)), ue = (e) => Math.sqrt(te(e) / e.length), de = (e, t, n) => {
let r = ue(e);
return e.map((e) => n + (r ? e / r * t : 0));
}, fe = de(ce, i, r), pe = de(le, o, a);
for (let e = fe.length - 1; e > 0; --e) {
let t = Math.floor(l() * (e + 1));
[fe[e], fe[t]] = [fe[t], fe[e]], [pe[e], pe[t]] = [pe[t], pe[e]];
}
return fe.map((e, t) => ({
x: e,
y: pe[t]
}));
}
let or = v(() => o({
defaultConfig: {
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" }
}
},
userConfig: R.value.skeletonConfig ?? {}
})), { loading: sr, FINAL_DATASET: cr, manualLoading: lr } = pe({
...Ue(P),
FINAL_CONFIG: R,
prepareConfig: mr,
skeletonDataset: P.config?.skeletonDataset ?? [{
name: "",
color: "#999999",
values: ar(100, .5, { seed: 42 })
}],
skeletonConfig: o({
defaultConfig: R.value,
userConfig: or.value
})
}), { userOptionsVisible: ur, setUserOptionsVisibility: dr, keepUserOptionState: fr } = Oe({ config: R.value }), { svgRef: pr } = ke({ config: R.value.style.title });
function mr() {
let e = ge({
userConfig: P.config,
defaultConfig: wn
}), t = e.theme;
if (!t) return e;
if (!Tn.value(e)) return En(e), e;
let n = ge({
userConfig: je[t] || P.config,
defaultConfig: e
}), r = ge({
userConfig: P.config,
defaultConfig: n
});
return {
...r,
customPalette: r.customPalette.length ? r.customPalette : s[t] || l
};
}
We(() => P.config, (e) => {
sr.value || (R.value = mr()), ur.value = !R.value.userOptions.showOnChartHover, _r(), In.value += 1, Ln.value += 1, Rn.value += 1, B.value.showTable = R.value.table.show, B.value.showTooltip = R.value.style.tooltip.show, gr.value && R.value.usePerformanceMode && console.warn("VueUiScatter : You are using performance mode\n\n- downsampling is disabled in this mode, all plots are rendered\n\n- plot significance is not active in this mode (all plots have the same opacity) \n\n- Depending on plot density, shapes might not display a border (stroke) to avoid fuzziness \n\nℹ️ To remove this warning, set config.debug to false.");
}, { deep: !0 }), We(() => P.dataset, (e) => {
Array.isArray(e) && e.length > 0 && (lr.value = !1);
}, { deep: !0 });
let z = He(null), hr = He(null);
Be(async () => {
_r(), await Le(), zn.value = !0;
});
let gr = v(() => !!R.value.debug);
function _r() {
if (te(P.dataset) && (ae({
componentName: "VueUiScatter",
type: "dataset",
debug: gr.value
}), lr.value = !0), te(P.dataset) || (lr.value = R.value.loading), R.value.responsive) {
let e = Ce(() => {
let { width: e, height: t } = we({
chart: I.value,
title: R.value.style.title.text ? Mn.value : null,
legend: R.value.style.legend.show ? Nn.value : null,
source: Pn.value,
noTitle: Fn.value
});
requestAnimationFrame(() => {
V.value.width = e, V.value.height = t;
});
});
z.value && (hr.value && z.value.unobserve(hr.value), z.value.disconnect()), z.value = new ResizeObserver(e), hr.value = I.value.parentNode, z.value.observe(hr.value);
}
}
ze(() => {
z.value && (hr.value && z.value.unobserve(hr.value), z.value.disconnect());
});
let { isPrinting: vr, isImaging: yr, generatePdf: br, generateImage: xr } = fe({
elementId: `vue-ui-scatter_${F.value}`,
fileName: R.value.style.title.text || "vue-ui-scatter",
options: R.value.userOptions.print
}), Sr = v(() => R.value.userOptions.show && !R.value.style.title.text), Cr = v(() => se(R.value.customPalette)), B = O({
showTable: R.value.table.show,
showTooltip: R.value.style.tooltip.show
});
We(R, () => {
B.value = {
showTable: R.value.table.show,
showTooltip: R.value.style.tooltip.show
};
}, { immediate: !0 });
let V = O({
height: R.value.style.layout.height,
width: R.value.style.layout.width
}), wr = v(() => R.value.style.layout.marginalBars.show ? R.value.style.layout.marginalBars.size + R.value.style.layout.marginalBars.offset : 0);
function Tr() {
let e = 0;
if (R.value.style.layout.dataLabels.yAxis.scales.show && Xn.value) try {
e = Array.from(Xn.value.querySelectorAll("text")).reduce((e, t) => {
let n = t.getComputedTextLength();
return n > e ? n : e;
}, 0);
} catch {
e = 0;
}
let t = 0;
if (Kn.value) try {
t = Kn.value.getBBox().width;
} catch {
t = 0;
}
return Math.max(t, e ? e + 12 : 0);
}
function Er() {
let e = 0;
if (qn.value) try {
let t = qn.value.getBBox(), n = t.x + t.width - V.value.width;
e = n > 0 ? n + 6 : 0;
} catch {
e = 0;
}
let t = 0;
if (R.value.style.layout.dataLabels.xAxis.scales.show && Zn.value) try {
t = Array.from(Zn.value.querySelectorAll("text")).reduce((e, t) => {
let n = t.getBBox(), r = n.x + n.width - V.value.width, i = r > 0 ? r + 6 : 0;
return i > e ? i : e;
}, 0);
} catch {
t = 0;
}
return e > t ? e : t;
}
let H = v(() => {
let e = 0, t = 0, n = 0;
if (e = Tr(), t = Er(), Yn.value) try {
n = Yn.value.getBBox().height + 6;
} catch {
n = 0;
}
return {
top: R.value.style.layout.padding.top + wr.value + R.value.style.layout.dataLabels.yAxis.fontSize * 2,
right: V.value.width - R.value.style.layout.padding.right - wr.value - 6 - t,
bottom: V.value.height - R.value.style.layout.padding.bottom - n,
left: R.value.style.layout.padding.left + e,
height: V.value.height - R.value.style.layout.padding.top - R.value.style.layout.padding.bottom - wr.value - n - R.value.style.layout.dataLabels.yAxis.fontSize * 2,
width: V.value.width - R.value.style.layout.padding.left - R.value.style.layout.padding.right - wr.value - e - t - 6
};
}), Dr = v(() => {
cr.value.forEach((e, t) => {
ne({
datasetObject: e,
requiredAttributes: ["values"]
}).forEach((e) => {
ae({
componentName: "VueUiScatter",
type: "datasetSerieAttribute",
property: e,
index: t
});
}), e.values && e.values.forEach((e, n) => {
ne({
datasetObject: e,
requiredAttributes: ["x", "y"]
}).forEach((e) => {
ae({
componentName: "VueUiScatter",
type: "datasetSerieAttribute",
property: `values.${e}`,
index: `${t} - ${n}`
});
});
});
});
let e = Math.min(...G.value.filter((e) => !L.value.includes(e.id)).flatMap((e) => e.values.map((e) => e.x))), t = Math.max(...G.value.filter((e) => !L.value.includes(e.id)).flatMap((e) => e.values.map((e) => e.x))), n = Math.min(...G.value.filter((e) => !L.value.includes(e.id)).flatMap((e) => e.values.map((e) => e.y))), r = Math.max(...G.value.filter((e) => !L.value.includes(e.id)).flatMap((e) => e.values.map((e) => e.y)));
return {
xMin: e < 0 ? e : 0,
xMax: t,
yMin: n < 0 ? n : 0,
yMax: r
};
}), Or = v(() => {
let e = R.value.style.layout.axis;
return {
xMin: e.xMin !== null && e.xMin !== void 0 ? e.xMin : Dr.value.xMin,
xMax: e.xMax !== null && e.xMax !== void 0 ? e.xMax : Dr.value.xMax,
yMin: e.yMin !== null && e.yMin !== void 0 ? e.yMin : Dr.value.yMin,
yMax: e.yMax !== null && e.yMax !== void 0 ? e.yMax : Dr.value.yMax
};
});
function kr(e) {
return Number.isFinite(e) ? e < 2 ? 2 : Math.trunc(e) : 5;
}
function Ar(e) {
return e.roundingValue !== void 0 && e.roundingValue !== null ? e.roundingValue : e.rounding !== void 0 && e.rounding !== null ? e.rounding : 0;
}
function jr({ minimum: e, maximum: t, stepCount: n, useNiceScale: r }) {
let i = kr(n);
if (e === t) {
let n = t + (e === 0 ? 1 : Math.abs(e) * .01);
return (r ? p : oe)(e, n, i);
}
return (r ? p : oe)(e, t, i);
}
let Mr = v(() => {
let e = R.value.style.layout.dataLabels.xAxis;
return jr({
minimum: Or.value.xMin,
maximum: Or.value.xMax,
stepCount: e.scales.steps,
useNiceScale: e.scales.useNiceScale
});
}), Nr = v(() => {
let e = R.value.style.layout.dataLabels.yAxis;
return jr({
minimum: Or.value.yMin,
maximum: Or.value.yMax,
stepCount: e.scales.steps,
useNiceScale: e.scales.useNiceScale
});
}), U = v(() => ({
xMin: Mr.value.min,
xMax: Mr.value.max,
yMin: Nr.value.min,
yMax: Nr.value.max
})), Pr = v(() => {
let e = R.value.style.layout.dataLabels.xAxis, t = e.scales.labels;
return Mr.value.ticks.map((n) => ({
value: n,
x: Rr(n),
label: g(t.formatter, h(n), f({
p: R.value.style.layout.plots.selectors.labels.prefix,
v: h(n),
s: R.value.style.layout.plots.selectors.labels.suffix,
r: Ar(e)
}))
}));
}), Fr = v(() => {
let e = R.value.style.layout.dataLabels.yAxis, t = e.scales.labels;
return Nr.value.ticks.map((n) => ({
value: n,
y: zr(n),
label: g(t.formatter, h(n), f({
p: R.value.style.layout.plots.selectors.labels.prefix,
v: h(n),
s: R.value.style.layout.plots.selectors.labels.suffix,
r: Ar(e)
}))
}));
}), Ir = v(() => Qr.value.length > 0 && R.value.style.layout.dataLabels.xAxis.scales.show), Lr = v(() => Qr.value.length > 0 && R.value.style.layout.dataLabels.yAxis.scales.show);
function Rr(e) {
let t = U.value.xMax - U.value.xMin;
return t === 0 ? H.value.left : H.value.left + (e - U.value.xMin) / t * H.value.width;
}
function zr(e) {
let t = U.value.yMax - U.value.yMin;
return t === 0 ? H.value.bottom : H.value.bottom - (e - U.value.yMin) / t * H.value.height;
}
let W = v(() => {
let { xMin: e, xMax: t, yMin: n, yMax: r } = U.value, i = e > 0 ? e : t < 0 ? t : 0, a = n > 0 ? n : r < 0 ? r : 0;
return {
x: Rr(i),
y: zr(a)
};
}), G = v(() => cr.value.map((e, t) => {
let n = `cluster_${F.value}_${t}`;
return {
...e,
values: d({
data: e.values,
threshold: R.value.usePerformanceMode ? e.values.length + 1 : R.value.downsample.threshold
}),
id: n,
color: e.color ? e.color : Cr.value[t] || l[t] || l[t % l.length],
opacity: L.value.includes(n) ? .5 : 1,
shape: e.shape ?? "circle",
segregate: () => ai(n),
isSegregated: L.value.includes(n),
hasGroupSelection: !!qr.value,
isGroupSelected: qr.value === n,
onEnter: () => Yr(n),
onLeave: () => Xr()
};
})), Br = v(() => ({
cy: "scatter-div-legend",
backgroundColor: R.value.style.legend.backgroundColor,
color: R.value.style.legend.color,
fontSize: R.value.style.legend.fontSize,
paddingBottom: 12,
fontWeight: R.value.style.legend.bold ? "bold" : ""
})), Vr = v(() => G.value.map((e, t) => ({
...e,
plots: e.values.map((n, r) => ({
x: Rr(n.x),
y: zr(n.y),
v: {
...n,
name: n.name || ""
},
clusterName: e.name,
clusterId: e.id,
color: e.color ? e.color : Cr.value[t] || l[t] || l[t % l.length],
id: `plot_${F.value}_${t}_${r}`,
weight: n.weight ?? R.value.style.layout.plots.radius
}))
})).filter((e) => !L.value.includes(e.id))), K = v(() => {
let e = 1e-9, t = ({ m: t, b: n, rect: r, verticalX: i = null }) => {
let { left: a, right: o, top: s, bottom: c } = r, l = [], u = (e, t) => {
Number.isFinite(e) && Number.isFinite(t) && l.push({
x: e,
y: t
});
}, d = ({ x: t, y: n }) => t >= a - e && t <= o + e && n >= s - e && n <= c + e;
i === null ? Number.isFinite(t) && (u(a, t * a + n), u(o, t * o + n), Math.abs(t) > e ? (u((s - n) / t, s), u((c - n) / t, c)) : n >= s - e && n <= c + e && (u(a, n), u(o, n))) : i >= a - e && i <= o + e && (u(i, s), u(i, c));
let f = l.filter(d), p = [];
for (let e of f) p.some((t) => Math.abs(t.x - e.x) < 1e-6 && Math.abs(t.y - e.y) < 1e-6) || p.push(e);
if (p.length < 2) return null;
let m = p[0], h = p[1], ee = 0;
for (let e = 0; e < p.length; e += 1) for (let t = e + 1; t < p.length; t += 1) {
let n = p[e].x - p[t].x, r = p[e].y - p[t].y, i = n * n + r * r;
i > ee && (ee = i, m = p[e], h = p[t]);
}
return {
x1: m.x,
y1: m.y,
x2: h.x,
y2: h.y
};
};
return Vr.value.map((n) => {
let r = n.plots.length, i = n.plots.reduce((e, t) => e + t.x, 0) / r, a = n.plots.reduce((e, t) => e + t.y, 0) / r, o = 0, s = 0, c = 0;
for (let e of n.plots) {
let t = e.x - i, n = e.y - a;
o += t * n, s += t * t, c += n * n;
}
let l, d, f = null;
s < e ? (f = i, l = Infinity, d = null) : (l = o / s, d = a - l * i);
let p, m;
f === null ? (p = l, m = d) : (p = Infinity, m = null);
let h = n.plots.every((e) => e.v && typeof e.v.x == "number" && typeof e.v.y == "number"), ee = NaN;
if (r >= 2) {
let t = 0, o = 0;
h ? (t = n.plots.reduce((e, t) => e + t.v.x, 0) / r, o = n.plots.reduce((e, t) => e + t.v.y, 0) / r) : (t = i, o = -a);
let s = 0, c = 0, l = 0;
for (let e of n.plots) {
let n = h ? e.v.x : e.x, r = h ? e.v.y : -e.y, i = n - t, a = r - o;
s += i * a, c += i * i, l += a * a;
}
if (c >= e && l >= e) {
let e = s / Math.sqrt(c * l);
ee = Math.max(-1, Math.min(1, e));
}
}
let g = t({
m: p,
b: m,
rect: H.value,
verticalX: f
});
if (!g) return {
...n,
correlation: null,
label: null,
plots: n.plots.map((e) => ({
...e,
deviation: 0,
shape: n.shape,
color: u(n.color)
}))
};
let te = {
x: (g.x1 + g.x2) / 2,
y: (g.y1 + g.y2) / 2
};
return {
...n,
color: u(n.color),
correlation: {
...g,
coefficient: ee
},
label: te,
plots: n.plots.map((t) => {
let r, i;
f === null ? Math.abs(p) < e ? (r = t.x, i = m) : (r = (t.x + p * t.y - p * m) / (1 + p * p), i = (p * t.x + p * p * t.y + m) / (1 + p * p)) : (r = f, i = t.y);
let a = t.x - r, o = t.y - i, s = Math.sqrt(a * a + o * o);
return {
...t,
deviation: s,
shape: n.shape,
color: u(n.color)
};
})
};
});
}), Hr = v(() => Math.max(...K.value.flatMap((e) => e.plots.map((e) => Math.abs(e.deviation)))));
function Ur() {
return K.value;
}
function Wr(e, t) {
let n = Array.isArray(e) ? e.flatMap((e) => e.plots.map((e) => ({
x: e.x,
y: e.y
}))) : e.plots.map((e) => ({
x: e.x,
y: e.y
})), r = Infinity, i = -Infinity, a = Infinity, o = -Infinity;
n.forEach(({ x: e, y: t }) => {
r = Math.min(r, e), i = Math.max(i, e), a = Math.min(a, t), o = Math.max(o, t);
});
let s = i - r, c = o - a, l = s / t, u = c / t, d = Array(t).fill(0), f = Array(t).fill(0);
n.forEach(({ x: e, y: t }) => {
let n = Math.floor((e - r) / l), i = Math.floor((t - a) / u);
d[n] || (d[n] = 0), f[i] || (f[i] = 0), d[n] += 1, f[i] += 1;
});
let p = [], m = [];
for (let e = 0; e < t; e += 1) p.push(r + (e + .5) * l), m.push(a + (e + .5) * u);
return {
x: d,
y: f,
avgX: p,
avgY: m,
maxX: Math.max(...d),
maxY: Math.max(...f)
};
}
let q = v(() => R.value.style.layout.marginalBars.tranches), J = v(() => Wr(Vr.value, q.value)), Gr = v(() => {
let e = H.value.top - R.value.style.layout.marginalBars.offset, t = H.value.right + R.value.style.layout.marginalBars.offset;
return Vr.value.map((n) => {
let r = Wr(n, q.value);
return {
coords: r,
dX: c(r.avgX.map((t, n) => ({
x: t,
y: e - r.x[n] / r.maxX * R.value.style.layout.marginalBars.size
}))),
dY: i(r.avgY.map((e, n) => ({
y: e,
x: t + R.value.style.layout.marginalBars.size * r.y[n] / r.maxY
}))),
color: n.color,
id: n.id
};
});
}), Y = O(void 0), X = O(null), Z = O([]), Kr = O(null), qr = O(void 0);
function Jr() {
kn.value = !1, Y.value = void 0, Z.value = [], X.value = null, nr.value = null, Qn.value = null, qr.value = void 0;
}
function Yr(e) {
let t = K.value.find((t) => t.id === e);
if (!t) {
Z.value = [];
return;
}
Z.value = t.plots.map((e) => e.id), qr.value = e;
}
function Xr() {
Z.value = [], qr.value = void 0;
}
function Zr(e) {
if (!pr.value || !e) return;
let t = a(e.x, e.y, pr.value);
t && ($n.value = t);
}
let Qr = v(() => X.value ? [X.value] : Z.value.length ? K.value.flatMap((e) => e.plots).filter((e) => Z.value.includes(e.id)) : []);
function $r(e) {
let t = R.value.style.layout.dataLabels.xAxis, n = t.scales.labels;
return g(n.formatter, h(e.v.x), f({
p: R.value.style.layout.plots.selectors.labels.prefix,
v: h(e.v.x),
s: R.value.style.layout.plots.selectors.labels.suffix,
r: Ar(t)
}), { datapoint: e });
}
function ei(e) {
let t = R.value.style.layout.dataLabels.yAxis, n = t.scales.labels;
return g(n.formatter, h(e.v.y), f({
p: R.value.style.layout.plots.selectors.labels.prefix,
v: h(e.v.y),
s: R.value.style.layout.plots.selectors.labels.suffix,
r: Ar(t)
}), { datapoint: e });
}
function ti(e, t, n = "pointer", r = null) {
Y.value = e.id, X.value = e, er.value = n, nr.value = r, Qn.value = e.id;
let i = "";
R.value.events.datapointEnter && R.value.events.datapointEnter({
datapoint: e,
seriesIndex: t
}), Kr.value = {
datapoint: e,
seriesIndex: t,
series: K.value,
config: R.value
};
let a = R.value.style.tooltip.customFormat;
ce(a) && ee(() => a({
datapoint: e,
seriesIndex: t,
series: K.value,
config: R.value
})) ? An.value = a({
datapoint: e,
seriesIndex: t,
series: K.value,
config: R.value
}) : (e.clusterName && (i += `<div style="display:flex;gap:3px;align-items:center">${e.clusterName}</div>`), e.v.name && (i += `<div>${e.v.name}</div>`), i += `<div style="text-align:left;margin-top:6px;padding-top:6px;border-top:1px solid ${R.value.style.tooltip.borderColor}">`, i += `<div>${R.value.style.layout.dataLabels.xAxis.name}: <b>${isNaN(e.v.x) ? "-" : g(R.value.style.layout.plots.selectors.labels.x.formatter, e.v.x, f({
p: R.value.style.tooltip.prefix,
v: e.v.x,
s: R.value.style.tooltip.suffix,
r: R.value.style.tooltip.roundingValue
}), {
datapoint: e,
seriesIndex: t
})}</b></div>`, i += `<div>${R.value.style.layout.dataLabels.yAxis.name}: <b>${isNaN(e.v.y) ? "-" : g(R.value.style.layout.plots.selectors.labels.y.formatter, e.v.y, f({
p: R.value.style.tooltip.prefix,
v: e.v.y,
s: R.value.style.tooltip.suffix,
r: R.value.style.tooltip.roundingValue
}), {
datapoint: e,
seriesIndex: t
})}</b></div>`, i += `${R.value.style.layout.plots.deviation.translation}: <b>${f({
v: e.deviation,
r: R.value.style.layout.plots.deviation.roundingValue
})}</b>`, i += "</div>", An.value = `<div>${i}</div>`), kn.value = !0, n === "keyboard" && Le(() => {
Zr(e);
});
}
function ni(e, t) {
R.value.events.datapointLeave && R.value.events.datapointLeave({
datapoint: e,
seriesIndex: t
}), (er.value !== "keyboard" || Qn.value !== e?.id) && (kn.value = !1, Y.value = void 0, X.value = null);
}
function ri(e, t) {
R.value.events.datapointClick && R.value.events.datapointClick({
datapoint: e,
seriesIndex: t
});
}
function ii() {
L.value.length ? L.value = [] : G.value.forEach((e) => {
L.value.push(e.id);
}), Dn("selectLegend", Vr.value);
}
function ai(e) {
L.value.includes(e) ? L.value = L.value.filter((t) => t !== e) : L.value.length < cr.value.length - 1 && L.value.push(e), Dn("selectLegend", Vr.value);
}
function oi(e) {
return G.value.length ? G.value.find((t) => t.name === e) || (R.value.debug && console.warn(`VueUiScatter - Series name not found "${e}"`), null) : (R.value.debug && console.warn("VueUiScatter - There are no series to show."), null);
}
function si(e) {
let t = oi(e);
t !== null && L.value.includes(t.id) && ai(t.id);
}
function ci(e) {
let t = oi(e);
t !== null && (L.value.includes(t.id) || ai(t.id));
}
function li(e = null) {
Le(() => {
let n = [
"",
R.value.table.translations.correlationCoefficient,
R.value.table.translations.nbrPlots,
`${R.value.style.layout.dataLabels.xAxis.name} ${R.value.table.translations.average}`,
`${R.value.style.layout.dataLabels.yAxis.name} ${R.value.table.translations.average}`
], i = K.value.map((e) => [
e.name,
e.correlation.coefficient,
e.plots.length,
e.plots.map((e) => e.v.x).reduce((e, t) => e + t, 0) / e.plots.length,
e.plots.map((e) => e.v.y).reduce((e, t) => e + t, 0) / e.plots.length
]), a = [
[R.value.style.title.text],
[R.value.style.title.subtitle.text],
[
[""],
[""],
[""]
],
n
].concat(i), o = r(a);
e ? e(o) : t({
csvContent: o,
title: R.value.style.title.text || "vue-ui-heatmap"
});
});
}
let ui = v(() => {
let e = [
R.value.table.translations.series,
R.value.table.translations.correlationCoefficient,
R.value.table.translations.nbrPlots,
`${R.value.style.layout.dataLabels.xAxis.name} ${R.value.table.translations.average}`,
`${R.value.style.layout.dataLabels.yAxis.name} ${R.value.table.translations.average}`
], t = K.value.map((e) => [
{
shape: e.shape,
content: e.name ?? "-",
color: e.color
},
Number((e.correlation?.coefficient ?? 0).toFixed(R.value.table.td.roundingValue)).toLocaleString(),
e.plots.length.toLocaleString(),
Number((e.plots.map((e) => e.v.x ?? 0).reduce((e, t) => e + t, 0) / e.plots.length).toFixed(R.value.table.td.roundingAverage)).toLocaleString(),
Number((e.plots.map((e) => e.v.y ?? 0).reduce((e, t) => e + t, 0) / e.plots.length).toFixed(R.value.table.td.roundingAverage)).toLocaleString()
]);
return {
head: e,
body: t,
a11yBody: t.map((e) => e.map((e, t) => t === 0 ? e.content : e)),
config: {
th: {
backgroundColor: R.value.table.th.backgroundColor,
color: R.value.table.th.color,
outline: R.value.table.th.outline
},
td: {
backgroundColor: R.value.table.td.backgroundColor,
color: R.value.table.td.color,
outline: R.value.table.td.outline
},
breakpoint: R.value.table.responsiveBreakpoint
},
colNames: e
};
}), di = O(!1);
function fi(e) {
di.value = e, jn.value += 1;
}
function pi() {
B.value.showTable = !B.value.showTable;
}
function mi() {
B.value.showTooltip = !B.value.showTooltip;
}
let hi = O(!1);
function gi() {
hi.value = !hi.value;
}
async function _i({ scale: e = 2 } = {}) {
if (!I.value) return;
let { width: t, height: n } = I.value.getBoundingClientRect(), r = t / n, { imageUri: i, base64: a } = await ye({
domElement: I.value,
base64: !0,
img: !0,
scale: e
});
return {
imageUri: i,
base64: a,
title: R.value.style.title.text,
width: t,
height: n,
aspectRatio: r
};
}
function vi(e) {
Bn.value = e, R.value.style.layout.marginalBars.highlighter.highlightBothAxes && (Vn.value = J.value.y.length - 2 - e);
}
function yi(e) {
Vn.value = e, R.value.style.layout.marginalBars.highlighter.highlightBothAxes && (Bn.value = e);
}
function bi() {
Bn.value = null, Vn.value = null;
}
let xi = {
circle: 1,
square: 1,
diamond: 1,
triangle: 1.2,
star: 1.3,
pentagon: 1.3,
hexagon: 1.3
}, Q = (e) => e.toFixed(3);
function Si({ shape: e = "circle", cx: t, cy: n, r }) {
if (!R.value.usePerformanceMode) return "";
let i = xi[e] * r;
switch (e) {
case "circle": {
let e = Q(t - i), r = Q(n), a = Q(t + i), o = Q(i);
return `M ${e} ${r} A ${o} ${o} 0 1 0 ${a} ${r} A ${o} ${o} 0 1 0 ${e} ${r} Z`;
}
case "square": {
let e = Q(t - i), r = Q(n - i), a = Q(t + i), o = Q(n + i);
return `M ${e} ${r} L ${a} ${r} L ${a} ${o} L ${e} ${o} Z`;
}
case "diamond": {
let e = Q(t), r = Q(n);
return `M ${e} ${Q(n - i)} L ${Q(t + i)} ${r} L ${e} ${Q(n + i)} L ${Q(t - i)} ${r} Z`;
}
case "triangle": {
let e = i * Math.sqrt(3), r = t, a = n - 2 / 3 * e, o = t - i, s = n + 1 / 3 * e, c = t + i, l = s;
return `M ${Q(r)} ${Q(a)} L ${Q(o)} ${Q(s)} L ${Q(c)} ${Q(l)} Z`;
}
case "star": {
let e = i, r = i * .5, a = [];
for (let i = 0; i < 10; i += 1) {
let o = (-90 + i * 36) * Math.PI / 180, s = i % 2 == 0 ? e : r;
a.push([t + s * Math.cos(o), n + s * Math.sin(o)]);
}
let o = `M ${Q(a[0][0])} ${Q(a[0][1])}`;
for (let e = 1; e < a.length; e += 1) o += ` L ${Q(a[e][0])} ${Q(a[e][1])}`;
return o + " Z";
}
case "pentagon": {
let e = [];
for (let r = 0; r < 5; r += 1) {
let a = (-90 + 360 / 5 * r) * Math.PI / 180;
e.push([t + i * Math.cos(a), n + i * Math.sin(a)]);
}
let r = `M ${Q(e[0][0])} ${Q(e[0][1])}`;
for (let t = 1; t < 5; t += 1) r += ` L ${Q(e[t][0])} ${Q(e[t][1])}`;
return r + " Z";
}
case "hexagon": {
let e = [];
for (let r = 0; r < 6; r += 1) {
let a = (-60 + 360 / 6 * r) * Math.PI / 180;
e.push([t + i * Math.cos(a), n + i * Math.sin(a)]);
}
let r = `M ${Q(e[0][0])} ${Q(e[0][1])}`;
for (let t = 1; t < 6; t += 1) r += ` L ${Q(e[t][0])} ${Q(e[t][1])}`;
return r + " Z";
}
default: {
let e = Q(t - i), r = Q(n), a = Q(t + i), o = Q(i);
return `M ${e} ${r} A ${o} ${o} 0 1 0 ${a} ${r} A ${o} ${o} 0 1 0 ${e} ${r} Z`;
}
}
}
let Ci = v(() => {
if (!R.value.usePerformanceMode) return [""];
let { left: e, right: t, top: r, bottom: i } = H.value, a = Math.max(1, (t - e) * (i - r)), o = (e) => e / a * 1e4, s = R.value.style.layout.plots.stroke, c = R.value.style.layout.plots.strokeWidth, l = R.value.style.layout.plots.opacity;
return K.value.map((a) => {
let u = [];
for (let n of a.plots) {
let o = n.x, s = n.y;
if (o < e || o > t || s < r || s > i) continue;
let c = Math.max(R.value.style.layout.plots.radius, n.weight);
u.push(Si({
shape: a.shape || "circle",
cx: o,
cy: s,
r: c
}));
}
if (!u.length) return null;
let d = o(a.plots.length) > 2.5 || a.plots.length > 1e3;
return {
id: a.id,
d: u.join(""),
fill: n(a.color, l * 100),
stroke: d ? "none" : s,
strokeWidth: d ? 0 : c,
strokeOpacity: 1
};
}).filter(Boolean);
});
function wi() {
return R.value.usePerformanceMode ? (e) => {
let t = pr.value;
if (!t) return;
let n = t.createSVGPoint();
n.x = e.clientX, n.y = e.clientY;
let r = t.getScreenCTM();
if (!r) return;
let i = r.inverse(), a = n.matrixTransform(i), o = null, s = Infinity, c = -1;
if (K.value.forEach((e, t) => {
e.plots.forEach((e) => {
let n = e.x - a.x, r = e.y - a.y, i = n * n + r * r;
i <= 64 && i < s && (s = i, o = e, c = t);
});
}), o) Y.value !== o.id && (Y.value = o.id, ti(o, c, "pointer", $.value.get(o.id) ?? null));
else if (Y.value) {
let e = X.value;
Y.value = void 0, ni(e, c);
}
} : () => null;
}
let Ti = wi();
function Ei() {
if (Y.value) {
let e = X.value;
Y.value = void 0, ni(e, null);
}
}
function Di(e) {
let t = X.value;
if (t) {
let e = K.value.findIndex((e) => e.id === t.clusterId);
ri(t, e >= 0 ? e : 0);
}
}
let Oi = v(() => {
let e = R.value.table.useDialog && !R.value.table.show, t = B.value.showTable;
return {
component: e ? Cn : vn,
title: `${R.value.style.title.text}${R.value.style.title.subtitle.text ? `: ${R.value.style.title.subtitle.text}` : ""}`,
props: e ? {
backgroundColor: R.value.table.th.backgroundColor,
color: R.value.table.th.color,
headerColor: R.value.table.th.color,
headerBg: R.value.table.th.backgroundColor,
isFullscreen: di.value,
fullscreenParent: I.value,
forcedWidth: Math.min(800, window.innerWidth * .8),
isCursorPointer: ir.value
} : {
hideDetails: !0,
config: {
open: t,
maxHeight: 1e4,
body: {
backgroundColor: R.value.style.backgroundColor,
color: R.value.style.color
},
head: {
backgroundColor: R.value.style.backgroundColor,
color: R.value.style.color
}
}
}
};
});
We(() => B.value.showTable, (e) => {
R.value.table.show || (e && R.value.table.useDialog && Hn.value ? Hn.value.open() : "close" in Hn.value && Hn.value.close());
});
function ki() {
B.value.showTable = !1, Un.value && Un.value.setTableIconState(!1);
}
let Ai = v(() => R.value.style.backgroundColor), ji = v(() => R.value.style.legend), Mi = v(() => R.value.style.title), { exportSvg: Ni, getSvg: Pi } = he({
svg: pr,
title: Mi,
legend: ji,
legendItems: G,
backgroundColor: Ai
});
async function Fi({ isCb: e }) {
Gn.value = !0, await Le();
try {
if (e) {
let { blob: e, url: t, text: n, dataUrl: r } = await Pi();
await Promise.resolve(R.value.userOptions.callbacks.svg({
blob: e,
url: t,
text: n,
dataUrl: r
}));
} else await Promise.resolve(Ni());
} finally {
Gn.value = !1;
}
}
function Ii(e) {
if (e?.stage === "start") {
Wn.value = !0;
return;
}
if (e?.stage === "end") {
Wn.value = !1;
return;
}
xr();
}
async function Li() {
if (Dn("copyAlt", {
config: R.value,
dataset: Vr.value
}), !R.value.userOptions.callbacks.altCopy) {
console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.");
return;
}
await Promise.resolve(R.value.userOptions.callbacks.altCopy({
config: R.value,
dataset: Vr.value
}));
}
function Ri(e, t) {
let n = Ui.value.filter((t) => t.id !== e.id);
if (!n.length) return null;
let r = ((n) => {
if (!n.length) return null;
let r = null, i = Infinity;
return n.forEach((n) => {
let a = n.x - e.x, o = n.y - e.y, s = 0, c = 0;
t === "right" || t === "left" ? (s = Math.abs(a), c = Math.abs(o)) : (s = Math.abs(o), c = Math.abs(a));
let l = s * 1e3 + c;
l < i && (r = n, i = l);
}), r;
})(n.filter((n) => t === "right" ? n.x > e.x : t === "left" ? n.x < e.x : t === "down" ? n.y > e.y : t === "up" && n.y < e.y));
if (r) return r;
let i = [];
if (t === "right") {
let e = Math.min(...n.map((e) => e.x));
i = n.filter((t) => t.x === e);
}
if (t === "left") {
let e = Math.max(...n.map((e) => e.x));
i = n.filter((t) => t.x === e);
}
if (t === "down") {
let e = Math.min(...n.map((e) => e.y));
i = n.filter((t) => t.y === e);
}
if (t === "up") {
let e = Math.max(...n.map((e) => e.y));
i = n.filter((t) => t.y === e);
}
return i.length ? i.reduce((n, r) => {
if (!n) return r;
let i = Math.abs(t === "right" || t === "left" ? n.y - e.y : n.x - e.x);
return Math.abs(t === "right" || t === "left" ? r.y - e.y : r.x - e.x) < i ? r : n;
}, null) : null;
}
function zi() {
nr.value = null, Qn.value = null, tr.value = !0;
}
function Bi() {
Jr(), er.value = "pointer", tr.value = !1;
}
function Vi(e) {
if (!pr.value || hi.value || document.activeElement !== pr.value || !Ui.value.length) return;
let t = e.key === "ArrowLeft", n = e.key === "ArrowRight", r = e.key === "ArrowUp", i = e.key === "ArrowDown", a = e.key === "Enter" || e.key === " ", o = e.key === "Escape";
if (!t && !n && !r && !i && !a && !o) return;
if (e.preventDefault(), e.stopPropagation(), o) {
Jr(), er.value = "pointer";
return;
}
if (a) {
if (nr.value === null) return;
let e = Ui.value[nr.value];
if (!e) return;
ri(e, e.seriesIndex);
return;
}
let s = null;
if (n && (s = "right"), t && (s = "left"), i && (s = "down"), r && (s = "up"), Qn.value === null) {
let e = X.value;
if (e && e.id) {
let t = Ri(e, s);
if (!t) {
let t = $.value.get(e.id);
if (t === void 0) return;
ti(e, e.seriesIndex, "keyboard", t);
return;
}
let n = $.value.get(t.id);
if (n === void 0) return;
ti(t, t.seriesIndex, "keyboard", n);
return;
}
let t = Ui.value[0];
if (!t) return;
let n = $.value.get(t.id) ?? 0;
ti(t, t.seriesIndex, "keyboard", n);
return;
}
let c = $.value.get(Qn.value);
if (c === void 0) return;
let l = Ui.value[c];
if (!l) return;
let u = Ri(l, s);
if (!u) return;
let d = $.value.get(u.id);
d !== void 0 && ti(u, u.seriesIndex, "keyboard", d);
}
let Hi = v(() => {
if (!X.value) return "";
let e = X.value, t = isNaN(e.v.x) ? "-" : g(R.value.style.layout.plots.selectors.labels.x.formatter, e.v.x, f({
p: R.value.style.tooltip.prefix,
v: e.v.x,
s: R.value.style.tooltip.suffix,
r: R.value.style.tooltip.roundingValue
}), {
datapoint: e,
seriesIndex: e.seriesIndex
}), n = isNaN(e.v.y) ? "-" : g(R.value.style.layout.plots.selectors.labels.y.formatter, e.v.y, f({
p: R.value.style.tooltip.prefix,
v: e.v.y,
s: R.value.style.tooltip.suffix,
r: R.value.style.tooltip.roundingValue
}), {
datapoint: e,
seriesIndex: e.seriesIndex
});
return [
e.clusterName || "",
e.v.name || "",
`${R.value.style.layout.dataLabels.xAxis.name}: ${t}`,
`${R.value.style.layout.dataLabels.yAxis.name}: ${n}`
].filter(Boolean).join(". ");
}), Ui = v(() => K.value.flatMap((e, t) => e.plots.map((n) => ({
...n,
seriesIndex: t,
seriesId: e.id,
seriesName: e.name,
shape: e.shape || "circle",
color: e.color
})))), $ = v(() => {
let e = /* @__PURE__ */ new Map();
return Ui.value.forEach((t, n) => {
e.set(t.id, n);
}), e;
}), Wi = v(() => ({
headers: ui.value?.colNames ?? [],
rows: ui.value?.a11yBody ?? []
}));
return Se({
getData: Ur,
getImage: _i,
generatePdf: br,
generateCsv: li,
generateImage: xr,
generateSvg: Fi,
hideSeries: ci,
showSeries: si,
toggleTable: pi,
toggleTooltip: mi,
toggleAnnotator: gi,
toggleFullscreen: fi,
copyAlt: Li
}), (e, t) => (D(), x("div", {
class: Re(`vue-data-ui-component vue-ui-scatter ${di.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${R.value.useCssAnimation ? "" : "vue-ui-dna"}`),
ref_key: "scatterChart",
ref: I,
id: `vue-ui-scatter_${F.value}`,
style: E(`font-family:${R.value.style.fontFamily};width:100%; text-align:center;background:${R.value.style.backgroundColor};${R.value.responsive ? "height: 100%" : ""}`),
onMouseenter: t[5] ||= () => M(dr)(!0),
onMouseleave: t[6] ||= () => {
M(dr)(!1), tr.value || Jr();
}
}, [
S("div", {
id: `chart-instructions-${F.value}`,
class: "sr-only"
}, [S("p", null, j(R.value.a11y.translations.keyboardNavigation), 1)], 8, qe),
B.value.showTooltip ? b("", !0) : (D(), x("div", Je, j(Hi.value), 1)),
Wi.value?.rows?.length && On.value ? (D(), y(De, {
key: 1,
uid: F.value,
head: Wi.value.headers,
body: Wi.value.rows,
notice: R.value.a11y.translations.tableAvailable,
caption: R.value.a11y.translations.tableCaption
}, null, 8, [
"uid",
"head",
"body",
"notice",
"caption"
])) : b("", !0),
R.value.userOptions.buttons.annotator ? (D(), y(M(bn), {
key: 2,
svgRef: M(pr),
backgroundColor: R.value.style.backgroundColor,
color: R.value.style.color,
active: hi.value,
isCursorPointer: ir.value,
onClose: gi
}, {
"annotator-action-close": N(() => [A(e.$slots, "annotator-action-close", {}, void 0, !0)]),
"annotator-action-color": N(({ color: t }) => [A(e.$slots, "annotator-action-color", T(w({ color: t })), void 0, !0)]),
"annotator-action-draw": N(({ mode: t }) => [A(e.$slots, "annotator-action-draw", T(w({ mode: t })), void 0, !0)]),
"annotator-action-undo": N(({ disabled: t }) => [A(e.$slots, "annotator-action-undo", T(w({ disabled: t })), void 0, !0)]),
"annotator-action-redo": N(({ disabled: t }) => [A(e.$slots, "annotator-action-redo", T(w({ disabled: t })), void 0, !0)]),
"annotator-action-delete": N(({ disabled: t }) => [A(e.$slots, "annotator-action-delete", T(w({ disabled: t })), void 0, !0)]),
_: 3
}, 8, [
"svgRef",
"backgroundColor",
"color",
"active",
"isCursorPointer"
])) : b("", !0),
Sr.value ? (D(), x("div", {
key: 3,
ref_key: "noTitle",
ref: Fn,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : b("", !0),
R.value.style.title.text ? (D(), x("div", {
key: 4,
ref_key: "chartTitle",
ref: Mn,
style: "width:100%;background:transparent"
}, [(D(), y(be, {
key: `title_${In.value}`,
config: {
title: {
cy: "scatter-div-title",
...R.value.style.title
},
subtitle: {
cy: "scatter-div-subtitle",
...R.value.style.title.subtitle
}
}
}, null, 8, ["config"]))], 512)) : b("", !0),
S("div", { id: `legend-top-${F.value}` }, null, 8, Ye),
R.value.userOptions.show && On.value && (M(fr) || M(ur)) ? (D(), y(M(xn), {
ref_key: "userOptionsRef",
ref: Un,
key: `user_options_${jn.value}`,
backgroundColor: R.value.style.backgroundColor,
color: R.value.style.color,
isImaging: M(yr),
isPrinting: M(vr),
uid: F.value,
hasTooltip: R.value.userOptions.buttons.tooltip && R.value.style.tooltip.show,
hasPdf: R.value.userOptions.buttons.pdf,
hasImg: R.value.userOptions.buttons.img,
hasSvg: R.value.userOptions.buttons.svg,
hasXls: R.value.userOptions.buttons.csv,
hasTable: R.value.userOptions.buttons.table,
hasFullscreen: R.value.userOptions.buttons.fullscreen,
hasAltCopy: R.value.userOptions.buttons.altCopy,
isTooltip: B.value.showTooltip,
isFullscreen: di.value,
titles: { ...R.value.userOptions.buttonTitles },
chartElement: I.value,
position: R.value.userOptions.position,
hasAnnotator: R.value.userOptions.buttons.annotator,
isAnnotation: hi.value,
callbacks: R.value.userOptions.callbacks,
printScale: R.value.userOptions.print.scale,
tableDialog: R.value.table.useDialog,
isCursorPointer: ir.value,
onToggleFullscreen: fi,
onGeneratePdf: M(br),
onGenerateCsv: li,
onGenerateImage: Ii,
onGenerateSvg: Fi,
onToggleTable: pi,
onToggleTooltip: mi,
onToggleAnnotator: gi,
onCopyAlt: Li,
style: E({ visibility: M(fr) ? M(ur) ? "visible" : "hidden" : "visible" })
}, Ne({ _: 2 }, [
e.$slots.menuIcon ? {
name: "menuIcon",
fn: N(({ isOpen: t, color: n }) => [A(e.$slots, "menuIcon", T(w({
isOpen: t,
color: n
})), void 0, !0)]),
key: "0"
} : void 0,
e.$slots.optionTooltip ? {
name: "optionTooltip",
fn: N(() => [A(e.$slots, "optionTooltip", {}, void 0, !0)]),
key: "1"
} : void 0,
e.$slots.optionPdf ? {
name: "optionPdf",
fn: N(() => [A(e.$slots, "optionPdf", {}, void 0, !0)]),
key: "2"
} : void 0,
e.$slots.optionCsv ? {
name: "optionCsv",
fn: N(() => [A(e.$slots, "optionCsv", {}, void 0, !0)]),
key: "3"
} : void 0,
e.$slots.optionImg ? {
name: "optionImg",
fn: N(() => [A(e.$slots, "optionImg", {}, void 0, !0)]),
key: "4"
} : void 0,
e.$slots.optionSvg ? {
name: "optionSvg",
fn: N(() => [A(e.$slots, "optionSvg", {}, void 0, !0)]),
key: "5"
} : void 0,
e.$slots.optionTable ? {
name: "optionTable",
fn: N(() => [A(e.$slots, "optionTable", {}, void 0, !0)]),
key: "6"
} : void 0,
e.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: N(({ toggleFullscreen: t, isFullscreen: n }) => [A(e.$slots, "optionFullscreen", T(w({
toggleFullscreen: t,
isFullscreen: n
})), void 0, !0)]),
key: "7"
} : void 0,
e.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: N(({ toggleAnnotator: t, isAnnotator: n }) => [A(e.$slots, "optionAnnotator", T(w({
toggleAnnotator: t,
isAnnotator: n
})), void 0, !0)]),
key: "8"
} : void 0,
e.$slots.optionAltCopy ? {
name: "optionAltCopy",
fn: N(({ altCopy: t }) => [A(e.$slots, "optionAltCopy", T(w({ altCopy: t })), void 0, !0)