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