vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
702 lines (701 loc) • 29.4 kB
JavaScript
import { defineAsyncComponent as O, computed as h, ref as u, watch as xe, shallowRef as Te, onMounted as et, onBeforeUnmount as tt, createElementBlock as i, openBlock as s, unref as r, normalizeStyle as X, normalizeClass as E, createBlock as P, createCommentVNode as p, createElementVNode as S, createVNode as Oe, createSlots as at, withCtx as f, renderSlot as v, normalizeProps as F, guardReactiveProps as M, Fragment as D, renderList as L, toDisplayString as R, createTextVNode as lt, nextTick as ot } from "vue";
import { u as nt, c as st, t as rt, p as Pe, a as ut, b as it, o as ct, e as Z, d as vt, X as dt, f as V, i as ee, x as _e, q as ht, r as ft, y as gt } from "./index-BLtEpj8j.js";
import { t as pt, u as yt } from "./useResponsive-DfdjqQps.js";
import { u as Ie } from "./useNestedProp-Bw1KcAmj.js";
import { u as mt } from "./usePrinter-DnRwTdvS.js";
import { u as bt } from "./useUserOptionState-BIvW1Kz7.js";
import { u as kt } from "./useChartAccessibility-9icAAmYg.js";
import wt from "./Title-DkG60EPg.js";
import $t from "./Legend-E7G897sw.js";
import Ct from "./img-D-vWHxhM.js";
import { _ as xt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Tt = ["id"], Ot = ["xmlns", "viewBox"], Pt = ["width", "height"], _t = ["cx", "cy", "r", "stroke", "stroke-width", "stroke-dasharray", "stroke-dashoffset"], It = ["cx", "cy", "r", "stroke", "stroke-width", "stroke-dasharray", "stroke-dashoffset"], At = ["id"], St = ["stdDeviation"], Ft = ["filter"], Mt = ["cx", "cy", "r", "stroke-width", "stroke-dasharray", "stroke-dashoffset"], Rt = ["cx", "cy", "r", "stroke-width", "stroke-dasharray", "stroke-dashoffset", "onMouseenter"], Nt = { key: 2 }, Dt = ["onMouseenter"], Lt = ["x", "y", "font-size", "fill", "font-weight"], Vt = {
key: 5,
class: "vue-data-ui-watermark"
}, zt = ["onClick"], Bt = ["innerHTML"], Yt = {
__name: "vue-ui-onion",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectLegend"],
setup(Ae, { expose: Se, emit: Fe }) {
const Me = O(() => import("./vue-ui-accordion-B6Svdk-2.js")), Re = O(() => import("./DataTable-CS_V_Adx.js")), Ne = O(() => import("./PackageVersion-CnRyWKP-.js")), De = O(() => import("./PenAndPaper-7BWf7zgA.js")), Le = O(() => import("./vue-ui-skeleton-CsMU8DwQ.js")), Ve = O(() => import("./Tooltip-CuHsd1IQ.js")), ze = O(() => import("./UserOptions-DGw0HvSp.js")), { vue_ui_onion: Be } = nt(), $ = Ae, z = h(() => !!$.dataset && $.dataset.length), _ = u(st()), Ye = u(null), te = u(0), B = u(!1), G = u(""), y = u([]), C = u(null), ae = u(null), le = u(null), oe = u(null), ne = u(null), se = u(0), re = u(0), ue = u(0), e = h({
get: () => de(),
set: (t) => t
}), { userOptionsVisible: H, setUserOptionsVisibility: ie, keepUserOptionState: ce } = bt({ config: e.value }), { svgRef: ve } = kt({ config: e.value.style.chart.title });
function de() {
const t = Ie({
userConfig: $.config,
defaultConfig: Be
});
return t.theme ? {
...Ie({
userConfig: ut.vue_ui_onion[t.theme] || $.config,
defaultConfig: t
}),
customPalette: rt[t.theme] || Pe
} : t;
}
xe(() => $.config, (t) => {
e.value = de(), H.value = !e.value.userOptions.showOnChartHover, ye(), se.value += 1, re.value += 1, ue.value += 1, m.value.showTable = e.value.table.show, m.value.showTooltip = e.value.style.chart.tooltip.show;
}, { deep: !0 });
const { isPrinting: he, isImaging: fe, generatePdf: ge, generateImage: pe } = mt({
elementId: `vue-ui-onion_${_.value}`,
fileName: e.value.style.chart.title.text || "vue-ui-onion",
options: e.value.userOptions.print
}), Ue = h(() => e.value.userOptions.show && !e.value.style.chart.title.text), Xe = h(() => it(e.value.customPalette)), m = u({
showTable: e.value.table.show,
showTooltip: e.value.style.chart.tooltip.show
}), n = u({
height: 512,
width: 512,
padding: {
top: 64,
left: 64,
right: 64,
bottom: 64
},
minRadius: 64
}), x = Te(null), I = Te(null);
et(() => {
ye();
});
function ye() {
if (ct($.dataset) && Z({
componentName: "VueUiOnion",
type: "dataset"
}), e.value.responsive) {
const o = pt(() => {
const { width: a, height: l } = yt({
chart: C.value,
title: e.value.style.chart.title.text ? ae.value : null,
legend: e.value.style.chart.legend.show ? le.value : null,
source: oe.value,
noTitle: ne.value
});
requestAnimationFrame(() => {
n.value.width = a, n.value.height = l, n.value.padding.top = Math.max(a, l) * 0.125, n.value.padding.right = Math.max(a, l) * 0.125, n.value.padding.bottom = Math.max(a, l) * 0.125, n.value.padding.left = Math.max(a, l) * 0.125, n.value.minRadius = Math.min(a, l) * 0.125;
});
});
x.value && (I.value && x.value.unobserve(I.value), x.value.disconnect()), x.value = new ResizeObserver(o), I.value = C.value.parentNode, x.value.observe(I.value);
}
}
tt(() => {
x.value && (I.value && x.value.unobserve(I.value), x.value.disconnect());
});
const c = h(() => ({
top: n.value.padding.top,
left: n.value.padding.left,
right: n.value.width - n.value.padding.right,
bottom: n.value.height - n.value.padding.bottom,
centerX: n.value.width / 2,
centerY: n.value.height / 2,
width: n.value.width - n.value.padding.right - n.value.padding.left,
height: n.value.height - n.value.padding.bottom - n.value.padding.top,
minRadius: n.value.minRadius,
maxRadius: Math.min(n.value.width, n.value.height) - n.value.padding.top * 2
})), d = h(() => ($.dataset.forEach((t, o) => {
[null, void 0].includes(t.name) && Z({
componentName: "VueUiOnion",
type: "datasetSerieAttribute",
property: "name",
index: o
}), [void 0].includes(t.percentage) && Z({
componentName: "VueUiOnion",
type: "datasetSerieAttribute",
property: "percentage",
index: o
});
}), $.dataset.map((t, o) => {
const a = `onion_serie_${o}_${_.value}`;
return {
...t,
percentage: t.percentage || 0,
targetPercentage: t.percentage || 0,
color: vt(t.color) || Xe.value[o] || Pe[o],
id: a,
shape: "circle",
opacity: y.value.includes(a) ? 0.5 : 1,
absoluteIndex: o,
segregate: () => me(a),
isSegregated: y.value.includes(a)
};
}))), N = u(d.value), Ee = h(() => e.value.useStartAnimation), Ge = u(null), He = h(() => Math.max(...d.value.map((t) => t.percentage))), W = u(!1);
xe(() => d.value, We, { immediate: !0 });
function We() {
if (Ee.value && !W.value) {
let o = function() {
t >= He.value ? (cancelAnimationFrame(Ge.value), N.value = d.value, W.value = !0) : (N.value = d.value.map((a) => ({
...a,
percentage: t < a.targetPercentage ? t : a.targetPercentage
})), t += 1, requestAnimationFrame(o), W.value = !0);
};
N.value = d.value.map((a) => ({
...a,
percentage: 0
}));
let t = 0;
o();
} else
N.value = d.value;
}
const je = h(() => ({
cy: "onion-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" : ""
})), qe = h(() => d.value.filter((t) => !y.value.includes(t.id)).length), T = h(() => {
const t = Math.min(c.value.width, c.value.height) / 2 / d.value.length;
return {
gutter: (t > e.value.style.chart.layout.maxThickness ? e.value.style.chart.layout.maxThickness : t) * e.value.style.chart.layout.gutter.width,
track: (t > e.value.style.chart.layout.maxThickness ? e.value.style.chart.layout.maxThickness : t) * e.value.style.chart.layout.track.width
};
}), k = h(() => N.value.filter((t) => !y.value.includes(t.id)).map((t, o) => {
const a = (c.value.maxRadius - T.value.track) / qe.value / 2 * (1 + o), l = c.value.centerY - a;
return {
percentage: t.percentage || 0,
...t,
labelY: l,
radius: a,
path: Je(a, t.percentage || 0)
};
}));
function Je(t, o) {
const a = 2 * Math.PI * t, l = a * 0.75, g = `${l} ${a}`, b = l * (1 - o / 100);
return {
bgDashArray: `${l} ${a}`,
bgDashOffset: 0,
dashArray: g,
dashOffset: b,
fullOffset: 0,
active: `
M ${c.value.centerX},${c.value.centerY - t}
A ${t},${t} 0 1 1
${c.value.centerX + t * Math.cos(Math.PI * 3 / 4)},${c.value.centerY + t * Math.sin(Math.PI * 3 / 4)}
`.trim()
};
}
const Ke = Fe;
function me(t) {
y.value.includes(t) ? y.value = y.value.filter((o) => o !== t) : y.value.push(t), Ke("selectLegend", k.value);
}
function Qe() {
return k.value;
}
const j = h(() => {
const t = [e.value.table.translations.serie, e.value.table.translations.percentage, e.value.table.translations.value], o = k.value.map((a) => [
a.name,
a.percentage,
a.value
]);
return { head: t, body: o };
}), Y = h(() => {
const t = j.value.head, o = k.value.map((l) => [
`<span style="color:${l.color}">⬤</span> ${l.name}`,
`${Number(l.percentage ?? 0).toFixed(e.value.table.td.roundingPercentage).toLocaleString()}%`,
`${l.prefix || ""}${[null, void 0, NaN, "NaN"].includes(l.value) ? "-" : l.value.toFixed(e.value.table.td.roundingValue).toLocaleString()}${l.suffix || ""}`
]), a = {
th: {
backgroundColor: e.value.table.th.backgroundColor,
color: e.value.table.th.color,
outline: e.value.table.th.outline
},
td: {
backgroundColor: e.value.table.td.backgroundColor,
color: e.value.table.td.color,
outline: e.value.table.td.outline
},
breakpoint: e.value.table.responsiveBreakpoint
};
return { head: t, body: o, config: a, colNames: t };
});
function be(t = null) {
ot(() => {
const o = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [""]], a = j.value.head, l = j.value.body, g = o.concat([a]).concat(l), b = ht(g);
t ? t(b) : ft({ csvContent: b, title: e.value.style.chart.title.text || "vue-ui-onion" });
});
}
const w = u(void 0), A = u(!1);
function ke(t) {
A.value = t, te.value += 1;
}
const q = u(null);
function we({ datapoint: t, seriesIndex: o, show: a = !0 }) {
const l = t.absoluteIndex;
w.value = o, q.value = {
datapoint: t,
seriesIndex: l,
series: d.value,
config: e.value
}, B.value = a;
let g = "";
const b = e.value.style.chart.tooltip.customFormat;
if (_e(b) && gt(() => b({
seriesIndex: l,
datapoint: t,
series: d.value,
config: e.value
})))
G.value = b({
seriesIndex: l,
datapoint: t,
series: d.value,
config: e.value
});
else {
const K = e.value.style.chart.tooltip.showPercentage, Q = e.value.style.chart.tooltip.showValue;
g += `<div style="width: 100%; border-bottom: 1px solid ${e.value.style.chart.tooltip.borderColor}; padding-bottom: 6px;margin-bottom:3px;display:flex;flex-direction:row;gap:3px;align-items:center"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${t.color}"/></svg><span></span>${t.name}</span></div>`, g += `<div style="width:100%;text-align:left;"><b>${K ? V({ p: "", v: t.percentage, s: "%", r: e.value.style.chart.tooltip.roundingPercentage }) : ""}</b> ${K && Q ? "(" : ""}${Q ? ee(
e.value.style.chart.layout.labels.value.formatter,
t.value,
V({
p: t.prefix || "",
v: t.value,
s: t.suffix || "",
r: e.value.style.chart.tooltip.roundingValue
}),
{ datapoint: t, seriesIndex: o }
) : ""}${K && Q ? ")" : ""}</div>`, G.value = `<div>${g}</div>`;
}
}
function $e() {
m.value.showTable = !m.value.showTable;
}
function Ce() {
m.value.showTooltip = !m.value.showTooltip;
}
const U = u(!1);
function J() {
U.value = !U.value;
}
async function Ze({ scale: t = 2 } = {}) {
if (!C.value) return;
const { width: o, height: a } = C.value.getBoundingClientRect(), l = o / a, { imageUri: g, base64: b } = await Ct({ domElement: C.value, base64: !0, img: !0, scale: t });
return {
imageUri: g,
base64: b,
title: e.value.style.chart.title.text,
width: o,
height: a,
aspectRatio: l
};
}
return Se({
getData: Qe,
getImage: Ze,
generatePdf: ge,
generateCsv: be,
generateImage: pe,
toggleTable: $e,
toggleTooltip: Ce,
toggleAnnotator: J,
toggleFullscreen: ke
}), (t, o) => (s(), i("div", {
class: E(`vue-ui-onion ${A.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
ref_key: "onionChart",
ref: C,
id: `vue-ui-onion_${_.value}`,
style: X(`font-family:${e.value.style.fontFamily};width:100%; ${e.value.responsive ? "height: 100%;" : ""} text-align:center;background:${e.value.style.chart.backgroundColor}`),
onMouseenter: o[4] || (o[4] = () => r(ie)(!0)),
onMouseleave: o[5] || (o[5] = () => r(ie)(!1))
}, [
e.value.userOptions.buttons.annotator ? (s(), P(r(De), {
key: 0,
svgRef: r(ve),
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
active: U.value,
onClose: J
}, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : p("", !0),
Ue.value ? (s(), i("div", {
key: 1,
ref_key: "noTitle",
ref: ne,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : p("", !0),
e.value.style.chart.title.text ? (s(), i("div", {
key: 2,
ref_key: "chartTitle",
ref: ae,
style: "width:100%;background:transparent"
}, [
(s(), P(wt, {
key: `title_${se.value}`,
config: {
title: {
cy: "onion-div-title",
...e.value.style.chart.title
},
subtitle: {
cy: "onion-div-subtitle",
...e.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))
], 512)) : p("", !0),
e.value.userOptions.show && z.value && (r(ce) || r(H)) ? (s(), P(r(ze), {
ref_key: "details",
ref: Ye,
key: `user_options${te.value}`,
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
isImaging: r(fe),
isPrinting: r(he),
uid: _.value,
hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
hasPdf: e.value.userOptions.buttons.pdf,
hasImg: e.value.userOptions.buttons.img,
hasXls: e.value.userOptions.buttons.csv,
hasTable: e.value.userOptions.buttons.table,
hasFullscreen: e.value.userOptions.buttons.fullscreen,
isFullscreen: A.value,
isTooltip: m.value.showTooltip,
titles: { ...e.value.userOptions.buttonTitles },
chartElement: C.value,
position: e.value.userOptions.position,
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: U.value,
callbacks: e.value.userOptions.callbacks,
printScale: e.value.userOptions.print.scale,
onToggleFullscreen: ke,
onGeneratePdf: r(ge),
onGenerateCsv: be,
onGenerateImage: r(pe),
onToggleTable: $e,
onToggleTooltip: Ce,
onToggleAnnotator: J,
style: X({
visibility: r(ce) ? r(H) ? "visible" : "hidden" : "visible"
})
}, at({ _: 2 }, [
t.$slots.menuIcon ? {
name: "menuIcon",
fn: f(({ isOpen: a, color: l }) => [
v(t.$slots, "menuIcon", F(M({ isOpen: a, color: l })), void 0, !0)
]),
key: "0"
} : void 0,
t.$slots.optionTooltip ? {
name: "optionTooltip",
fn: f(() => [
v(t.$slots, "optionTooltip", {}, void 0, !0)
]),
key: "1"
} : void 0,
t.$slots.optionPdf ? {
name: "optionPdf",
fn: f(() => [
v(t.$slots, "optionPdf", {}, void 0, !0)
]),
key: "2"
} : void 0,
t.$slots.optionCsv ? {
name: "optionCsv",
fn: f(() => [
v(t.$slots, "optionCsv", {}, void 0, !0)
]),
key: "3"
} : void 0,
t.$slots.optionImg ? {
name: "optionImg",
fn: f(() => [
v(t.$slots, "optionImg", {}, void 0, !0)
]),
key: "4"
} : void 0,
t.$slots.optionTable ? {
name: "optionTable",
fn: f(() => [
v(t.$slots, "optionTable", {}, void 0, !0)
]),
key: "5"
} : void 0,
t.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: f(({ toggleFullscreen: a, isFullscreen: l }) => [
v(t.$slots, "optionFullscreen", F(M({ toggleFullscreen: a, isFullscreen: l })), void 0, !0)
]),
key: "6"
} : void 0,
t.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: f(({ toggleAnnotator: a, isAnnotator: l }) => [
v(t.$slots, "optionAnnotator", F(M({ toggleAnnotator: a, isAnnotator: l })), void 0, !0)
]),
key: "7"
} : void 0
]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "onGeneratePdf", "onGenerateImage", "style"])) : p("", !0),
z.value ? (s(), i("svg", {
key: 4,
ref_key: "svgRef",
ref: ve,
xmlns: r(dt),
class: E({ "vue-data-ui-fullscreen--on": A.value, "vue-data-ui-fulscreen--off": !A.value }),
viewBox: `0 0 ${n.value.width <= 0 ? 10 : n.value.width} ${n.value.height <= 0 ? 10 : n.value.height}`,
style: X(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color}`)
}, [
Oe(r(Ne)),
t.$slots["chart-background"] ? (s(), i("foreignObject", {
key: 0,
x: 0,
y: 0,
width: n.value.width <= 0 ? 10 : n.value.width,
height: n.value.height <= 0 ? 10 : n.value.height,
style: {
pointerEvents: "none"
}
}, [
v(t.$slots, "chart-background", {}, void 0, !0)
], 8, Pt)) : p("", !0),
(s(!0), i(D, null, L(k.value, (a, l) => (s(), i("circle", {
cx: c.value.centerX,
cy: c.value.centerY,
r: a.radius <= 0 ? 1e-4 : a.radius,
stroke: e.value.style.chart.layout.gutter.color,
"stroke-width": T.value.gutter,
fill: "none",
"stroke-dasharray": a.path.bgDashArray,
"stroke-dashoffset": a.path.fullOffset,
"stroke-linecap": "round",
class: E({ "vue-ui-onion-path": !0, "vue-ui-onion-blur": e.value.useBlurOnHover && ![null, void 0].includes(w.value) && w.value !== l }),
style: { transform: "rotate(-90deg)", "transform-origin": "50% 50%" }
}, null, 10, _t))), 256)),
(s(!0), i(D, null, L(k.value, (a, l) => (s(), i("circle", {
cx: c.value.centerX,
cy: c.value.centerY,
r: a.radius < 0 ? 1e-4 : a.radius,
stroke: `${a.color}`,
"stroke-width": T.value.track,
fill: "none",
"stroke-dasharray": a.path.dashArray,
"stroke-dashoffset": a.path.dashOffset,
class: E({ "vue-ui-onion-path": !0, "vue-ui-onion-blur": e.value.useBlurOnHover && ![null, void 0].includes(w.value) && w.value !== l }),
"stroke-linecap": "round",
style: { transform: "rotate(-90deg)", "transform-origin": "50% 50%" }
}, null, 10, It))), 256)),
S("defs", null, [
S("filter", {
id: `blur_${_.value}`,
x: "-50%",
y: "-50%",
width: "200%",
height: "200%"
}, [
S("feGaussianBlur", {
in: "SourceGraphic",
stdDeviation: 100 / e.value.style.chart.gradientIntensity
}, null, 8, St)
], 8, At)
]),
e.value.style.chart.useGradient ? (s(), i("g", {
key: 1,
filter: `url(#blur_${_.value})`
}, [
(s(!0), i(D, null, L(k.value, (a, l) => (s(), i("circle", {
cx: c.value.centerX,
cy: c.value.centerY,
r: a.radius <= 0 ? 1e-4 : a.radius,
stroke: "white",
"stroke-width": T.value.track / 3,
fill: "none",
"stroke-linecap": "round",
"stroke-dasharray": a.path.dashArray,
"stroke-dashoffset": a.path.dashOffset,
style: { transform: "rotate(-90deg)", "transform-origin": "50% 50%" }
}, null, 8, Mt))), 256))
], 8, Ft)) : p("", !0),
(s(!0), i(D, null, L(k.value, (a, l) => (s(), i("circle", {
cx: c.value.centerX,
cy: c.value.centerY,
r: a.radius <= 0 ? 1e-4 : a.radius,
stroke: "transparent",
"stroke-width": Math.max(T.value.track, T.value.gutter),
fill: "none",
"stroke-dasharray": a.path.bgDashArray,
"stroke-dashoffset": a.path.fullOffset,
"stroke-linecap": "round",
class: "vue-ui-onion-path",
style: { transform: "rotate(-90deg)", "transform-origin": "50% 50%" },
onMouseenter: (g) => we({
datapoint: a,
show: !0,
seriesIndex: l
}),
onMouseleave: o[0] || (o[0] = (g) => {
w.value = void 0, B.value = !1;
})
}, null, 40, Rt))), 256)),
e.value.style.chart.layout.labels.show ? (s(), i("g", Nt, [
(s(!0), i(D, null, L(k.value, (a, l) => (s(), i("g", {
onMouseenter: (g) => we({
datapoint: a,
show: !0,
seriesIndex: l
}),
onMouseleave: o[1] || (o[1] = (g) => {
w.value = void 0, B.value = !1;
})
}, [
y.value.includes(a.id) ? p("", !0) : (s(), i("text", {
key: 0,
x: n.value.width / 2 - T.value.gutter * 0.8 + e.value.style.chart.layout.labels.offsetX,
y: a.labelY + e.value.style.chart.layout.labels.offsetY,
"text-anchor": "end",
"font-size": e.value.style.chart.layout.labels.fontSize,
fill: e.value.useBlurOnHover && ![null, void 0].includes(w.value) && w.value === l ? a.color : e.value.style.chart.layout.labels.color,
"font-weight": e.value.style.chart.layout.labels.bold ? "bold" : "normal"
}, R(a.name ? a.name + ": " : "") + " " + R(e.value.style.chart.layout.labels.percentage.show ? r(V)({
v: a.percentage,
s: "%",
r: e.value.style.chart.layout.labels.roundingPercentage
}) : "") + " " + R(!e.value.style.chart.layout.labels.percentage.show && e.value.style.chart.layout.labels.value.show ? `: ${r(ee)(
e.value.style.chart.layout.labels.value.formatter,
a.value,
r(V)({
p: a.prefix || "",
v: a.value || 0,
s: a.suffix || "",
r: e.value.style.chart.layout.labels.roundingValue
}),
{ datapoint: a, seriesIndex: l }
)}` : `${e.value.style.chart.layout.labels.value.show && a.value ? `(${r(ee)(
e.value.style.chart.layout.labels.value.formatter,
a.value,
r(V)({
p: a.prefix || "",
v: a.value || 0,
s: a.suffix || "",
r: e.value.style.chart.layout.labels.roundingValue
}),
{ datapoint: a, seriesIndex: l }
)})` : ""}`), 9, Lt))
], 40, Dt))), 256))
])) : p("", !0),
v(t.$slots, "svg", { svg: n.value }, void 0, !0)
], 14, Ot)) : p("", !0),
t.$slots.watermark ? (s(), i("div", Vt, [
v(t.$slots, "watermark", F(M({ isPrinting: r(he) || r(fe) })), void 0, !0)
])) : p("", !0),
z.value ? p("", !0) : (s(), P(r(Le), {
key: 6,
config: {
type: "onion",
style: {
backgroundColor: e.value.style.chart.backgroundColor,
onion: {
color: e.value.style.chart.layout.gutter.color
}
}
}
}, null, 8, ["config"])),
S("div", {
ref_key: "chartLegend",
ref: le
}, [
e.value.style.chart.legend.show ? (s(), P($t, {
key: `legend_${ue.value}`,
legendSet: d.value,
config: je.value,
onClickMarker: o[2] || (o[2] = ({ legend: a }) => me(a.id))
}, {
item: f(({ legend: a }) => [
S("div", {
"data-cy-legend-item": "",
onClick: (l) => a.segregate(),
style: X(`opacity:${y.value.includes(a.id) ? 0.5 : 1}`)
}, R(a.name ? a.name + ": " : "") + " " + R((a.percentage || 0).toFixed(e.value.style.chart.legend.roundingPercentage)) + "% ", 13, zt)
]),
_: 1
}, 8, ["legendSet", "config"])) : v(t.$slots, "legend", {
key: 1,
legend: d.value
}, void 0, !0)
], 512),
t.$slots.source ? (s(), i("div", {
key: 7,
ref_key: "source",
ref: oe,
dir: "auto"
}, [
v(t.$slots, "source", {}, void 0, !0)
], 512)) : p("", !0),
Oe(r(Ve), {
show: m.value.showTooltip && B.value,
backgroundColor: e.value.style.chart.tooltip.backgroundColor,
color: e.value.style.chart.tooltip.color,
borderRadius: e.value.style.chart.tooltip.borderRadius,
borderColor: e.value.style.chart.tooltip.borderColor,
borderWidth: e.value.style.chart.tooltip.borderWidth,
fontSize: e.value.style.chart.tooltip.fontSize,
backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
position: e.value.style.chart.tooltip.position,
offsetY: e.value.style.chart.tooltip.offsetY,
parent: C.value,
content: G.value,
isFullscreen: A.value,
isCustom: r(_e)(e.value.style.chart.tooltip.customFormat)
}, {
"tooltip-before": f(() => [
v(t.$slots, "tooltip-before", F(M({ ...q.value })), void 0, !0)
]),
"tooltip-after": f(() => [
v(t.$slots, "tooltip-after", F(M({ ...q.value })), void 0, !0)
]),
_: 3
}, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
z.value ? (s(), P(r(Me), {
key: 8,
hideDetails: "",
config: {
open: m.value.showTable,
maxHeight: 1e4,
head: {
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color
},
body: {
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color
}
}
}, {
content: f(() => [
(s(), P(r(Re), {
key: `table_${re.value}`,
colNames: Y.value.colNames,
head: Y.value.head,
body: Y.value.body,
config: Y.value.config,
title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
onClose: o[3] || (o[3] = (a) => m.value.showTable = !1)
}, {
th: f(({ th: a }) => [
lt(R(a), 1)
]),
td: f(({ td: a }) => [
S("div", { innerHTML: a }, null, 8, Bt)
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title"]))
]),
_: 1
}, 8, ["config"])) : p("", !0)
], 46, Tt));
}
}, Zt = /* @__PURE__ */ xt(Yt, [["__scopeId", "data-v-d3a1937a"]]);
export {
Zt as default
};