vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
948 lines (947 loc) • 43 kB
JavaScript
import { computed as p, ref as b, onMounted as vt, watch as Ue, createElementBlock as o, openBlock as a, unref as c, normalizeStyle as Z, normalizeClass as P, createBlock as D, createCommentVNode as v, renderSlot as S, createSlots as dt, withCtx as A, normalizeProps as B, guardReactiveProps as G, createVNode as ht, createElementVNode as y, Fragment as k, renderList as _, toDisplayString as m, withKeys as yt, createTextVNode as We, nextTick as j } from "vue";
import { u as ft, o as gt, e as Q, g as bt, c as Xe, t as mt, p as ee, a as xt, C as Be, b as pt, d as ve, J as kt, D as Ge, m as de, X as _t, s as Y, E as Ct, i as he, f as te, j as je, k as Ye, n as le, q as wt, r as zt, K as Ke } from "./index-BaaDnc4F.js";
import { _ as Lt } from "./Title-D_MGglyN.js";
import { u as St, U as At } from "./usePrinter-y4-4tCWT.js";
import { D as $t } from "./DataTable-DvwmNjb-.js";
import { L as It } from "./Legend-Be8mrJpb.js";
import Nt from "./vue-ui-skeleton-6RiQNJSb.js";
import { S as Ft } from "./Slicer-CUm2ijlc.js";
import Pt from "./vue-ui-accordion-CF9kQTXq.js";
import { u as qe } from "./useNestedProp-D8vQcOps.js";
import { _ as Ot } from "./PackageVersion-D9Lm1C1X.js";
import { P as Dt } from "./PenAndPaper-DR58HO_U.js";
import { u as Et } from "./useUserOptionState-BIvW1Kz7.js";
import { u as Tt } from "./useChartAccessibility-BWojgys7.js";
import { _ as Vt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Ht = ["id"], Rt = ["xmlns", "viewBox"], Mt = ["x", "y", "width", "height"], Ut = ["id"], Wt = ["stop-color"], Xt = ["stop-color"], Bt = ["id"], Gt = ["stop-color"], jt = ["stop-color"], Yt = ["stop-color"], Kt = { key: 1 }, qt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Jt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Zt = { key: 0 }, Qt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], el = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], tl = ["x", "y", "font-size", "fill", "font-weight"], ll = ["text-anchor", "font-size", "fill", "transform"], al = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], ol = { key: 1 }, ul = ["cx", "cy", "r", "fill"], sl = { key: 0 }, nl = { key: 0 }, rl = ["d", "stroke"], il = ["text-anchor", "x", "y", "fill"], cl = ["cx", "cy", "r", "fill"], vl = { key: 0 }, dl = ["cx", "cy", "fill"], hl = { key: 1 }, yl = ["d", "fill", "stroke"], fl = { key: 2 }, gl = ["d", "fill", "stroke"], bl = ["x", "y", "font-size", "fill"], ml = ["x", "y", "width", "fill", "onClick"], xl = ["x", "y", "width", "height", "onMouseenter", "onClick"], pl = {
key: 4,
"data-cy-zoom": "",
class: "vue-ui-donut-evolution-dialog"
}, kl = ["x", "y", "width", "height", "fill"], _l = ["x1", "y1", "x2", "y2", "stroke"], Cl = ["x1", "y2", "x2", "y1", "stroke"], wl = ["cx", "cy", "r"], zl = ["d", "stroke"], Ll = ["cx", "cy", "r", "fill"], Sl = ["d", "fill", "stroke"], Al = { class: "vue-ui-donut-evolution-focus" }, $l = ["text-anchor", "x", "y", "fill"], Il = ["cx", "cy", "r", "fill"], Nl = ["cx", "cy", "r", "fill"], Fl = ["x", "y", "fill"], Pl = ["x", "y", "font-size", "fill"], Ol = {
key: 5,
class: "vue-data-ui-watermark"
}, Dl = ["onClick"], El = { key: 0 }, Tl = { key: 1 }, Vl = {
key: 9,
ref: "source",
dir: "auto"
}, Hl = { key: 0 }, Rl = { key: 1 }, Ml = {
__name: "vue-ui-donut-evolution",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectLegend"],
setup(Je, { expose: Ze, emit: Qe }) {
const { vue_ui_donut_evolution: et } = ft(), x = Je, K = p(() => !!x.dataset && x.dataset.length), d = b({
start: 0,
end: Math.max(...x.dataset.map((l) => l.values.length))
});
function ye() {
fe();
}
const V = b(null);
async function fe() {
(e.value.style.chart.zoom.startIndex !== null || e.value.style.chart.zoom.endIndex !== null) && V.value ? (e.value.style.chart.zoom.startIndex !== null && (await j(), await j(), V.value && V.value.setStartValue(e.value.style.chart.zoom.startIndex)), e.value.style.chart.zoom.endIndex !== null && (await j(), await j(), V.value && V.value.setEndValue(tt(e.value.style.chart.zoom.endIndex + 1)))) : (d.value = {
start: 0,
end: T.value
}, xe.value += 1);
}
function tt(l) {
const u = T.value;
return l > u ? u : l < 0 || e.value.style.chart.zoom.startIndex !== null && l < e.value.style.chart.zoom.startIndex ? e.value.style.chart.zoom.startIndex !== null ? e.value.style.chart.zoom.startIndex + 1 : 1 : l;
}
vt(() => {
ge();
});
function ge() {
gt(x.dataset) ? Q({
componentName: "VueUiDonutEvolution",
type: "dataset"
}) : x.dataset.length && x.dataset.forEach((l, u) => {
bt({
datasetObject: l,
requiredAttributes: ["name", "values"]
}).forEach((t) => {
Q({
componentName: "VueUiDonutEvolution",
type: "datasetSerieAttribute",
property: t,
index: u
});
});
}), fe();
}
const E = b(Xe()), C = b([]), g = b(null), ae = b(null), $ = b(!1), I = b(null), be = b(null), lt = b(null), me = b(0), xe = b(0), pe = b(0), ke = b(0), _e = b(0), Ce = Qe, e = p({
get: () => Se(),
set: (l) => l
}), { userOptionsVisible: oe, setUserOptionsVisibility: we, keepUserOptionState: ze } = Et({ config: e.value }), { svgRef: Le } = Tt({ config: e.value.style.chart.title });
function Se() {
const l = qe({
userConfig: x.config,
defaultConfig: et
});
let u = {};
return l.theme ? u = {
...qe({
userConfig: xt.vue_ui_donut_evolution[l.theme] || x.config,
defaultConfig: l
}),
customPalette: mt[l.theme] || ee
} : u = l, x.config && Be(x.config, "style.chart.zoom.startIndex") ? u.style.chart.zoom.startIndex = x.config.style.chart.zoom.startIndex : u.style.chart.zoom.startIndex = null, x.config && Be(x.config, "style.chart.zoom.endIndex") ? u.style.chart.zoom.endIndex = x.config.style.chart.zoom.endIndex : u.style.chart.zoom.endIndex = null, u;
}
Ue(() => x.config, (l) => {
e.value = Se(), oe.value = !e.value.userOptions.showOnChartHover, ge(), pe.value += 1, ke.value += 1, _e.value += 1, U.value.showTable = e.value.table.show;
}, { deep: !0 }), Ue(() => x.dataset, (l) => {
ye();
}, { deep: !0 });
const { isPrinting: Ae, isImaging: $e, generatePdf: Ie, generateImage: Ne } = St({
elementId: E.value,
fileName: e.value.style.chart.title.text || "vue-ui-donut-evolution"
}), at = p(() => e.value.userOptions.show && !e.value.style.chart.title.text), ot = p(() => pt(e.value.customPalette)), U = b({
showTable: e.value.table.show
}), n = p(() => ({
top: e.value.style.chart.layout.padding.top,
right: e.value.style.chart.layout.padding.right,
bottom: e.value.style.chart.layout.padding.bottom,
left: e.value.style.chart.layout.padding.left
})), i = p(() => {
const l = e.value.style.chart.layout.height, u = e.value.style.chart.layout.width, t = l - n.value.top - n.value.bottom, r = u - n.value.left - n.value.right;
return {
absoluteHeight: l,
absoluteWidth: u,
centerX: n.value.left + r / 2,
centerY: n.value.top + t / 2,
height: t,
width: r
};
}), O = p(() => (x.dataset.forEach((l, u) => {
[null, void 0].includes(l.name) && Q({
componentName: "VueUiDonutEvolution",
type: "datasetSerieAttribute",
property: "name",
index: u
}), [null, void 0].includes(l.values) && Q({
componentName: "VueUiDonutEvolution",
type: "datasetSerieAttribute",
property: "values",
index: u
});
}), x.dataset.map((l, u) => ({
...l,
values: kt(l.values),
color: ve(l.color) || ot.value[u] || ee[u] || ee[u % ee.length],
length: (l.values || []).length,
uid: Xe()
})))), W = p(() => O.value.filter((l) => !C.value.includes(l.uid)).map((l) => ({
...l,
values: l.values.filter((u, t) => t >= d.value.start && t <= d.value.end)
}))), T = p(() => Math.max(...W.value.map((l) => l.length))), z = p(() => i.value.width / (d.value.end - d.value.start)), w = p(() => {
const l = [];
for (let s = 0; s < d.value.end - d.value.start; s += 1) {
const f = W.value.map((F) => F.values[s] ?? null), h = f.filter((F) => [void 0, null].includes(F)).length === f.length, N = f.reduce((F, L) => F + L, 0), ce = f.map((F) => F / N), M = n.value.left + z.value * s + z.value / 2;
l.push({
index: s,
percentages: ce,
subtotal: h || N < 0 ? null : N,
values: f,
x: M
});
}
const u = 0, t = Math.max(...l.map((s) => s.subtotal)), r = l.length === 1 ? t * 2 : t;
return l.map((s, f) => {
const h = z.value / 2 * 0.7, N = h > i.value.width / 16 ? i.value.width / 16 : h, ce = g.value === s.index ? i.value.width / 16 : N, M = l.length > 4 ? h * 2 : h * 2 > z.value / 2 * 0.7 ? z.value / 2 * 0.7 : h * 2, F = i.value.absoluteHeight - n.value.bottom - i.value.height * s.subtotal / Ge(u, r, e.value.style.chart.layout.grid.yAxis.dataLabels.steps).max;
return {
...s,
y: F,
radius: N,
activeRadius: ce,
hoverRadius: M,
donut: de({
series: W.value.map((L, Me) => ({
color: L.color,
name: L.name,
value: L.values[f] ?? 0
}))
}, s.x, F, N, N, 1.99999, 2, 1, 360, 105.25, N / 2),
donutHover: de({
series: W.value.map((L, Me) => ({
color: L.color,
name: L.name,
value: L.values[f] ?? 0
}))
}, s.x, F, M, M, 1.99999, 2, 1, 360, 105.25, M / 2),
donutFocus: de({
series: W.value.map((L, Me) => ({
color: L.color,
name: L.name,
value: L.values[f] ?? 0
}))
}, i.value.centerX, i.value.centerY, i.value.height / 3.6, i.value.height / 3.6, 1.99999, 2, 1, 360, 105.25, i.value.height / 6)
};
});
});
function q(l, u, t) {
return he(
e.value.style.chart.layout.dataLabels.formatter,
l,
te({
p: e.value.style.chart.layout.dataLabels.prefix,
v: l,
s: e.value.style.chart.layout.dataLabels.suffix,
r: e.value.style.chart.layout.dataLabels.rounding
}),
{ datapoint: u, index: t }
);
}
const ue = p(() => ({
max: Math.max(...w.value.map((l) => l.subtotal)),
min: 0
})), H = p(() => {
const l = w.value.length === 1 ? ue.value.max * 2 : ue.value.max;
return Ge(ue.value.min, l, e.value.style.chart.layout.grid.yAxis.dataLabels.steps);
});
function ut(l) {
return l / H.value.max;
}
const st = p(() => H.value.ticks.map((l) => ({
y: i.value.absoluteHeight - n.value.bottom - i.value.height * ut(l),
value: l
})));
function Fe(l, u) {
return isNaN(l.value / Ke(u, "value")) ? 0 : (l.value / Ke(u, "value") * 100).toFixed(0) + "%";
}
function Pe() {
$.value || (g.value = null, ae.value = null);
}
function nt(l) {
$.value || (g.value = l.index, ae.value = l);
}
const se = b(null);
function ne(l, u) {
l.subtotal && (ae.value = null, g.value = null, $.value = !0, I.value = l, [null, void 0].includes(u) || (se.value = u));
}
function Oe() {
I.value = null, $.value = !1, se.value = null;
}
const De = p(() => O.value.map((l, u) => ({
name: l.name,
value: l.values.slice(d.value.start, d.value.end).reduce((t, r) => t + r, 0),
shape: "circle",
uid: l.uid,
color: l.color
})).sort((l, u) => u.value - l.value).map((l) => ({
...l,
opacity: C.value.includes(l.uid) ? 0.5 : 1,
segregate: () => re(l.uid),
isSegregated: C.value.includes(l.uid)
}))), Ee = p(() => w.value.map((l) => l.subtotal).reduce((l, u) => l + u, 0)), rt = p(() => ({
cy: "donut-div-legend",
backgroundColor: e.value.style.chart.legend.backgroundColor,
color: e.value.style.chart.legend.color,
fontSize: e.value.style.chart.legend.fontSize,
paddingBottom: 12,
fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
}));
function re(l) {
if (C.value.includes(l))
C.value = C.value.filter((u) => u !== l), Ce("selectLegend", null);
else {
if (C.value.length === O.value.length - 1) return;
C.value.push(l), Ce("selectLegend", O.value.find((u) => u.uid === l));
}
I.value && ne(w.value.find((u, t) => t === se.value));
}
const R = p(() => {
const l = [""].concat(O.value.filter((s) => !C.value.includes(s.uid)).map((s) => ({
name: s.name,
color: s.color
}))).concat(["Σ"]);
let u = [];
for (let s = 0; s < T.value; s += 1) {
const f = O.value.filter((h) => !C.value.includes(h.uid)).map((h) => h.values[s] ?? 0).reduce((h, N) => h + N, 0);
u.push([e.value.style.chart.layout.grid.xAxis.dataLabels.values[s] ?? "-"].concat(O.value.filter((h) => !C.value.includes(h.uid)).map((h) => ({
value: h.values[s] ?? 0,
percentage: h.values[s] ? h.values[s] / f * 100 : 0
}))).concat([`${e.value.style.chart.layout.dataLabels.prefix}${Number(f.toFixed(e.value.table.td.roundingValue))}${e.value.style.chart.layout.dataLabels.suffix}`]));
}
const t = {
th: {
backgroundColor: e.value.table.th.backgroundColor,
color: e.value.table.th.color,
outline: e.value.table.th.outline
},
td: {
backgroundColor: e.value.table.td.backgroundColor,
color: e.value.table.td.color,
outline: e.value.table.td.outline
},
breakpoint: e.value.table.responsiveBreakpoint
}, r = [
e.value.table.columnNames.period
].concat(O.value.filter((s) => !C.value.includes(s.uid)).map((s) => s.name)).concat(e.value.table.columnNames.total);
return { head: l, body: u, config: t, colNames: r };
});
function it() {
return O.value;
}
function Te() {
j(() => {
const l = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], u = [...R.value.head.map((f) => f.name ?? f)], t = [...R.value.body.map((f) => f.map((h) => h.value ?? h))], r = l.concat([u]).concat(t), s = wt(r);
zt({ csvContent: s, title: e.value.style.chart.title.text || "vue-ui-donut-evolution" });
});
}
const X = b(!1);
function ct(l) {
X.value = l, me.value += 1;
}
function Ve() {
U.value.showTable = !U.value.showTable;
}
const J = b(!1);
function ie() {
J.value = !J.value;
}
function He(l) {
return l.proportion * 100 > e.value.style.chart.donuts.hover.hideLabelsUnderValue;
}
function Re(l) {
return l.proportion * 100 > e.value.style.chart.donuts.zoom.hideLabelsUnderValue;
}
return Ze({
getData: it,
generatePdf: Ie,
generateCsv: Te,
generateImage: Ne,
toggleTable: Ve,
toggleAnnotator: ie
}), (l, u) => (a(), o("div", {
ref_key: "donutEvolutionChart",
ref: be,
class: P(`vue-ui-donut-evolution ${X.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
style: Z(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor}`),
id: E.value,
onMouseenter: u[4] || (u[4] = () => c(we)(!0)),
onMouseleave: u[5] || (u[5] = () => c(we)(!1))
}, [
e.value.userOptions.buttons.annotator ? (a(), D(Dt, {
key: 0,
svgRef: c(Le),
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
active: J.value,
onClose: ie
}, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : v("", !0),
at.value ? (a(), o("div", {
key: 1,
ref_key: "noTitle",
ref: lt,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : v("", !0),
e.value.style.chart.title.text ? (a(), o("div", {
key: 2,
style: "width:100%;background:transparent;padding-bottom:24px",
onMouseleave: Pe
}, [
(a(), D(Lt, {
key: `title_${pe.value}`,
config: {
title: {
cy: "donut-evolution-div-title",
...e.value.style.chart.title
},
subtitle: {
cy: "donut-evolution-div-subtitle",
...e.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))
], 32)) : v("", !0),
e.value.userOptions.show && K.value && (c(ze) || c(oe)) ? (a(), D(At, {
ref: "details",
key: `user_options_${me.value}`,
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
isPrinting: c(Ae),
isImaging: c($e),
uid: E.value,
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,
isFullscreen: X.value,
titles: { ...e.value.userOptions.buttonTitles },
chartElement: be.value,
position: e.value.userOptions.position,
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: J.value,
onToggleFullscreen: ct,
onGeneratePdf: c(Ie),
onGenerateCsv: Te,
onGenerateImage: c(Ne),
onToggleTable: Ve,
onToggleAnnotator: ie,
style: Z({
visibility: c(ze) ? c(oe) ? "visible" : "hidden" : "visible"
})
}, dt({ _: 2 }, [
l.$slots.menuIcon ? {
name: "menuIcon",
fn: A(({ isOpen: t, color: r }) => [
S(l.$slots, "menuIcon", B(G({ isOpen: t, color: r })), void 0, !0)
]),
key: "0"
} : void 0,
l.$slots.optionPdf ? {
name: "optionPdf",
fn: A(() => [
S(l.$slots, "optionPdf", {}, void 0, !0)
]),
key: "1"
} : void 0,
l.$slots.optionCsv ? {
name: "optionCsv",
fn: A(() => [
S(l.$slots, "optionCsv", {}, void 0, !0)
]),
key: "2"
} : void 0,
l.$slots.optionImg ? {
name: "optionImg",
fn: A(() => [
S(l.$slots, "optionImg", {}, void 0, !0)
]),
key: "3"
} : void 0,
l.$slots.optionTable ? {
name: "optionTable",
fn: A(() => [
S(l.$slots, "optionTable", {}, void 0, !0)
]),
key: "4"
} : void 0,
l.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: A(({ toggleFullscreen: t, isFullscreen: r }) => [
S(l.$slots, "optionFullscreen", B(G({ toggleFullscreen: t, isFullscreen: r })), void 0, !0)
]),
key: "5"
} : void 0,
l.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: A(({ toggleAnnotator: t, isAnnotator: r }) => [
S(l.$slots, "optionAnnotator", B(G({ toggleAnnotator: t, isAnnotator: r })), void 0, !0)
]),
key: "6"
} : void 0
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : v("", !0),
K.value ? (a(), o("svg", {
key: 4,
ref_key: "svgRef",
ref: Le,
xmlns: c(_t),
class: P({ "vue-data-ui-fullscreen--on": X.value, "vue-data-ui-fulscreen--off": !X.value }),
viewBox: `0 0 ${i.value.absoluteWidth} ${i.value.absoluteHeight}`,
style: Z(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color}`)
}, [
ht(Ot),
l.$slots["chart-background"] ? (a(), o("foreignObject", {
key: 0,
x: n.value.left,
y: n.value.top,
width: i.value.width,
height: i.value.height,
style: {
pointerEvents: "none"
}
}, [
S(l.$slots, "chart-background", {}, void 0, !0)
], 8, Mt)) : v("", !0),
y("defs", null, [
y("linearGradient", {
id: `hover_${E.value}`,
x1: "0%",
y1: "0%",
x2: "0%",
y2: "100%"
}, [
y("stop", {
offset: "0%",
"stop-color": c(Y)(e.value.style.chart.backgroundColor, e.value.style.chart.layout.highlighter.opacity)
}, null, 8, Wt),
y("stop", {
offset: "100%",
"stop-color": c(Y)(e.value.style.chart.layout.highlighter.color, e.value.style.chart.layout.highlighter.opacity)
}, null, 8, Xt)
], 8, Ut),
y("radialGradient", {
id: `focus_${E.value}`
}, [
y("stop", {
offset: "0%",
"stop-color": c(Y)(c(ve)(e.value.style.chart.backgroundColor), 0)
}, null, 8, Gt),
y("stop", {
offset: "77%",
"stop-color": c(Y)("#FFFFFF", 30)
}, null, 8, jt),
y("stop", {
offset: "100%",
"stop-color": c(Y)(c(ve)(e.value.style.chart.backgroundColor), 0)
}, null, 8, Yt)
], 8, Bt)
]),
e.value.style.chart.layout.grid.show ? (a(), o("g", Kt, [
y("line", {
x1: n.value.left,
x2: n.value.left,
y1: n.value.top,
y2: n.value.top + i.value.height,
stroke: e.value.style.chart.layout.grid.stroke,
"stroke-width": e.value.style.chart.layout.grid.strokeWidth,
"stroke-linecap": "round"
}, null, 8, qt),
y("line", {
x1: n.value.left,
x2: i.value.absoluteWidth - n.value.right,
y1: i.value.absoluteHeight - n.value.bottom,
y2: i.value.absoluteHeight - n.value.bottom,
stroke: e.value.style.chart.layout.grid.stroke,
"stroke-width": e.value.style.chart.layout.grid.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Jt),
e.value.style.chart.layout.grid.showVerticalLines ? (a(), o("g", Zt, [
(a(!0), o(k, null, _(d.value.end - d.value.start, (t, r) => (a(), o("line", {
x1: n.value.left + (r + 1) * z.value,
x2: n.value.left + (r + 1) * z.value,
y1: n.value.top,
y2: i.value.absoluteHeight - n.value.bottom,
stroke: e.value.style.chart.layout.grid.stroke,
"stroke-width": e.value.style.chart.layout.grid.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Qt))), 256))
])) : v("", !0)
])) : v("", !0),
e.value.style.chart.layout.grid.yAxis.dataLabels.show ? (a(), o("g", {
key: 2,
class: P({ "donut-opacity": !0, "donut-behind": g.value !== null || $.value })
}, [
(a(!0), o(k, null, _(st.value, (t, r) => (a(), o("g", null, [
t.value >= H.value.min && t.value <= H.value.max ? (a(), o("line", {
key: 0,
x1: n.value.left,
x2: n.value.left - 5,
y1: t.y,
y2: t.y,
stroke: e.value.style.chart.layout.grid.stroke,
"stroke-width": e.value.style.chart.layout.grid.strokeWidth
}, null, 8, el)) : v("", !0),
t.value >= H.value.min && t.value <= H.value.max ? (a(), o("text", {
key: 1,
x: n.value.left - 8 + e.value.style.chart.layout.grid.yAxis.dataLabels.offsetX,
y: t.y + e.value.style.chart.layout.grid.yAxis.dataLabels.fontSize / 3,
"font-size": e.value.style.chart.layout.grid.yAxis.dataLabels.fontSize,
"text-anchor": "end",
fill: e.value.style.chart.layout.grid.yAxis.dataLabels.color,
"font-weight": e.value.style.chart.layout.grid.yAxis.dataLabels.bold ? "bold" : "normal"
}, m(c(Ct)(t.value) ? c(he)(
e.value.style.chart.layout.dataLabels.formatter,
t.value,
c(te)({
p: e.value.style.chart.layout.dataLabels.prefix,
v: t.value,
s: e.value.style.chart.layout.dataLabels.suffix,
r: e.value.style.chart.layout.grid.yAxis.dataLabels.roundingValue
}),
{ datapoint: t, seriesIndex: r }
) : ""), 9, tl)) : v("", !0)
]))), 256))
], 2)) : v("", !0),
e.value.style.chart.layout.grid.xAxis.dataLabels.show ? (a(), o("g", {
key: 3,
class: P({ "donut-opacity": !0, "donut-behind": $.value })
}, [
(a(!0), o(k, null, _(d.value.end - d.value.start, (t, r) => (a(), o("g", null, [
e.value.style.chart.layout.grid.xAxis.dataLabels.showOnlyFirstAndLast && (r === 0 || r === T.value - 1) || !e.value.style.chart.layout.grid.xAxis.dataLabels.showOnlyFirstAndLast ? (a(), o("text", {
key: 0,
"text-anchor": e.value.style.chart.layout.grid.xAxis.dataLabels.rotation > 0 ? "start" : e.value.style.chart.layout.grid.xAxis.dataLabels.rotation < 0 ? "end" : "middle",
"font-size": e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize,
fill: e.value.style.chart.layout.grid.xAxis.dataLabels.color,
transform: `translate(${n.value.left + z.value * r + z.value / 2}, ${e.value.style.chart.layout.grid.xAxis.dataLabels.offsetY + i.value.absoluteHeight - n.value.bottom + e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize * 2}), rotate(${e.value.style.chart.layout.grid.xAxis.dataLabels.rotation})`
}, m(e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(r) + Number(d.value.start)] ?? ""), 9, ll)) : v("", !0)
]))), 256))
], 2)) : v("", !0),
(a(!0), o(k, null, _(w.value, (t, r) => (a(), o("g", null, [
e.value.style.chart.layout.line.show && r < w.value.length - 1 && ![t.subtotal, w.value[r + 1].subtotal].includes(null) ? (a(), o("line", {
key: 0,
class: P({ "donut-opacity": !0, "donut-behind": g.value !== null || $.value }),
x1: t.x,
y1: t.y,
x2: w.value[r + 1].x,
y2: w.value[r + 1].y,
stroke: e.value.style.chart.layout.line.stroke,
"stroke-width": e.value.style.chart.layout.line.strokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null, 10, al)) : v("", !0),
t.subtotal !== null ? (a(), o("g", ol, [
t.subtotal ? (a(), o("circle", {
key: 0,
cx: t.x,
cy: t.y,
r: t.activeRadius,
fill: e.value.style.chart.backgroundColor
}, null, 8, ul)) : v("", !0)
])) : v("", !0)
]))), 256)),
(a(!0), o(k, null, _(w.value, (t, r) => (a(), o("g", {
class: P({ "donut-opacity": !0, "donut-behind": r !== g.value && g.value !== null || $.value })
}, [
t.subtotal ? (a(), o("g", sl, [
g.value !== null && g.value === r ? (a(), o("g", nl, [
(a(!0), o(k, null, _(t.donutHover, (s) => (a(), o("g", null, [
He(s) ? (a(), o("path", {
key: 0,
d: c(je)(s, { x: s.center.endX, y: s.center.endY }, 12, 12, { x: t.x, y: t.y }, !1, 20),
stroke: s.color,
"stroke-width": "1",
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none"
}, null, 8, rl)) : v("", !0)
]))), 256)),
(a(!0), o(k, null, _(t.donutHover, (s, f) => (a(), o("g", null, [
He(s) ? (a(), o("text", {
key: 0,
"data-cy-hover-label": "",
"text-anchor": c(le)(s, !0, 0).anchor,
x: c(le)(s, !0, 9).x,
y: c(Ye)(s, 14, 10),
fill: e.value.style.chart.layout.grid.yAxis.dataLabels.color,
"font-size": 8,
"font-weight": "bold"
}, m(s.name) + ": " + m(Fe(s, t.donut)) + " (" + m(s.value === null ? "-" : q(s.value, s, f)) + ") ", 9, il)) : v("", !0)
]))), 256)),
y("g", null, [
y("circle", {
cx: t.x,
cy: t.y,
r: t.hoverRadius,
fill: e.value.style.chart.backgroundColor
}, null, 8, cl)
])
])) : v("", !0)
])) : v("", !0)
], 2))), 256)),
(a(!0), o(k, null, _(w.value, (t, r) => (a(), o("g", {
class: P({ "donut-opacity": !0, "donut-behind": r !== g.value && g.value !== null || $.value })
}, [
t.subtotal !== null ? (a(), o("g", vl, [
t.subtotal === 0 ? (a(), o("circle", {
key: 0,
cx: t.x,
cy: t.y,
r: 3,
fill: e.value.style.chart.color
}, null, 8, dl)) : g.value !== null && g.value === r ? (a(), o("g", hl, [
(a(!0), o(k, null, _(t.donutHover, (s, f) => (a(), o("path", {
d: s.arcSlice,
fill: `${s.color}`,
"stroke-width": 1,
stroke: e.value.style.chart.backgroundColor
}, null, 8, yl))), 256))
])) : (a(), o("g", fl, [
(a(!0), o(k, null, _(t.donut, (s, f) => (a(), o("path", {
d: s.arcSlice,
fill: `${s.color}`,
"stroke-width": 0.5,
stroke: e.value.style.chart.backgroundColor
}, null, 8, gl))), 256))
]))
])) : v("", !0)
], 2))), 256)),
(a(!0), o(k, null, _(w.value, (t, r) => (a(), o("g", {
class: P({ "donut-opacity": !0, "donut-behind": r !== g.value && g.value !== null || $.value })
}, [
t.subtotal !== null && e.value.style.chart.layout.dataLabels.show ? (a(), o("text", {
key: 0,
"text-anchor": "middle",
x: t.x,
y: g.value === t.index && t.subtotal ? t.y + e.value.style.chart.layout.dataLabels.fontSize / 3 : t.y - t.radius - e.value.style.chart.layout.dataLabels.fontSize + e.value.style.chart.layout.dataLabels.offsetY,
"font-size": e.value.style.chart.layout.dataLabels.fontSize,
"font-weight": "bold",
fill: e.value.style.chart.layout.dataLabels.color
}, m(q(t.subtotal, t, r)), 9, bl)) : v("", !0)
], 2))), 256)),
(a(!0), o(k, null, _(w.value, (t, r) => (a(), o("rect", {
x: n.value.left + r * z.value,
y: i.value.absoluteHeight - n.value.bottom - 10,
width: z.value,
height: 10,
fill: g.value === t.index ? `url(#hover_${E.value})` : "transparent",
onClick: (s) => ne(t, r),
class: P({ "donut-hover": g.value === t.index && t.subtotal })
}, null, 10, ml))), 256)),
(a(!0), o(k, null, _(w.value, (t, r) => (a(), o("rect", {
"data-cy-trap": "",
x: n.value.left + r * z.value,
y: n.value.top,
width: z.value,
height: i.value.height,
fill: "transparent",
onMouseenter: (s) => nt(t),
onMouseleave: Pe,
onClick: (s) => ne(t, r),
class: P({ "donut-hover": g.value === t.index && t.subtotal })
}, null, 42, xl))), 256)),
$.value ? (a(), o("g", pl, [
y("rect", {
rx: 4,
x: n.value.left,
y: n.value.top,
width: i.value.width,
height: i.value.height,
fill: e.value.style.chart.backgroundColor,
style: { filter: "drop-shadow(0 12px 12px rgba(0,0,0,0.3))" }
}, null, 8, kl),
y("line", {
"data-html2canvas-ignore": "",
x1: i.value.absoluteWidth - n.value.right - 15,
y1: n.value.top + 5,
x2: i.value.absoluteWidth - n.value.right - 4,
y2: n.value.top + 15.5,
"stroke-linecap": "round",
stroke: e.value.style.chart.color,
"stroke-width": "1.5"
}, null, 8, _l),
y("line", {
"data-html2canvas-ignore": "",
x1: i.value.absoluteWidth - n.value.right - 15,
y2: n.value.top + 5,
x2: i.value.absoluteWidth - n.value.right - 4,
y1: n.value.top + 15.5,
"stroke-linecap": "round",
stroke: e.value.style.chart.color,
"stroke-width": "1.5"
}, null, 8, Cl),
y("circle", {
"data-cy-close": "",
onClick: Oe,
onKeypress: yt(Oe, ["enter"]),
cx: i.value.absoluteWidth - n.value.right - i.value.width / 40,
cy: n.value.top + i.value.height / 30,
r: i.value.height / 12,
fill: "transparent",
style: { cursor: "pointer" },
tabindex: "0"
}, null, 40, wl),
(a(!0), o(k, null, _(I.value.donutFocus, (t) => (a(), o("g", null, [
Re(t) ? (a(), o("path", {
key: 0,
"data-cy-zoom-donut": "",
d: c(je)(t, { x: i.value.centerX, y: i.value.centerY }, 12, 12, !1, !1, 15),
stroke: t.color,
"stroke-width": "1",
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none",
class: "vue-ui-donut-evolution-focus"
}, null, 8, zl)) : v("", !0)
]))), 256)),
y("circle", {
cx: n.value.left + i.value.width / 2,
cy: n.value.top + i.value.height / 2,
r: i.value.height / 7,
fill: e.value.style.chart.backgroundColor
}, null, 8, Ll),
(a(!0), o(k, null, _(I.value.donutFocus, (t, r) => (a(), o("path", {
d: t.arcSlice,
fill: `${t.color}`,
"stroke-width": 1,
stroke: e.value.style.chart.backgroundColor,
class: "vue-ui-donut-evolution-focus"
}, null, 8, Sl))), 256)),
(a(!0), o(k, null, _(I.value.donutFocus, (t, r) => (a(), o("g", Al, [
Re(t) ? (a(), o("text", {
key: 0,
"text-anchor": c(le)(t, !0, 20).anchor,
x: c(le)(t, !0, 10).x,
y: c(Ye)(t),
fill: e.value.style.chart.layout.grid.yAxis.dataLabels.color,
"font-size": 10,
"font-weight": "bold"
}, m(t.name) + ": " + m(Fe(t, I.value.donutFocus)) + " (" + m(t.value === null ? "-" : q(t.value, t, r)) + ") ", 9, $l)) : v("", !0)
]))), 256)),
y("circle", {
cx: n.value.left + i.value.width / 2,
cy: n.value.top + i.value.height / 2,
r: i.value.height / 3.8,
fill: `url(#focus_${E.value})`
}, null, 8, Il),
y("circle", {
cx: n.value.left + i.value.width / 2,
cy: n.value.top + i.value.height / 2,
r: i.value.height / 7.7,
fill: e.value.style.chart.backgroundColor
}, null, 8, Nl),
y("text", {
"text-anchor": "middle",
x: n.value.left + i.value.width / 2,
y: n.value.top + i.value.height / 2 + 14 / 3,
"font-size": 14,
"font-weight": "bold",
fill: e.value.style.chart.layout.dataLabels.color,
class: "vue-ui-donut-evolution-focus"
}, m(q(I.value.subtotal, I.value, null)), 9, Fl),
e.value.style.chart.layout.grid.xAxis.dataLabels.values[I.value.index] ? (a(), o("text", {
key: 0,
x: n.value.left + 6,
y: n.value.top + e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize * 2,
"font-size": e.value.style.chart.layout.grid.xAxis.dataLabels.fontSize * 1.6,
fill: e.value.style.chart.layout.dataLabels.color
}, m(e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(I.value.index) + Number(d.value.start)]), 9, Pl)) : v("", !0)
])) : v("", !0),
S(l.$slots, "svg", { svg: i.value }, void 0, !0)
], 14, Rt)) : v("", !0),
l.$slots.watermark ? (a(), o("div", Ol, [
S(l.$slots, "watermark", B(G({ isPrinting: c(Ae) || c($e) })), void 0, !0)
])) : v("", !0),
K.value ? v("", !0) : (a(), D(Nt, {
key: 6,
config: {
type: "donutEvolution",
style: {
backgroundColor: e.value.style.chart.backgroundColor,
donutEvolution: {
axis: {
color: "#CCCCCC"
},
donuts: {
color: "#CCCCCC"
}
}
}
}
}, null, 8, ["config"])),
T.value > 1 && e.value.style.chart.zoom.show ? (a(), D(Ft, {
ref_key: "slicerComponent",
ref: V,
key: `slicer_${xe.value}`,
background: e.value.style.chart.zoom.color,
borderColor: e.value.style.chart.backgroundColor,
fontSize: e.value.style.chart.zoom.fontSize,
useResetSlot: e.value.style.chart.zoom.useResetSlot,
labelLeft: e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(d.value.start)] || "",
labelRight: e.value.style.chart.layout.grid.xAxis.dataLabels.values[Number(d.value.end) - 1] || "",
textColor: e.value.style.chart.color,
inputColor: e.value.style.chart.zoom.color,
selectColor: e.value.style.chart.zoom.highlightColor,
max: T.value,
min: 0,
valueStart: d.value.start,
valueEnd: d.value.end,
start: d.value.start,
"onUpdate:start": u[0] || (u[0] = (t) => d.value.start = t),
end: d.value.end,
"onUpdate:end": u[1] || (u[1] = (t) => d.value.end = t),
refreshStartPoint: e.value.style.chart.zoom.startIndex !== null ? e.value.style.chart.zoom.startIndex : 0,
refreshEndPoint: e.value.style.chart.zoom.endIndex !== null ? e.value.style.chart.zoom.endIndex + 1 : T.value,
enableRangeHandles: e.value.style.chart.zoom.enableRangeHandles,
enableSelectionDrag: e.value.style.chart.zoom.enableSelectionDrag,
onReset: ye
}, {
"reset-action": A(({ reset: t }) => [
S(l.$slots, "reset-action", B(G({ reset: t })), void 0, !0)
]),
_: 3
}, 8, ["background", "borderColor", "fontSize", "useResetSlot", "labelLeft", "labelRight", "textColor", "inputColor", "selectColor", "max", "valueStart", "valueEnd", "start", "end", "refreshStartPoint", "refreshEndPoint", "enableRangeHandles", "enableSelectionDrag"])) : v("", !0),
e.value.style.chart.legend.show ? (a(), D(It, {
key: `legend_${_e.value}`,
legendSet: De.value,
config: rt.value,
onClickMarker: u[2] || (u[2] = ({ legend: t }) => re(t.uid))
}, {
item: A(({ legend: t, index: r }) => [
y("div", {
onClick: (s) => re(t.uid),
style: Z(`opacity:${C.value.includes(t.uid) ? 0.5 : 1}`)
}, [
We(m(t.name) + ": " + m(c(he)(
e.value.style.chart.layout.dataLabels.formatter,
t.value,
c(te)({
p: e.value.style.chart.layout.dataLabels.prefix,
v: t.value,
s: e.value.style.chart.layout.dataLabels.suffix,
r: e.value.style.chart.legend.roundingValue
}),
{ datapoint: t, seriesIndex: r }
)) + " ", 1),
C.value.includes(t.uid) ? (a(), o("span", Tl, " ( - % ) ")) : (a(), o("span", El, " (" + m(isNaN(t.value / Ee.value) ? "-" : c(te)({
v: t.value / Ee.value * 100,
s: "%",
r: e.value.style.chart.legend.roundingPercentage
})) + ") ", 1))
], 12, Dl)
]),
_: 1
}, 8, ["legendSet", "config"])) : v("", !0),
S(l.$slots, "legend", { legend: De.value }, void 0, !0),
l.$slots.source ? (a(), o("div", Vl, [
S(l.$slots, "source", {}, void 0, !0)
], 512)) : v("", !0),
K.value ? (a(), D(Pt, {
key: 10,
hideDetails: "",
config: {
open: U.value.showTable,
maxHeight: 1e4,
body: {
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color
},
head: {
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color
}
}
}, {
content: A(() => [
(a(), D($t, {
key: `table_${ke.value}`,
colNames: R.value.colNames,
head: R.value.head,
body: R.value.body,
config: R.value.config,
title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
onClose: u[3] || (u[3] = (t) => U.value.showTable = !1)
}, {
th: A(({ th: t }) => [
We(m(t.name ?? t), 1)
]),
td: A(({ td: t }) => [
t.value === null ? (a(), o("span", Hl, "-")) : (a(), o("b", Rl, m(isNaN(t.value) ? "" : e.value.style.chart.layout.dataLabels.prefix) + m(!isNaN(t.value) && t.value !== null ? Number(t.value.toFixed(e.value.table.td.roundingValue)).toLocaleString() : t) + m(isNaN(t.value) ? "" : e.value.style.chart.layout.dataLabels.suffix), 1)),
y("span", null, m(t.percentage && !isNaN(t.percentage) ? `(${Number(t.percentage.toFixed(e.value.table.td.roundingPercentage)).toLocaleString()}%)` : ""), 1)
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title"]))
]),
_: 1
}, 8, ["config"])) : v("", !0)
], 46, Ht));
}
}, aa = /* @__PURE__ */ Vt(Ml, [["__scopeId", "data-v-0880a0ca"]]);
export {
aa as default
};