vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
950 lines (947 loc) • 40.2 kB
JavaScript
import { useCssVars as _t, defineAsyncComponent as Y, ref as h, shallowRef as He, computed as C, watch as St, onMounted as Qe, onBeforeUnmount as Ze, createElementBlock as i, openBlock as n, unref as d, normalizeStyle as F, normalizeClass as z, createBlock as G, createCommentVNode as v, renderSlot as $, createElementVNode as B, createSlots as Je, withCtx as _, normalizeProps as re, guardReactiveProps as ue, withModifiers as Ke, createVNode as he, Fragment as R, renderList as W, mergeProps as Tt, toDisplayString as D, createTextVNode as Ot, nextTick as Bt } from "vue";
import { u as Lt, c as fe, t as Nt, p as ie, a as Et, o as Ft, e as et, g as zt, b as Rt, d as Xt, X as jt, F as Dt, f as ge, q as Ut, r as Vt, i as Yt } from "./index-BLtEpj8j.js";
import { u as Gt } from "./useUserOptionState-BIvW1Kz7.js";
import { u as tt } from "./useNestedProp-Bw1KcAmj.js";
import { u as Wt } from "./useChartAccessibility-9icAAmYg.js";
import { u as qt } from "./usePrinter-DnRwTdvS.js";
import { t as Ht, u as Qt } from "./useResponsive-DfdjqQps.js";
import Zt from "./Legend-E7G897sw.js";
import Jt from "./Title-DkG60EPg.js";
import { _ as Kt } from "./Shape-Cqnzky8X.js";
import ea from "./img-D-vWHxhM.js";
import { _ as ta } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const aa = ["id"], oa = ["xmlns", "viewBox"], la = ["width", "height"], sa = { key: 1 }, na = ["id", "d"], ra = { key: 2 }, ua = ["transform"], ia = ["d", "fill", "stroke", "stroke-width", "onMouseenter", "onClick"], ca = ["d", "fill", "stroke", "stroke-width"], da = ["d", "fill"], va = ["d", "fill", "stroke", "stroke-width", "onMouseenter", "onClick"], ha = ["d", "fill", "stroke", "stroke-width"], fa = ["d", "fill", "stroke", "stroke-width"], ga = ["d", "fill", "stroke", "stroke-width"], pa = { key: 0 }, ba = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], ma = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], ya = ["cx", "cy", "r", "stroke", "stroke-width", "fill"], ka = ["transform", "fill", "text-anchor", "font-size", "font-weight"], $a = { key: 1 }, wa = ["font-size", "font-weight", "fill"], Ca = ["href"], Ma = ["transform", "text-anchor", "font-size", "font-weight", "fill"], xa = {
key: 5,
class: "vue-data-ui-watermark"
}, Ia = ["onClick"], Aa = {
key: 8,
"data-dom-to-png-ignore": "",
class: "reset-wrapper"
}, Pa = { style: { "text-align": "right", width: "100%" } }, _a = {
__name: "vue-ui-chord",
props: {
dataset: {
type: Object,
default() {
return {};
}
},
config: {
type: Object,
default() {
return {};
}
}
},
emits: ["selectLegend", "selectGroup", "selectRibbon"],
setup(at, { expose: ot, emit: lt }) {
_t((t) => ({
"3518436d": t.slicerColor
}));
const st = Y(() => import("./vue-ui-accordion-B6Svdk-2.js")), nt = Y(() => import("./BaseIcon-Ba5t14Aj.js")), rt = Y(() => import("./DataTable-CS_V_Adx.js")), ut = Y(() => import("./PackageVersion-CnRyWKP-.js")), it = Y(() => import("./PenAndPaper-7BWf7zgA.js")), ct = Y(() => import("./vue-ui-skeleton-CsMU8DwQ.js")), dt = Y(() => import("./UserOptions-DGw0HvSp.js")), { vue_ui_chord: vt } = Lt(), g = at, te = lt, L = h(!!g.dataset && Object.hasOwn(g.dataset, "matrix")), S = h(fe()), w = h(null), m = h(null), p = h(null), pe = h(0), N = h(null), be = h(null), me = h(null), ye = h(null), ke = h(null), $e = h(0), we = h(0), Ce = h(0), q = h(!1), X = He(null), H = He(null), a = C({
get: () => Se(),
set: (t) => t
}), { userOptionsVisible: ce, setUserOptionsVisibility: Me, keepUserOptionState: xe } = Gt({ config: a.value }), { svgRef: Q } = Wt({ config: a.value.style.chart.title }), { isPrinting: Ie, isImaging: Ae, generatePdf: Pe, generateImage: _e } = qt({
elementId: `chord_${S.value}`,
fileName: a.value.style.chart.title.text || "vue-ui-chord",
options: a.value.userOptions.print
}), Z = h({
showTable: a.value.table.show
});
function Se() {
const t = tt({
userConfig: g.config,
defaultConfig: vt
});
return t.theme ? {
...tt({
userConfig: Et.vue_ui_chord[t.theme] || g.config,
defaultConfig: t
}),
customPalette: Nt[t.theme] || ie
} : t;
}
St(() => g.config, (t) => {
a.value = Se(), ce.value = !a.value.userOptions.showOnChartHover, Te(), $e.value += 1, we.value += 1, Ce.value += 1, x.value = a.value.initialRotation, Z.value.showTable = a.value.table.show;
}, { deep: !0 });
function Te() {
if (Ft(g.dataset) ? et({
componentName: "VueUiChord",
type: "dataset"
}) : zt({
datasetObject: g.dataset,
requiredAttributes: ["matrix"]
}).forEach((t) => {
L.value = !1, et({
componentName: "VueUiChord",
type: "datasetAttribute",
property: t
});
}), L.value && Oe(), a.value.responsive) {
const t = Ht(() => {
const { width: o, height: e, heightNoTitle: l, heightSource: u, heightTitle: s, heightLegend: r } = Qt({
chart: N.value,
title: a.value.style.chart.title.text ? be.value : null,
legend: a.value.style.chart.legend.show ? me.value : null,
source: ye.value,
noTitle: ke.value
}), f = s + r + u + l;
o < e ? N.value.style.width = "100%" : (N.value.style.height = "100%", Q.value.style.height = `calc(100% - ${f}px)`);
}, 100);
X.value && (H.value && X.value.unobserve(H.value), X.value.disconnect()), X.value = new ResizeObserver(t), H.value = N.value.parentNode, X.value.observe(H.value), t();
}
Be.value = setTimeout(() => {
q.value = !0;
}, 500);
}
function Oe() {
if (!g.dataset || !Object.hasOwn(g.dataset, "matrix") || g.dataset.matrix.length < 2) {
console.warn(`VueUiChord: dataset.matrix requires a minimum of 2 datapoints, for example:
matrix:[
[1, 1],
[1, 1]
]`), L.value = !1;
return;
}
g.dataset.matrix.forEach((t, o) => {
t.length !== g.dataset.matrix.length && (console.warn(`VueUiChord - Invalid matrix: dataset.matrix at index ${o} has ${t.length} elements instead of the required ${g.dataset.matrix.length}
dataset.matrix[${o}] = [${t.toString()}] has a length of ${t.length} but should have the same length as the matrix itself (${g.dataset.matrix.length})`), L.value = !1);
});
}
const Be = h(null);
Qe(() => {
Te();
});
const T = h({
height: 600,
width: 600
}), ht = C(() => a.value.userOptions.show && !a.value.style.chart.title.text), ft = C(() => Rt(a.value.customPalette)), b = C(() => ({
inner: T.value.width * 0.3 * a.value.style.chart.arcs.innerRadiusRatio,
outer: T.value.width * 0.34 * a.value.style.chart.arcs.outerRadiusRatio
})), gt = C(() => a.value.style.chart.arcs.padAngle / 100), y = C(() => L.value ? {
matrix: g.dataset.matrix ?? [[0]],
labels: g.dataset.labels ?? [""],
colors: g.dataset.colors && Array.isArray(g.dataset.colors) && g.dataset.colors.length ? g.dataset.colors.map((t) => Xt(t)) : g.dataset.matrix.map((t, o) => ft.value[o] || ie[o] || ie[o % ie.length])
} : {
matrix: [],
labels: [],
colors: []
});
function pt(t, o) {
const e = t.length, l = b.value.inner, u = new Array(e).fill(0);
let s = 0;
for (let c = 0; c < e; c += 1)
for (let k = 0; k < e; k += 1)
u[c] += t[c][k], s += t[c][k];
const r = (2 * Math.PI - o * e) / s, f = [];
let I = 0;
for (let c = 0; c < e; c += 1) {
const k = I, P = k + u[c] * r;
f.push({
index: c,
pattern: `pattern_${S.value}_${c}`,
startAngle: k,
endAngle: P,
name: y.value.labels[c],
id: fe(),
color: y.value.colors[c],
proportion: u[c] / s
}), I = P + o;
}
const A = [];
for (let c = 0; c < e; c += 1) {
const k = t[c].map((O, j) => ({ j, v: O }));
k.sort((O, j) => j.v - O.v);
let P = f[c].startAngle;
for (const { j: O, v: j } of k) {
const V = P, ee = V + j * r;
A.push({
index: c,
subIndex: O,
pattern: `pattern_${S.value}_${c}`,
startAngle: V,
endAngle: ee,
value: j,
groupName: y.value.labels[c],
groupId: f[c].id,
groupColor: y.value.colors[c],
midAngle: (V + ee) / 2,
midBaseX: Math.cos((V + ee) / 2 - Math.PI / 2) * l,
midBaseY: Math.sin((V + ee) / 2 - Math.PI / 2) * l
}), P = ee;
}
}
const E = [];
for (const c of A) {
const k = A.find(
(P) => P.index === c.subIndex && P.subIndex === c.index
);
E.push({ source: c, target: k, id: fe() });
}
return { groups: f, chords: E };
}
const M = C(() => {
const t = pt(y.value.matrix, gt.value);
return Oe(), t.chords.sort(
(o, e) => Math.max(e.source.value, e.target.value) - Math.max(o.source.value, o.target.value)
), t;
}), bt = C(() => {
const t = b.value.outer + a.value.style.chart.ribbons.labels.offset + 12, e = a.value.style.chart.ribbons.labels.fontSize * 0.6, l = [];
if (m.value) {
const s = m.value;
if (s.source.value) {
const r = String(s.source.value);
l.push({
id: s.id + "-src",
theta: s.source.midAngle,
w: r.length * e / t,
midBaseX: s.source.midBaseX,
midBaseY: s.source.midBaseY,
groupColor: s.source.groupColor,
value: s.source.value
});
}
if (s.target && s.target.value && s.target.value !== s.source.value) {
const r = String(s.target.value);
l.push({
id: s.id + "-tgt",
theta: s.target.midAngle,
w: r.length * e / t,
midBaseX: s.target.midBaseX,
midBaseY: s.target.midBaseY,
groupColor: s.target.groupColor,
value: s.target.value
});
}
return l;
}
function u(s) {
M.value.chords.filter((r) => r.source.groupId === s && r.source.value).forEach((r) => {
{
const f = String(r.source.value);
l.push({
id: r.id + "-src",
theta: r.source.midAngle,
w: f.length * e / t,
midBaseX: r.source.midBaseX,
midBaseY: r.source.midBaseY,
groupColor: r.source.groupColor,
value: r.source.value
});
}
if (r.target && r.target.value && r.target.value !== r.source.value) {
const f = String(r.target.value);
l.push({
id: r.id + "-tgt",
theta: r.target.midAngle,
w: f.length * e / t,
midBaseX: r.target.midBaseX,
midBaseY: r.target.midBaseY,
groupColor: r.target.groupColor,
value: r.target.value
});
}
});
}
return p.value && u(p.value), w.value && u(w.value.id), l;
}), mt = C(() => {
const t = bt.value.map((u) => ({ ...u })).sort((u, s) => u.theta - s.theta), o = a.value.style.chart.ribbons.labels.minSeparationDeg * Math.PI / 180;
let e = !0, l = 0;
for (; e && l++ < 10; ) {
e = !1;
for (let f = 1; f < t.length; f += 1) {
const I = t[f - 1], A = t[f], E = I.theta + I.w + o;
A.theta < E && (A.theta = E, e = !0);
}
const u = t[0], s = t[t.length - 1], r = s.theta + s.w + o - 2 * Math.PI;
u.theta < r && (u.theta = r, e = !0);
}
return t;
});
function Le(t, o, e, l) {
const u = t - Math.PI / 2, s = o - Math.PI / 2, r = Math.cos(u) * e, f = Math.sin(u) * e, I = Math.cos(s) * e, A = Math.sin(s) * e, E = Math.cos(s) * l, c = Math.sin(s) * l, k = Math.cos(u) * l, P = Math.sin(u) * l, O = o - t > Math.PI ? 1 : 0;
return `M${r},${f} A${e},${e} 0 ${O} 1 ${I},${A} L${E},${c} A${l},${l} 0 ${O} 0 ${k},${P} Z`;
}
function ae(t, o) {
const e = b.value.inner, l = t.startAngle - Math.PI / 2, u = t.endAngle - Math.PI / 2, s = o.startAngle - Math.PI / 2, r = o.endAngle - Math.PI / 2, f = Math.cos(l) * e, I = Math.sin(l) * e, A = Math.cos(u) * e, E = Math.sin(u) * e, c = Math.cos(s) * e, k = Math.sin(s) * e, P = Math.cos(r) * e, O = Math.sin(r) * e, j = t.endAngle - t.startAngle > Math.PI ? 1 : 0, V = o.endAngle - o.startAngle > Math.PI ? 1 : 0;
return `M${f},${I}A${e},${e} 0 ${j} 1 ${A},${E}Q0,0 ${c},${k}A${e},${e} 0 ${V} 1 ${P},${O}Q0,0 ${f},${I}Z`;
}
const Ne = C(() => x.value * Math.PI / 180);
function yt(t) {
return (t.startAngle + t.endAngle) / 2;
}
function kt(t) {
return ((yt(t) + Ne.value) % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);
}
function $t(t) {
let o = t + Ne.value;
return o = (o % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI), o > Math.PI ? "end" : "start";
}
function wt(t) {
const o = t - Math.PI / 2, e = Math.cos(o) * (b.value.outer + a.value.style.chart.arcs.labels.offset + 24), l = Math.sin(o) * (b.value.outer + a.value.style.chart.arcs.labels.offset + 24);
return `translate(${e},${l})`;
}
function Ct(t, o, e) {
const l = t - Math.PI / 2, u = o - Math.PI / 2, s = Math.cos(l) * e, r = Math.sin(l) * e, f = Math.cos(u) * e, I = Math.sin(u) * e, A = o - t > Math.PI ? 1 : 0;
return `M${s},${r} A${e},${e} 0 ${A} 1 ${f},${I}`;
}
const x = h(a.value.initialRotation), J = h(!1);
let Ee = 0, Fe = 0;
function ze(t) {
const o = Q.value.getBoundingClientRect(), e = o.left + o.width / 2, l = o.top + o.height / 2, u = t.clientX ?? t.touches[0].clientX, s = t.clientY ?? t.touches[0].clientY;
return Math.atan2(s - l, u - e);
}
function Re(t) {
!a.value.enableRotation || K.value || (t.preventDefault(), J.value = !0, Ee = x.value, Fe = ze(t));
}
function oe(t) {
if (!J.value) return;
const o = ze(t);
x.value = Ee + (o - Fe) * 180 / Math.PI;
}
function le() {
J.value = !1;
}
function Xe(t) {
return Yt(
a.value.style.chart.ribbons.labels.formatter,
t,
ge({
p: a.value.style.chart.ribbons.labels.prefix,
v: t,
s: a.value.style.chart.ribbons.labels.suffix,
r: a.value.style.chart.ribbons.labels.rounding
})
);
}
Qe(() => {
window.addEventListener("mousemove", oe), window.addEventListener("mouseup", le), window.addEventListener("touchmove", oe, { passive: !1 }), window.addEventListener("touchend", le);
}), Ze(() => {
window.removeEventListener("mousemove", oe), window.removeEventListener("mouseup", le), window.removeEventListener("touchmove", oe), window.removeEventListener("touchend", le), clearTimeout(Be.value), X.value && (H.value && X.value.unobserve(H.value), X.value.disconnect());
});
const de = h(!1);
function je(t) {
de.value = t, pe.value += 1;
}
function Mt(t) {
p.value || (w.value = t);
}
function xt(t) {
p.value || (m.value = t);
}
function De(t) {
return !p.value && !w.value && !m.value ? 0.8 : (p.value ? p.value === t.source.groupId : w.value ? w.value.id === t.source.groupId : m.value?.id === t.id) ? 1 : 0.1;
}
function Ue(t) {
return !p.value && !w.value && !m.value || (p.value ? p.value === t.id : w.value ? w.value.id === t.id : [m.value?.source.groupId, m.value?.target.groupId].includes(t.id)) ? 1 : 0.3;
}
const K = h(!1);
function ve() {
K.value = !K.value;
}
function Ve() {
Z.value.showTable = !Z.value.showTable;
}
function It() {
return M.value;
}
const U = h(null);
function Ye() {
const t = a.value.initialRotation;
U.value !== null && cancelAnimationFrame(U.value);
const o = () => {
x.value += (t - x.value) * 0.05, Math.abs(x.value - t) < 0.1 ? (x.value = t, U.value = null) : U.value = requestAnimationFrame(o);
};
U.value = requestAnimationFrame(o);
}
Ze(() => {
U.value !== null && cancelAnimationFrame(U.value);
});
function Ge(t) {
t === p.value ? (p.value = null, te("selectLegend", null)) : (p.value = t, te("selectLegend", M.value.groups.find((o) => o.id === t)));
}
const We = C(() => M.value.groups.map((t, o) => ({
name: t.name,
color: t.color,
shape: "circle",
patternIndex: o,
pattern: `pattern_${S.value}_${o}`,
id: t.id,
select: () => Ge(t.id),
opacity: p.value ? p.value === t.id ? 1 : 0.3 : 1
}))), At = C(() => ({
cy: "chord-div-legend",
backgroundColor: a.value.style.chart.legend.backgroundColor,
color: a.value.style.chart.legend.color,
fontSize: a.value.style.chart.legend.fontSize,
paddingBottom: 12,
fontWeight: a.value.style.chart.legend.bold ? "bold" : ""
})), se = C(() => {
const t = M.value.groups.map((e, l) => ({
name: e.name || l,
color: e.color
})), o = y.value.matrix;
return { head: t, body: o };
}), ne = C(() => {
const t = [{ name: "", color: null }, ...se.value.head], o = se.value.body.map((u, s) => [
se.value.head[s],
...se.value.body[s]
]), e = {
th: {
backgroundColor: a.value.table.th.backgroundColor,
color: a.value.table.th.color,
outline: a.value.table.th.outline
},
td: {
backgroundColor: a.value.table.td.backgroundColor,
color: a.value.table.td.color,
outline: a.value.table.td.outline
},
breakpoint: a.value.table.responsiveBreakpoint
};
return {
colNames: t,
head: t,
body: o,
config: e
};
});
function qe(t = null) {
Bt(() => {
const o = y.value.matrix.map((u, s) => [
[y.value.labels[s] || s],
u
]), e = [
[a.value.style.chart.title.text],
[a.value.style.chart.title.subtitle.text],
[
[""],
...y.value.labels.map((u, s) => [u || s])
]
].concat(o), l = Ut(e);
t ? t(l) : Vt({ csvContent: l, title: a.value.style.chart.title.text || "vue-ui-chord" });
});
}
async function Pt({ scale: t = 2 } = {}) {
if (!N.value) return;
const { width: o, height: e } = N.value.getBoundingClientRect(), l = o / e, { imageUri: u, base64: s } = await ea({ domElement: N.value, base64: !0, img: !0, scale: t });
return {
imageUri: u,
base64: s,
title: a.value.style.chart.title.text,
width: o,
height: e,
aspectRatio: l
};
}
return ot({
getData: It,
getImage: Pt,
generateCsv: qe,
generateImage: _e,
generatePdf: Pe,
toggleAnnotator: ve,
toggleTable: Ve,
toggleFullscreen: je
}), (t, o) => (n(), i("div", {
ref_key: "chordChart",
ref: N,
class: z({
"vue-ui-chord": !0,
"vue-data-ui-wrapper-fullscreen": de.value,
"vue-data-ui-responsive": a.value.responsive
}),
style: F(`font-family:${a.value.style.fontFamily};width:100%; text-align:center;background:${a.value.style.chart.backgroundColor}`),
id: `chord_${S.value}`,
onMouseenter: o[4] || (o[4] = () => d(Me)(!0)),
onMouseleave: o[5] || (o[5] = () => d(Me)(!1))
}, [
a.value.userOptions.buttons.annotator && d(Q) ? (n(), G(d(it), {
key: 0,
color: a.value.style.chart.color,
backgroundColor: a.value.style.chart.backgroundColor,
active: K.value,
svgRef: d(Q),
onClose: ve
}, null, 8, ["color", "backgroundColor", "active", "svgRef"])) : v("", !0),
$(t.$slots, "userConfig", {}, void 0, !0),
ht.value ? (n(), i("div", {
key: 1,
ref_key: "noTitle",
ref: ke,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : v("", !0),
a.value.style.chart.title.text ? (n(), i("div", {
key: 2,
ref_key: "chartTitle",
ref: be,
style: "width:100%;background:transparent;padding-bottom:24px"
}, [
(n(), G(Jt, {
key: `title_${$e.value}`,
config: {
title: {
cy: "chord-div-title",
...a.value.style.chart.title
},
subtitle: {
cy: "chord-div-subtitle",
...a.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))
], 512)) : v("", !0),
a.value.userOptions.show && L.value && (d(xe) || d(ce)) ? (n(), G(d(dt), {
ref: "details",
key: `user_option_${pe.value}`,
backgroundColor: a.value.style.chart.backgroundColor,
color: a.value.style.chart.color,
isPrinting: d(Ie),
isImaging: d(Ae),
uid: S.value,
hasTooltip: !1,
hasPdf: a.value.userOptions.buttons.pdf,
hasImg: a.value.userOptions.buttons.img,
hasXls: a.value.userOptions.buttons.csv,
hasTable: a.value.userOptions.buttons.table,
hasLabel: !1,
hasFullscreen: a.value.userOptions.buttons.fullscreen,
isFullscreen: de.value,
chartElement: N.value,
position: a.value.userOptions.position,
titles: { ...a.value.userOptions.buttonTitles },
hasAnnotator: a.value.userOptions.buttons.annotator,
isAnnotation: K.value,
callbacks: a.value.userOptions.callbacks,
printScale: a.value.userOptions.print.scale,
onToggleFullscreen: je,
onGeneratePdf: d(Pe),
onGenerateCsv: qe,
onGenerateImage: d(_e),
onToggleTable: Ve,
onToggleAnnotator: ve,
style: F({
visibility: d(xe) ? d(ce) ? "visible" : "hidden" : "visible"
})
}, Je({ _: 2 }, [
t.$slots.menuIcon ? {
name: "menuIcon",
fn: _(({ isOpen: e, color: l }) => [
$(t.$slots, "menuIcon", re(ue({ isOpen: e, color: l })), void 0, !0)
]),
key: "0"
} : void 0,
t.$slots.optionPdf ? {
name: "optionPdf",
fn: _(() => [
$(t.$slots, "optionPdf", {}, void 0, !0)
]),
key: "1"
} : void 0,
t.$slots.optionCsv ? {
name: "optionCsv",
fn: _(() => [
$(t.$slots, "optionCsv", {}, void 0, !0)
]),
key: "2"
} : void 0,
t.$slots.optionImg ? {
name: "optionImg",
fn: _(() => [
$(t.$slots, "optionImg", {}, void 0, !0)
]),
key: "3"
} : void 0,
t.$slots.optionTable ? {
name: "optionTable",
fn: _(() => [
$(t.$slots, "optionTable", {}, void 0, !0)
]),
key: "4"
} : void 0,
t.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: _(({ toggleFullscreen: e, isFullscreen: l }) => [
$(t.$slots, "optionFullscreen", re(ue({ toggleFullscreen: e, isFullscreen: l })), void 0, !0)
]),
key: "5"
} : void 0,
t.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: _(({ toggleAnnotator: e, isAnnotator: l }) => [
$(t.$slots, "optionAnnotator", re(ue({ toggleAnnotator: e, isAnnotator: l })), void 0, !0)
]),
key: "6"
} : void 0
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "chartElement", "position", "titles", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "onGeneratePdf", "onGenerateImage", "style"])) : v("", !0),
L.value ? (n(), i("svg", {
key: 4,
xmlns: d(jt),
ref_key: "svgRef",
ref: Q,
viewBox: `0 0 ${T.value.width} ${T.value.height}`,
preserveAspectRatio: "xMidYMid meet",
style: {
overflow: "visible"
},
class: z({ "vue-ui-chord-rotating": J.value, "vue-ui-chord-idle": !J.value }),
onMousedown: Ke(Re, ["prevent"]),
onTouchstart: Ke(Re, ["prevent"])
}, [
he(d(ut)),
t.$slots["chart-background"] ? (n(), i("foreignObject", {
key: 0,
x: 0,
y: 0,
width: T.value.width <= 0 ? 10 : T.value.width,
height: T.value.height <= 0 ? 10 : T.value.height,
style: {
pointerEvents: "none"
}
}, [
$(t.$slots, "chart-background", {}, void 0, !0)
], 8, la)) : v("", !0),
a.value.style.chart.arcs.labels.curved ? (n(), i("defs", sa, [
(n(!0), i(R, null, W(M.value.groups, (e, l) => (n(), i("path", {
key: `labelPath-${l}`,
id: `labelPath-${l}_${S.value}`,
d: Ct(
e.startAngle,
e.endAngle,
(b.value.inner + b.value.outer) / 2 + a.value.style.chart.arcs.labels.offset
),
fill: "none"
}, null, 8, na))), 128))
])) : v("", !0),
t.$slots.pattern ? (n(), i("g", ra, [
(n(!0), i(R, null, W(M.value.groups, (e, l) => (n(), i("defs", null, [
$(t.$slots, "pattern", Tt({ ref_for: !0 }, { seriesIndex: e.index, patternId: `pattern_${S.value}_${l}` }), void 0, !0)
]))), 256))
])) : v("", !0),
B("g", {
transform: `translate(${T.value.width / 2}, ${T.value.height / 2}) rotate(${x.value})`
}, [
(n(!0), i(R, null, W(M.value.groups, (e, l) => (n(), i("g", null, [
(n(), i("path", {
class: z({ "vue-ui-chord-arc": !0, "vue-ui-chord-arc-animated": a.value.useCssAnimation && !q.value }),
key: `arc-${l}`,
d: Le(
e.startAngle,
e.endAngle,
b.value.outer,
b.value.inner
),
fill: y.value.colors[l],
stroke: a.value.style.chart.arcs.stroke,
"stroke-width": a.value.style.chart.arcs.strokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round",
style: F({
opacity: Ue(e)
}),
onMouseenter: () => Mt(e),
onMouseleave: o[0] || (o[0] = (u) => w.value = null),
onClick: (u) => te("selectGroup", e)
}, null, 46, ia)),
t.$slots.pattern ? (n(), i("path", {
class: z({ "vue-ui-chord-arc": !0, "vue-ui-chord-arc-animated": a.value.useCssAnimation && !q.value }),
key: `arc-${l}`,
d: Le(
e.startAngle,
e.endAngle,
b.value.outer,
b.value.inner
),
fill: `url(#${e.pattern})`,
stroke: a.value.style.chart.arcs.stroke,
"stroke-width": a.value.style.chart.arcs.strokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round",
style: F({
opacity: Ue(e),
pointerEvents: "none"
})
}, null, 14, ca)) : v("", !0)
]))), 256)),
B("g", null, [
(n(!0), i(R, null, W(w.value ? M.value.chords.filter((e) => e.source.groupId === w.value.id) : p.value ? M.value.chords.filter((e) => e.source.groupId === p.value) : M.value.chords, (e) => (n(), i(R, {
key: `ribbon-${e.id}`
}, [
e.source.value ? (n(), i("path", {
key: 0,
class: z({ "vue-ui-chord-ribbon": !0, "vue-ui-chord-ribbon-animated": a.value.useCssAnimation && !q.value }),
d: ae(e.source, e.target),
fill: a.value.style.chart.backgroundColor,
style: F({ opacity: a.value.style.chart.ribbons.underlayerOpacity })
}, null, 14, da)) : v("", !0),
e.source.value ? (n(), i("path", {
key: 1,
class: z({ "vue-ui-chord-ribbon": !0, "vue-ui-chord-ribbon-animated": a.value.useCssAnimation && !q.value }),
d: ae(e.source, e.target),
fill: y.value.colors[e.source.index],
stroke: a.value.style.chart.ribbons.stroke,
"stroke-width": a.value.style.chart.ribbons.strokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round",
style: F({ opacity: De(e) }),
onMouseenter: () => xt({
...e,
path: ae(e.source, e.target),
color: y.value.colors[e.source.index]
}),
onClick: (l) => te("selectRibbon", {
...e,
color: y.value.colors[e.source.index]
}),
onMouseleave: o[1] || (o[1] = (l) => m.value = null)
}, null, 46, va)) : v("", !0),
e.source.value && t.$slots.pattern ? (n(), i("path", {
key: 2,
class: z({ "vue-ui-chord-ribbon": !0, "vue-ui-chord-ribbon-animated": a.value.useCssAnimation && !q.value }),
d: ae(e.source, e.target),
fill: `url(#pattern_${S.value}_${e.source.index})`,
stroke: a.value.style.chart.ribbons.stroke,
"stroke-width": a.value.style.chart.ribbons.strokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round",
style: F({
opacity: De(e),
pointerEvents: "none"
})
}, null, 14, ha)) : v("", !0)
], 64))), 128)),
m.value ? (n(), i("path", {
key: 0,
d: m.value.path,
fill: m.value.color,
stroke: a.value.style.chart.ribbons.stroke,
"stroke-width": a.value.style.chart.ribbons.strokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round",
class: z({ "vue-ui-chord-ribbon": !0 }),
style: {
pointerEvents: "none"
}
}, null, 8, fa)) : v("", !0),
m.value && t.$slots.pattern ? (n(), i("path", {
key: 1,
d: m.value.path,
fill: `url(#${m.value.source.pattern})`,
stroke: a.value.style.chart.ribbons.stroke,
"stroke-width": a.value.style.chart.ribbons.strokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round",
class: z({ "vue-ui-chord-ribbon": !0 }),
style: {
pointerEvents: "none"
}
}, null, 8, ga)) : v("", !0)
]),
(w.value || m.value || p.value) && a.value.style.chart.ribbons.labels.show ? (n(), i("g", pa, [
(n(!0), i(R, null, W(mt.value, (e) => (n(), i(R, {
key: e.id
}, [
B("line", {
x1: e.midBaseX,
y1: e.midBaseY,
x2: Math.cos(e.theta - Math.PI / 2) * (b.value.outer + a.value.style.chart.ribbons.labels.offset + 12),
y2: Math.sin(e.theta - Math.PI / 2) * (b.value.outer + a.value.style.chart.ribbons.labels.offset + 12),
stroke: a.value.style.chart.backgroundColor,
"stroke-width": a.value.style.chart.ribbons.labels.connector.strokeWidth * 3,
"pointer-events": "none"
}, null, 8, ba),
B("line", {
x1: e.midBaseX,
y1: e.midBaseY,
x2: Math.cos(e.theta - Math.PI / 2) * (b.value.outer + a.value.style.chart.ribbons.labels.offset + 12),
y2: Math.sin(e.theta - Math.PI / 2) * (b.value.outer + a.value.style.chart.ribbons.labels.offset + 12),
stroke: a.value.style.chart.ribbons.labels.connector.stroke,
"stroke-width": a.value.style.chart.ribbons.labels.connector.strokeWidth,
"pointer-events": "none"
}, null, 8, ma),
a.value.style.chart.ribbons.labels.marker.show ? (n(), i("circle", {
key: 0,
cx: Math.cos(e.theta - Math.PI / 2) * (b.value.outer + a.value.style.chart.ribbons.labels.offset + 12),
cy: Math.sin(e.theta - Math.PI / 2) * (b.value.outer + a.value.style.chart.ribbons.labels.offset + 12),
r: a.value.style.chart.ribbons.labels.marker.radius,
stroke: a.value.style.chart.ribbons.labels.marker.stroke,
"stroke-width": a.value.style.chart.ribbons.labels.marker.strokeWidth,
fill: e.groupColor,
"pointer-events": "none"
}, null, 8, ya)) : v("", !0),
B("text", {
transform: `
translate(
${Math.cos(e.theta - Math.PI / 2) * (b.value.outer + a.value.style.chart.ribbons.labels.offset + 24)},
${Math.sin(e.theta - Math.PI / 2) * (b.value.outer + a.value.style.chart.ribbons.labels.offset + 24)}
) rotate(${-x.value})
`,
fill: a.value.style.chart.ribbons.labels.useSerieColor ? e.groupColor : a.value.style.chart.ribbons.labels.color,
"text-anchor": $t(e.theta),
"font-size": a.value.style.chart.ribbons.labels.fontSize,
"font-weight": a.value.style.chart.ribbons.labels.bold ? "bold" : "normal",
dy: ".35em",
"pointer-events": "none"
}, D(Xe(e.value)), 9, ka)
], 64))), 128))
])) : v("", !0),
a.value.style.chart.arcs.labels.show ? (n(), i("g", $a, [
a.value.style.chart.arcs.labels.curved ? (n(!0), i(R, { key: 0 }, W(M.value.groups, (e, l) => (n(), i("text", {
key: `curved-label-${l}`,
"font-size": a.value.style.chart.arcs.labels.fontSize,
"font-weight": a.value.style.chart.arcs.labels.bold ? "bold" : "normal",
fill: a.value.style.chart.arcs.labels.adaptColorToBackground ? d(Dt)(y.value.colors[l]) : a.value.style.chart.arcs.labels.color
}, [
B("textPath", {
href: `#labelPath-${l}_${S.value}`,
startOffset: "50%",
"text-anchor": "middle"
}, D(y.value.labels[l]) + D(a.value.style.chart.arcs.labels.showPercentage ? d(ge)({
p: " (",
v: isNaN(e.proportion) ? 0 : e.proportion * 100,
s: "%)",
r: a.value.style.chart.arcs.labels.roundingPercentage
}) : ""), 9, Ca)
], 8, wa))), 128)) : !w.value && !m.value && !p.value ? (n(!0), i(R, { key: 1 }, W(M.value.groups, (e, l) => (n(), i("text", {
key: `label-${l}`,
transform: `
${wt((e.startAngle + e.endAngle) / 2)}
rotate(${-x.value})
`,
dy: ".35em",
"text-anchor": kt(e) > Math.PI ? "end" : "start",
"font-size": a.value.style.chart.arcs.labels.fontSize,
"font-weight": a.value.style.chart.arcs.labels.bold ? "bold" : "normal",
fill: a.value.style.chart.arcs.labels.color
}, D(y.value.labels[l]) + D(a.value.style.chart.arcs.labels.showPercentage ? d(ge)({
p: " (",
v: isNaN(e.proportion) ? 0 : e.proportion * 100,
s: "%)",
r: a.value.style.chart.arcs.labels.roundingPercentage
}) : ""), 9, Ma))), 128)) : v("", !0)
])) : v("", !0)
], 8, ua),
$(t.$slots, "svg", { svg: { height: 600, width: 600 } }, void 0, !0)
], 42, oa)) : v("", !0),
t.$slots.watermark ? (n(), i("div", xa, [
$(t.$slots, "watermark", re(ue({ isPrinting: d(Ie) || d(Ae) })), void 0, !0)
])) : v("", !0),
L.value ? v("", !0) : (n(), G(d(ct), {
key: 6,
config: {
type: "chord",
style: {
backgroundColor: a.value.style.chart.backgroundColor,
chord: {
color: "#CCCCCC"
}
}
}
}, null, 8, ["config"])),
B("div", {
ref_key: "chartLegend",
ref: me
}, [
a.value.style.chart.legend.show ? (n(), G(Zt, {
key: `legend_${Ce.value}`,
legendSet: We.value,
config: At.value,
onClickMarker: o[2] || (o[2] = ({ legend: e }) => Ge(e.id))
}, Je({
item: _(({ legend: e }) => [
B("div", {
style: F({
opacity: p.value ? p.value === e.id ? 1 : 0.3 : 1
}),
onClick: (l) => e.select()
}, D(e.name), 13, Ia)
]),
_: 2
}, [
t.$slots.pattern ? {
name: "legend-pattern",
fn: _(({ legend: e, index: l }) => [
he(Kt, {
shape: e.shape,
radius: 30,
stroke: "none",
plot: { x: 30, y: 30 },
fill: `url(#pattern_${S.value}_${l})`
}, null, 8, ["shape", "fill"])
]),
key: "0"
} : void 0
]), 1032, ["legendSet", "config"])) : v("", !0),
$(t.$slots, "legend", { legend: We.value }, void 0, !0)
], 512),
t.$slots.source ? (n(), i("div", {
key: 7,
ref_key: "source",
ref: ye,
dir: "auto"
}, [
$(t.$slots, "source", {}, void 0, !0)
], 512)) : v("", !0),
x.value !== a.value.initialRotation ? (n(), i("div", Aa, [
$(t.$slots, "reset-action", { reset: Ye }, () => [
B("button", {
"data-cy-reset": "",
tabindex: "0",
role: "button",
class: "vue-data-ui-refresh-button",
style: F({
background: a.value.style.chart.backgroundColor
}),
onClick: Ye
}, [
he(d(nt), {
name: "refresh",
stroke: a.value.style.chart.color
}, null, 8, ["stroke"])
], 4)
], !0)
])) : v("", !0),
L.value ? (n(), G(d(st), {
key: 9,
hideDetails: "",
config: {
open: Z.value.showTable,
maxHeight: 1e4,
body: {
backgroundColor: a.value.style.chart.backgroundColor,
color: a.value.style.chart.color
},
head: {
backgroundColor: a.value.style.chart.backgroundColor,
color: a.value.style.chart.color
}
}
}, {
content: _(() => [
(n(), G(d(rt), {
key: `table_${we.value}`,
colNames: ne.value.colNames,
head: ne.value.head,
body: ne.value.body,
config: ne.value.config,
title: `${a.value.style.chart.title.text}${a.value.style.chart.title.subtitle.text ? ` : ${a.value.style.chart.title.subtitle.text}` : ""}`,
onClose: o[3] || (o[3] = (e) => Z.value.showTable = !1)
}, {
th: _(({ th: e }) => [
Ot(D(e.name), 1)
]),
td: _(({ td: e }) => [
B("div", Pa, D(e.name ? e.name : Xe(e)), 1)
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title"]))
]),
_: 1
}, 8, ["config"])) : v("", !0)
], 46, aa));
}
}, Da = /* @__PURE__ */ ta(_a, [["__scopeId", "data-v-94fd68af"]]);
export {
Da as default
};