vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
762 lines (761 loc) • 32.7 kB
JavaScript
import { defineAsyncComponent as A, computed as f, ref as v, watch as Qe, shallowRef as Ae, onMounted as Ze, onBeforeUnmount as et, createElementBlock as u, openBlock as r, unref as n, normalizeStyle as Y, normalizeClass as R, createBlock as S, createCommentVNode as c, createVNode as Se, createSlots as tt, withCtx as y, renderSlot as p, normalizeProps as F, guardReactiveProps as I, createElementVNode as x, Fragment as k, renderList as T, toDisplayString as z, mergeProps as lt, createTextVNode as at, nextTick as ot } from "vue";
import { u as st, c as le, t as rt, p as O, a as ut, o as it, e as ae, g as ze, b as nt, d as Oe, v as vt, D as ct, f as j, X as ht, i as oe, I as dt, l as pt, h as ft, x as Pe, E as yt, q as bt, r as mt, y as gt } from "./index-BLtEpj8j.js";
import { t as kt, u as xt } from "./useResponsive-DfdjqQps.js";
import { u as Ne } from "./useNestedProp-Bw1KcAmj.js";
import { u as wt } from "./usePrinter-DnRwTdvS.js";
import { u as Ct } from "./useUserOptionState-BIvW1Kz7.js";
import { u as $t } from "./useChartAccessibility-9icAAmYg.js";
import Tt from "./Title-DkG60EPg.js";
import { _ as _t } from "./Shape-Cqnzky8X.js";
import Lt from "./img-D-vWHxhM.js";
import { _ as At } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const St = ["id"], zt = ["xmlns", "viewBox"], Ot = ["x", "y", "width", "height"], Pt = { key: 1 }, Nt = { key: 0 }, Mt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], Ft = { key: 1 }, It = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], Wt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Dt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Gt = ["x", "y", "fill", "font-size"], Rt = ["x", "y", "font-size", "fill"], Et = ["x", "y", "font-size", "fill", "innerHTML"], Vt = ["fill", "font-size", "transform"], Ht = ["fill", "font-size", "x", "y"], Ut = ["x1", "x2", "y1", "y2", "stroke"], Bt = ["cx", "cy", "fill"], Xt = ["cx", "cy", "fill"], Yt = ["id"], jt = ["stop-color"], qt = ["stop-color"], Jt = ["stop-color"], Kt = { key: 0 }, Qt = ["x", "y", "font-size", "fill"], Zt = {
key: 5,
class: "vue-data-ui-watermark"
}, el = ["innerHTML"], tl = {
__name: "vue-ui-strip-plot",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
emits: ["selectDatapoint"],
setup(Me, { expose: Fe, emit: Ie }) {
const We = A(() => import("./vue-ui-accordion-B6Svdk-2.js")), De = A(() => import("./DataTable-CS_V_Adx.js")), Ge = A(() => import("./PackageVersion-CnRyWKP-.js")), Re = A(() => import("./PenAndPaper-7BWf7zgA.js")), Ee = A(() => import("./vue-ui-skeleton-CsMU8DwQ.js")), Ve = A(() => import("./Tooltip-CuHsd1IQ.js")), He = A(() => import("./UserOptions-DGw0HvSp.js")), { vue_ui_strip_plot: Ue } = st(), b = Me, Be = Ie, _ = f({
get() {
return !!b.dataset && b.dataset.length;
},
set(t) {
return t;
}
}), q = v(le()), se = v(0), J = v(!1), K = v(""), C = v(null), re = v(null), ue = v(null), ie = v(null), ne = v(!1), ve = v(0), ce = v(0), e = f({
get: () => fe(),
set: (t) => t
}), { userOptionsVisible: Q, setUserOptionsVisibility: he, keepUserOptionState: de } = Ct({ config: e.value }), { svgRef: pe } = $t({ config: e.value.style.chart.title });
function fe() {
const t = Ne({
userConfig: b.config,
defaultConfig: Ue
});
return t.theme ? {
...Ne({
userConfig: ut.vue_ui_strip_plot[t.theme] || b.config,
defaultConfig: t
}),
customPalette: rt[t.theme] || O
} : t;
}
Qe(() => b.config, (t) => {
e.value = fe(), Q.value = !e.value.userOptions.showOnChartHover, ye(), ve.value += 1, ce.value += 1, d.value.dataLabels.show = e.value.style.chart.labels.bestPlotLabel.show, d.value.showTable = e.value.table.show, d.value.showTooltip = e.value.style.chart.tooltip.show;
}, { deep: !0 });
const $ = Ae(null), P = Ae(null);
Ze(() => {
ye();
});
function ye() {
if (it(b.dataset) ? ae({
componentName: "VueUiStripPlot",
type: "dataset"
}) : b.dataset.forEach((t, o) => {
ze({
datasetObject: t,
requiredAttributes: ["name", "plots"]
}).forEach((l) => {
_.value = !1, ae({
componentName: "VueUiStripPlot",
type: "datasetSerieAttribute",
property: l,
index: o
});
}), t.plots && t.plots.forEach((l, s) => {
ze({
datasetObject: l,
requiredAttributes: ["name", "value"]
}).forEach((i) => {
_.value = !1, ae({
componentName: "VueUiStripPlot",
type: "datasetSerieAttribute",
property: i,
index: `${o},${s}`
});
});
});
}), e.value.responsive) {
const t = kt(() => {
const { width: o, height: l } = xt({
chart: C.value,
title: e.value.style.chart.title.text ? re.value : null,
source: ue.value,
noTitle: ie.value
});
requestAnimationFrame(() => {
E.value = l, N.value.width = o, N.value.height = l, D.value = (o - m.value.left - m.value.right) / b.dataset.length, e.value.responsiveProportionalSizing ? G.value = yt({
relator: Math.min(l, o),
adjuster: 600,
source: e.value.style.chart.plots.radius,
threshold: 6,
fallback: 6
}) : G.value = e.value.style.chart.plots.radius;
});
});
$.value && (P.value && $.value.unobserve(P.value), $.value.disconnect()), $.value = new ResizeObserver(t), P.value = C.value.parentNode, $.value.observe(P.value);
}
ne.value = !0, setTimeout(() => {
W.value = !1;
}, Ye.value * 50);
}
et(() => {
$.value && (P.value && $.value.unobserve(P.value), $.value.disconnect());
});
const { isPrinting: be, isImaging: me, generatePdf: ge, generateImage: ke } = wt({
elementId: `strip-plot_${q.value}`,
fileName: e.value.style.chart.title.text || "vue-ui-strip-plot",
options: e.value.userOptions.print
}), Xe = f(() => e.value.userOptions.show && !e.value.style.chart.title.text), xe = f(() => nt(e.value.customPalette)), W = v(e.value.useCssAnimation), d = v({
showTable: e.value.table.show,
dataLabels: {
show: e.value.style.chart.labels.bestPlotLabel.show
},
showTooltip: e.value.style.chart.tooltip.show
}), m = v({
top: e.value.style.chart.padding.top,
bottom: e.value.style.chart.padding.bottom,
left: e.value.style.chart.padding.left,
right: e.value.style.chart.padding.right
}), D = v(e.value.style.chart.stripWidth), E = v(e.value.style.chart.height), G = v(e.value.style.chart.plots.radius), N = v({
width: D.value * b.dataset.length + m.value.left + m.value.right,
height: e.value.style.chart.height
}), a = f(() => {
const t = D.value * b.dataset.length + m.value.left + m.value.right;
return {
left: m.value.left,
right: t - m.value.right,
top: m.value.top,
bottom: E.value - m.value.bottom,
width: D.value * b.dataset.length,
height: E.value - m.value.top - m.value.bottom,
stripWidth: D.value,
absoluteHeight: E.value,
absoluteWidth: t
};
}), V = f(() => _.value ? b.dataset.map((t, o) => {
const l = le();
return {
...t,
id: l,
color: t.color ? Oe(t.color) : xe.value[o] || O[o] || O[o % O.length],
plots: t.plots.map((s) => ({
...s,
value: vt(s.value),
parentId: l,
color: t.color ? Oe(t.color) : xe.value[o] || O[o] || O[o % O.length],
id: le()
})).sort((s, i) => s.value - i.value)
};
}) : null), w = f(() => (V.value || []).map((t, o) => ({
...t,
plots: t.plots.map((l) => ({
...l,
x: a.value.left + (o + 1) * a.value.stripWidth - a.value.stripWidth / 2
}))
}))), Ye = f(() => Math.max(...w.value.map((t) => t.plots.length))), Z = f(() => {
const t = w.value.flatMap((o) => o.plots.map((l) => l.value));
return {
max: Math.max(...t),
min: Math.min(...t)
};
}), L = f(() => ct(Z.value.min < 0 ? Z.value.min : 0, Z.value.max, e.value.style.chart.grid.scaleSteps)), je = f(() => (w.value || []).map((t, o) => ({
...t,
plots: t.plots.map((l) => ({
...l,
y: a.value.bottom - (l.value + Math.abs(L.value.min)) / (L.value.max + Math.abs(L.value.min)) * a.value.height
}))
}))), we = f(() => L.value.ticks.map((t) => ({
y: a.value.bottom - a.value.height * ((t + Math.abs(L.value.min)) / (L.value.max + Math.abs(L.value.min))),
x1: a.value.left,
x2: a.value.right,
value: t
}))), ee = v(null), h = v(null);
function qe({ datapoint: t, seriesIndex: o }) {
ee.value = { datapoint: t, seriesIndex: o, config: e.value, series: V.value }, J.value = !0, h.value = t;
const l = e.value.style.chart.tooltip.customFormat;
if (Pe(l) && gt(() => l({
seriesIndex: o,
datapoint: t,
series: V.value,
config: e.value
})))
K.value = l({
seriesIndex: o,
datapoint: t,
series: V.value,
config: e.value
});
else {
let s = "";
s += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${e.value.style.chart.plots.gradient.show ? `url(#${t.parentId})` : t.color}"/></svg>${t.name}</div>`, s += `<div>${oe(
e.value.style.chart.labels.formatter,
t.value,
j({
p: e.value.style.chart.labels.prefix,
v: t.value,
s: e.value.style.chart.labels.suffix,
r: e.value.style.chart.tooltip.roundingValue
}),
{ datapoint: t, seriesIndex: o }
)}</div>`, K.value = `<div>${s}</div>`;
}
}
const H = f(() => {
const t = w.value.flatMap((l) => JSON.parse(JSON.stringify(l.plots)).sort((s, i) => i.value - s.value).map((s) => ({
name: `${l.name} - ${s.name}`,
color: s.color
}))), o = w.value.flatMap((l) => JSON.parse(JSON.stringify(l.plots)).sort((s, i) => i.value - s.value).map((s) => s.value));
return { head: t, body: o };
});
function Ce(t = null) {
ot(() => {
const o = H.value.head.map((i, g) => [[
i.name
], [H.value.body[g]]]), l = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[e.value.table.columnNames.series], [e.value.table.columnNames.value]]].concat(o), s = bt(l);
t ? t(s) : mt({ csvContent: s, title: e.value.style.chart.title.text || "vue-ui-strip-plot" });
});
}
const U = f(() => {
const t = [
e.value.table.columnNames.series,
e.value.table.columnNames.value
], o = H.value.head.map((i, g) => {
const X = j({
p: e.value.style.chart.labels.prefix,
v: H.value.body[g],
s: e.value.style.chart.labels.suffix,
r: e.value.table.td.roundingValue
});
return [
{
color: i.color,
name: i.name
},
X
];
}), l = {
th: {
backgroundColor: e.value.table.th.backgroundColor,
color: e.value.table.th.color,
outline: e.value.table.th.outline
},
td: {
backgroundColor: e.value.table.td.backgroundColor,
color: e.value.table.td.color,
outline: e.value.table.td.outline
},
breakpoint: e.value.table.responsiveBreakpoint
};
return {
colNames: [
e.value.table.columnNames.series,
e.value.table.columnNames.value
],
head: t,
body: o,
config: l
};
}), M = v(!1);
function $e(t) {
M.value = t, se.value += 1;
}
function Je() {
return w.value;
}
function Te() {
d.value.showTable = !d.value.showTable;
}
function _e() {
d.value.dataLabels.show = !d.value.dataLabels.show;
}
function Le() {
d.value.showTooltip = !d.value.showTooltip;
}
const B = v(!1);
function te() {
B.value = !B.value;
}
async function Ke({ scale: t = 2 } = {}) {
if (!C.value) return;
const { width: o, height: l } = C.value.getBoundingClientRect(), s = o / l, { imageUri: i, base64: g } = await Lt({ domElement: C.value, base64: !0, img: !0, scale: t });
return {
imageUri: i,
base64: g,
title: e.value.style.chart.title.text,
width: o,
height: l,
aspectRatio: s
};
}
return Fe({
getData: Je,
getImage: Ke,
generatePdf: ge,
generateCsv: Ce,
generateImage: ke,
toggleTable: Te,
toggleLabels: _e,
toggleTooltip: Le,
toggleAnnotator: te,
toggleFullscreen: $e
}), (t, o) => (r(), u("div", {
ref_key: "stripPlotChart",
ref: C,
class: R(`vue-ui-strip-plot ${M.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
style: Y(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height:100%" : ""}`),
id: `strip-plot_${q.value}`,
onMouseenter: o[2] || (o[2] = () => n(he)(!0)),
onMouseleave: o[3] || (o[3] = () => n(he)(!1))
}, [
e.value.userOptions.buttons.annotator ? (r(), S(n(Re), {
key: 0,
svgRef: n(pe),
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
active: B.value,
onClose: te
}, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : c("", !0),
Xe.value ? (r(), u("div", {
key: 1,
ref_key: "noTitle",
ref: ie,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : c("", !0),
e.value.style.chart.title.text ? (r(), u("div", {
key: 2,
ref_key: "chartTitle",
ref: re,
style: "width:100%;background:transparent;padding-bottom:24px"
}, [
(r(), S(Tt, {
key: `title_${ve.value}`,
config: {
title: {
cy: "donut-div-title",
...e.value.style.chart.title
},
subtitle: {
cy: "donut-div-subtitle",
...e.value.style.chart.title.subtitle
}
}
}, null, 8, ["config"]))
], 512)) : c("", !0),
e.value.userOptions.show && _.value && (n(de) || n(Q)) ? (r(), S(n(He), {
ref: "details",
key: `user_option_${se.value}`,
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
isPrinting: n(be),
isImaging: n(me),
uid: q.value,
hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
hasPdf: e.value.userOptions.buttons.pdf,
hasXls: e.value.userOptions.buttons.csv,
hasImg: e.value.userOptions.buttons.img,
hasTable: e.value.userOptions.buttons.table,
hasLabel: e.value.userOptions.buttons.labels,
hasFullscreen: e.value.userOptions.buttons.fullscreen,
isTooltip: d.value.showTooltip,
isFullscreen: M.value,
titles: { ...e.value.userOptions.buttonTitles },
chartElement: C.value,
position: e.value.userOptions.position,
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: B.value,
callbacks: e.value.userOptions.callbacks,
printScale: e.value.userOptions.print.scale,
onToggleFullscreen: $e,
onGeneratePdf: n(ge),
onGenerateCsv: Ce,
onGenerateImage: n(ke),
onToggleTable: Te,
onToggleLabels: _e,
onToggleTooltip: Le,
onToggleAnnotator: te,
style: Y({
visibility: n(de) ? n(Q) ? "visible" : "hidden" : "visible"
})
}, tt({ _: 2 }, [
t.$slots.menuIcon ? {
name: "menuIcon",
fn: y(({ isOpen: l, color: s }) => [
p(t.$slots, "menuIcon", F(I({ isOpen: l, color: s })), void 0, !0)
]),
key: "0"
} : void 0,
t.$slots.optionTooltip ? {
name: "optionTooltip",
fn: y(() => [
p(t.$slots, "optionTooltip", {}, void 0, !0)
]),
key: "1"
} : void 0,
t.$slots.optionPdf ? {
name: "optionPdf",
fn: y(() => [
p(t.$slots, "optionPdf", {}, void 0, !0)
]),
key: "2"
} : void 0,
t.$slots.optionCsv ? {
name: "optionCsv",
fn: y(() => [
p(t.$slots, "optionCsv", {}, void 0, !0)
]),
key: "3"
} : void 0,
t.$slots.optionImg ? {
name: "optionImg",
fn: y(() => [
p(t.$slots, "optionImg", {}, void 0, !0)
]),
key: "4"
} : void 0,
t.$slots.optionTable ? {
name: "optionTable",
fn: y(() => [
p(t.$slots, "optionTable", {}, void 0, !0)
]),
key: "5"
} : void 0,
t.$slots.optionLabels ? {
name: "optionLabels",
fn: y(() => [
p(t.$slots, "optionLabels", {}, void 0, !0)
]),
key: "6"
} : void 0,
t.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: y(({ toggleFullscreen: l, isFullscreen: s }) => [
p(t.$slots, "optionFullscreen", F(I({ toggleFullscreen: l, isFullscreen: s })), void 0, !0)
]),
key: "7"
} : void 0,
t.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: y(({ toggleAnnotator: l, isAnnotator: s }) => [
p(t.$slots, "optionAnnotator", F(I({ toggleAnnotator: l, isAnnotator: s })), void 0, !0)
]),
key: "8"
} : void 0
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasLabel", "hasFullscreen", "isTooltip", "isFullscreen", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "onGeneratePdf", "onGenerateImage", "style"])) : c("", !0),
_.value ? (r(), u("svg", {
key: 4,
ref_key: "svgRef",
ref: pe,
xmlns: n(ht),
class: R({ "vue-data-ui-fullscreen--on": M.value, "vue-data-ui-fulscreen--off": !M.value }),
viewBox: `0 0 ${N.value.width <= 0 ? 10 : N.value.width} ${N.value.height <= 0 ? 10 : N.value.height}`,
style: Y(`max-width:100%; overflow: visible; background:transparent;color:${e.value.style.chart.color};`)
}, [
Se(n(Ge)),
t.$slots["chart-background"] ? (r(), u("foreignObject", {
key: 0,
x: a.value.left,
y: a.value.top,
width: Math.max(0.1, a.value.width),
height: Math.max(0.1, a.value.height),
style: {
pointerEvents: "none"
}
}, [
p(t.$slots, "chart-background", {}, void 0, !0)
], 8, Ot)) : c("", !0),
e.value.style.chart.grid.show ? (r(), u("g", Pt, [
e.value.style.chart.grid.horizontalGrid.show ? (r(), u("g", Nt, [
(r(!0), u(k, null, T(we.value, (l) => (r(), u("line", {
x1: l.x1,
x2: l.x2,
y1: l.y,
y2: l.y,
stroke: e.value.style.chart.grid.horizontalGrid.stroke,
"stroke-width": e.value.style.chart.grid.horizontalGrid.strokeWidth,
"stroke-dasharray": e.value.style.chart.grid.horizontalGrid.strokeDasharray,
"stroke-linecap": "round"
}, null, 8, Mt))), 256))
])) : c("", !0),
e.value.style.chart.grid.verticalGrid.show ? (r(), u("g", Ft, [
(r(!0), u(k, null, T(w.value, (l, s) => (r(), u("line", {
x1: a.value.left + (s + 1) * a.value.stripWidth,
x2: a.value.left + (s + 1) * a.value.stripWidth,
y1: a.value.top,
y2: a.value.bottom,
stroke: e.value.style.chart.grid.verticalGrid.stroke,
"stroke-width": e.value.style.chart.grid.verticalGrid.strokeWidth,
"stroke-dasharray": e.value.style.chart.grid.verticalGrid.strokeDasharray,
"stroke-linecap": "round"
}, null, 8, It))), 256))
])) : c("", !0),
x("line", {
x1: a.value.left,
x2: a.value.left,
y1: a.value.top,
y2: a.value.bottom,
stroke: e.value.style.chart.grid.stroke,
"stroke-width": e.value.style.chart.grid.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Wt),
x("line", {
x1: a.value.left,
x2: a.value.right,
y1: a.value.bottom,
y2: a.value.bottom,
stroke: e.value.style.chart.grid.stroke,
"stroke-width": e.value.style.chart.grid.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Dt)
])) : c("", !0),
e.value.style.chart.labels.yAxisLabels.show ? (r(!0), u(k, { key: 2 }, T(we.value, (l, s) => (r(), u("text", {
x: l.x1 - e.value.style.chart.labels.yAxisLabels.fontSize / 2 + e.value.style.chart.labels.yAxisLabels.offsetX,
y: l.y + e.value.style.chart.labels.yAxisLabels.fontSize / 3,
fill: e.value.style.chart.labels.yAxisLabels.color,
"font-size": e.value.style.chart.labels.yAxisLabels.fontSize,
"text-anchor": "end"
}, z(n(oe)(
e.value.style.chart.labels.formatter,
l.value,
n(j)({
p: e.value.style.chart.labels.prefix,
v: l.value,
s: e.value.style.chart.labels.suffix,
r: e.value.style.chart.labels.yAxisLabels.rounding
}),
{ datapoint: l, seriesIndex: s }
)), 9, Gt))), 256)) : c("", !0),
e.value.style.chart.labels.xAxisLabels.show ? (r(!0), u(k, { key: 3 }, T(w.value, (l, s) => (r(), u("g", null, [
String(l.name).includes(`
`) ? (r(), u("text", {
key: 1,
x: a.value.left + (s + 1) * a.value.stripWidth - a.value.stripWidth / 2,
y: a.value.bottom + e.value.style.chart.labels.xAxisLabels.fontSize * 2 + e.value.style.chart.labels.xAxisLabels.offsetY,
"font-size": e.value.style.chart.labels.xAxisLabels.fontSize,
fill: e.value.style.chart.labels.xAxisLabels.color,
"text-anchor": "middle",
innerHTML: n(dt)({
content: String(l.name),
fontSize: e.value.style.chart.labels.xAxisLabels.fontSize,
fill: e.value.style.chart.labels.xAxisLabels.color,
x: a.value.left + (s + 1) * a.value.stripWidth - a.value.stripWidth / 2,
y: a.value.bottom + e.value.style.chart.labels.xAxisLabels.fontSize * 2 + e.value.style.chart.labels.xAxisLabels.offsetY
})
}, null, 8, Et)) : (r(), u("text", {
key: 0,
x: a.value.left + (s + 1) * a.value.stripWidth - a.value.stripWidth / 2,
y: a.value.bottom + e.value.style.chart.labels.xAxisLabels.fontSize * 2 + e.value.style.chart.labels.xAxisLabels.offsetY,
"font-size": e.value.style.chart.labels.xAxisLabels.fontSize,
fill: e.value.style.chart.labels.xAxisLabels.color,
"text-anchor": "middle"
}, z(l.name), 9, Rt))
]))), 256)) : c("", !0),
e.value.style.chart.labels.axis.yLabel ? (r(), u("text", {
key: 4,
fill: e.value.style.chart.labels.axis.color,
"font-size": e.value.style.chart.labels.axis.fontSize,
transform: `translate(${e.value.style.chart.labels.axis.fontSize + e.value.style.chart.labels.axis.yLabelOffsetX}, ${a.value.top + a.value.height / 2}) rotate(-90)`,
"text-anchor": "middle"
}, z(e.value.style.chart.labels.axis.yLabel), 9, Vt)) : c("", !0),
e.value.style.chart.labels.axis.xLabel ? (r(), u("text", {
key: 5,
fill: e.value.style.chart.labels.axis.color,
"font-size": e.value.style.chart.labels.axis.fontSize,
x: a.value.left + a.value.width / 2,
y: a.value.absoluteHeight,
"text-anchor": "middle"
}, z(e.value.style.chart.labels.axis.xLabel), 9, Ht)) : c("", !0),
h.value ? (r(), u(k, { key: 6 }, [
x("line", {
x1: a.value.left,
x2: a.value.right,
y1: h.value.y,
y2: h.value.y,
stroke: h.value.color,
"stroke-width": 1,
class: R({ "select-circle": e.value.useCssAnimation })
}, null, 10, Ut),
x("circle", {
cx: a.value.left,
cy: h.value.y,
r: 3,
fill: h.value.color,
class: R({ "select-circle": e.value.useCssAnimation })
}, null, 10, Bt),
x("circle", {
cx: a.value.right,
cy: h.value.y,
r: 3,
fill: h.value.color,
class: R({ "select-circle": e.value.useCssAnimation })
}, null, 10, Xt)
], 64)) : c("", !0),
x("defs", null, [
(r(!0), u(k, null, T(w.value, (l) => (r(), u("radialGradient", {
id: l.id,
fy: "30%"
}, [
x("stop", {
offset: "10%",
"stop-color": n(pt)(l.color, e.value.style.chart.plots.gradient.intensity / 100)
}, null, 8, jt),
x("stop", {
offset: "90%",
"stop-color": n(ft)(l.color, 0.1)
}, null, 8, qt),
x("stop", {
offset: "100%",
"stop-color": l.color
}, null, 8, Jt)
], 8, Yt))), 256))
]),
(r(!0), u(k, null, T(je.value, (l, s) => (r(), u(k, null, [
(r(!0), u(k, null, T(l.plots, (i, g) => (r(), S(_t, lt({
plot: { x: i.x, y: ne.value ? i.y : a.value.top },
radius: h.value && h.value.id === i.id ? G.value * 1.5 : G.value,
shape: e.value.style.chart.plots.shape,
stroke: e.value.style.chart.plots.stroke,
strokeWidth: e.value.style.chart.plots.strokeWidth,
color: e.value.style.chart.plots.gradient.show ? `url(#${l.id})` : l.color,
onMouseenter: (X) => qe({ datapoint: i, seriesIndex: g }),
onMouseleave: o[0] || (o[0] = (X) => {
J.value = !1, h.value = null;
}),
onClick: (X) => Be("selectDatapoint", i),
style: `transition: all 0.2s ease-in-out; opacity:${h.value ? h.value.id === i.id ? 1 : 0.2 : e.value.style.chart.plots.opacity};${W.value ? `transition-delay:${g * 50}ms` : ""}`,
class: { "vue-ui-strip-plot-animated": e.value.useCssAnimation && W.value, "vue-ui-strip-plot-select-circle": e.value.useCssAnimation && !W.value }
}, { ref_for: !0 }, t.$attrs), null, 16, ["plot", "radius", "shape", "stroke", "strokeWidth", "color", "onMouseenter", "onClick", "style", "class"]))), 256)),
d.value.dataLabels.show ? (r(), u("g", Kt, [
(r(!0), u(k, null, T(l.plots, (i, g) => (r(), u(k, null, [
g === l.plots.length - 1 || h.value && h.value.id === i.id && !d.value.showTooltip ? (r(), u("text", {
key: 0,
x: i.x,
y: i.y + e.value.style.chart.labels.bestPlotLabel.offsetY - G.value * (h.value && h.value.id === i.id && !d.value.showTooltip ? 2 : 1.5),
"font-size": e.value.style.chart.labels.bestPlotLabel.fontSize,
fill: e.value.style.chart.labels.bestPlotLabel.color,
"text-anchor": "middle",
style: Y(`opacity:${e.value.useCssAnimation && W.value ? 0 : 1};transition:opacity 0.2s ease-in;`)
}, z(i.name) + " " + z(e.value.style.chart.labels.bestPlotLabel.showValue ? n(oe)(
e.value.style.chart.labels.formatter,
i.value,
n(j)({
p: `(${e.value.style.chart.labels.prefix}`,
v: i.value,
s: `${e.value.style.chart.labels.suffix})`,
r: e.value.style.chart.labels.bestPlotLabel.rounding
}),
{ datapoint: i, seriesIndex: g }
) : ""), 13, Qt)) : c("", !0)
], 64))), 256))
])) : c("", !0)
], 64))), 256)),
p(t.$slots, "svg", { svg: a.value }, void 0, !0)
], 14, zt)) : c("", !0),
t.$slots.watermark ? (r(), u("div", Zt, [
p(t.$slots, "watermark", F(I({ isPrinting: n(be) || n(me) })), void 0, !0)
])) : c("", !0),
_.value ? c("", !0) : (r(), S(n(Ee), {
key: 6,
config: {
type: "stripPlot",
style: {
backgroundColor: e.value.style.chart.backgroundColor,
stripPlot: {
color: "#CCCCCC"
}
}
}
}, null, 8, ["config"])),
t.$slots.source ? (r(), u("div", {
key: 7,
ref_key: "source",
ref: ue,
dir: "auto"
}, [
p(t.$slots, "source", {}, void 0, !0)
], 512)) : c("", !0),
Se(n(Ve), {
show: d.value.showTooltip && J.value,
backgroundColor: e.value.style.chart.tooltip.backgroundColor,
color: e.value.style.chart.tooltip.color,
borderRadius: e.value.style.chart.tooltip.borderRadius,
borderColor: e.value.style.chart.tooltip.borderColor,
borderWidth: e.value.style.chart.tooltip.borderWidth,
fontSize: e.value.style.chart.tooltip.fontSize,
backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
position: e.value.style.chart.tooltip.position,
offsetY: e.value.style.chart.tooltip.offsetY,
parent: C.value,
content: K.value,
isFullscreen: M.value,
isCustom: n(Pe)(e.value.style.chart.tooltip.customFormat)
}, {
"tooltip-before": y(() => [
p(t.$slots, "tooltip-before", F(I({ ...ee.value })), void 0, !0)
]),
"tooltip-after": y(() => [
p(t.$slots, "tooltip-after", F(I({ ...ee.value })), void 0, !0)
]),
_: 3
}, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
_.value ? (r(), S(n(We), {
key: 8,
hideDetails: "",
config: {
open: d.value.showTable,
maxHeight: 1e4,
body: {
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color
},
head: {
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color
}
}
}, {
content: y(() => [
(r(), S(n(De), {
key: `table_${ce.value}`,
colNames: U.value.colNames,
head: U.value.head,
body: U.value.body,
config: U.value.config,
title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
onClose: o[1] || (o[1] = (l) => d.value.showTable = !1)
}, {
th: y(({ th: l }) => [
x("div", {
innerHTML: l,
style: { display: "flex", "align-items": "center" }
}, null, 8, el)
]),
td: y(({ td: l }) => [
at(z(l.name || l), 1)
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title"]))
]),
_: 1
}, 8, ["config"])) : c("", !0)
], 46, St));
}
}, dl = /* @__PURE__ */ At(tl, [["__scopeId", "data-v-678d1447"]]);
export {
dl as default
};