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