vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
860 lines (859 loc) • 42.4 kB
JavaScript
import { useCssVars as Ue, computed as f, ref as b, watch as Te, onMounted as Ye, createElementBlock as i, openBlock as o, unref as r, normalizeStyle as T, normalizeClass as Q, createBlock as H, createCommentVNode as c, createVNode as ie, createSlots as He, withCtx as A, renderSlot as m, normalizeProps as R, guardReactiveProps as X, Fragment as _, renderList as z, createElementVNode as v, toDisplayString as x, withKeys as je, createTextVNode as We, nextTick as qe } from "vue";
import { u as Ke, o as Je, e as Ae, c as re, a as Qe, C as Ze, N as j, g as el, X as ll, G as ve, i as O, f as M, v as N, q as tl, r as al, x as ol, y as sl } from "./index-CO-5OgQA.js";
import { _ as ul } from "./Title-CxubvuEh.js";
import { u as nl, U as il } from "./usePrinter-DldU0tBx.js";
import { _ as rl } from "./Tooltip-C0W6IWVK.js";
import vl from "./vue-ui-skeleton-BeEBd4CC.js";
import yl from "./BaseIcon-V0HD2AAD.js";
import dl from "./vue-ui-accordion-RRHvINsj.js";
import { u as ze } from "./useNestedProp-D8sa_wYF.js";
import { _ as cl } from "./PackageVersion-DqsC6J9R.js";
import { _ as hl } from "./PenAndPaper-Bqjmruhh.js";
import { u as gl } from "./useUserOptionState-BIvW1Kz7.js";
import { u as pl } from "./useChartAccessibility-BWojgys7.js";
import { _ as fl } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const bl = ["id"], ml = {
key: 2,
style: "width:100%;background:transparent"
}, xl = ["xmlns", "viewBox"], wl = ["width", "height"], kl = ["x", "y", "height", "width", "fill", "stroke", "stroke-width"], _l = ["x", "y", "height", "width", "fill", "stroke", "stroke-width"], $l = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"], Cl = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"], Ll = ["font-size", "font-weight", "fill", "x", "y"], Tl = ["x", "y", "width", "height", "onMouseover", "onClick"], Al = { key: 0 }, zl = ["font-size", "fill", "x", "y", "font-weight"], Ml = ["font-size", "fill", "x", "y", "font-weight"], Sl = { key: 1 }, Ol = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"], Nl = ["x", "y", "width", "height", "fill", "stroke", "stroke-width"], Vl = { key: 2 }, Fl = ["text-anchor", "font-size", "fill", "font-weight", "transform"], Il = ["text-anchor", "font-size", "fill", "font-weight", "transform"], Pl = { key: 4 }, Rl = ["x", "y", "width", "height", "stroke", "stroke-width"], Xl = { key: 5 }, Bl = ["id"], Dl = ["stop-color"], El = ["stop-color"], Gl = ["x", "y", "font-size", "fill"], Ul = ["x", "y", "height", "rx", "fill"], Yl = ["x", "y", "font-size", "fill"], Hl = ["stroke", "x1", "x2", "y1", "y2"], jl = ["fill", "d"], Wl = { key: 6 }, ql = {
id: "colorScaleHorizontal",
x1: "0%",
x2: "100%",
y1: "0%",
y2: "0%"
}, Kl = ["stop-color"], Jl = ["stop-color"], Ql = ["x", "y", "width", "height", "rx"], Zl = ["x", "y", "font-size", "fill"], et = ["x", "y", "font-size", "fill"], lt = ["stroke", "x1", "x2", "y1", "y2"], tt = ["fill", "d"], at = {
key: 5,
class: "vue-data-ui-watermark"
}, ot = {
key: 6,
ref: "source",
dir: "auto"
}, st = { class: "vue-ui-data-table" }, ut = { key: 0 }, nt = ["data-cell"], it = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, rt = ["data-cell"], vt = { style: { display: "flex", "align-items": "center", gap: "5px", "justify-content": "flex-end", width: "100%", "padding-right": "3px" } }, yt = {
__name: "vue-ui-heatmap",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectDatapoint"],
setup(B, { expose: Me, emit: Se }) {
Ue((l) => ({
"6b84a214": l.tdo
}));
const { vue_ui_heatmap: Oe } = Ke(), y = B, Ne = Se, W = f(() => !!y.dataset && y.dataset.length);
Je(y.dataset) && Ae({
componentName: "VueUiHeatmap",
type: "dataset"
});
const D = b(re()), Z = b(null), Ve = b(null), ee = b(!1), le = b(""), ye = b(void 0), E = b(null), de = b(0), ce = b(null), Fe = b(null), he = b(!1), ge = b(0), e = f({
get: () => me(),
set: (l) => l
}), { userOptionsVisible: te, setUserOptionsVisibility: pe, keepUserOptionState: fe } = gl({ config: e.value }), { svgRef: be } = pl({ config: e.value.style.title });
function me() {
const l = ze({
userConfig: y.config,
defaultConfig: Oe
});
let s = {};
return l.theme ? s = {
...ze({
userConfig: Qe.vue_ui_heatmap[l.theme] || y.config,
defaultConfig: l
})
} : s = l, y.config && Ze(y.config, "style.layout.dataLabels.xAxis.showOnlyAtModulo") ? s.style.layout.dataLabels.xAxis.showOnlyAtModulo = y.config.style.layout.dataLabels.xAxis.showOnlyAtModulo : s.style.layout.dataLabels.xAxis.showOnlyAtModulo = null, s;
}
Te(() => y.config, (l) => {
e.value = me(), te.value = !e.value.userOptions.showOnChartHover, ae(), ge.value += 1, $.value.showTable = e.value.table.show, $.value.showTooltip = e.value.style.tooltip.show;
}, { deep: !0 }), Te(() => y.dataset, () => {
ae();
}, { deep: !0 });
const { isPrinting: xe, isImaging: we, generatePdf: ke, generateImage: _e } = nl({
elementId: `heatmap__${D.value}`,
fileName: e.value.style.title.text || "vue-ui-heatmap",
options: e.value.userOptions.print
}), Ie = f(() => e.value.userOptions.show && !e.value.style.title.text), $ = b({
showTable: e.value.table.show,
showTooltip: e.value.style.tooltip.show
}), Pe = f(() => e.value.table.responsiveBreakpoint);
function Re() {
new ResizeObserver((s) => {
s.forEach((n) => {
he.value = n.contentRect.width < Pe.value;
});
}).observe(ce.value);
}
Ye(ae);
function ae() {
Re();
}
const V = f(() => Math.max(...y.dataset.flatMap((l) => (l.values || []).length))), C = f(() => {
const l = e.value.style.layout.padding.top + e.value.style.layout.padding.bottom + y.dataset.length * e.value.style.layout.cells.height, s = e.value.style.layout.padding.left + e.value.style.layout.padding.right + (V.value < y.dataset.length ? y.dataset.length : V.value) * e.value.style.layout.cells.height, n = l + (e.value.style.legend.show ? e.value.style.legend.position === "right" ? 0 : e.value.style.layout.cells.height * 2 : 0);
return {
height: l,
heightWithLegend: n,
width: s
};
}), q = f(() => e.value.style.legend.position), t = f(() => ({
top: e.value.style.layout.padding.top,
left: e.value.style.layout.padding.left,
right: C.value.width - e.value.style.layout.padding.right - (q.value === "right" && e.value.style.legend.show ? 92 : 0),
bottom: C.value.height - e.value.style.layout.padding.bottom,
height: C.value.height - e.value.style.layout.padding.top - e.value.style.layout.padding.bottom,
width: C.value.width - e.value.style.layout.padding.right - e.value.style.layout.padding.left - (q.value === "right" && e.value.style.legend.show ? 92 : 0)
})), oe = f(() => a.value.height * y.dataset.length), L = f(() => Math.max(...y.dataset.flatMap((l) => l.values))), F = f(() => Math.min(...y.dataset.flatMap((l) => l.values))), I = f(() => {
const l = y.dataset.flatMap((n) => n.values);
return l.reduce((n, u) => n + u, 0) / l.length;
}), a = f(() => ({
width: t.value.width / V.value,
height: t.value.width / (V.value < y.dataset.length ? y.dataset.length : V.value)
})), g = f(() => {
const l = e.value.style.layout.dataLabels.yAxis.values.length ? e.value.style.layout.dataLabels.yAxis.values : y.dataset.map((h) => h.name), s = e.value.style.layout.dataLabels.xAxis.values, n = y.dataset.map((h) => h.values.reduce((w, ne) => w + ne, 0)), u = Math.max(...n), d = Math.min(...n), p = [];
for (let h = 0; h < V.value; h += 1)
p.push(y.dataset.map((w) => w.values[h] || 0).reduce((w, ne) => w + ne, 0));
const k = Math.max(...p), ue = Math.min(...p);
return {
yTotals: n.map((h) => {
const w = isNaN(h / u) ? 0 : h / u;
return {
total: h,
proportion: w,
color: j(e.value.style.layout.cells.colors.cold, e.value.style.layout.cells.colors.hot, d, u, h)
};
}),
xTotals: p.map((h) => {
const w = isNaN(h / k) ? 0 : h / k;
return {
total: h,
proportion: w,
color: j(e.value.style.layout.cells.colors.cold, e.value.style.layout.cells.colors.hot, ue, k, h)
};
}),
yLabels: l,
xLabels: s.slice(0, V.value)
};
}), K = f(() => (y.dataset.forEach((l, s) => {
el({
datasetObject: l,
requiredAttributes: ["values"]
}).forEach((n) => {
Ae({
componentName: "VueUiHeatmap",
type: "datasetSerieAttribute",
property: "values",
index: s
});
});
}), y.dataset.map((l) => ({
...l,
temperatures: (l.values || []).map((s, n) => s >= I.value ? {
side: "up",
color: j(e.value.style.layout.cells.colors.cold, e.value.style.layout.cells.colors.hot, F.value, L.value, s),
ratio: Math.abs(Math.abs(s - I.value) / Math.abs(L.value - I.value)) > 1 ? 1 : Math.abs(Math.abs(s - I.value) / Math.abs(L.value - I.value)),
value: s,
yAxisName: l.name,
xAxisName: g.value.xLabels[n],
id: `vue-data-ui-heatmap-cell-${re()}`
} : {
side: "down",
ratio: Math.abs(1 - Math.abs(s) / Math.abs(I.value)) > 1 ? 1 : Math.abs(1 - Math.abs(s) / Math.abs(I.value)),
color: j(e.value.style.layout.cells.colors.cold, e.value.style.layout.cells.colors.hot, F.value, L.value, s),
value: s,
yAxisName: l.name,
xAxisName: g.value.xLabels[n],
id: `vue-data-ui-heatmap-cell-${re()}`
})
})))), S = b(null), G = b(null);
function Xe(l, s, n, u) {
E.value = { x: n, y: u };
const { value: d, yAxisName: p, xAxisName: k, id: ue } = l;
ye.value = ue, S.value = d, G.value = {
datapoint: l,
seriesIndex: s,
series: K.value,
config: e.value
}, ee.value = !0;
let h = "";
const w = e.value.style.tooltip.customFormat;
ol(w) && sl(() => w({
datapoint: l,
seriesIndex: s,
series: K.value,
config: e.value
})) ? le.value = w({
datapoint: l,
seriesIndex: s,
series: K.value,
config: e.value
}) : (h += `<div>${p} ${k ? `${k}` : ""}</div>`, h += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${e.value.style.tooltip.borderColor};font-weight:bold;display:flex;flex-direction:row;gap:12px;align-items:center;justify-content:center"><span style="color:${j(e.value.style.layout.cells.colors.cold, e.value.style.layout.cells.colors.hot, F.value, L.value, d)}">⬤</span><span>${isNaN(d) ? "-" : O(
e.value.style.layout.cells.value.formatter,
d,
M({
p: e.value.style.layout.dataLabels.prefix,
v: d,
s: e.value.style.layout.dataLabels.suffix,
r: e.value.style.tooltip.roundingValue
}),
{ datapoint: l, seriesIndex: s }
)}</span></div>`, le.value = `<div style="font-size:${e.value.style.tooltip.fontSize}px">${h}</div>`);
}
const U = f(() => t.value.top + oe.value * (1 - S.value / L.value)), Y = f(() => t.value.left + (C.value.width - t.value.left - e.value.style.layout.padding.right) * (S.value / L.value));
function Be(l) {
return O(
e.value.style.layout.cells.value.formatter,
g.value.yTotals[l].total,
M({
p: e.value.style.layout.dataLabels.prefix,
v: g.value.yTotals[l].total,
s: e.value.style.layout.dataLabels.suffix,
r: e.value.style.layout.cells.value.roundingValue
}),
{ datapoint: g.value.yTotals[l], rowIndex: l }
);
}
function De(l) {
return O(
e.value.style.layout.cells.value.formatter,
g.value.xTotals[l].total,
M({
p: e.value.style.layout.dataLabels.prefix,
v: g.value.xTotals[l].total,
s: e.value.style.layout.dataLabels.suffix,
r: e.value.style.layout.cells.value.roundingValue
}),
{ datapoint: g.value.xTotals[l], colIndex: l }
);
}
f(() => {
const l = y.dataset.map((n) => ({
name: n.name
})), s = y.dataset.map((n) => n.values);
return { head: l, body: s };
});
function $e() {
qe(() => {
const l = ["", ...y.dataset.map((d, p) => d.name)], s = [];
for (let d = 0; d < g.value.xLabels.length; d += 1) {
const p = [g.value.xLabels[d]];
for (let k = 0; k < y.dataset.length; k += 1)
p.push([y.dataset[k].values[d]]);
s.push(p);
}
const n = [[e.value.style.title.text], [e.value.style.title.subtitle.text], [[""], [""], [""]]].concat([l]).concat(s), u = tl(n);
al({ csvContent: u, title: e.value.style.title.text || "vue-ui-heatmap" });
});
}
const P = b(!1);
function Ee(l) {
P.value = l, de.value += 1;
}
function Ce() {
$.value.showTable = !$.value.showTable;
}
function Le() {
$.value.showTooltip = !$.value.showTooltip;
}
const J = b(!1);
function se() {
J.value = !J.value;
}
function Ge(l) {
Ne("selectDatapoint", l);
}
return Me({
generatePdf: ke,
generateCsv: $e,
generateImage: _e,
toggleTable: Ce,
toggleTooltip: Le,
toggleAnnotator: se
}), (l, s) => (o(), i("div", {
ref_key: "heatmapChart",
ref: Z,
class: Q(`vue-ui-heatmap ${P.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
style: T(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.backgroundColor}`),
id: `heatmap__${D.value}`,
onMouseenter: s[3] || (s[3] = () => r(pe)(!0)),
onMouseleave: s[4] || (s[4] = () => r(pe)(!1))
}, [
e.value.userOptions.buttons.annotator ? (o(), H(hl, {
key: 0,
svgRef: r(be),
backgroundColor: e.value.style.backgroundColor,
color: e.value.style.color,
active: J.value,
onClose: se
}, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : c("", !0),
Ie.value ? (o(), i("div", {
key: 1,
ref_key: "noTitle",
ref: Fe,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : c("", !0),
e.value.style.title.text ? (o(), i("div", ml, [
(o(), H(ul, {
key: `title_${ge.value}`,
config: {
title: {
cy: "heatmap-div-title",
...e.value.style.title
},
subtitle: {
cy: "heatmap-div-subtitle",
...e.value.style.title.subtitle
}
}
}, null, 8, ["config"]))
])) : c("", !0),
e.value.userOptions.show && W.value && (r(fe) || r(te)) ? (o(), H(il, {
ref_key: "details",
ref: Ve,
key: `user_options_${de.value}`,
backgroundColor: e.value.style.backgroundColor,
color: e.value.style.color,
isImaging: r(we),
isPrinting: r(xe),
uid: D.value,
hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.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: P.value,
isTooltip: $.value.showTooltip,
titles: { ...e.value.userOptions.buttonTitles },
chartElement: Z.value,
position: e.value.userOptions.position,
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: J.value,
onToggleFullscreen: Ee,
onGeneratePdf: r(ke),
onGenerateCsv: $e,
onGenerateImage: r(_e),
onToggleTable: Ce,
onToggleTooltip: Le,
onToggleAnnotator: se,
style: T({
visibility: r(fe) ? r(te) ? "visible" : "hidden" : "visible"
})
}, He({ _: 2 }, [
l.$slots.menuIcon ? {
name: "menuIcon",
fn: A(({ isOpen: n, color: u }) => [
m(l.$slots, "menuIcon", R(X({ isOpen: n, color: u })), void 0, !0)
]),
key: "0"
} : void 0,
l.$slots.optionTooltip ? {
name: "optionTooltip",
fn: A(() => [
m(l.$slots, "optionTooltip", {}, void 0, !0)
]),
key: "1"
} : void 0,
l.$slots.optionPdf ? {
name: "optionPdf",
fn: A(() => [
m(l.$slots, "optionPdf", {}, void 0, !0)
]),
key: "2"
} : void 0,
l.$slots.optionCsv ? {
name: "optionCsv",
fn: A(() => [
m(l.$slots, "optionCsv", {}, void 0, !0)
]),
key: "3"
} : void 0,
l.$slots.optionImg ? {
name: "optionImg",
fn: A(() => [
m(l.$slots, "optionImg", {}, void 0, !0)
]),
key: "4"
} : void 0,
l.$slots.optionTable ? {
name: "optionTable",
fn: A(() => [
m(l.$slots, "optionTable", {}, void 0, !0)
]),
key: "5"
} : void 0,
l.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: A(({ toggleFullscreen: n, isFullscreen: u }) => [
m(l.$slots, "optionFullscreen", R(X({ toggleFullscreen: n, isFullscreen: u })), void 0, !0)
]),
key: "6"
} : void 0,
l.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: A(({ toggleAnnotator: n, isAnnotator: u }) => [
m(l.$slots, "optionAnnotator", R(X({ toggleAnnotator: n, isAnnotator: u })), 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", "onGeneratePdf", "onGenerateImage", "style"])) : c("", !0),
W.value ? (o(), i("svg", {
key: 4,
ref_key: "svgRef",
ref: be,
xmlns: r(ll),
class: Q({ "vue-data-ui-fullscreen--on": P.value, "vue-data-ui-fulscreen--off": !P.value }),
viewBox: `0 0 ${C.value.width} ${C.value.heightWithLegend}`,
style: T(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.color}`)
}, [
ie(cl),
l.$slots["chart-background"] ? (o(), i("foreignObject", {
key: 0,
x: 0,
y: 0,
width: C.value.width,
height: C.value.heightWithLegend,
style: {
pointerEvents: "none"
}
}, [
m(l.$slots, "chart-background", {}, void 0, !0)
], 8, wl)) : c("", !0),
e.value.style.layout.cells.columnTotal.color.show ? (o(), i(_, { key: 1 }, [
(o(!0), i(_, null, z(g.value.xTotals, (n, u) => (o(), i("rect", {
x: t.value.left + a.value.width * u + e.value.style.layout.cells.spacing / 2 + (e.value.style.layout.cells.rowTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0),
y: t.value.top - a.value.height / 3 - e.value.style.layout.cells.spacing,
height: a.value.height / 3,
width: a.value.width - e.value.style.layout.cells.spacing,
fill: e.value.style.layout.cells.colors.underlayer,
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.cells.spacing
}, null, 8, kl))), 256)),
(o(!0), i(_, null, z(g.value.xTotals, (n, u) => (o(), i("rect", {
x: t.value.left + a.value.width * u + e.value.style.layout.cells.spacing / 2 + (e.value.style.layout.cells.rowTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0),
y: t.value.top - a.value.height / 3 - e.value.style.layout.cells.spacing,
height: a.value.height / 3,
width: a.value.width - e.value.style.layout.cells.spacing,
fill: n.color,
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.cells.spacing
}, null, 8, _l))), 256))
], 64)) : c("", !0),
(o(!0), i(_, null, z(K.value, (n, u) => (o(), i("g", null, [
(o(!0), i(_, null, z(n.temperatures, (d, p) => (o(), i("g", null, [
v("rect", {
x: t.value.left + a.value.width * p + e.value.style.layout.cells.spacing / 2 + (e.value.style.layout.cells.rowTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0),
y: t.value.top + a.value.height * u + e.value.style.layout.cells.spacing / 2,
width: a.value.width - e.value.style.layout.cells.spacing,
height: a.value.height - e.value.style.layout.cells.spacing,
fill: e.value.style.layout.cells.colors.underlayer,
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.cells.spacing
}, null, 8, $l),
v("rect", {
x: t.value.left + a.value.width * p + e.value.style.layout.cells.spacing / 2 + (e.value.style.layout.cells.rowTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0),
y: t.value.top + a.value.height * u + e.value.style.layout.cells.spacing / 2,
width: a.value.width - e.value.style.layout.cells.spacing,
height: a.value.height - e.value.style.layout.cells.spacing,
fill: d.color,
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.cells.spacing
}, null, 8, Cl),
e.value.style.layout.cells.value.show ? (o(), i("text", {
key: 0,
"text-anchor": "middle",
"font-size": e.value.style.layout.cells.value.fontSize,
"font-weight": e.value.style.layout.cells.value.bold ? "bold" : "normal",
fill: r(ve)(d.color),
x: t.value.left + a.value.width * p + a.value.width / 2 + +(e.value.style.layout.cells.rowTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0),
y: t.value.top + a.value.height * u + a.value.height / 2 + e.value.style.layout.cells.value.fontSize / 3
}, x(r(O)(
e.value.style.layout.cells.value.formatter,
d.value,
r(M)({
p: e.value.style.layout.dataLabels.prefix,
v: d.value,
s: e.value.style.layout.dataLabels.suffix,
r: e.value.style.layout.cells.value.roundingValue
}),
{ datapoint: d }
)), 9, Ll)) : c("", !0)
]))), 256)),
(o(!0), i(_, null, z(n.temperatures, (d, p) => (o(), i("g", null, [
v("rect", {
x: t.value.left + a.value.width * p + (e.value.style.layout.cells.rowTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0),
y: t.value.top + a.value.height * u,
width: a.value.width,
height: a.value.height,
fill: "transparent",
stroke: "none",
onMouseover: (k) => Xe(d, u, t.value.left + a.value.width * p, t.value.top + a.value.height * u),
onMouseout: s[0] || (s[0] = (k) => {
ee.value = !1, ye.value = void 0, S.value = null, E.value = null;
}),
onClick: () => Ge(d)
}, null, 40, Tl)
]))), 256)),
e.value.style.layout.dataLabels.yAxis.show ? (o(), i("g", Al, [
v("text", {
class: "vue-ui-heatmap-row-name",
"font-size": e.value.style.layout.dataLabels.yAxis.fontSize,
fill: e.value.style.layout.dataLabels.yAxis.color,
x: t.value.left + e.value.style.layout.dataLabels.yAxis.offsetX - 6,
y: t.value.top + a.value.height * u + a.value.height / 2 + e.value.style.layout.dataLabels.yAxis.fontSize / 3 + e.value.style.layout.dataLabels.yAxis.offsetY - (e.value.style.layout.cells.rowTotal.value.show ? e.value.style.layout.dataLabels.yAxis.fontSize / 1.5 : 0),
"text-anchor": "end",
"font-weight": e.value.style.layout.dataLabels.yAxis.bold ? "bold" : "normal"
}, x(g.value.yLabels[u]), 9, zl),
e.value.style.layout.cells.rowTotal.value.show ? (o(), i("text", {
key: 0,
class: "vue-ui-heatmap-row-total",
"font-size": e.value.style.layout.dataLabels.yAxis.fontSize,
fill: e.value.style.layout.dataLabels.yAxis.color,
x: t.value.left + e.value.style.layout.dataLabels.yAxis.offsetX - 6,
y: t.value.top + a.value.height * u + a.value.height / 2 + e.value.style.layout.dataLabels.yAxis.fontSize + e.value.style.layout.dataLabels.yAxis.offsetY,
"text-anchor": "end",
"font-weight": e.value.style.layout.dataLabels.yAxis.bold ? "bold" : "normal"
}, x(Be(u)), 9, Ml)) : c("", !0)
])) : c("", !0),
e.value.style.layout.cells.rowTotal.color.show ? (o(), i("g", Sl, [
v("rect", {
x: t.value.left,
y: t.value.top + a.value.height * u,
width: a.value.height / 3,
height: a.value.height - e.value.style.layout.cells.spacing,
fill: e.value.style.layout.cells.colors.underlayer,
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.cells.spacing
}, null, 8, Ol),
v("rect", {
x: t.value.left,
y: t.value.top + a.value.height * u + e.value.style.layout.cells.spacing / 2,
width: a.value.height / 3,
height: a.value.height - e.value.style.layout.cells.spacing,
fill: g.value.yTotals[u].color,
stroke: e.value.style.backgroundColor,
"stroke-width": e.value.style.layout.cells.spacing
}, null, 8, Nl)
])) : c("", !0)
]))), 256)),
e.value.style.layout.dataLabels.xAxis.show ? (o(), i("g", Vl, [
(o(!0), i(_, null, z(g.value.xLabels, (n, u) => (o(), i(_, null, [
!e.value.style.layout.dataLabels.xAxis.showOnlyAtModulo || e.value.style.layout.dataLabels.xAxis.showOnlyAtModulo && u % e.value.style.layout.dataLabels.xAxis.showOnlyAtModulo === 0 ? (o(), i("text", {
key: 0,
class: "vue-ui-heatmap-col-name",
"text-anchor": e.value.style.layout.dataLabels.xAxis.rotation === 0 ? "middle" : e.value.style.layout.dataLabels.xAxis.rotation < 0 ? "start" : "end",
"font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
fill: e.value.style.layout.dataLabels.xAxis.color,
"font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal",
transform: `translate(${t.value.left + a.value.width / 2 + t.value.width / g.value.xLabels.length * u + e.value.style.layout.dataLabels.xAxis.offsetX + (e.value.style.layout.cells.rowTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0)}, ${t.value.top + e.value.style.layout.dataLabels.xAxis.offsetY - 6 - (e.value.style.layout.cells.columnTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0)}), rotate(${e.value.style.layout.dataLabels.xAxis.rotation})`
}, x(n), 9, Fl)) : c("", !0)
], 64))), 256))
])) : c("", !0),
e.value.style.layout.cells.columnTotal.value.show ? (o(!0), i(_, { key: 3 }, z(g.value.xLabels, (n, u) => (o(), i("text", {
class: "vue-ui-heatmap-col-total",
"text-anchor": e.value.style.layout.cells.columnTotal.value.rotation === 0 ? "middle" : e.value.style.layout.cells.columnTotal.value.rotation < 0 ? "end" : "start",
"font-size": e.value.style.layout.dataLabels.xAxis.fontSize,
fill: e.value.style.layout.dataLabels.xAxis.color,
"font-weight": e.value.style.layout.dataLabels.xAxis.bold ? "bold" : "normal",
transform: `translate(${t.value.left + a.value.width / 2 + t.value.width / g.value.xLabels.length * u + e.value.style.layout.dataLabels.xAxis.offsetX + e.value.style.layout.cells.columnTotal.value.offsetX + (e.value.style.layout.cells.rowTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0)}, ${(a.value.height + e.value.style.layout.cells.spacing) * (B.dataset.length + 1) + e.value.style.layout.cells.columnTotal.value.offsetY}), rotate(${e.value.style.layout.cells.columnTotal.value.rotation})`
}, x(De(u)), 9, Il))), 256)) : c("", !0),
E.value ? (o(), i("g", Pl, [
v("rect", {
style: { "pointer-events": "none" },
x: E.value.x - e.value.style.layout.cells.selected.border / 2 + e.value.style.layout.cells.spacing + (e.value.style.layout.cells.rowTotal.color.show ? a.value.height / 3 + e.value.style.layout.cells.spacing : 0),
y: E.value.y - e.value.style.layout.cells.selected.border / 2 + e.value.style.layout.cells.spacing,
width: a.value.width - e.value.style.layout.cells.spacing + e.value.style.layout.cells.selected.border - e.value.style.layout.cells.spacing,
height: a.value.height - e.value.style.layout.cells.spacing + e.value.style.layout.cells.selected.border - e.value.style.layout.cells.spacing,
fill: "transparent",
stroke: e.value.style.layout.cells.selected.color,
"stroke-width": e.value.style.layout.cells.selected.border,
rx: 1
}, null, 8, Rl)
])) : c("", !0),
e.value.style.legend.show && q.value === "right" ? (o(), i("g", Xl, [
v("defs", null, [
v("linearGradient", {
id: `colorScaleVertical_${D.value}`,
x2: "0%",
y2: "100%"
}, [
v("stop", {
offset: "0%",
"stop-color": e.value.style.layout.cells.colors.hot
}, null, 8, Dl),
v("stop", {
offset: "100%",
"stop-color": e.value.style.layout.cells.colors.cold
}, null, 8, El)
], 8, Bl)
]),
v("text", {
x: t.value.right + 36 + 18,
y: t.value.top - e.value.style.legend.fontSize * 1.5,
"text-anchor": "middle",
"font-size": e.value.style.legend.fontSize * 2,
fill: e.value.style.legend.color
}, x(r(O)(
e.value.style.layout.cells.value.formatter,
r(N)(L.value),
r(M)({
p: e.value.style.layout.dataLabels.prefix,
v: r(N)(L.value),
s: e.value.style.layout.dataLabels.suffix,
r: e.value.style.legend.roundingValue
})
)), 9, Gl),
v("rect", {
x: t.value.right + 36,
y: t.value.top,
width: 36,
height: oe.value,
rx: e.value.style.legend.scaleBorderRadius,
fill: `url(#colorScaleVertical_${D.value})`
}, null, 8, Ul),
v("text", {
x: t.value.right + 36 + 18,
y: t.value.top + oe.value + e.value.style.legend.fontSize * 2.5,
"text-anchor": "middle",
"font-size": e.value.style.legend.fontSize * 2,
fill: e.value.style.legend.color
}, x(r(O)(
e.value.style.layout.cells.value.formatter,
r(N)(F.value),
r(M)({
p: e.value.style.layout.dataLabels.prefix,
v: r(N)(F.value),
s: e.value.style.layout.dataLabels.suffix,
r: e.value.style.legend.roundingValue
})
)), 9, Yl),
S.value !== null ? (o(), i("line", {
key: 0,
stroke: r(ve)(G.value.datapoint.color),
"stroke-width": "2",
x1: t.value.right + 36,
x2: t.value.right + 72,
y1: U.value,
y2: U.value
}, null, 8, Hl)) : c("", !0),
S.value !== null ? (o(), i("path", {
key: 1,
fill: e.value.style.color,
stroke: "none",
d: `M ${t.value.right + 36},${U.value} ${t.value.right + 26},${U.value - 8} ${t.value.right + 26},${U.value + 8}z`
}, null, 8, jl)) : c("", !0)
])) : c("", !0),
e.value.style.legend.show && q.value === "bottom" ? (o(), i("g", Wl, [
v("defs", null, [
v("linearGradient", ql, [
v("stop", {
offset: "0%",
"stop-color": e.value.style.layout.cells.colors.cold
}, null, 8, Kl),
v("stop", {
offset: "100%",
"stop-color": e.value.style.layout.cells.colors.hot
}, null, 8, Jl)
])
]),
v("rect", {
x: t.value.left,
y: t.value.bottom + e.value.style.layout.cells.height,
width: C.value.width - t.value.left - e.value.style.layout.padding.right,
height: e.value.style.layout.cells.height,
rx: e.value.style.legend.scaleBorderRadius > e.value.style.layout.cells.height / 2 ? e.value.style.layout.cells.height / 2 : e.value.style.legend.scaleBorderRadius,
fill: "url(#colorScaleHorizontal)"
}, null, 8, Ql),
v("text", {
x: t.value.left,
y: t.value.bottom + e.value.style.layout.cells.height * 2 + e.value.style.legend.fontSize * 2,
"text-anchor": "start",
"font-size": e.value.style.legend.fontSize * 2,
fill: e.value.style.legend.color
}, x(r(O)(
e.value.style.layout.cells.value.formatter,
r(N)(F.value),
r(M)({
p: e.value.style.layout.dataLabels.prefix,
v: r(N)(F.value),
s: e.value.style.layout.dataLabels.suffix,
r: e.value.style.legend.roundingValue
})
)), 9, Zl),
v("text", {
x: t.value.right,
y: t.value.bottom + e.value.style.layout.cells.height * 2 + e.value.style.legend.fontSize * 2,
"text-anchor": "end",
"font-size": e.value.style.legend.fontSize * 2,
fill: e.value.style.legend.color
}, x(r(O)(
e.value.style.layout.cells.value.formatter,
r(N)(L.value),
r(M)({
p: e.value.style.layout.dataLabels.prefix,
v: r(N)(L.value),
s: e.value.style.layout.dataLabels.suffix,
r: e.value.style.legend.roundingValue
})
)), 9, et),
S.value !== null ? (o(), i("line", {
key: 0,
stroke: r(ve)(G.value.datapoint.color),
"stroke-width": "2",
x1: Y.value,
x2: Y.value,
y1: t.value.bottom + e.value.style.layout.cells.height,
y2: t.value.bottom + e.value.style.layout.cells.height * 2
}, null, 8, lt)) : c("", !0),
S.value !== null ? (o(), i("path", {
key: 1,
fill: e.value.style.color,
stroke: "none",
d: `M ${Y.value},${t.value.bottom + e.value.style.layout.cells.height} ${Y.value - 12},${t.value.bottom + e.value.style.layout.cells.height - 20} ${Y.value + 12},${t.value.bottom + e.value.style.layout.cells.height - 20}z`
}, null, 8, tt)) : c("", !0)
])) : c("", !0),
m(l.$slots, "svg", { svg: C.value }, void 0, !0)
], 14, xl)) : c("", !0),
l.$slots.watermark ? (o(), i("div", at, [
m(l.$slots, "watermark", R(X({ isPrinting: r(xe) || r(we) })), void 0, !0)
])) : c("", !0),
l.$slots.source ? (o(), i("div", ot, [
m(l.$slots, "source", {}, void 0, !0)
], 512)) : c("", !0),
W.value ? c("", !0) : (o(), H(vl, {
key: 7,
config: {
type: "heatmap",
style: {
backgroundColor: e.value.style.backgroundColor,
heatmap: {
color: "#CCCCCC"
}
}
}
}, null, 8, ["config"])),
ie(rl, {
show: $.value.showTooltip && ee.value,
backgroundColor: e.value.style.tooltip.backgroundColor,
color: e.value.style.tooltip.color,
borderRadius: e.value.style.tooltip.borderRadius,
borderColor: e.value.style.tooltip.borderColor,
borderWidth: e.value.style.tooltip.borderWidth,
fontSize: e.value.style.tooltip.fontSize,
backgroundOpacity: e.value.style.tooltip.backgroundOpacity,
position: e.value.style.tooltip.position,
offsetY: e.value.style.tooltip.offsetY,
parent: Z.value,
content: le.value,
isFullscreen: P.value,
isCustom: e.value.style.tooltip.customFormat && typeof e.value.style.tooltip.customFormat == "function"
}, {
"tooltip-before": A(() => [
m(l.$slots, "tooltip-before", R(X({ ...G.value })), void 0, !0)
]),
"tooltip-after": A(() => [
m(l.$slots, "tooltip-after", R(X({ ...G.value })), void 0, !0)
]),
_: 3
}, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
W.value ? (o(), H(dl, {
key: 8,
hideDetails: "",
config: {
open: $.value.showTable,
maxHeight: 1e4,
body: {
backgroundColor: e.value.style.backgroundColor,
color: e.value.style.color
},
head: {
backgroundColor: e.value.style.backgroundColor,
color: e.value.style.color
}
}
}, {
content: A(() => [
v("div", {
ref_key: "tableContainer",
ref: ce,
class: "vue-ui-heatmap-table atom-data-table"
}, [
v("div", {
style: "width:100%;overflow-x:auto;padding-top:36px;position:relative",
class: Q({ "vue-ui-responsive": he.value })
}, [
v("div", {
role: "button",
tabindex: "0",
style: T(`width:32px; position: absolute; top: 0; left:4px; padding: 0 0px; display: flex; align-items:center;justify-content:center;height: 36px; width: 32px; cursor:pointer; background:${e.value.table.th.backgroundColor};`),
onClick: s[1] || (s[1] = (n) => $.value.showTable = !1),
onKeypress: s[2] || (s[2] = je((n) => $.value.showTable = !1, ["enter"]))
}, [
ie(yl, {
name: "close",
stroke: e.value.table.th.color,
"stroke-width": 2
}, null, 8, ["stroke"])
], 36),
v("table", st, [
v("caption", {
style: T(`backgroundColor:${e.value.table.th.backgroundColor};color:${e.value.table.th.color};outline:${e.value.table.th.outline}`)
}, [
We(x(e.value.style.title.text) + " ", 1),
e.value.style.title.subtitle.text ? (o(), i("span", ut, x(e.value.style.title.subtitle.text), 1)) : c("", !0)
], 4),
v("thead", null, [
v("tr", {
role: "row",
style: T(`background:${e.value.table.th.backgroundColor};color:${e.value.table.th.color}`)
}, [
v("th", {
style: T(`outline:${e.value.table.th.outline};padding-right:6px`)
}, null, 4),
(o(!0), i(_, null, z(B.dataset, (n, u) => (o(), i("th", {
align: "right",
style: T(`outline:${e.value.table.th.outline};padding-right:6px`)
}, x(n.name), 5))), 256))
], 4)
]),
v("tbody", null, [
(o(!0), i(_, null, z(g.value.xLabels, (n, u) => (o(), i("tr", {
role: "row",
class: Q({ "vue-ui-data-table__tbody__row": !0, "vue-ui-data-table__tbody__row-even": u % 2 === 0, "vue-ui-data-table__tbody__row-odd": u % 2 !== 0 }),
style: T(`background:${e.value.table.td.backgroundColor};color:${e.value.table.td.color}`)
}, [
v("td", {
"data-cell": e.value.table.colNames.xAxis,
class: "vue-ui-data-table__tbody__td",
style: T(`outline:${e.value.table.td.outline}`)
}, [
v("div", it, x(n), 1)
], 12, nt),
(o(!0), i(_, null, z(B.dataset, (d, p) => (o(), i("td", {
class: "vue-ui-data-table__tbody__td",
"data-cell": B.dataset[p].name,
style: T(`outline:${e.value.table.td.outline}`)
}, [
v("div", vt, x(isNaN(d.values[u]) ? "-" : r(M)({ p: e.value.style.layout.dataLabels.prefix, v: d.values[u], s: e.value.style.layout.dataLabels.suffix, r: e.value.table.td.roundingValue })), 1)
], 12, rt))), 256))
], 6))), 256))
])
])
], 2)
], 512)
]),
_: 1
}, 8, ["config"])) : c("", !0)
], 46, bl));
}
}, Lt = /* @__PURE__ */ fl(yt, [["__scopeId", "data-v-cd2b0b4d"]]);
export {
Lt as default
};