vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
1,035 lines (1,034 loc) • 47.4 kB
JavaScript
import { computed as x, ref as h, watch as at, onMounted as ot, onBeforeUnmount as st, createElementBlock as r, openBlock as o, unref as n, normalizeStyle as Y, normalizeClass as Re, createBlock as V, createCommentVNode as c, createElementVNode as d, createVNode as pe, createSlots as ut, withCtx as _, renderSlot as $, normalizeProps as J, guardReactiveProps as K, Fragment as P, renderList as X, toDisplayString as C, createTextVNode as rt, nextTick as it } from "vue";
import { u as nt, c as vt, t as yt, p as q, a as ct, o as dt, e as fe, b as ht, g as Ee, U as pt, Z as ft, S as gt, X as mt, s as ge, V as xt, i as j, v as A, f as W, q as bt, r as kt, x as wt, y as _t } from "./index-CHWA6Lnw.js";
import { t as $t, u as Mt } from "./useResponsive-vZgZwV-S.js";
import { _ as Ct } from "./Title-BwZtefYd.js";
import { u as At, U as zt } from "./usePrinter-DibtVl2x.js";
import { _ as St } from "./Tooltip-eCCz9HFo.js";
import { L as Tt } from "./Legend-BMXzxIhA.js";
import { _ as Ue } from "./Shape-Bs9E3f4-.js";
import { D as Lt } from "./DataTable-B4YF6guk.js";
import Bt from "./vue-ui-skeleton-BSUFPx4a.js";
import Ot from "./vue-ui-accordion-gHGrRoVr.js";
import { u as Ge } from "./useNestedProp-ByBiJC9_.js";
import { _ as Nt } from "./PackageVersion-DcMafJMi.js";
import { P as Pt } from "./PenAndPaper-ljJaW1FE.js";
import { u as Wt } from "./useUserOptionState-BIvW1Kz7.js";
import { u as Ft } from "./useChartAccessibility-BWojgys7.js";
import { _ as It } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Xt = ["id"], Dt = ["xmlns", "viewBox"], Yt = ["width", "height"], Vt = { key: 1 }, jt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Rt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Et = { key: 2 }, Ut = ["points", "fill", "stroke-width", "stroke-dasharray", "stroke"], Gt = { key: 0 }, qt = ["cx", "cy", "r", "fill", "stroke", "stroke-width", "onMouseover"], Ht = { key: 1 }, Zt = { key: 3 }, Jt = ["id"], Kt = ["stop-color"], Qt = ["stop-color"], el = ["id"], tl = ["stop-color"], ll = ["stop-color"], al = ["x", "y", "width", "height", "fill", "stroke", "stroke-width", "rx"], ol = ["x", "y", "height", "width", "fill", "stroke", "stroke-width", "rx"], sl = { key: 0 }, ul = ["d", "stroke", "stroke-width"], rl = ["d", "stroke", "stroke-width"], il = ["d", "stroke", "stroke-width"], nl = ["d", "stroke", "stroke-width"], vl = {
key: 4,
style: { "pointer-events": "none !important" }
}, yl = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], cl = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], dl = ["x", "y", "font-size", "fill", "font-weight", "text-anchor"], hl = ["x", "y", "font-size", "fill", "font-weight"], pl = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], fl = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], gl = ["x", "y", "font-size", "fill", "font-weight", "text-anchor"], ml = { key: 5 }, xl = ["x", "y", "font-size", "fill"], bl = ["x", "y", "font-size", "fill"], kl = ["id", "transform", "font-size", "font-weight", "fill"], wl = { key: 6 }, _l = ["x", "y", "font-size", "fill"], $l = ["x", "y", "font-size", "fill"], Ml = ["font-size", "font-weight", "fill", "x", "y"], Cl = ["id"], Al = ["x", "y", "width", "height"], zl = { key: 7 }, Sl = ["x1", "x2", "y1", "y2", "stroke-dasharray", "stroke", "stroke-width", "clip-path"], Tl = ["x", "y", "fill", "font-size", "font-weight"], Ll = {
key: 5,
class: "vue-data-ui-watermark"
}, Bl = ["onClick"], Ol = {
key: 0,
style: { width: "100%", display: "flex", "align-items": "center", "justify-content": "center" }
}, Nl = {
viewBox: "0 0 20 20",
height: "20",
width: "20",
style: { overflow: "hidden", background: "transparent" }
}, Pl = { key: 0 }, Wl = ["innerHTML"], Fl = {
__name: "vue-ui-scatter",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
setup(qe, { expose: He }) {
const { vue_ui_scatter: Ze } = nt(), F = qe, ee = x(() => !!F.dataset && F.dataset.length), z = h(vt()), Je = h(null), ue = h(!1), re = h(""), me = h(0), Q = h(null), xe = h(null), be = h(null), ke = h(null), we = h(null), _e = h(0), $e = h(0), Me = h(0), e = x({
get: () => Se(),
set: (t) => t
}), { userOptionsVisible: ie, setUserOptionsVisibility: Ce, keepUserOptionState: Ae } = Wt({ config: e.value }), { svgRef: ze } = Ft({ config: e.value.style.title });
function Se() {
const t = Ge({
userConfig: F.config,
defaultConfig: Ze
});
return t.theme ? {
...Ge({
userConfig: ct.vue_ui_scatter[t.theme] || F.config,
defaultConfig: t
}),
customPalette: yt[t.theme] || q
} : t;
}
at(() => F.config, (t) => {
e.value = Se(), ie.value = !e.value.userOptions.showOnChartHover, Te(), _e.value += 1, $e.value += 1, Me.value += 1, B.value.showTable = e.value.table.show, B.value.showTooltip = e.value.style.tooltip.show;
}, { deep: !0 });
const te = h(null);
ot(() => {
Te();
});
function Te() {
if (dt(F.dataset) && fe({
componentName: "VueUiScatter",
type: "dataset"
}), e.value.responsive) {
const t = $t(() => {
const { width: u, height: l } = Mt({
chart: Q.value,
title: e.value.style.title.text ? xe.value : null,
legend: e.value.style.legend.show ? be.value : null,
source: ke.value,
noTitle: we.value
});
requestAnimationFrame(() => {
b.value.width = u, b.value.height = l;
});
});
te.value = new ResizeObserver(t), te.value.observe(Q.value.parentNode);
}
}
st(() => {
te.value && te.value.disconnect();
});
const { isPrinting: Le, isImaging: Be, generatePdf: Oe, generateImage: Ne } = At({
elementId: `vue-ui-scatter_${z.value}`,
fileName: e.value.style.title.text || "vue-ui-scatter"
}), Ke = x(() => e.value.userOptions.show && !e.value.style.title.text), Pe = x(() => ht(e.value.customPalette)), B = h({
showTable: e.value.table.show,
showTooltip: e.value.style.tooltip.show
}), b = h({
height: e.value.style.layout.height,
width: e.value.style.layout.width
}), le = x(() => e.value.style.layout.marginalBars.show ? e.value.style.layout.marginalBars.size + e.value.style.layout.marginalBars.offset : 0), i = x(() => ({
top: e.value.style.layout.padding.top + le.value,
right: b.value.width - e.value.style.layout.padding.right - le.value,
bottom: b.value.height - e.value.style.layout.padding.bottom,
left: e.value.style.layout.padding.left,
height: b.value.height - e.value.style.layout.padding.top - e.value.style.layout.padding.bottom - le.value,
width: b.value.width - e.value.style.layout.padding.left - e.value.style.layout.padding.right - le.value
})), p = x(() => {
F.dataset.forEach((a, v) => {
Ee({
datasetObject: a,
requiredAttributes: ["values"]
}).forEach((k) => {
fe({
componentName: "VueUiScatter",
type: "datasetSerieAttribute",
property: k,
index: v
});
}), a.values && a.values.forEach((k, E) => {
Ee({
datasetObject: k,
requiredAttributes: ["x", "y"]
}).forEach((Z) => {
fe({
componentName: "VueUiScatter",
type: "datasetSerieAttribute",
property: `values.${Z}`,
index: `${v} - ${E}`
});
});
});
});
const t = Math.min(...R.value.filter((a) => !m.value.includes(a.id)).flatMap((a) => a.values.map((v) => v.x))), u = Math.max(...R.value.filter((a) => !m.value.includes(a.id)).flatMap((a) => a.values.map((v) => v.x))), l = Math.min(...R.value.filter((a) => !m.value.includes(a.id)).flatMap((a) => a.values.map((v) => v.y))), s = Math.max(...R.value.filter((a) => !m.value.includes(a.id)).flatMap((a) => a.values.map((v) => v.y)));
return { xMin: t >= 0 ? 0 : t, xMax: u, yMin: l >= 0 ? 0 : l, yMax: s };
}), f = x(() => ({
x: i.value.left + Math.abs(p.value.xMin) / (p.value.xMax + Math.abs(p.value.xMin)) * i.value.width,
y: i.value.bottom - Math.abs(p.value.yMin) / (p.value.yMax + Math.abs(p.value.yMin)) * i.value.height
})), R = x(() => F.dataset.map((t, u) => {
const l = `cluster_${z.value}_${u}`;
return {
...t,
values: pt({
data: t.values,
threshold: e.value.downsample.threshold
}),
id: l,
color: t.color ? t.color : Pe.value[u] || q[u] || q[u % q.length],
opacity: m.value.includes(l) ? 0.5 : 1,
shape: t.shape ?? "circle",
segregate: () => De(l),
isSegregated: m.value.includes(l)
};
})), Qe = x(() => ({
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" : ""
})), ne = x(() => R.value.map((t, u) => ({
...t,
plots: t.values.map((l) => ({
x: i.value.left + (l.x + Math.abs(p.value.xMin)) / (p.value.xMax + Math.abs(p.value.xMin)) * i.value.width,
y: i.value.bottom - (l.y + Math.abs(p.value.yMin)) / (p.value.yMax + Math.abs(p.value.yMin)) * i.value.height,
v: {
...l,
name: l.name || ""
},
clusterName: t.name,
color: t.color ? t.color : Pe.value[u] || q[u] || q[u % q.length],
id: `plot_${z.value}_${Math.random()}`,
weight: l.weight ?? e.value.style.layout.plots.radius
}))
})).filter((t) => !m.value.includes(t.id))), S = x(() => ne.value.map((t) => {
const u = t.plots.reduce((g, U) => g + U.x, 0) / t.plots.length, l = t.plots.reduce((g, U) => g + U.y, 0) / t.plots.length;
let s = 0, a = 0, v = 0;
for (const g of t.plots)
s += (g.x - u) * (g.y - l), a += (g.x - u) ** 2, v += (g.y - l) ** 2;
const k = s / Math.sqrt(a * v), E = k * (Math.sqrt(v) / Math.sqrt(a)), Z = l - E * u, N = {
x1: i.value.left,
x2: i.value.right,
y1: E * i.value.left + Z,
y2: E * i.value.right + Z,
coefficient: k
}, M = (N.y2 - N.y1) / (N.x2 - N.x1), L = N.y1 - M * N.x1, I = Math.min(b.value.width - e.value.style.layout.padding.right, Math.max(e.value.style.layout.padding.left, (i.value.top - L) / M)), se = {
x: I,
y: M * I + L <= e.value.style.layout.padding.top ? i.value.top : M * I + L
};
return {
...t,
correlation: N,
label: se,
plots: t.plots.map((g) => {
const U = (g.x + M * g.y - M * L) / (1 + Math.pow(M, 2)), ce = (M * g.x + Math.pow(M, 2) * g.y + L) / (1 + Math.pow(M, 2)), w = Math.sqrt(Math.pow(g.x - U, 2) + Math.pow(g.y - ce, 2));
return {
...g,
deviation: w,
shape: t.shape,
color: t.color
};
})
};
})), We = x(() => Math.max(...S.value.flatMap((t) => t.plots.map((u) => Math.abs(u.deviation)))));
function et() {
return S.value;
}
function Fe(t, u) {
const l = Array.isArray(t) ? t.flatMap((w) => w.plots.map((G) => ({
x: G.x,
y: G.y
}))) : t.plots.map((w) => ({
x: w.x,
y: w.y
}));
let s = 1 / 0, a = -1 / 0, v = 1 / 0, k = -1 / 0;
l.forEach(({ x: w, y: G }) => {
s = Math.min(s, w), a = Math.max(a, w), v = Math.min(v, G), k = Math.max(k, G);
});
const E = a - s, Z = k - v, N = E / u, M = Z / u, L = Array(u).fill(0), I = Array(u).fill(0);
l.forEach(({ x: w, y: G }) => {
const de = Math.floor((w - s) / N), he = Math.floor((G - v) / M);
L[de] || (L[de] = 0), I[he] || (I[he] = 0), L[de] += 1, I[he] += 1;
});
const se = [], g = [];
for (let w = 0; w < u; w += 1)
se.push(s + (w + 0.5) * N), g.push(v + (w + 0.5) * M);
const U = Math.max(...L), ce = Math.max(...I);
return { x: L, y: I, avgX: se, avgY: g, maxX: U, maxY: ce };
}
const D = x(() => e.value.style.layout.marginalBars.tranches), T = x(() => Fe(ne.value, D.value)), tt = x(() => {
const t = i.value.top - e.value.style.layout.marginalBars.offset, u = i.value.right + e.value.style.layout.marginalBars.offset;
return ne.value.map((l) => {
const s = Fe(l, D.value);
return {
coords: s,
dX: gt(s.avgX.map((a, v) => ({
x: a,
y: t - s.x[v] / s.maxX * e.value.style.layout.marginalBars.size
}))),
dY: ft(s.avgY.map((a, v) => ({
y: a,
x: u + e.value.style.layout.marginalBars.size * s.y[v] / s.maxY
}))),
color: l.color,
id: l.id
};
});
}), O = h(void 0), y = h(null), ve = h(null);
function Ie(t, u) {
O.value = t.id, y.value = t;
let l = "";
ve.value = {
datapoint: t,
seriesIndex: u,
series: S.value,
config: e.value
};
const s = e.value.style.tooltip.customFormat;
wt(s) && _t(() => s({
datapoint: t,
seriesIndex: u,
series: S.value,
config: e.value
})) ? re.value = s({
datapoint: t,
seriesIndex: u,
series: S.value,
config: e.value
}) : (t.clusterName && (l += `<div style="display:flex;gap:3px;align-items:center">${t.clusterName}</div>`), t.v.name && (l += `<div>${t.v.name}</div>`), l += `<div style="text-align:left;margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor}">`, l += `<div>${e.value.style.layout.dataLabels.xAxis.name}: <b>${isNaN(t.v.x) ? "-" : j(
e.value.style.layout.plots.selectors.labels.x.formatter,
t.v.x,
W({
p: e.value.style.tooltip.prefix,
v: t.v.x,
s: e.value.style.tooltip.suffix,
r: e.value.style.tooltip.roundingValue
}),
{ datapoint: t, seriesIndex: u }
)}</b></div>`, l += `<div>${e.value.style.layout.dataLabels.yAxis.name}: <b>${isNaN(t.v.y) ? "-" : j(
e.value.style.layout.plots.selectors.labels.y.formatter,
t.v.y,
W({
p: e.value.style.tooltip.prefix,
v: t.v.y,
s: e.value.style.tooltip.suffix,
r: e.value.style.tooltip.roundingValue
}),
{ datapoint: t, seriesIndex: u }
)}</b></div>`, l += `${e.value.style.layout.plots.deviation.translation}: <b>${W({
v: t.deviation,
r: e.value.style.layout.plots.deviation.roundingValue
})}</b>`, l += "</div>", re.value = `<div>${l}</div>`), ue.value = !0;
}
function Xe() {
ue.value = !1, O.value = void 0, y.value = null;
}
const m = h([]);
function De(t) {
m.value.includes(t) ? m.value = m.value.filter((u) => u !== t) : m.value.length < F.dataset.length - 1 && m.value.push(t);
}
function Ye() {
it(() => {
const t = ["", 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}`], u = S.value.map((a) => [
a.name,
a.correlation.coefficient,
a.plots.length,
a.plots.map((v) => v.v.x).reduce((v, k) => v + k, 0) / a.plots.length,
a.plots.map((v) => v.v.y).reduce((v, k) => v + k, 0) / a.plots.length
]), l = [[e.value.style.title.text], [e.value.style.title.subtitle.text], [[""], [""], [""]]].concat([t]).concat(u), s = bt(l);
kt({ csvContent: s, title: e.value.style.title.text || "vue-ui-heatmap" });
});
}
const ae = x(() => {
const t = [
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}`
], u = S.value.map((s) => [
{
shape: s.shape,
content: s.name,
color: s.color
},
Number((s.correlation.coefficient ?? 0).toFixed(e.value.table.td.roundingValue)).toLocaleString(),
s.plots.length.toLocaleString(),
Number((s.plots.map((a) => a.v.x ?? 0).reduce((a, v) => a + v, 0) / s.plots.length).toFixed(e.value.table.td.roundingAverage)).toLocaleString(),
Number((s.plots.map((a) => a.v.y ?? 0).reduce((a, v) => a + v, 0) / s.plots.length).toFixed(e.value.table.td.roundingAverage)).toLocaleString()
]), l = {
th: {
backgroundColor: e.value.table.th.backgroundColor,
color: e.value.table.th.color,
outline: e.value.table.th.outline
},
td: {
backgroundColor: e.value.table.td.backgroundColor,
color: e.value.table.td.color,
outline: e.value.table.td.outline
},
breakpoint: e.value.table.responsiveBreakpoint
};
return { head: t, body: u, config: l, colNames: t };
}), H = h(!1);
function lt(t) {
H.value = t, me.value += 1;
}
function Ve() {
B.value.showTable = !B.value.showTable;
}
function je() {
B.value.showTooltip = !B.value.showTooltip;
}
const oe = h(!1);
function ye() {
oe.value = !oe.value;
}
return He({
getData: et,
generatePdf: Oe,
generateCsv: Ye,
generateImage: Ne,
toggleTable: Ve,
toggleTooltip: je,
toggleAnnotator: ye
}), (t, u) => (o(), r("div", {
class: Re(`vue-ui-scatter ${H.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
ref_key: "scatterChart",
ref: Q,
id: `vue-ui-scatter_${z.value}`,
style: Y(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`),
onMouseenter: u[2] || (u[2] = () => n(Ce)(!0)),
onMouseleave: u[3] || (u[3] = () => n(Ce)(!1))
}, [
e.value.userOptions.buttons.annotator ? (o(), V(Pt, {
key: 0,
svgRef: n(ze),
backgroundColor: e.value.style.backgroundColor,
color: e.value.style.color,
active: oe.value,
onClose: ye
}, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : c("", !0),
Ke.value ? (o(), r("div", {
key: 1,
ref_key: "noTitle",
ref: we,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : c("", !0),
e.value.style.title.text ? (o(), r("div", {
key: 2,
ref_key: "chartTitle",
ref: xe,
style: "width:100%;background:transparent"
}, [
(o(), V(Ct, {
key: `title_${_e.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)) : c("", !0),
e.value.userOptions.show && ee.value && (n(Ae) || n(ie)) ? (o(), V(zt, {
ref_key: "details",
ref: Je,
key: `user_options_${me.value}`,
backgroundColor: e.value.style.backgroundColor,
color: e.value.style.color,
isImaging: n(Be),
isPrinting: n(Le),
uid: z.value,
hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.tooltip.show,
hasPdf: e.value.userOptions.buttons.pdf,
hasImg: e.value.userOptions.buttons.img,
hasXls: e.value.userOptions.buttons.csv,
hasTable: e.value.userOptions.buttons.table,
hasFullscreen: e.value.userOptions.buttons.fullscreen,
isTooltip: B.value.showTooltip,
isFullscreen: H.value,
titles: { ...e.value.userOptions.buttonTitles },
chartElement: Q.value,
position: e.value.userOptions.position,
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: oe.value,
onToggleFullscreen: lt,
onGeneratePdf: n(Oe),
onGenerateCsv: Ye,
onGenerateImage: n(Ne),
onToggleTable: Ve,
onToggleTooltip: je,
onToggleAnnotator: ye,
style: Y({
visibility: n(Ae) ? n(ie) ? "visible" : "hidden" : "visible"
})
}, ut({ _: 2 }, [
t.$slots.menuIcon ? {
name: "menuIcon",
fn: _(({ isOpen: l, color: s }) => [
$(t.$slots, "menuIcon", J(K({ isOpen: l, color: s })), void 0, !0)
]),
key: "0"
} : void 0,
t.$slots.optionTooltip ? {
name: "optionTooltip",
fn: _(() => [
$(t.$slots, "optionTooltip", {}, void 0, !0)
]),
key: "1"
} : void 0,
t.$slots.optionPdf ? {
name: "optionPdf",
fn: _(() => [
$(t.$slots, "optionPdf", {}, void 0, !0)
]),
key: "2"
} : void 0,
t.$slots.optionCsv ? {
name: "optionCsv",
fn: _(() => [
$(t.$slots, "optionCsv", {}, void 0, !0)
]),
key: "3"
} : void 0,
t.$slots.optionImg ? {
name: "optionImg",
fn: _(() => [
$(t.$slots, "optionImg", {}, void 0, !0)
]),
key: "4"
} : void 0,
t.$slots.optionTable ? {
name: "optionTable",
fn: _(() => [
$(t.$slots, "optionTable", {}, void 0, !0)
]),
key: "5"
} : void 0,
t.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: _(({ toggleFullscreen: l, isFullscreen: s }) => [
$(t.$slots, "optionFullscreen", J(K({ toggleFullscreen: l, isFullscreen: s })), void 0, !0)
]),
key: "6"
} : void 0,
t.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: _(({ toggleAnnotator: l, isAnnotator: s }) => [
$(t.$slots, "optionAnnotator", J(K({ toggleAnnotator: l, isAnnotator: s })), void 0, !0)
]),
key: "7"
} : void 0
]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isTooltip", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : c("", !0),
ee.value ? (o(), r("svg", {
key: 4,
ref_key: "svgRef",
ref: ze,
xmlns: n(mt),
class: Re({ "vue-data-ui-fullscreen--on": H.value, "vue-data-ui-fulscreen--off": !H.value }),
viewBox: `0 0 ${b.value.width <= 0 ? 10 : b.value.width} ${b.value.height <= 0 ? 10 : b.value.height}`,
style: Y(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.color}`)
}, [
pe(Nt),
t.$slots["chart-background"] ? (o(), r("foreignObject", {
key: 0,
x: 0,
y: 0,
width: b.value.width <= 0 ? 10 : b.value.width,
height: b.value.height <= 0 ? 10 : b.value.height,
style: {
pointerEvents: "none"
}
}, [
$(t.$slots, "chart-background", {}, void 0, !0)
], 8, Yt)) : c("", !0),
e.value.style.layout.axis.show ? (o(), r("g", Vt, [
d("line", {
x1: f.value.x,
x2: f.value.x,
y1: i.value.top,
y2: i.value.bottom,
stroke: e.value.style.layout.axis.stroke,
"stroke-width": e.value.style.layout.axis.strokeWidth,
"stroke-linecap": "round"
}, null, 8, jt),
d("line", {
x1: i.value.left,
x2: i.value.right,
y1: f.value.y,
y2: f.value.y,
stroke: e.value.style.layout.axis.stroke,
"stroke-width": e.value.style.layout.axis.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Rt)
])) : c("", !0),
e.value.style.layout.plots.giftWrap.show ? (o(), r("g", Et, [
(o(!0), r(P, null, X(S.value, (l, s) => (o(), r("g", null, [
l.plots.length > 2 ? (o(), r("polygon", {
key: 0,
points: n(xt)({ series: l.plots }),
fill: n(ge)(l.color, e.value.style.layout.plots.giftWrap.fillOpacity * 100),
"stroke-width": e.value.style.layout.plots.giftWrap.strokeWidth,
"stroke-dasharray": e.value.style.layout.plots.giftWrap.strokeDasharray,
stroke: l.color,
"stroke-linejoin": "round",
"stroke-linecap": "round"
}, null, 8, Ut)) : c("", !0)
]))), 256))
])) : c("", !0),
(o(!0), r(P, null, X(S.value, (l, s) => (o(), r("g", null, [
!l.shape || l.shape === "circle" ? (o(), r("g", Gt, [
(o(!0), r(P, null, X(l.plots, (a, v) => (o(), r("circle", {
cx: a.x,
cy: a.y,
r: O.value && O.value === a.id ? a.weight * 2 : a.weight,
fill: n(ge)(l.color, e.value.style.layout.plots.opacity * 100),
stroke: e.value.style.layout.plots.stroke,
"stroke-width": e.value.style.layout.plots.strokeWidth,
onMouseover: (k) => Ie(a, s),
onMouseleave: Xe,
style: Y(`opacity:${O.value && O.value === a.id ? 1 : e.value.style.layout.plots.significance.useDistanceOpacity ? 1 - Math.abs(a.deviation) / We.value : e.value.style.layout.plots.significance.show && Math.abs(a.deviation) > e.value.style.layout.plots.significance.deviationThreshold ? e.value.style.layout.plots.significance.opacity : 1}`)
}, null, 44, qt))), 256))
])) : (o(), r("g", Ht, [
(o(!0), r(P, null, X(l.plots, (a, v) => (o(), V(Ue, {
plot: { x: a.x, y: a.y },
radius: O.value && O.value === a.id ? a.weight * 2 : a.weight,
shape: l.shape,
color: n(ge)(l.color, e.value.style.layout.plots.opacity * 100),
stroke: e.value.style.layout.plots.stroke,
strokeWidth: e.value.style.layout.plots.strokeWidth,
onMouseover: (k) => Ie(a, s),
onMouseleave: Xe,
style: Y(`opacity:${O.value && O.value === a.id ? 1 : e.value.style.layout.plots.significance.useDistanceOpacity ? 1 - Math.abs(a.deviation) / We.value : e.value.style.layout.plots.significance.show && Math.abs(a.deviation) > e.value.style.layout.plots.significance.deviationThreshold ? e.value.style.layout.plots.significance.opacity : 1}`)
}, null, 8, ["plot", "radius", "shape", "color", "stroke", "strokeWidth", "onMouseover", "style"]))), 256))
]))
]))), 256)),
e.value.style.layout.marginalBars.show ? (o(), r("g", Zt, [
d("defs", null, [
d("linearGradient", {
id: `marginal_x_${z.value}`,
x1: "0%",
y1: "0%",
x2: "0%",
y2: "100%"
}, [
d("stop", {
offset: "0%",
"stop-color": e.value.style.layout.marginalBars.fill
}, null, 8, Kt),
d("stop", {
offset: "100%",
"stop-color": e.value.style.backgroundColor
}, null, 8, Qt)
], 8, Jt),
d("linearGradient", {
id: `marginal_y_${z.value}`,
x1: "0%",
x2: "100%",
y1: "0%",
y2: "0%"
}, [
d("stop", {
offset: "0%",
"stop-color": e.value.style.backgroundColor
}, null, 8, tl),
d("stop", {
offset: "100%",
"stop-color": e.value.style.layout.marginalBars.fill
}, null, 8, ll)
], 8, el)
]),
(o(!0), r(P, null, X(T.value.x, (l, s) => (o(), r("g", null, [
l && T.value.avgX[s] ? (o(), r("rect", {
key: 0,
x: T.value.avgX[s] - i.value.width / D.value / 2,
y: i.value.top - e.value.style.layout.marginalBars.offset - l / T.value.maxX * e.value.style.layout.marginalBars.size,
width: i.value.width / D.value <= 0 ? 1e-4 : i.value.width / D.value,
height: l / T.value.maxX * e.value.style.layout.marginalBars.size <= 0 ? 1e-4 : l / T.value.maxX * e.value.style.layout.marginalBars.size,
fill: e.value.style.layout.marginalBars.useGradient ? `url(#marginal_x_${z.value})` : e.value.style.layout.marginalBars.fill,
style: Y(`opacity:${e.value.style.layout.marginalBars.opacity}`),
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.marginalBars.strokeWidth,
rx: e.value.style.layout.marginalBars.borderRadius
}, null, 12, al)) : c("", !0)
]))), 256)),
(o(!0), r(P, null, X(T.value.y, (l, s) => (o(), r("g", null, [
l && T.value.avgY[s] ? (o(), r("rect", {
key: 0,
x: i.value.right + e.value.style.layout.marginalBars.offset,
y: T.value.avgY[s] - i.value.height / D.value / 2,
height: i.value.height / D.value <= 0 ? 1e-4 : i.value.height / D.value,
width: l / T.value.maxY * e.value.style.layout.marginalBars.size <= 0 ? 1e-4 : l / T.value.maxY * e.value.style.layout.marginalBars.size,
fill: e.value.style.layout.marginalBars.useGradient ? `url(#marginal_y_${z.value})` : e.value.style.layout.marginalBars.fill,
style: Y(`opacity:${e.value.style.layout.marginalBars.opacity}`),
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.marginalBars.strokeWidth,
rx: e.value.style.layout.marginalBars.borderRadius
}, null, 12, ol)) : c("", !0)
]))), 256)),
e.value.style.layout.marginalBars.showLines ? (o(), r("g", sl, [
(o(!0), r(P, null, X(tt.value, (l) => (o(), r(P, null, [
m.value.includes(l.id) ? c("", !0) : (o(), r("path", {
key: 0,
d: `M ${l.dX}`,
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.marginalBars.linesStrokeWidth + 1,
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none"
}, null, 8, ul)),
m.value.includes(l.id) ? c("", !0) : (o(), r("path", {
key: 1,
d: `M ${l.dX}`,
stroke: l.color,
"stroke-width": e.value.style.layout.marginalBars.linesStrokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none"
}, null, 8, rl)),
m.value.includes(l.id) ? c("", !0) : (o(), r("path", {
key: 2,
d: `M ${l.dY}`,
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.marginalBars.linesStrokeWidth + 1,
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none"
}, null, 8, il)),
m.value.includes(l.id) ? c("", !0) : (o(), r("path", {
key: 3,
d: `M ${l.dY}`,
stroke: l.color,
"stroke-width": e.value.style.layout.marginalBars.linesStrokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none"
}, null, 8, nl))
], 64))), 256))
])) : c("", !0)
])) : c("", !0),
y.value && e.value.style.layout.plots.selectors.show ? (o(), r("g", vl, [
d("line", {
x1: f.value.x,
x2: y.value.x,
y1: y.value.y,
y2: y.value.y,
stroke: e.value.style.layout.plots.selectors.stroke,
"stroke-width": e.value.style.layout.plots.selectors.strokeWidth,
"stroke-dasharray": e.value.style.layout.plots.selectors.strokeDasharray,
"stroke-linecap": "round",
class: "line-pointer"
}, null, 8, yl),
d("line", {
x1: y.value.x,
x2: y.value.x,
y1: f.value.y,
y2: y.value.y,
stroke: e.value.style.layout.plots.selectors.stroke,
"stroke-width": e.value.style.layout.plots.selectors.strokeWidth,
"stroke-dasharray": e.value.style.layout.plots.selectors.strokeDasharray,
"stroke-linecap": "round",
class: "line-pointer"
}, null, 8, cl),
d("text", {
x: f.value.x + (y.value.x > f.value.x ? -6 : 6),
y: y.value.y + e.value.style.layout.plots.selectors.labels.fontSize / 3,
"font-size": e.value.style.layout.plots.selectors.labels.fontSize,
fill: e.value.style.layout.plots.selectors.labels.color,
"font-weight": e.value.style.layout.plots.selectors.labels.bold ? "bold" : "normal",
"text-anchor": y.value.x > f.value.x ? "end" : "start"
}, C(n(j)(
e.value.style.layout.plots.selectors.labels.y.formatter,
n(A)(y.value.v.y),
n(W)({
p: e.value.style.layout.plots.selectors.labels.prefix,
v: n(A)(y.value.v.y),
s: e.value.style.layout.plots.selectors.labels.suffix,
r: e.value.style.layout.plots.selectors.labels.rounding
}),
{ datapoint: y.value }
)), 9, dl),
d("text", {
x: y.value.x,
y: f.value.y + (y.value.y > f.value.y ? -6 : e.value.style.layout.plots.selectors.labels.fontSize + 6),
"font-size": e.value.style.layout.plots.selectors.labels.fontSize,
fill: e.value.style.layout.plots.selectors.labels.color,
"font-weight": e.value.style.layout.plots.selectors.labels.bold ? "bold" : "normal",
"text-anchor": "middle"
}, C(n(j)(
e.value.style.layout.plots.selectors.labels.y.formatter,
n(A)(y.value.v.x),
n(W)({
p: e.value.style.layout.plots.selectors.labels.prefix,
v: n(A)(y.value.v.x),
s: e.value.style.layout.plots.selectors.labels.suffix,
r: e.value.style.layout.plots.selectors.labels.rounding
}),
{ datapoint: y.value }
)), 9, hl),
d("circle", {
cx: f.value.x,
cy: y.value.y,
r: e.value.style.layout.plots.selectors.markers.radius,
fill: e.value.style.layout.plots.selectors.markers.fill,
stroke: e.value.style.layout.plots.selectors.markers.stroke,
"stroke-width": e.value.style.layout.plots.selectors.markers.strokeWidth,
class: "line-pointer"
}, null, 8, pl),
d("circle", {
cx: y.value.x,
cy: f.value.y,
r: e.value.style.layout.plots.selectors.markers.radius,
fill: e.value.style.layout.plots.selectors.markers.fill,
stroke: e.value.style.layout.plots.selectors.markers.stroke,
"stroke-width": e.value.style.layout.plots.selectors.markers.strokeWidth,
class: "line-pointer"
}, null, 8, fl),
e.value.style.layout.plots.selectors.labels.showName ? (o(), r("text", {
key: 0,
x: y.value.x,
y: y.value.y + (y.value.y < f.value.y ? -e.value.style.layout.plots.selectors.labels.fontSize / 2 : e.value.style.layout.plots.selectors.labels.fontSize),
"font-size": e.value.style.layout.plots.selectors.labels.fontSize,
fill: e.value.style.layout.plots.selectors.labels.color,
"font-weight": e.value.style.layout.plots.selectors.labels.bold ? "bold" : "normal",
"text-anchor": y.value.x < i.value.left + 100 ? "start" : y.value.x > i.value.right - 100 ? "end" : y.value.x > f.value.x ? "start" : "end"
}, C(y.value.v.name), 9, gl)) : c("", !0)
])) : c("", !0),
e.value.style.layout.dataLabels.xAxis.show ? (o(), r("g", ml, [
d("text", {
x: i.value.left - 5,
y: f.value.y + e.value.style.layout.dataLabels.xAxis.fontSize / 3,
"text-anchor": "end",
"font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
fill: e.value.style.layout.dataLabels.xAxis.color
}, C(n(j)(
e.value.style.layout.plots.selectors.labels.x.formatter,
n(A)(p.value.xMin),
n(W)({
p: e.value.style.layout.plots.selectors.labels.prefix,
v: n(A)(p.value.xMin),
s: e.value.style.layout.plots.selectors.labels.suffix,
r: e.value.style.layout.dataLabels.xAxis.rounding
})
)), 9, xl),
d("text", {
x: i.value.right + 3,
y: f.value.y + e.value.style.layout.dataLabels.xAxis.fontSize / 3,
"text-anchor": "start",
"font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
fill: e.value.style.layout.dataLabels.xAxis.color
}, C(n(j)(
e.value.style.layout.plots.selectors.labels.x.formatter,
n(A)(p.value.xMax),
n(W)({
p: e.value.style.layout.plots.selectors.labels.prefix,
v: n(A)(p.value.xMax),
s: e.value.style.layout.plots.selectors.labels.suffix,
r: e.value.style.layout.dataLabels.xAxis.rounding
})
)), 9, bl),
d("text", {
id: `vue-ui-scatter-xAxis-label-${z.value}`,
transform: `translate(${e.value.style.layout.dataLabels.xAxis.fontSize * 2}, ${i.value.top + i.value.height / 2}), rotate(-90)`,
"text-anchor": "middle",
"font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
"font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal",
fill: e.value.style.layout.dataLabels.xAxis.color
}, C(e.value.style.layout.dataLabels.xAxis.name), 9, kl)
])) : c("", !0),
e.value.style.layout.dataLabels.yAxis.show ? (o(), r("g", wl, [
d("text", {
x: f.value.x,
y: i.value.bottom + e.value.style.layout.dataLabels.yAxis.fontSize + 3,
"text-anchor": "middle",
"font-size": e.value.style.layout.dataLabels.yAxis.fontSize,
fill: e.value.style.layout.dataLabels.yAxis.color
}, C(n(j)(
e.value.style.layout.plots.selectors.labels.y.formatter,
n(A)(p.value.yMin),
n(W)({
p: e.value.style.layout.plots.selectors.labels.prefix,
v: n(A)(p.value.yMin),
s: e.value.style.layout.plots.selectors.labels.suffix,
r: e.value.style.layout.dataLabels.yAxis.rounding
})
)), 9, _l),
d("text", {
x: f.value.x,
y: i.value.top - e.value.style.layout.dataLabels.yAxis.fontSize / 2,
"text-anchor": "middle",
"font-size": e.value.style.layout.dataLabels.yAxis.fontSize,
fill: e.value.style.layout.dataLabels.yAxis.color
}, C(n(j)(
e.value.style.layout.plots.selectors.labels.y.formatter,
n(A)(p.value.yMax),
n(W)({
p: e.value.style.layout.plots.selectors.labels.prefix,
v: n(A)(p.value.yMax),
s: e.value.style.layout.plots.selectors.labels.suffix,
r: e.value.style.layout.dataLabels.yAxis.rounding
})
)), 9, $l),
d("text", {
"text-anchor": "middle",
"font-size": e.value.style.layout.dataLabels.yAxis.fontSize,
"font-weight": e.value.style.layout.dataLabels.yAxis.bold ? "bold" : "normal",
fill: e.value.style.layout.dataLabels.yAxis.color,
x: i.value.left + i.value.width / 2,
y: i.value.bottom + 8 + e.value.style.layout.dataLabels.yAxis.fontSize * 2
}, C(e.value.style.layout.dataLabels.yAxis.name), 9, Ml)
])) : c("", !0),
d("clipPath", {
id: `clip_path_${z.value}`
}, [
d("rect", {
x: i.value.left,
y: i.value.top,
width: i.value.width <= 0 ? 1e-4 : i.value.width,
height: i.value.height <= 0 ? 1e-4 : i.value.height
}, null, 8, Al)
], 8, Cl),
e.value.style.layout.correlation.show ? (o(), r("g", zl, [
(o(!0), r(P, null, X(S.value, (l, s) => (o(), r("line", {
x1: l.correlation.x1,
x2: l.correlation.x2,
y1: l.correlation.y1,
y2: l.correlation.y2,
"stroke-dasharray": e.value.style.layout.correlation.strokeDasharray,
stroke: l.color,
"stroke-width": e.value.style.layout.correlation.strokeWidth,
"clip-path": `url(#clip_path_${z.value})`
}, null, 8, Sl))), 256)),
(o(!0), r(P, null, X(S.value, (l, s) => (o(), r("g", null, [
e.value.style.layout.correlation.label.show ? (o(), r("text", {
key: 0,
x: l.label.x,
y: l.label.y,
fill: e.value.style.layout.correlation.label.useSerieColor ? l.color : e.value.style.layout.correlation.label.color,
"font-size": e.value.style.layout.correlation.label.fontSize,
"font-weight": e.value.style.layout.correlation.label.bold ? "bold" : "normal"
}, C(n(W)({
v: n(A)(l.correlation.coefficient),
r: e.value.style.layout.correlation.label.roundingValue
})), 9, Tl)) : c("", !0)
]))), 256))
])) : c("", !0),
$(t.$slots, "svg", { svg: b.value }, void 0, !0)
], 14, Dt)) : c("", !0),
t.$slots.watermark ? (o(), r("div", Ll, [
$(t.$slots, "watermark", J(K({ isPrinting: n(Le) || n(Be) })), void 0, !0)
])) : c("", !0),
ee.value ? c("", !0) : (o(), V(Bt, {
key: 6,
config: {
type: "quadrant",
style: {
backgroundColor: e.value.style.backgroundColor,
quadrant: {
grid: {
color: e.value.style.layout.axis.stroke
},
plots: {
color: e.value.style.layout.axis.stroke,
radius: 1
}
}
}
}
}, null, 8, ["config"])),
d("div", {
ref_key: "chartLegend",
ref: be
}, [
e.value.style.legend.show ? (o(), V(Tt, {
key: `legend_${Me.value}`,
legendSet: R.value,
config: Qe.value,
onClickMarker: u[0] || (u[0] = ({ legend: l }) => De(l.id))
}, {
item: _(({ legend: l }) => [
d("div", {
onClick: (s) => l.segregate(),
style: Y(`opacity:${m.value.includes(l.id) ? 0.5 : 1}`)
}, C(l.name), 13, Bl)
]),
_: 1
}, 8, ["legendSet", "config"])) : $(t.$slots, "legend", {
key: 1,
legend: R.value
}, void 0, !0)
], 512),
t.$slots.source ? (o(), r("div", {
key: 7,
ref_key: "source",
ref: ke,
dir: "auto"
}, [
$(t.$slots, "source", {}, void 0, !0)
], 512)) : c("", !0),
pe(St, {
show: B.value.showTooltip && ue.value,
backgroundColor: e.value.style.tooltip.backgroundColor,
color: e.value.style.tooltip.color,
borderRadius: e.value.style.tooltip.borderRadius,
borderColor: e.value.style.tooltip.borderColor,
borderWidth: e.value.style.tooltip.borderWidth,
fontSize: e.value.style.tooltip.fontSize,
backgroundOpacity: e.value.style.tooltip.backgroundOpacity,
position: e.value.style.tooltip.position,
offsetY: e.value.style.tooltip.offsetY,
parent: Q.value,
content: re.value,
isFullscreen: H.value,
isCustom: e.value.style.tooltip.customFormat && typeof e.value.style.tooltip.customFormat == "function"
}, {
"tooltip-before": _(() => [
$(t.$slots, "tooltip-before", J(K({ ...ve.value })), void 0, !0)
]),
"tooltip-after": _(() => [
$(t.$slots, "tooltip-after", J(K({ ...ve.value })), void 0, !0)
]),
default: _(() => [
e.value.style.tooltip.showShape ? (o(), r("div", Ol, [
(o(), r("svg", Nl, [
pe(Ue, {
shape: y.value.shape,
color: y.value.color,
plot: { x: 10, y: 10 },
radius: 7
}, null, 8, ["shape", "color"])
]))
])) : c("", !0)
]),
_: 3
}, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
ee.value ? (o(), V(Ot, {
key: 8,
hideDetails: "",
config: {
open: B.value.showTable,
maxHeight: 1e4,
body: {
backgroundColor: e.value.style.backgroundColor,
color: e.value.style.color
},
head: {
backgroundColor: e.value.style.backgroundColor,
color: e.value.style.color
}
}
}, {
content: _(() => [
(o(), V(Lt, {
key: `table_${$e.value}`,
colNames: ae.value.colNames,
head: ae.value.head,
body: ae.value.body,
config: ae.value.config,
title: `${e.value.style.title.text}${e.value.style.title.subtitle.text ? ` : ${e.value.style.title.subtitle.text}` : ""}`,
onClose: u[1] || (u[1] = (l) => B.value.showTable = !1)
}, {
th: _(({ th: l }) => [
rt(C(l), 1)
]),
td: _(({ td: l }) => [
l.shape ? (o(), r("div", Pl, [
d("span", null, C(l.content), 1)
])) : (o(), r("div", {
key: 1,
innerHTML: l
}, null, 8, Wl))
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title"]))
]),
_: 1
}, 8, ["config"])) : c("", !0)
], 46, Xt));
}
}, ta = /* @__PURE__ */ It(Fl, [["__scopeId", "data-v-fef2b0c8"]]);
export {
ta as default
};