vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
1,084 lines (1,083 loc) • 55.2 kB
JavaScript
import { computed as S, ref as T, watch as He, onMounted as Re, createElementBlock as i, openBlock as n, unref as d, normalizeStyle as O, normalizeClass as Me, createBlock as G, createCommentVNode as y, createSlots as Ze, withCtx as z, renderSlot as j, normalizeProps as Y, guardReactiveProps as J, createVNode as qe, createElementVNode as u, Fragment as _, renderList as m, toDisplayString as P, mergeProps as Pe, createTextVNode as Xe, nextTick as Ye } from "vue";
import { u as Je, c as je, t as Ke, p as K, a as Qe, b as et, d as tt, o as lt, e as Q, g as re, l as U, m as Te, f as D, X as ot, s as g, h as ee, i as te, j as Se, k as le, n as A, q as st, r as at } from "./index-CHWA6Lnw.js";
import { _ as nt } from "./Title-BwZtefYd.js";
import { u as rt, U as ut } from "./usePrinter-DibtVl2x.js";
import it from "./vue-ui-skeleton-BSUFPx4a.js";
import { D as dt } from "./DataTable-B4YF6guk.js";
import ct from "./vue-ui-accordion-gHGrRoVr.js";
import { u as ze } from "./useNestedProp-ByBiJC9_.js";
import { _ as ht } from "./PackageVersion-DcMafJMi.js";
import { P as vt } from "./PenAndPaper-ljJaW1FE.js";
import { u as ft } from "./useUserOptionState-BIvW1Kz7.js";
import { u as pt } from "./useChartAccessibility-BWojgys7.js";
import { _ as yt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const kt = ["id"], gt = {
key: 1,
style: "width:100%;background:transparent"
}, $t = ["xmlns", "viewBox"], _t = ["width", "height"], mt = ["id"], bt = ["stop-color"], xt = ["stop-color"], wt = ["id"], Ct = ["stop-color"], Ft = ["stop-color"], Mt = ["id"], Pt = ["stop-color"], jt = ["stop-color"], Tt = ["id"], St = ["stop-color"], zt = ["stop-color"], Dt = ["stop-color"], Ot = { key: 1 }, Nt = ["id"], Bt = ["stop-color"], At = ["stop-color"], It = ["id"], Lt = ["stop-color"], Wt = ["stop-color"], Vt = ["id"], Gt = ["stop-color"], Ut = ["stop-color"], Et = ["id"], Ht = ["x", "y", "font-size", "font-weight", "fill"], Rt = ["x", "y"], Zt = ["d", "stroke"], qt = ["d", "stroke"], Xt = { key: 4 }, Yt = { key: 0 }, Jt = ["stroke-dasharray", "d", "stroke", "stroke-width"], Kt = ["stroke-dasharray", "d", "stroke", "stroke-width"], Qt = ["stroke-dasharray", "d", "stroke", "stroke-width"], el = ["stroke-dasharray", "d", "stroke", "stroke-width"], tl = { key: 1 }, ll = ["d", "stroke", "stroke-width", "fill"], ol = ["d", "stroke", "stroke-width", "fill"], sl = ["d", "stroke", "stroke-width", "fill"], al = { key: 2 }, nl = ["d", "fill", "onMouseenter", "onClick"], rl = ["d", "fill", "onMouseenter", "onClick"], ul = ["d", "fill", "onMouseenter", "onClick"], il = ["d", "onMouseenter", "onClick"], dl = ["d"], cl = ["d", "stroke"], hl = ["onClick"], vl = ["stroke", "d"], fl = ["cx", "cy", "fill", "stroke"], pl = ["x", "y", "width", "height"], yl = { key: 1 }, kl = ["d", "stroke"], gl = ["d", "fill", "stroke"], $l = ["id"], _l = ["stop-color"], ml = ["stop-color"], bl = ["cx", "cy", "fill"], xl = ["cx", "cy", "fill"], wl = { key: 0 }, Cl = ["text-anchor", "x", "y", "fill", "font-size"], Fl = ["text-anchor", "x", "y", "fill", "font-size"], Ml = { key: 2 }, Pl = ["d", "fill", "stroke"], jl = { key: 5 }, Tl = { key: 0 }, Sl = ["stroke-dasharray", "d", "stroke", "stroke-width"], zl = ["stroke-dasharray", "d", "stroke", "stroke-width"], Dl = ["stroke-dasharray", "d", "stroke", "stroke-width"], Ol = ["stroke-dasharray", "d", "stroke", "stroke-width"], Nl = ["d", "stroke", "stroke-width", "fill"], Bl = ["d", "stroke", "stroke-width", "fill"], Al = { key: 1 }, Il = ["onClick"], Ll = ["id"], Wl = ["stop-color"], Vl = ["stop-color"], Gl = ["id"], Ul = ["stop-color"], El = ["stop-color"], Hl = ["stop-color"], Rl = ["stop-color"], Zl = ["stop-color"], ql = ["onMouseenter", "onClick", "d", "fill"], Xl = ["onMouseenter", "onClick", "d"], Yl = ["onMouseenter", "onClick", "d", "fill"], Jl = ["onClick"], Kl = ["stroke", "d"], Ql = ["cx", "cy", "fill", "stroke"], eo = ["x", "y", "width", "height"], to = { key: 1 }, lo = ["d", "stroke"], oo = ["d", "fill", "stroke"], so = ["id"], ao = ["stop-color"], no = ["stop-color"], ro = ["cx", "cy", "fill"], uo = ["cx", "cy", "fill"], io = { key: 0 }, co = ["text-anchor", "x", "y", "fill", "font-size"], ho = ["text-anchor", "x", "y", "fill", "font-size"], vo = { key: 2 }, fo = ["d", "fill", "stroke"], po = {
key: 4,
class: "vue-data-ui-watermark"
}, yo = {
key: 6,
ref: "source",
dir: "auto"
}, ko = ["innerHTML"], go = {
__name: "vue-ui-3d-bar",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Object,
default() {
return {};
}
}
},
emits: ["selectDatapoint"],
setup(De, { expose: Oe, emit: Ne }) {
const { vue_ui_3d_bar: Be } = Je(), $ = De, R = Ne, Z = S(() => !!$.dataset && Object.keys($.dataset).length), b = T(je()), Ae = T(null), ue = T(null), I = T(!1), ie = T(0), de = T(0), t = S({
get: () => fe(),
set: (a) => a
}), { userOptionsVisible: oe, setUserOptionsVisibility: ce, keepUserOptionState: he } = ft({ config: t.value }), { svgRef: ve } = pt({ config: t.value.style.chart.title });
function fe() {
const a = ze({
userConfig: $.config,
defaultConfig: Be
});
return a.theme ? {
...ze({
userConfig: Qe.vue_ui_3d_bar[a.theme] || $.config,
defaultConfig: a
}),
customPalette: Ke[a.theme] || K
} : a;
}
He(() => $.config, (a) => {
t.value = fe(), oe.value = !t.value.userOptions.showOnChartHover, $e(), ie.value += 1, de.value += 1, E.value.showTable = t.value.table.show;
}, { deep: !0 });
const { isPrinting: pe, isImaging: ye, generatePdf: ke, generateImage: ge } = rt({
elementId: `3d_bar_${b.value}`,
fileName: t.value.style.chart.title.text || "vue-ui-3d-bar"
}), Ie = S(() => et(t.value.customPalette)), E = T({
showTable: t.value.table.show
}), F = S(() => $.dataset.series && $.dataset.series.length), o = S(() => ({
height: t.value.style.chart.box.dimensions.height,
width: t.value.style.chart.box.dimensions.width,
absoluteWidth: t.value.style.chart.box.dimensions.width * (F.value ? 2 : 1),
top: t.value.style.chart.box.dimensions.top,
bottom: t.value.style.chart.box.dimensions.bottom,
left: t.value.style.chart.box.dimensions.left,
right: t.value.style.chart.box.dimensions.right,
perspective: t.value.style.chart.box.dimensions.perspective
})), C = S(() => {
if (F.value) {
const a = $.dataset.series.map((l) => l.value || 0).reduce((l, r) => l + r, 0), s = $.dataset.series.map((l, r) => ({
...l,
id: je(),
proportion: (l.value || 0) / a,
color: tt(l.color) || Ie.value[r] || K[r] || K[r % K.length],
breakdown: l.breakdown ? l.breakdown.sort((c, k) => k.value - c.value) : null
})).sort((l, r) => r.value - l.value), e = [];
let h = 0;
for (let l = 0; l < s.length; l += 1)
e.push({
...s[l],
fill: Le(h, s[l].proportion, s[l].breakdown, s[l].color)
}), h += s[l].proportion;
return e;
}
return null;
}), N = S(() => ({
right: `M${o.value.width / 2},${o.value.top} ${o.value.width - o.value.right}, ${o.value.top + o.value.perspective} ${o.value.width - o.value.right},${o.value.height - o.value.bottom - o.value.perspective} ${o.value.width / 2},${o.value.height - o.value.bottom}`,
left: `M${o.value.width / 2},${o.value.top} ${o.value.left},${o.value.top + o.value.perspective} ${o.value.left},${o.value.height - o.value.bottom - o.value.perspective} ${o.value.width / 2},${o.value.height - o.value.bottom}`,
side: `M${o.value.width / 2},${o.value.height - o.value.bottom} ${o.value.width / 2},${o.value.top + o.value.perspective * 2}`,
topSides: `M${o.value.left},${o.value.top + o.value.perspective} ${o.value.width / 2},${o.value.top + o.value.perspective * 2} ${o.value.width - o.value.right},${o.value.top + o.value.perspective}`,
tubeTop: `M${o.value.left},${o.value.top + o.value.perspective} C ${o.value.left},${o.value.top - o.value.perspective / 3} ${o.value.width - o.value.right},${o.value.top - o.value.perspective / 3} ${o.value.width - o.value.right},${o.value.top + o.value.perspective} C ${o.value.width - o.value.right},${o.value.top + o.value.perspective * 2.3} ${o.value.left},${o.value.top + o.value.perspective * 2.3} ${o.value.left},${o.value.top + o.value.perspective}`,
tubeLeft: `M${o.value.left},${o.value.top + o.value.perspective} ${o.value.left},${o.value.height - o.value.bottom - o.value.perspective}`,
tubeRight: `M${o.value.width - o.value.right},${o.value.top + o.value.perspective} ${o.value.width - o.value.right},${o.value.height - o.value.bottom - o.value.perspective}`,
tubeBottom: `M${o.value.width - o.value.right},${o.value.height - o.value.bottom - o.value.perspective} C ${o.value.width - o.value.right},${o.value.height} ${o.value.left},${o.value.height} ${o.value.left},${o.value.height - o.value.bottom - o.value.perspective}`
})), W = T(t.value.style.chart.animation.use ? 0 : $.dataset.percentage);
Re(() => {
$e();
let a = 0, s = t.value.style.chart.animation.speed, e = 5e-3 * t.value.style.chart.animation.acceleration;
function h() {
W.value += s + a, a += e, W.value < $.dataset.percentage ? requestAnimationFrame(h) : W.value = $.dataset.percentage;
}
t.value.style.chart.animation.use && (W.value = 0, h());
});
function $e() {
lt($.dataset) ? Q({
componentName: "VueUi3dBar",
type: "dataset"
}) : $.dataset.series ? $.dataset.series.forEach((a, s) => {
re({
datasetObject: a,
requiredAttributes: ["name", "value"]
}).forEach((e) => {
Q({
componentName: "VueUi3dBar",
type: "datasetSerieAttribute",
property: e,
index: s
});
}), a.breakdown && a.breakdown.forEach((e, h) => {
re({
datasetObject: e,
requiredAttributes: ["name", "value"]
}).forEach((l) => {
Q({
componentName: "VueUi3dBar",
type: "datasetSerieAttribute",
property: l,
index: `${s} - ${h}`
});
});
});
}) : re({
datasetObject: $.dataset,
requiredAttributes: ["percentage"]
}).forEach((a) => {
Q({
componentName: "VueUi3dBar",
type: "datasetAttribute",
property: a
});
});
}
function Le(a, s, e, h) {
const l = o.value.height - o.value.bottom - o.value.top - o.value.perspective * 2, { width: r, height: c, bottom: k, right: w, left: f, perspective: p } = o.value, v = k + l * a, ne = c - v - p - l * s / 2, Ge = ne > o.value.height / 2 ? "top" : "bottom", xe = 64, Ue = !!e;
let we = null, Ce = null;
return Ue && (e = e.map((Fe, Ee) => ({
...Fe,
value: Fe.value || 0,
color: U(h, Ee / e.length)
})), we = Te(
{ series: e },
r + o.value.absoluteWidth / 4 - 14,
Ge === "top" ? ne - xe : ne + xe,
28,
28,
1.99999,
2,
1,
360,
105.25,
14
), Ce = Te(
{ series: e },
r - w + 20,
c - v - p - l * s / 2,
6,
6,
1.99999,
2,
1,
360,
105.25,
6
)), {
donut: we,
miniDonut: Ce,
sidePointer: {
x: r - w,
y: c - v - p - l * s / 2,
topY: c - v - p - l * s,
height: l * s
},
apexBottom: { y: c - v, x: r / 2 },
apexTop: { y: c - v - l * s, x: r / 2 },
right: `M${r / 2},${c - v} ${r / 2},${c - v - l * s} ${r - w},${c - v - p - l * s} ${r - w},${c - v - p}Z`,
left: `M${r / 2},${c - v} ${r / 2},${c - v - l * s} ${f}, ${c - v - p - l * s} ${f},${c - v - p}Z`,
liningTop: `M${f},${c - v - p - l * s} ${r / 2},${c - v - l * s} ${r - w},${c - v - p - l * s}`,
liningTopShade: `M${f},${c - v - p - l * s - 0.5} ${r / 2},${c - v - l * s - 0.5} ${r - w},${c - v - p - l * s - 0.5}`,
top: `M${r / 2},${c - v - l * s} ${f},${c - v - p - l * s} ${r / 2},${c - v - p * 2 - l * s} ${r - w},${c - v - p - l * s} Z`,
tubeTop: `M${f},${c - v - l * s - p} C ${f},${c - v - l * s - p * 2.5} ${r - w},${c - v - l * s - p * 2.5} ${r - w},${c - v - l * s - p} C ${r - w},${c - v - l * s + p / 2} ${f},${c - v - l * s + p / 2} ${f},${c - v - l * s - p}`,
bottomTubeTop: `M ${r - w - 0.5},${c - v - p} C ${r - w - 0.5},${c - v + p / 2} ${f},${c - v + p / 2} ${f + 0.5},${c - v - p}`,
tubeBody: `M
${f},${c - v - l * s - p}
C ${f},${c - v - l * s + p / 2}
${r - w},${c - v - l * s + p / 2}
${r - w},${c - v - l * s - p}
L${r - w},${c - v - p}
C
${r - w},${c - v + p / 2}
${f},${c - v + p / 2}
${f},${c - v - p}Z`
};
}
const H = S(() => {
const a = W.value / 100, s = o.value.height - o.value.bottom - o.value.top - o.value.perspective * 2, { width: e, height: h, bottom: l, right: r, left: c, perspective: k } = o.value, f = l + s * 0;
return {
right: `M${e / 2},${h - f} ${e / 2},${h - f - s * a} ${e - r},${h - f - k - s * a} ${e - r},${h - f - k}Z`,
left: `M${e / 2},${h - f} ${e / 2},${h - f - s * a} ${c}, ${h - f - k - s * a} ${c},${h - f - k}Z`,
top: `M${e / 2},${h - f - s * a} ${c},${h - f - k - s * a} ${e / 2},${h - f - k * 2 - s * a} ${e - r},${h - f - k - s * a} Z`,
tubeTop: `M${c},${h - f - s * a - k} C ${c},${h - f - s * a - k * 2.5} ${e - r},${h - f - s * a - k * 2.5} ${e - r},${h - f - s * a - k} C ${e - r},${h - f - s * a + k / 2} ${c},${h - f - s * a + k / 2} ${c},${h - f - s * a - k}`,
tubeBody: `M
${c},${h - f - s * a - k}
C ${c},${h - f - s * a + k / 2}
${e - r},${h - f - s * a + k / 2}
${e - r},${h - f - s * a - k}
L${e - r},${h - k * 1.5}
C
${e - r},${h}
${c},${h}
${c},${h - f - k}Z`
};
}), x = T(null);
function M(a, s = !1) {
R("selectDatapoint", a), s || (x.value = a.id), s && I.value && (I.value = !1), s && !I.value && (I.value = !0);
}
function L() {
I.value || (x.value = null);
}
function V(a, s, e = !1) {
const h = $.dataset.series.map((c) => c.value || 0).reduce((c, k) => c + k, 0), l = isNaN(a.value / h) ? 0 : a.value / h * 100, r = isNaN(a.value / _e(s)) ? 0 : a.value / _e(s) * 100;
return e ? r : l.toFixed(0) + "%";
}
function _e(a) {
return [...a].map((s) => s.value).reduce((s, e) => s + e, 0);
}
const se = T(!1);
function We(a) {
se.value = a;
}
function Ve() {
return F.value ? C.value : $.dataset.percentage;
}
const B = S(() => {
if (F.value) {
const a = C.value.flatMap((e) => e.breakdown && e.breakdown.length ? [{ name: e.name, color: e.color }, ...e.breakdown.map((h, l) => ({
name: h.name,
color: U(e.color, l / e.breakdown.length)
}))] : {
name: e.name,
color: e.color
}), s = C.value.flatMap((e) => e.breakdown && e.breakdown.length ? [e.value, ...e.breakdown.map((h) => h.value)] : e.value);
return { head: a, body: s };
} else
return null;
});
function me() {
if (!F.value) {
console.warn("VueUi3dBar : CSV download is only available in stack mode (providing dataset.series instead of dataset.percentage)");
return;
}
Ye(() => {
const a = C.value.map((l) => l.value).reduce((l, r) => l + r, 0), s = B.value.head.map((l, r) => [[
l.name
], [B.value.body[r]], [isNaN(B.value.body[r] / a) ? "-" : B.value.body[r] / a * 100]]), e = [[t.value.style.chart.title.text], [t.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(s), h = st(e);
at({ csvContent: h, title: t.value.style.chart.title.text || "vue-ui-3d-bar" });
});
}
const q = S(() => {
const a = C.value.map((r) => r.value).reduce((r, c) => r + c, 0), s = [
' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>',
D({ p: t.value.style.chart.legend.prefix, v: a, s: t.value.style.chart.legend.suffix, r: t.value.table.td.roundingValue }),
"100%"
], e = B.value.head.map((r, c) => {
const k = D({ p: t.value.style.chart.legend.prefix, v: B.value.body[c], s: t.value.style.chart.legend.suffix, r: t.value.table.td.roundingValue });
return [
{
color: r.color,
name: r.name
},
k,
isNaN(B.value.body[c] / a) ? "-" : D({
v: B.value.body[c] / a * 100,
s: "%",
r: t.value.table.td.roundingPercentage
})
];
}), h = {
th: {
backgroundColor: t.value.table.th.backgroundColor,
color: t.value.table.th.color,
outline: t.value.table.th.outline
},
td: {
backgroundColor: t.value.table.td.backgroundColor,
color: t.value.table.td.color,
outline: t.value.table.td.outline
},
breakpoint: t.value.table.responsiveBreakpoint,
shape: t.value.style.shape === "tube" ? "circle" : "square"
};
return {
colNames: [
t.value.table.columnNames.series,
t.value.table.columnNames.value,
t.value.table.columnNames.percentage
],
head: s,
body: e,
config: h
};
});
function be() {
E.value.showTable = !E.value.showTable;
}
const X = T(!1);
function ae() {
X.value = !X.value;
}
return Oe({
generateCsv: me,
generatePdf: ke,
generateImage: ge,
getData: Ve,
toggleTable: be,
toggleAnnotator: ae
}), (a, s) => (n(), i("div", {
ref_key: "bar3dChart",
ref: ue,
class: Me("vue-ui-3d-bar"),
style: O(`font-family:${t.value.style.fontFamily};width:100%; text-align:center;background:${t.value.style.chart.backgroundColor}`),
id: `3d_bar_${b.value}`,
onMouseenter: s[2] || (s[2] = () => d(ce)(!0)),
onMouseleave: s[3] || (s[3] = () => d(ce)(!1))
}, [
t.value.userOptions.buttons.annotator ? (n(), G(vt, {
key: 0,
svgRef: d(ve),
backgroundColor: t.value.style.chart.backgroundColor,
color: t.value.style.chart.color,
active: X.value,
onClose: ae
}, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : y("", !0),
t.value.style.chart.title.text ? (n(), i("div", gt, [
(n(), G(nt, {
key: `title_${ie.value}`,
config: {
title: {
cy: "3dBar-div-title",
...t.value.style.chart.title
},
subtitle: {
cy: "3dBar-div-subtitle",
...t.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))
])) : y("", !0),
t.value.userOptions.show && Z.value && (d(he) || d(oe)) ? (n(), G(ut, {
key: 2,
ref_key: "details",
ref: Ae,
backgroundColor: t.value.style.chart.backgroundColor,
color: t.value.style.chart.color,
isPrinting: d(pe),
isImaging: d(ye),
uid: b.value,
hasPdf: t.value.userOptions.buttons.pdf,
hasTable: !!F.value && t.value.userOptions.buttons.table,
hasXls: !!F.value && t.value.userOptions.buttons.csv,
hasImg: t.value.userOptions.buttons.img,
hasFullscreen: t.value.userOptions.buttons.fullscreen,
titles: { ...t.value.userOptions.buttonTitles },
chartElement: ue.value,
position: t.value.userOptions.position,
hasAnnotator: t.value.userOptions.buttons.annotator,
isAnnotation: X.value,
onToggleFullscreen: We,
onGeneratePdf: d(ke),
onGenerateCsv: me,
onGenerateImage: d(ge),
onToggleTable: be,
onToggleAnnotator: ae,
style: O({
visibility: d(he) ? d(oe) ? "visible" : "hidden" : "visible"
})
}, Ze({ _: 2 }, [
a.$slots.menuIcon ? {
name: "menuIcon",
fn: z(({ isOpen: e, color: h }) => [
j(a.$slots, "menuIcon", Y(J({ isOpen: e, color: h })), void 0, !0)
]),
key: "0"
} : void 0,
a.$slots.optionPdf ? {
name: "optionPdf",
fn: z(() => [
j(a.$slots, "optionPdf", {}, void 0, !0)
]),
key: "1"
} : void 0,
a.$slots.optionCsv ? {
name: "optionCsv",
fn: z(() => [
j(a.$slots, "optionCsv", {}, void 0, !0)
]),
key: "2"
} : void 0,
a.$slots.optionImg ? {
name: "optionImg",
fn: z(() => [
j(a.$slots, "optionImg", {}, void 0, !0)
]),
key: "3"
} : void 0,
a.$slots.optionTable ? {
name: "optionTable",
fn: z(() => [
j(a.$slots, "optionTable", {}, void 0, !0)
]),
key: "4"
} : void 0,
a.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: z(({ toggleFullscreen: e, isFullscreen: h }) => [
j(a.$slots, "optionFullscreen", Y(J({ toggleFullscreen: e, isFullscreen: h })), void 0, !0)
]),
key: "5"
} : void 0,
a.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: z(({ toggleAnnotator: e, isAnnotator: h }) => [
j(a.$slots, "optionAnnotator", Y(J({ toggleAnnotator: e, isAnnotator: h })), void 0, !0)
]),
key: "6"
} : void 0
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasTable", "hasXls", "hasImg", "hasFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : y("", !0),
Z.value ? (n(), i("svg", {
key: 3,
ref_key: "svgRef",
ref: ve,
xmlns: d(ot),
class: Me({ "vue-data-ui-fullscreen--on": se.value, "vue-data-ui-fulscreen--off": !se.value }),
viewBox: `0 0 ${o.value.absoluteWidth} ${o.value.height}`,
style: O(`max-width:100%; overflow: visible; background:transparent;color:${t.value.style.chart.color}`)
}, [
qe(ht),
a.$slots["chart-background"] ? (n(), i("foreignObject", {
key: 0,
x: 0,
y: 0,
width: o.value.absoluteWidth,
height: o.value.height,
style: {
pointerEvents: "none"
}
}, [
j(a.$slots, "chart-background", {}, void 0, !0)
], 8, _t)) : y("", !0),
u("defs", null, [
u("radialGradient", {
id: `gradient_top${b.value}`
}, [
u("stop", {
offset: "0%",
"stop-color": d(g)(t.value.style.chart.backgroundColor, 0)
}, null, 8, bt),
u("stop", {
offset: "100%",
"stop-color": t.value.style.chart.bar.color
}, null, 8, xt)
], 8, mt),
u("radialGradient", {
id: `gradient_left${b.value}`
}, [
u("stop", {
offset: "0%",
"stop-color": d(g)(t.value.style.chart.backgroundColor, 0)
}, null, 8, Ct),
u("stop", {
offset: "100%",
"stop-color": d(g)(t.value.style.chart.bar.color, 20)
}, null, 8, Ft)
], 8, wt),
u("radialGradient", {
id: `gradient_right${b.value}`
}, [
u("stop", {
offset: "0%",
"stop-color": d(g)(t.value.style.chart.backgroundColor, 0)
}, null, 8, Pt),
u("stop", {
offset: "100%",
"stop-color": d(g)(t.value.style.chart.bar.color, 20)
}, null, 8, jt)
], 8, Mt),
u("linearGradient", {
id: `gradient_tube_body${b.value}`,
x1: "0%",
y1: "0%",
x2: "100%",
y2: "0%"
}, [
u("stop", {
offset: "0%",
"stop-color": `${t.value.style.chart.bar.color}`
}, null, 8, St),
u("stop", {
offset: "75%",
"stop-color": d(g)(t.value.style.chart.backgroundColor, 0)
}, null, 8, zt),
u("stop", {
offset: "100%",
"stop-color": d(g)(t.value.style.chart.bar.color, 40)
}, null, 8, Dt)
], 8, Tt)
]),
F.value ? (n(), i("defs", Ot, [
(n(!0), i(_, null, m(C.value, (e) => (n(), i("radialGradient", {
id: `grad_top_${e.id}`
}, [
u("stop", {
offset: "0%",
"stop-color": d(g)(d(U)(e.color, 0.5), 80)
}, null, 8, Bt),
u("stop", {
offset: "100%",
"stop-color": e.color
}, null, 8, At)
], 8, Nt))), 256)),
(n(!0), i(_, null, m(C.value, (e) => (n(), i("linearGradient", {
id: `grad_left_${e.id}`
}, [
u("stop", {
offset: "0%",
"stop-color": d(g)(e.color, 80)
}, null, 8, Lt),
u("stop", {
offset: "100%",
"stop-color": d(g)(d(ee)(e.color, 0.5), 100)
}, null, 8, Wt)
], 8, It))), 256)),
(n(!0), i(_, null, m(C.value, (e) => (n(), i("linearGradient", {
id: `grad_right_${e.id}`
}, [
u("stop", {
offset: "2%",
"stop-color": d(g)(d(U)(e.color, 0.5), 100)
}, null, 8, Gt),
u("stop", {
offset: "100%",
"stop-color": d(g)(e.color, 80)
}, null, 8, Ut)
], 8, Vt))), 256)),
u("linearGradient", {
x1: "0%",
y1: "0%",
x2: "0%",
y2: "100%",
id: `vertical_line_${b.value}`
}, s[4] || (s[4] = [
u("stop", {
offset: "0%",
"stop-color": "#FFFFFF"
}, null, -1),
u("stop", {
offset: "100%",
"stop-color": "#FFFFFF33"
}, null, -1)
]), 8, Et)
])) : y("", !0),
t.value.style.chart.dataLabel.show && ![null, void 0].includes($.dataset.percentage) && [null, void 0].includes($.dataset.series) ? (n(), i("text", {
key: 2,
x: o.value.width / 2,
y: o.value.top - t.value.style.chart.dataLabel.fontSize / 2,
"font-size": t.value.style.chart.dataLabel.fontSize,
"font-weight": t.value.style.chart.dataLabel.bold ? "bold" : "normal",
fill: t.value.style.chart.dataLabel.color,
"text-anchor": "middle"
}, P(d(D)({
v: W.value,
s: "%",
r: t.value.style.chart.dataLabel.rounding
})), 9, Ht)) : y("", !0),
I.value ? (n(), i("g", {
key: 3,
onClick: s[0] || (s[0] = (e) => {
I.value = !1, x.value = null;
}),
"data-html2canvas-ignore": "",
style: { cursor: "pointer" }
}, [
u("rect", {
x: o.value.width / 2 - 6,
y: o.value.top - 20,
height: 12,
width: 12,
fill: "transparent"
}, null, 8, Rt),
u("path", {
d: `M${o.value.width / 2 - 6},${o.value.top - 20} ${o.value.width / 2 + 6},${o.value.top - 9}`,
stroke: t.value.style.chart.color,
"stroke-linecap": "round",
"stroke-width": "1"
}, null, 8, Zt),
u("path", {
d: `M${o.value.width / 2 + 6},${o.value.top - 20} ${o.value.width / 2 - 6},${o.value.top - 9}`,
stroke: t.value.style.chart.color,
"stroke-linecap": "round",
"stroke-width": "1"
}, null, 8, qt)
])) : y("", !0),
!t.value.style.shape || t.value.style.shape === "bar" ? (n(), i("g", Xt, [
F.value ? y("", !0) : (n(), i("g", Yt, [
u("path", {
"stroke-dasharray": t.value.style.chart.box.strokeDasharray,
d: N.value.right,
stroke: t.value.style.chart.box.stroke,
"stroke-width": t.value.style.chart.box.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: "none"
}, null, 8, Jt),
u("path", {
"stroke-dasharray": t.value.style.chart.box.strokeDasharray,
d: N.value.left,
stroke: t.value.style.chart.box.stroke,
"stroke-width": t.value.style.chart.box.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: "none"
}, null, 8, Kt),
u("path", {
"stroke-dasharray": t.value.style.chart.box.strokeDasharray,
d: N.value.side,
stroke: t.value.style.chart.box.stroke,
"stroke-width": t.value.style.chart.box.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: "none"
}, null, 8, Qt),
u("path", {
"stroke-dasharray": t.value.style.chart.box.strokeDasharray,
d: N.value.topSides,
stroke: t.value.style.chart.box.stroke,
"stroke-width": t.value.style.chart.box.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: "none"
}, null, 8, el)
])),
F.value ? y("", !0) : (n(), i("g", tl, [
u("path", {
d: H.value.right,
stroke: t.value.style.chart.bar.stroke,
"stroke-width": t.value.style.chart.bar.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: `url(#gradient_right${b.value})`
}, null, 8, ll),
u("path", {
d: H.value.left,
stroke: t.value.style.chart.bar.stroke,
"stroke-width": t.value.style.chart.bar.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: `url(#gradient_left${b.value})`
}, null, 8, ol),
u("path", {
d: H.value.top,
stroke: t.value.style.chart.bar.stroke,
"stroke-width": t.value.style.chart.bar.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: `url(#gradient_top${b.value})`
}, null, 8, sl)
])),
F.value ? (n(), i("g", al, [
(n(!0), i(_, null, m(C.value, (e, h) => (n(), i("g", {
style: O(`opacity:${x.value ? x.value === e.id ? 1 : 0.3 : 1}`),
class: "vue-ui-3d-bar-stack"
}, [
u("path", {
d: e.fill.right,
fill: `url(#grad_right_${e.id})`,
onMouseenter: (l) => M(e),
onClick: (l) => M(e, !0),
onMouseout: L
}, null, 40, nl),
u("path", {
d: e.fill.left,
fill: `url(#grad_left_${e.id})`,
onMouseenter: (l) => M(e),
onClick: (l) => M(e, !0),
onMouseout: L
}, null, 40, rl),
u("path", {
d: e.fill.top,
fill: `url(#grad_top_${e.id})`,
onMouseenter: (l) => M(e),
onClick: (l) => M(e, !0),
onMouseout: L
}, null, 40, ul),
u("path", {
d: e.fill.liningTop,
stroke: "#FFFFFF",
"stroke-width": "0.5",
"stroke-linecap": "round",
fill: "none",
onMouseenter: (l) => M(e),
onClick: (l) => M(e, !0),
onMouseout: L
}, null, 40, il),
u("path", {
d: `M ${e.fill.apexTop.x},${e.fill.apexTop.y} ${e.fill.apexBottom.x},${e.fill.apexBottom.y}`,
stroke: "#FFFFFF",
"stroke-width": "0.5",
"stroke-linecap": "round"
}, null, 8, dl)
], 4))), 256)),
(n(!0), i(_, null, m(C.value, (e, h) => (n(), i("g", null, [
h !== C.value.length - 1 ? (n(), i("path", {
key: 0,
d: e.fill.liningTopShade,
stroke: t.value.style.chart.bar.shadeColor,
"stroke-width": "0.5",
"stroke-linecap": "round",
fill: "none",
style: { "pointer-events": "none" }
}, null, 8, cl)) : y("", !0)
]))), 256)),
(n(!0), i(_, null, m(C.value, (e, h) => (n(), i("g", {
style: O(`opacity:${x.value ? x.value === e.id ? 1 : 0 : e.proportion * 100 > t.value.style.chart.legend.hideUnderPercentage ? 1 : 0}`),
onClick: (l) => R("selectDatapoint", e)
}, [
u("path", {
stroke: t.value.style.chart.color,
"stroke-dasharray": "1",
"stroke-width": "0.5",
"stroke-linecap": "round",
d: `M${e.fill.sidePointer.x},${e.fill.sidePointer.y} ${e.fill.sidePointer.x + 20},${e.fill.sidePointer.y}`
}, null, 8, vl),
!e.fill.miniDonut || x.value ? (n(), i("circle", {
key: 0,
cx: e.fill.sidePointer.x + 20,
cy: e.fill.sidePointer.y,
r: 2,
fill: e.color,
stroke: t.value.style.chart.backgroundColor
}, null, 8, fl)) : y("", !0),
(n(), i("foreignObject", {
x: e.fill.sidePointer.x + 30,
y: e.fill.sidePointer.y - t.value.style.chart.legend.fontSize,
width: o.value.absoluteWidth / 2 - 12,
height: t.value.style.chart.legend.fontSize * 2,
style: { overflow: "visible", position: "relative" }
}, [
t.value.style.chart.legend.showDefault ? (n(), i("div", {
key: 0,
style: O(`height: 100%; width: 100%; display: flex; flex-direction: row; flex-wrap: wrap; align-items:center;justify-content: flex-start; font-size:${t.value.style.chart.legend.fontSize}px; text-align:left; line-height: ${t.value.style.chart.legend.fontSize}px; color:${t.value.style.chart.legend.color}`)
}, P(e.name) + ": " + P(d(D)({ v: e.proportion * 100, s: "%", r: t.value.style.chart.legend.roundingPercentage })) + " (" + P(d(te)(
t.value.style.chart.dataLabel.formatter,
e.value,
d(D)({
p: t.value.style.chart.legend.prefix,
v: e.value,
s: t.value.style.chart.legend.suffix,
r: t.value.style.chart.legend.roundingValue
}),
{ datapoint: e, seriesIndex: h }
)) + ") ", 5)) : y("", !0),
j(a.$slots, "legend", Pe({ ref_for: !0 }, { datapoint: e, config: t.value, dataset: C.value }), void 0, !0)
], 8, pl)),
e.fill.donut && x.value === e.id ? (n(), i("g", yl, [
(n(!0), i(_, null, m(e.fill.donut, (l, r) => (n(), i("g", null, [
V(l, e.fill.donut, !0) > 6 ? (n(), i("path", {
key: 0,
d: d(Se)(l, { x: l.cx, y: l.cy }, 0, 8, !1, !0, 10),
stroke: l.color,
class: "vue-ui-donut-arc-path",
"stroke-width": "0.5",
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none"
}, null, 8, kl)) : y("", !0)
]))), 256)),
(n(!0), i(_, null, m(e.fill.donut, (l, r) => (n(), i("path", {
class: "vue-ui-donut-arc-path",
d: l.arcSlice,
fill: `${l.color}`,
stroke: t.value.style.chart.backgroundColor,
"stroke-width": 1
}, null, 8, gl))), 256)),
u("defs", null, [
u("radialGradient", {
id: `hollow_gradient_${b.value}`
}, [
u("stop", {
offset: "0%",
"stop-color": d(g)(t.value.style.chart.backgroundColor, 0)
}, null, 8, _l),
s[5] || (s[5] = u("stop", {
offset: "77%",
"stop-color": "#FFFFFF20"
}, null, -1)),
u("stop", {
offset: "100%",
"stop-color": d(g)(t.value.style.chart.backgroundColor, 0)
}, null, 8, ml)
], 8, $l)
]),
(n(!0), i(_, null, m(e.fill.donut, (l, r) => (n(), i("circle", {
class: "vue-ui-donut-arc-path",
cx: l.cx,
cy: l.cy,
r: 28,
fill: `url(#hollow_gradient_${b.value})`
}, null, 8, bl))), 256)),
(n(!0), i(_, null, m(e.fill.donut, (l, r) => (n(), i("circle", {
class: "vue-ui-donut-arc-path",
cx: l.cx,
cy: l.cy,
r: 14,
fill: t.value.style.chart.backgroundColor
}, null, 8, xl))), 256)),
(n(!0), i(_, null, m(e.fill.donut, (l, r) => (n(), i("g", null, [
V(l, e.fill.donut, !0) > 6 ? (n(), i("g", wl, [
u("text", {
"text-anchor": d(A)(l, !0, 0).anchor,
x: d(A)(l, !0, 2).x,
y: d(le)(l, 12, 12),
fill: t.value.style.chart.legend.color,
"font-size": t.value.style.chart.legend.fontSize / 1.5
}, P(V(l, e.fill.donut)) + " (" + P(d(te)(
t.value.style.chart.dataLabel.formatter,
l.value,
d(D)({
p: t.value.style.chart.legend.prefix,
v: l.value,
s: t.value.style.chart.legend.suffix,
r: t.value.style.chart.legend.roundingValue
}),
{ datapoint: l, seriesIndex: r }
)) + ") ", 9, Cl),
u("text", {
"text-anchor": d(A)(l).anchor,
x: d(A)(l, !0, 2).x,
y: d(le)(l, 12, 12) + t.value.style.chart.legend.fontSize / 1.5,
fill: t.value.style.chart.legend.color,
"font-size": t.value.style.chart.legend.fontSize / 1.5
}, P(l.name), 9, Fl)
])) : y("", !0)
]))), 256))
])) : y("", !0),
e.fill.miniDonut && !x.value ? (n(), i("g", Ml, [
(n(!0), i(_, null, m(e.fill.miniDonut, (l, r) => (n(), i("path", {
class: "vue-ui-donut-arc-path",
d: l.arcSlice,
fill: `${l.color}`,
stroke: t.value.style.chart.backgroundColor,
"stroke-width": 0.5
}, null, 8, Pl))), 256))
])) : y("", !0)
], 12, hl))), 256))
])) : y("", !0)
])) : y("", !0),
t.value.style.shape === "tube" ? (n(), i("g", jl, [
F.value ? y("", !0) : (n(), i("g", Tl, [
u("path", {
"stroke-dasharray": t.value.style.chart.box.strokeDasharray,
d: N.value.tubeTop,
stroke: t.value.style.chart.box.stroke,
"stroke-width": t.value.style.chart.box.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: "none"
}, null, 8, Sl),
u("path", {
"stroke-dasharray": t.value.style.chart.box.strokeDasharray,
d: N.value.tubeLeft,
stroke: t.value.style.chart.box.stroke,
"stroke-width": t.value.style.chart.box.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: "none"
}, null, 8, zl),
u("path", {
"stroke-dasharray": t.value.style.chart.box.strokeDasharray,
d: N.value.tubeRight,
stroke: t.value.style.chart.box.stroke,
"stroke-width": t.value.style.chart.box.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: "none"
}, null, 8, Dl),
u("path", {
"stroke-dasharray": t.value.style.chart.box.strokeDasharray,
d: N.value.tubeBottom,
stroke: t.value.style.chart.box.stroke,
"stroke-width": t.value.style.chart.box.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: "none"
}, null, 8, Ol),
u("path", {
d: H.value.tubeTop,
stroke: t.value.style.chart.bar.stroke,
"stroke-width": t.value.style.chart.bar.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: `url(#gradient_top${b.value})`
}, null, 8, Nl),
u("path", {
d: H.value.tubeBody,
stroke: t.value.style.chart.bar.stroke,
"stroke-width": t.value.style.chart.bar.strokeWidth,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: `url(#gradient_tube_body${b.value})`
}, null, 8, Bl)
])),
F.value ? (n(), i("g", Al, [
(n(!0), i(_, null, m(C.value, (e, h) => (n(), i("g", {
style: O(`opacity:${x.value ? x.value === e.id ? 1 : 0.3 : 1}`),
class: "vue-ui-3d-bar-stack",
onClick: (l) => R("selectDatapoint", e)
}, [
u("defs", null, [
u("radialGradient", {
id: `gradient_tube_top_${e.id}`,
fx: "10%",
cy: "55%"
}, [
u("stop", {
offset: "0%",
"stop-color": d(g)(d(U)(e.color, 0.5), 80)
}, null, 8, Wl),
u("stop", {
offset: "100%",
"stop-color": d(g)(d(ee)(e.color, 0.1), 80)
}, null, 8, Vl)
], 8, Ll),
u("linearGradient", {
id: `gradient_tube_body_${e.id}`,
x1: "0%",
y1: "0%",
x2: "100%",
y2: "0%"
}, [
u("stop", {
offset: "0%",
"stop-color": `${e.color}`
}, null, 8, Ul),
u("stop", {
offset: "10%",
"stop-color": d(g)(d(ee)(e.color, 0.7), 100)
}, null, 8, El),
u("stop", {
offset: "25%",
"stop-color": d(g)(d(ee)(e.color, 0.5), 100)
}, null, 8, Hl),
u("stop", {
offset: "75%",
"stop-color": d(g)(e.color, 80)
}, null, 8, Rl),
u("stop", {
offset: "100%",
"stop-color": d(g)(d(U)(e.color, 0.7), 100)
}, null, 8, Zl)
], 8, Gl)
]),
u("path", {
onMouseenter: (l) => M(e),
onClick: (l) => M(e, !0),
onMouseout: L,
d: e.fill.tubeBody,
stroke: "#FFFFFF",
"stroke-width": 0.5,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: `url(#gradient_tube_body_${e.id})`
}, null, 40, ql),
h > 0 ? (n(), i("path", {
key: 0,
onMouseenter: (l) => M(e),
onClick: (l) => M(e, !0),
onMouseout: L,
d: e.fill.bottomTubeTop,
stroke: "#000000",
"stroke-width": 0.5,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: "none"
}, null, 40, Xl)) : y("", !0),
u("path", {
onMouseenter: (l) => M(e),
onClick: (l) => M(e, !0),
onMouseout: L,
d: e.fill.tubeTop,
stroke: "#FFFFFF",
"stroke-width": 0.5,
"stroke-linejoin": "round",
"stroke-linecap": "round",
fill: `url(#gradient_tube_top_${e.id})`
}, null, 40, Yl)
], 12, Il))), 256)),
(n(!0), i(_, null, m(C.value, (e, h) => (n(), i("g", {
style: O(`opacity:${x.value ? x.value === e.id ? 1 : 0 : e.proportion * 100 > t.value.style.chart.legend.hideUnderPercentage ? 1 : 0}`),
onClick: (l) => R("selectDatapoint", e)
}, [
u("path", {
stroke: t.value.style.chart.color,
"stroke-dasharray": "1",
"stroke-width": "0.5",
"stroke-linecap": "round",
d: `M${e.fill.sidePointer.x},${e.fill.sidePointer.y} ${e.fill.sidePointer.x + 20},${e.fill.sidePointer.y}`
}, null, 8, Kl),
!e.fill.miniDonut || x.value ? (n(), i("circle", {
key: 0,
cx: e.fill.sidePointer.x + 20,
cy: e.fill.sidePointer.y,
r: 2,
fill: e.color,
stroke: t.value.style.chart.backgroundColor
}, null, 8, Ql)) : y("", !0),
(n(), i("foreignObject", {
x: e.fill.sidePointer.x + 30,
y: e.fill.sidePointer.y - t.value.style.chart.legend.fontSize,
width: o.value.absoluteWidth / 2 - 12,
height: t.value.style.chart.legend.fontSize * 2,
style: { overflow: "visible", position: "relative" }
}, [
t.value.style.chart.legend.showDefault ? (n(), i("div", {
key: 0,
style: O(`height: 100%; width: 100%; display: flex; flex-direction: row; flex-wrap: wrap; align-items:center;justify-content: flex-start; font-size:${t.value.style.chart.legend.fontSize}px; text-align:left; line-height: ${t.value.style.chart.legend.fontSize}px; color:${t.value.style.chart.legend.color}`)
}, P(e.name) + ": " + P(d(D)({ v: e.proportion * 100, s: "%", r: t.value.style.chart.legend.roundingPercentage })) + " (" + P(d(te)(
t.value.style.chart.dataLabel.formatter,
e.value,
d(D)({
p: t.value.style.chart.legend.prefix,
v: e.value,
s: t.value.style.chart.legend.suffix,
r: t.value.style.chart.legend.roundingValue
}),
{ datapoint: e, seriesIndex: h }
)) + ") ", 5)) : y("", !0),
j(a.$slots, "legend", Pe({ ref_for: !0 }, { datapoint: e, config: t.value, dataset: C.value }), void 0, !0)
], 8, eo)),
e.fill.donut && x.value === e.id ? (n(), i("g", to, [
(n(!0), i(_, null, m(e.fill.donut, (l, r) => (n(), i("g", null, [
V(l, e.fill.donut, !0) > 6 ? (n(), i("path", {
key: 0,
d: d(Se)(l, { x: l.cx, y: l.cy }, 0, 8, !1, !0, 10),
stroke: l.color,
class: "vue-ui-donut-arc-path",
"stroke-width": "0.5",
"stroke-linecap": "round",
"stroke-linejoin": "round",
fill: "none"
}, null, 8, lo)) : y("", !0)
]))), 256)),
(n(!0), i(_, null, m(e.fill.donut, (l, r) => (n(), i("path", {
class: "vue-ui-donut-arc-path",
d: l.arcSlice,
fill: `${l.color}`,
stroke: t.value.style.chart.backgroundColor,
"stroke-width": 1
}, null, 8, oo))), 256)),
u("defs", null, [
u("radialGradient", {
id: `hollow_gradient_${b.value}`
}, [
u("stop", {
offset: "0%",
"stop-color": d(g)(t.value.style.chart.backgroundColor, 0)
}, null, 8, ao),