UNPKG

vue-data-ui

Version:

A user-empowering data visualization Vue 3 components library for eloquent data storytelling

1,103 lines (1,102 loc) • 45.7 kB
import { useCssVars as Ct, ref as h, reactive as At, computed as k, onUnmounted as _t, createBlock as P, openBlock as r, Teleport as St, createElementBlock as u, createCommentVNode as y, withModifiers as U, normalizeStyle as O, createElementVNode as c, unref as g, renderSlot as x, createVNode as Ze, nextTick as et, onMounted as Mt, onBeforeUnmount as zt, watch as Ue, normalizeClass as ce, createSlots as Ve, withCtx as $, normalizeProps as de, guardReactiveProps as he, Fragment as b, renderList as T, mergeProps as Ge, toDisplayString as J, createTextVNode as je } from "vue"; import { X as tt, u as Lt, c as Ae, o as Tt, e as _e, g as qe, b as Ot, d as Pt, p as ve, al as Je, a8 as Et, S as Ke, T as Dt, U as Nt, G as It, i as fe, f as ge, t as Xt, a as Ft, q as Ht, r as Rt, am as Bt } from "./index-CO-5OgQA.js"; import { u as Wt } from "./useUserOptionState-BIvW1Kz7.js"; import { u as Yt } from "./useChartAccessibility-BWojgys7.js"; import { u as Ut, U as Vt } from "./usePrinter-DldU0tBx.js"; import { t as Gt, u as jt } from "./useResponsive-Cw4oZ8sQ.js"; import { u as Qe } from "./useNestedProp-D8sa_wYF.js"; import qt from "./vue-ui-accordion-RRHvINsj.js"; import Jt from "./BaseIcon-V0HD2AAD.js"; import { _ as at } from "./_plugin-vue_export-helper-CHgC5LLL.js"; import { D as Kt } from "./DataTable-CVSajw4G.js"; import { L as Qt } from "./Legend-B61dtd8W.js"; import { _ as Zt } from "./PenAndPaper-Bqjmruhh.js"; import { _ as ea } from "./Shape-CWSam3QO.js"; import ta from "./vue-ui-skeleton-BeEBd4CC.js"; import { _ as aa } from "./Title-CxubvuEh.js"; import la from "./vue-ui-xy-CKNq6i3B.js"; const oa = ["xmlns"], sa = { class: "modal-title" }, na = { class: "modal-body" }, ra = { __name: "BaseDraggableDialog", props: { backgroundColor: { type: String }, color: { type: String }, headerBg: { type: String }, headerColor: { type: String } }, emits: ["close"], setup(X, { expose: ye, emit: pe }) { Ct((i) => ({ b93256ca: X.color })); const me = X, C = pe, z = h(!1), V = h(!1), o = At({ left: window.innerWidth / 2 - 200, top: window.innerHeight / 2 - 120, width: 400, height: 400, dragging: !1, resizing: !1, dragOffsetX: 0, dragOffsetY: 0, pointerStartX: 0, pointerStartY: 0, resizeStartW: 0, resizeStartH: 0 }); function ne() { z.value = !0, et(() => { V.value || (o.left = Math.max(0, window.innerWidth / 2 - o.width / 2), o.top = Math.max(0, window.innerHeight / 2 - o.height / 2), V.value = !0); }); } function K() { z.value = !1, C("close"); } ye({ open: ne, close: K }); const G = k(() => ({ position: "fixed", left: `${o.left}px`, top: `${o.top}px`, width: `${o.width}px`, height: `${o.height}px`, padding: 0, border: "none", background: me.backgroundColor, boxShadow: "0 4px 24px rgba(0,0,0,0.15)", zIndex: 9999, overflow: "visible", borderRadius: "2px" })); function E(i) { return i.touches && i.touches.length ? { x: i.touches[0].clientX, y: i.touches[0].clientY } : { x: i.clientX, y: i.clientY }; } function Q(i) { var p; (p = i.preventDefault) == null || p.call(i), o.dragging = !0; const v = E(i); o.dragOffsetX = v.x - o.left, o.dragOffsetY = v.y - o.top, document.addEventListener("mousemove", F), document.addEventListener("mouseup", H), document.addEventListener("touchmove", F, { passive: !1 }), document.addEventListener("touchend", H); } function F(i) { var e; if (!o.dragging) return; (e = i.preventDefault) == null || e.call(i); const v = E(i); let p = v.x - o.dragOffsetX, L = v.y - o.dragOffsetY; p = Math.max(0, Math.min(p, window.innerWidth - o.width)), L = Math.max(0, Math.min(L, window.innerHeight - o.height)), o.left = p, o.top = L; } function H() { o.dragging = !1, document.removeEventListener("mousemove", F), document.removeEventListener("mouseup", H), document.removeEventListener("touchmove", F), document.removeEventListener("touchend", H); } function Z(i) { var p; (p = i.preventDefault) == null || p.call(i), o.resizing = !0; const v = E(i); o.pointerStartX = v.x, o.pointerStartY = v.y, o.resizeStartW = o.width, o.resizeStartH = o.height, document.addEventListener("mousemove", w), document.addEventListener("mouseup", N), document.addEventListener("touchmove", w, { passive: !1 }), document.addEventListener("touchend", N); } function w(i) { var e; if (!o.resizing) return; (e = i.preventDefault) == null || e.call(i); const v = E(i); let p = v.x - o.pointerStartX, L = v.y - o.pointerStartY; o.width = Math.max(240, o.resizeStartW + p), o.height = Math.max(400, o.resizeStartH + L); } function N() { o.resizing = !1, document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", N), document.removeEventListener("touchmove", w), document.removeEventListener("touchend", N); } function re(i) { var p; (p = i.preventDefault) == null || p.call(i), o.resizing = !0; const v = E(i); o.pointerStartX = v.x, o.pointerStartY = v.y, o.resizeStartW = o.width, o.resizeStartH = o.height, o.resizeStartLeft = o.left, o.resizeStartTop = o.top, document.addEventListener("mousemove", R), document.addEventListener("mouseup", f), document.addEventListener("touchmove", R, { passive: !1 }), document.addEventListener("touchend", f); } function R(i) { var te; if (!o.resizing) return; (te = i.preventDefault) == null || te.call(i); const v = E(i); let p = v.x - o.pointerStartX, L = Math.min( Math.max(0, o.resizeStartLeft + p), o.resizeStartLeft + o.resizeStartW - 240 // min width ), e = o.resizeStartW - (L - o.resizeStartLeft), _ = v.y - o.pointerStartY, ee = Math.max(400, o.resizeStartH + _); o.left = L, o.width = e, o.height = ee; } function f() { o.resizing = !1, document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", f), document.removeEventListener("touchmove", R), document.removeEventListener("touchend", f); } return _t(() => { H(), N(), f(); }), (i, v) => (r(), P(St, { to: "body" }, [ z.value ? (r(), u("div", { key: 0, class: "modal vue-ui-draggable-dialog", style: O(G.value), onClick: v[0] || (v[0] = U(() => { }, ["stop"])) }, [ c("div", { class: "modal-header", style: O({ backgroundColor: X.headerBg, color: X.headerColor }) }, [ c("span", { class: "drag-handle", onMousedown: U(Q, ["stop", "prevent"]), onTouchstart: U(Q, ["stop", "prevent"]) }, [ (r(), u("svg", { xmlns: g(tt), width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1", "stroke-linecap": "round", "stroke-linejoin": "round" }, v[1] || (v[1] = [ c("path", { d: "M5 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1), c("path", { d: "M5 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1), c("path", { d: "M12 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1), c("path", { d: "M12 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1), c("path", { d: "M19 9m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1), c("path", { d: "M19 15m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" }, null, -1) ]), 8, oa)) ], 32), c("span", sa, [ x(i.$slots, "title", {}, void 0, !0) ]), c("button", { class: "close", onClick: K }, [ Ze(Jt, { name: "close", stroke: X.headerColor }, null, 8, ["stroke"]) ]) ], 4), c("div", na, [ x(i.$slots, "default", {}, void 0, !0) ]), c("div", { class: "resize-handle", onMousedown: U(Z, ["stop", "prevent"]), onTouchstart: U(Z, ["stop", "prevent"]) }, null, 32), c("div", { class: "resize-handle resize-handle-left", onMousedown: U(re, ["stop", "prevent"]), onTouchstart: U(re, ["stop", "prevent"]) }, null, 32) ], 4)) : y("", !0) ])); } }, ia = /* @__PURE__ */ at(ra, [["__scopeId", "data-v-1344ad9f"]]), ua = ["id"], ca = ["xmlns", "viewBox"], da = ["id"], ha = ["stop-color"], va = ["stop-color"], fa = ["stop-color"], ga = ["stop-color"], ya = ["id"], pa = ["stop-color"], ma = ["stop-color"], xa = ["stop-color"], ba = ["stop-color"], ka = { key: 0 }, wa = ["fill", "d"], $a = ["stroke", "stroke-width", "d"], Ca = ["fill", "d"], Aa = ["stroke", "stroke-dasharray", "stroke-width", "d"], _a = ["x1", "y1", "x2", "y2", "stroke", "stroke-width", "stroke-dasharray"], Sa = ["cx", "cy", "stroke", "stroke-width", "r", "fill"], Ma = ["x", "y", "font-size", "font-weight", "fill", "text-decoration", "onMouseenter", "onClick"], za = { key: 0 }, La = ["font-size", "fill", "font-weight", "transform", "text-anchor"], Ta = ["x", "y", "width", "height", "onMouseenter", "onClick"], Oa = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], Pa = ["cx", "cy", "stroke", "stroke-width", "r", "fill"], Ea = ["x", "y", "text-anchor", "font-size", "fill"], Da = { key: 5, class: "vue-data-ui-watermark" }, Na = ["onClick"], Ia = ["innerHTML"], Xa = { __name: "vue-ui-ridgeline", props: { config: { type: Object, default() { return {}; } }, dataset: { type: Array, default() { return []; } } }, emits: ["selectLegend", "selectDatapoint", "selectX"], setup(X, { expose: ye, emit: pe }) { const { vue_ui_ridgeline: me } = Lt(), C = X, z = k({ get() { return !!C.dataset && C.dataset.length; }, set(a) { return a; } }), V = pe, o = h(null), ne = h(null), K = h(null), G = h(null), E = h(null), Q = h(null), F = h(0), H = h(0), Z = h(0), w = h(Ae()), N = h(0), re = h(0), R = h(512), f = h(null), i = h(null), v = h(null), p = h(0); function L() { const a = Qe({ userConfig: C.config, defaultConfig: me }); return a.theme ? { ...Qe({ userConfig: Ft.vue_ui_ridgeline[a.theme] || C.config, defaultConfig: a }), customPalette: Xt[a.theme] || ve } : a; } const e = k({ get: () => L(), set: (a) => a }), _ = h(Math.min( e.value.style.chart.areas.height, e.value.style.chart.areas.rowHeight )), { userOptionsVisible: ee, setUserOptionsVisibility: te, keepUserOptionState: Se } = Wt({ config: e.value }), { svgRef: xe } = Yt({ config: e.value.style.chart.title }); Mt(be), zt(() => { G.value && G.value.disconnect(); }); function be() { if (Tt(C.dataset) ? _e({ componentName: "VueUiRidgeline", type: "dataset" }) : C.dataset.forEach((a, n) => { qe({ datasetObject: a, requiredAttributes: ["name", "datapoints"] }).forEach((t) => { z.value = !1, _e({ componentName: "VueUiRidgeline", type: "datasetSerieAttribute", property: t, index: n }); }), a.datapoints.length && a.datapoints.forEach((t, s) => { qe({ datasetObject: t, requiredAttributes: ["name", "values"] }).forEach((l) => { z.value = !1, _e({ componentName: "VueUiRidgeline", type: "datasetSerieAttribute", property: `datapoint.${l}`, index: `${n}-${s}` }); }); }); }), re.value = C.dataset.length, _.value = Math.min( e.value.style.chart.areas.height, e.value.style.chart.areas.rowHeight ), e.value.responsive) { const a = Gt(() => { const { width: n, height: t } = jt({ chart: o.value, title: e.value.style.chart.title.text ? ne.value : null, legend: e.value.style.chart.legend.show ? K.value : null, source: E.value, noTitle: Q.value, padding: e.value.style.chart.padding }); requestAnimationFrame(() => { R.value = n, _.value = t / C.dataset.length, p.value = t; }); }); G.value = new ResizeObserver(a), G.value.observe(o.value.parentNode); } } const { isPrinting: Me, isImaging: ze, generatePdf: Le, generateImage: Te } = Ut({ elementId: `vue-ui-ridgeline_${w.value}`, fileName: e.value.style.chart.title.text || "vue-ui-ridgeline", options: e.value.userOptions.print }), lt = k(() => e.value.userOptions.show && !e.value.style.chart.title.text), ot = k(() => Ot(e.value.customPalette)), ae = h({ showTable: e.value.table.show }); Ue(() => C.config, (a) => { e.value = L(), ee.value = !e.value.userOptions.showOnChartHover, be(), F.value += 1, Z.value += 1, _.value = Math.min( e.value.style.chart.areas.height, e.value.style.chart.areas.rowHeight ), ae.value.showTable = e.value.table.show; }, { deep: !0 }), Ue(() => C.dataset, be, { deep: !0 }); const ke = k(() => e.value.style.chart.areas.height / e.value.style.chart.areas.rowHeight); function Oe(a) { I.value.includes(a) ? I.value = I.value.filter((n) => n !== a) : I.value.push(a), V("selectLegend", q.value); } const D = k(() => z.value ? C.dataset.map((a, n) => ({ ...a, labelLen: rt(a.name, e.value.style.chart.yAxis.labels.fontSize), uid: Ae(), datapoints: a.datapoints.map((t, s) => { const l = t.color ? Pt(t.color) : ot.value[s] || ve[s] || ve[s % ve.length], d = Je(t.name); return { ...t, color: l, id: d }; }) })) : []), Pe = k(() => e.value.style.chart.padding.top + _.value * C.dataset.length + _.value * ke.value), S = k(() => ({ fullHeight: m.value.padding.top + m.value.padding.bottom + m.value.height, top: m.value.padding.top, left: m.value.padding.left, right: m.value.width - m.value.padding.right, bottom: m.value.padding.top + m.value.height, width: m.value.width - (m.value.padding.left + m.value.padding.right) })), m = k(() => { const a = e.value.style.chart.padding; return { width: R.value, height: Pe.value, padding: a }; }), j = k(() => { const a = Math.max(...D.value.map((d) => d.labelLen)), n = Math.max(...D.value.flatMap((d) => d.datapoints.map((M) => M.values.length))), t = m.value.padding.left + a + 16 + e.value.style.chart.yAxis.labels.offsetX, s = (S.value.width - t) / n, l = []; for (let d = 0; d < n; d += 1) l.push({ selectorX: t + s * d, x: t + s * d - s / 2, y: S.value.top, label: e.value.style.chart.xAxis.labels.values[d] || "", index: d, width: s, height: Pe.value }); return l; }); function st(a) { V("selectX", D.value.map((n) => n.datapoints.map((t) => ({ dp: t, selected: t.values[a.index] })))); } function nt(a, n) { return a.length * n / 2 + n; } function Ee(a, n, t) { const s = nt(n, t); return a + s > S.value.right; } function rt(a, n, t = "sans-serif") { const l = document.createElement("canvas").getContext("2d"), d = typeof n == "number" ? `${n}px` : n; return l.font = `${d} ${t}`, l.measureText(a).width; } const q = k(() => { _.value; const a = Math.max(...D.value.map((A) => A.labelLen)), n = Math.max(...D.value.flatMap((A) => A.datapoints.map((B) => B.values.length))), t = Math.max(...D.value.flatMap((A) => A.datapoints.flatMap((B) => B.values))), s = Math.min(...D.value.flatMap((A) => A.datapoints.flatMap((B) => B.values))), l = m.value.padding.left + a + 16 + e.value.style.chart.yAxis.labels.offsetX, d = (S.value.width - l) / n, M = Math.abs(Math.min(s, 0)), He = t + M; function Re(A) { return isNaN(A / He) ? 0 : A / He; } return D.value.map((A, B) => { const Be = S.value.top + _.value * B, W = S.value.top + Be + _.value * ke.value * (1 - Re(M)); return { ...A, label: { x: l - e.value.style.chart.yAxis.labels.fontSize, y: W }, datapoints: A.datapoints.map((oe) => { const Y = oe.values.map((se, xt) => { const bt = isNaN(se) || [void 0, null, "NaN", NaN, 1 / 0, -1 / 0].includes(se) ? 0 : se || 0, kt = l + d * xt, wt = S.value.top + Be + _.value * ke.value * (1 - Re(bt + M)), $t = se === Math.max(...oe.values); return { x: kt, y: wt, value: se, isMaxPoint: $t, zero: W }; }), gt = `${Et(Y, W, !1, !1)}`, yt = `M ${l},${W} ${Ke(Y)} ${Y.at(-1).x},${W}`, pt = `M ${l},${W} ${Y.at(-1).x},${W}`, We = `M ${Dt(Y)}`, Ye = `M ${Ke(Y)}`, mt = Nt( e.value.style.chart.areas.smooth ? We : Ye ); return { ...oe, uid: Ae(), plots: Y, smoothPath: gt, straightPath: yt, zeroPath: pt, pathLength: mt, smoothPathRidge: We, straightPathRidge: Ye }; }).filter((oe) => !I.value.includes(oe.id)) }; }); }), I = h([]); function it(a) { const n = /* @__PURE__ */ new Map(); return a.forEach((t) => { t.datapoints.forEach((s, l) => { const d = Je(s.name); n.has(d) || n.set(d, { id: d, name: s.name, color: s.color, shape: "circle", segregate: () => Oe(d), isSegregated: I.value.includes(d), opacity: I.value.includes(d) ? 0.5 : 1 }); }); }), Array.from(n.values()); } const we = k(() => it(D.value)), ut = k(() => ({ cy: "donut-div-legend", backgroundColor: e.value.style.chart.legend.backgroundColor, color: e.value.style.chart.legend.color, fontSize: e.value.style.chart.legend.fontSize, paddingBottom: 12, fontWeight: e.value.style.chart.legend.bold ? "bold" : "" })), le = h(!1); function ct(a) { le.value = a, N.value += 1; } const De = h({}), Ne = h([]); function dt(a) { V("selectDatapoint", a), e.value.style.chart.dialog.show && (Ne.value = a.datapoints.map((n) => ({ name: n.name, color: n.color, type: "line", useArea: !0, smooth: e.value.style.chart.areas.smooth, series: n.values })), i.value = a, De.value = Bt({ ...e.value.style.chart.dialog.xyChart, responsive: !0, // Overriding chart: { ...e.value.style.chart.dialog.xyChart.chart, grid: { ...e.value.style.chart.dialog.xyChart.chart.grid, labels: { ...e.value.style.chart.dialog.xyChart.chart.grid.labels, xAxisLabels: { ...e.value.style.chart.dialog.xyChart.chart.grid.labels.xAxisLabels, values: e.value.style.chart.xAxis.labels.values // Overriding } } }, tooltip: { ...e.value.style.chart.dialog.xyChart.chart.tooltip, showTimeLabel: e.value.style.chart.xAxis.labels.values.length > 0 // Overriding } } }), v.value && v.value.open()); } const $e = h(null); function ht(a) { $e.value = a; } function vt() { $e.value = null; } const ie = h(!1); function Ce() { ie.value = !ie.value; } function Ie() { ae.value.showTable = !ae.value.showTable; } const Xe = k(() => ({ body: q.value.flatMap((t) => t.datapoints.flatMap((s) => ({ ...s, rowName: `${t.name}: ${s.name}` }))).map((t) => [ { name: t.rowName, color: t.color }, ...t.values ]) })), ue = k(() => { const a = [ e.value.table.columnNames.series, ...e.value.style.chart.xAxis.labels.values ], n = { 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.style.chart.xAxis.labels.values ], head: a, body: Xe.value.body, config: n }; }); function Fe() { et(() => { const a = [ [e.value.table.columnNames.series, ...e.value.style.chart.xAxis.labels.values.map((s) => [s])], ...Xe.value.body.map((s, l) => [s[0].name, ...s.slice(1)]) ], n = [ [e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text] ].concat(a), t = Ht(n); Rt({ csvContent: t, title: e.value.style.chart.title.text || "vue-ui-ridgeline" }); }); } function ft() { return q.value; } return ye({ getData: ft, generateImage: Te, generatePdf: Le, generateCsv: Fe, toggleAnnotator: Ce, toggleTable: Ie }), (a, n) => (r(), u("div", { ref_key: "ridgelineChart", ref: o, class: ce(`vue-ui-ridgeline ${le.value ? "vue-data-ui-wrapper-fullscreen" : ""}`), id: `vue-ui-ridgeline_${w.value}`, style: O({ fontFamily: e.value.style.fontFamily, width: "100%", textAlign: "center", background: e.value.style.chart.backgroundColor, height: e.value.responsive ? "100%" : void 0 }), onMouseenter: n[4] || (n[4] = () => g(te)(!0)), onMouseleave: n[5] || (n[5] = () => g(te)(!1)) }, [ e.value.userOptions.buttons.annotator && g(xe) ? (r(), P(Zt, { key: 0, color: e.value.style.chart.color, backgroundColor: e.value.style.chart.backgroundColor, active: ie.value, svgRef: g(xe), onClose: Ce }, null, 8, ["color", "backgroundColor", "active", "svgRef"])) : y("", !0), x(a.$slots, "userConfig", {}, void 0, !0), lt.value ? (r(), u("div", { key: 1, ref_key: "noTitle", ref: Q, class: "vue-data-ui-no-title-space", style: "height:36px; width: 100%;background:transparent" }, null, 512)) : y("", !0), e.value.style.chart.title.text ? (r(), u("div", { key: 2, ref_key: "chartTitle", ref: ne, style: "width:100%;background:transparent;padding-bottom:24px" }, [ (r(), P(aa, { key: `title_${F.value}`, config: { title: { cy: "ridgeline-div-title", ...e.value.style.chart.title }, subtitle: { cy: "ridgeline-div-subtitle", ...e.value.style.chart.title.subtitle } } }, null, 8, ["config"])) ], 512)) : y("", !0), e.value.userOptions.show && z.value && (g(Se) || g(ee)) ? (r(), P(Vt, { ref: "details", key: `user_option_${N.value}`, backgroundColor: e.value.style.chart.backgroundColor, color: e.value.style.chart.color, isPrinting: g(Me), isImaging: g(ze), uid: w.value, hasTooltip: !1, hasPdf: e.value.userOptions.buttons.pdf, hasImg: e.value.userOptions.buttons.img, hasXls: e.value.userOptions.buttons.csv, hasTable: e.value.userOptions.buttons.table, hasLabel: !1, hasFullscreen: e.value.userOptions.buttons.fullscreen, isFullscreen: le.value, chartElement: o.value, position: e.value.userOptions.position, isTooltip: !1, titles: { ...e.value.userOptions.buttonTitles }, hasAnnotator: e.value.userOptions.buttons.annotator, isAnnotation: ie.value, style: O({ visibility: g(Se) ? g(ee) ? "visible" : "hidden" : "visible" }), onToggleFullscreen: ct, onGeneratePdf: g(Le), onGenerateCsv: Fe, onGenerateImage: g(Te), onToggleTable: Ie, onToggleAnnotator: Ce }, Ve({ _: 2 }, [ a.$slots.menuIcon ? { name: "menuIcon", fn: $(({ isOpen: t, color: s }) => [ x(a.$slots, "menuIcon", de(he({ isOpen: t, color: s })), void 0, !0) ]), key: "0" } : void 0, a.$slots.optionTooltip ? { name: "optionTooltip", fn: $(() => [ x(a.$slots, "optionTooltip", {}, void 0, !0) ]), key: "1" } : void 0, a.$slots.optionPdf ? { name: "optionPdf", fn: $(() => [ x(a.$slots, "optionPdf", {}, void 0, !0) ]), key: "2" } : void 0, a.$slots.optionCsv ? { name: "optionCsv", fn: $(() => [ x(a.$slots, "optionCsv", {}, void 0, !0) ]), key: "3" } : void 0, a.$slots.optionImg ? { name: "optionImg", fn: $(() => [ x(a.$slots, "optionImg", {}, void 0, !0) ]), key: "4" } : void 0, a.$slots.optionTable ? { name: "optionTable", fn: $(() => [ x(a.$slots, "optionTable", {}, void 0, !0) ]), key: "5" } : void 0, a.$slots.optionFullscreen ? { name: "optionFullscreen", fn: $(({ toggleFullscreen: t, isFullscreen: s }) => [ x(a.$slots, "optionFullscreen", de(he({ toggleFullscreen: t, isFullscreen: s })), void 0, !0) ]), key: "6" } : void 0, a.$slots.optionAnnotator ? { name: "optionAnnotator", fn: $(({ toggleAnnotator: t, isAnnotator: s }) => [ x(a.$slots, "optionAnnotator", de(he({ toggleAnnotator: t, isAnnotator: s })), void 0, !0) ]), key: "7" } : void 0 ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "chartElement", "position", "titles", "hasAnnotator", "isAnnotation", "style", "onGeneratePdf", "onGenerateImage"])) : y("", !0), z.value ? (r(), u("svg", { key: 4, ref_key: "svgRef", ref: xe, xmlns: g(tt), class: ce({ "vue-data-ui-fullscreen--on": le.value, "vue-data-ui-fulscreen--off": !le.value }), viewBox: `0 0 ${m.value.width <= 0 ? 10 : m.value.width} ${S.value.fullHeight <= 0 ? 10 : S.value.fullHeight}`, style: O(`max-width:100%;overflow:visible;background:transparent;color:${e.value.style.chart.color};${e.value.responsive ? `height: ${p.value}px; width: 100%;` : ""}`) }, [ c("defs", null, [ (r(!0), u(b, null, T(we.value, (t, s) => (r(), u("linearGradient", { id: `gradient-${t.id}-${w.value}`, x1: "50%", y1: "0%", x2: "50%", y2: "100%" }, [ c("stop", { offset: "0%", "stop-color": t.color, "stop-opacity": "1" }, null, 8, ha), c("stop", { offset: "30%", "stop-color": t.color, "stop-opacity": "0.7" }, null, 8, va), c("stop", { offset: "70%", "stop-color": t.color, "stop-opacity": "0.3" }, null, 8, fa), c("stop", { offset: "100%", "stop-color": t.color, "stop-opacity": "0.1" }, null, 8, ga) ], 8, da))), 256)), (r(!0), u(b, null, T(q.value, (t, s) => (r(), u(b, null, [ (r(!0), u(b, null, T(t.datapoints, (l, d) => (r(), u("linearGradient", { key: `grad${l.id}`, id: `gradient-single-${w.value}-${l.uid}`, x1: "50%", y1: "0%", x2: "50%", y2: "100%" }, [ c("stop", { offset: "0%", "stop-color": l.color, "stop-opacity": "1" }, null, 8, pa), c("stop", { offset: "30%", "stop-color": l.color, "stop-opacity": "0.7" }, null, 8, ma), c("stop", { offset: "70%", "stop-color": l.color, "stop-opacity": "0.3" }, null, 8, xa), c("stop", { offset: "100%", "stop-color": l.color, "stop-opacity": "0.1" }, null, 8, ba) ], 8, ya))), 128)) ], 64))), 256)) ]), (r(!0), u(b, null, T(q.value, (t, s) => (r(), u("g", { key: `ds-${s}` }, [ (r(!0), u(b, null, T(t.datapoints, (l, d) => (r(), u("g", { key: l.id }, [ a.$slots.pattern ? (r(), u("g", ka, [ c("defs", null, [ x(a.$slots, "pattern", Ge({ ref_for: !0 }, { datapointIndex: s, seriesIndex: d, patternId: `pattern_${w.value}_${l.uid}` }), void 0, !0) ]) ])) : y("", !0), c("path", { fill: a.$slots.pattern ? `url(#pattern_${w.value}_${l.uid})` : e.value.style.chart.backgroundColor, stroke: "none", "stroke-linecap": "round", d: e.value.style.chart.areas.smooth ? l.smoothPath : l.straightPath, style: O({ opacity: e.value.style.chart.areas.opacity }) }, null, 12, wa), c("path", { fill: "none", stroke: e.value.style.chart.areas.stroke.useSerieColor ? l.color : e.value.style.chart.areas.stroke.color, "stroke-width": e.value.style.chart.areas.strokeWidth, d: e.value.style.chart.areas.smooth ? l.smoothPathRidge : l.straightPathRidge, "stroke-linecap": "round", "stroke-linejoin": "round", class: ce({ "vue-ui-ridgeline-animate": e.value.useCssAnimation }), style: O({ strokeDasharray: l.pathLength, strokeDashoffset: e.value.useCssAnimation ? l.pathLength : 0 }) }, null, 14, $a), c("path", { fill: e.value.style.chart.areas.useGradient ? e.value.style.chart.areas.useCommonColor ? `url(#gradient-${l.id}-${w.value})` : `url(#gradient-single-${w.value}-${l.uid})` : l.color, stroke: "none", d: e.value.style.chart.areas.smooth ? l.smoothPath : l.straightPath, "stroke-linecap": "round", "stroke-linejoin": "round", class: ce({ "vue-ui-ridgeline-animate": e.value.useCssAnimation }), style: O({ strokeDasharray: l.pathLength, strokeDashoffset: e.value.useCssAnimation ? l.pathLength : 0 }) }, null, 14, Ca), e.value.style.chart.zeroLine.show ? (r(), u("path", { key: 1, stroke: e.value.style.chart.zeroLine.useSerieColor ? l.color : e.value.style.chart.zeroLine.stroke, "stroke-dasharray": e.value.style.chart.zeroLine.strokeDasharray, "stroke-width": e.value.style.chart.zeroLine.strokeWidth, d: l.zeroPath, "stroke-linecap": "round" }, null, 8, Aa)) : y("", !0), e.value.style.chart.areas.maxPoint.show && l.plots.length > 1 ? (r(!0), u(b, { key: 2 }, T(l.plots, (M) => (r(), u(b, null, [ M.isMaxPoint ? (r(), u("line", { key: 0, x1: M.x, y1: M.y, x2: M.x, y2: M.zero, stroke: e.value.style.chart.areas.maxPoint.adaptStrokeToBackground ? g(It)(l.color) : e.value.style.chart.areas.maxPoint.stroke, "stroke-width": e.value.style.chart.areas.maxPoint.strokeWidth, "stroke-linecap": "round", "stroke-dasharray": e.value.style.chart.areas.maxPoint.strokeDasharray }, null, 8, _a)) : y("", !0) ], 64))), 256)) : y("", !0), l.plots.length === 1 ? (r(), u("circle", { key: 3, cx: l.plots[0].x, cy: l.plots[0].y, stroke: e.value.style.chart.selector.dot.stroke, "stroke-width": e.value.style.chart.selector.dot.strokeWidth, r: e.value.style.chart.selector.dot.radius, fill: e.value.style.chart.selector.dot.useDatapointColor ? l.color : e.value.style.chart.selector.dot.fill, style: { pointerEvents: "none" } }, null, 8, Sa)) : y("", !0) ]))), 128)), c("text", { x: t.label.x, y: t.label.y, "text-anchor": "end", "font-size": e.value.style.chart.yAxis.labels.fontSize, "font-weight": e.value.style.chart.yAxis.labels.bold ? "bold" : "normal", fill: e.value.style.chart.yAxis.labels.color, style: O({ cursor: e.value.style.chart.dialog.show ? "pointer" : "default" }), "text-decoration": e.value.style.chart.dialog.show && ($e.value === s || i.value && t.uid === i.value.uid) ? "underline" : "", onMouseenter: (l) => ht(s), onMouseleave: vt, onClick: (l) => dt(t) }, J(t.name), 45, Ma) ]))), 128)), e.value.style.chart.xAxis.labels.values.length ? (r(), u("g", za, [ (r(!0), u(b, null, T(j.value, (t, s) => x(a.$slots, "time-label", Ge({ ref_for: !0 }, { show: t && !e.value.style.chart.xAxis.labels.showOnlyFirstAndLast && !e.value.style.chart.xAxis.labels.showOnlyAtModulo || t && e.value.style.chart.xAxis.labels.showOnlyFirstAndLast && (s === 0 || s === j.value.length - 1) || t && f.value && f.value.index === s || t && !e.value.style.chart.xAxis.labels.showOnlyFirstAndLast && e.value.style.chart.xAxis.labels.showOnlyAtModulo && s % Math.floor(j.value.length / e.value.style.chart.xAxis.labels.modulo) === 0, fontSize: e.value.style.chart.xAxis.labels.fontSize, content: t.label, textAnchor: e.value.style.chart.xAxis.labels.rotation > 0 ? "start" : e.value.style.chart.xAxis.labels.rotation < 0 ? "end" : "middle", fill: e.value.style.chart.xAxis.labels.color, transform: `translate(${t.selectorX}, ${S.value.top + t.height + e.value.style.chart.xAxis.labels.offsetY}), rotate(${e.value.style.chart.xAxis.labels.rotation})`, x: t.selectorX, y: S.value.top + t.height + e.value.style.chart.xAxis.labels.offsetY }), () => [ t && !e.value.style.chart.xAxis.labels.showOnlyFirstAndLast && !e.value.style.chart.xAxis.labels.showOnlyAtModulo || t && e.value.style.chart.xAxis.labels.showOnlyFirstAndLast && (s === 0 || s === j.value.length - 1) || t && f.value && f.value.index === s || t && !e.value.style.chart.xAxis.labels.showOnlyFirstAndLast && e.value.style.chart.xAxis.labels.showOnlyAtModulo && s % Math.floor(j.value.length / e.value.style.chart.xAxis.labels.modulo) === 0 ? (r(), u("text", { key: 0, "font-size": e.value.style.chart.xAxis.labels.fontSize, fill: e.value.style.chart.xAxis.labels.color, "font-weight": e.value.style.chart.xAxis.labels.bold ? "bold" : "normal", transform: `translate(${t.selectorX}, ${S.value.top + t.height + e.value.style.chart.xAxis.labels.offsetY}), rotate(${e.value.style.chart.xAxis.labels.rotation})`, "text-anchor": e.value.style.chart.xAxis.labels.rotation > 0 ? "start" : e.value.style.chart.xAxis.labels.rotation < 0 ? "end" : "middle", style: O({ opacity: f.value ? f.value.index === s ? 1 : 0.2 : 1 }) }, J(t.label), 13, La)) : y("", !0) ], !0)), 256)) ])) : y("", !0), c("g", null, [ (r(!0), u(b, null, T(j.value, (t, s) => (r(), u("rect", { x: t.x, y: t.y, width: t.width < 0 ? 0.1 : t.width, height: t.height < 0 ? 0.1 : t.height, fill: "transparent", onMouseenter: (l) => f.value = t, onMouseleave: n[0] || (n[0] = (l) => f.value = null), onClick: () => st(t) }, null, 40, Ta))), 256)), e.value.style.chart.selector.show && f.value ? (r(), u("line", { key: 0, x1: f.value.selectorX, x2: f.value.selectorX, y1: f.value.y, y2: f.value.y + f.value.height - _.value / 2, stroke: e.value.style.chart.selector.stroke, "stroke-width": e.value.style.chart.selector.strokeWidth, "stroke-dasharray": e.value.style.chart.selector.strokeDasharray, "stroke-linecap": "round", style: { pointerEvents: "none" } }, null, 8, Oa)) : y("", !0), f.value ? (r(!0), u(b, { key: 1 }, T(q.value, (t) => (r(), u(b, null, [ (r(!0), u(b, null, T(t.datapoints, (s) => (r(), u(b, null, [ (r(!0), u(b, null, T(s.plots, (l, d) => (r(), u(b, null, [ f.value && f.value.index === d ? (r(), u("circle", { key: 0, cx: l.x, cy: l.y, stroke: e.value.style.chart.selector.dot.stroke, "stroke-width": e.value.style.chart.selector.dot.strokeWidth, r: e.value.style.chart.selector.dot.radius, fill: e.value.style.chart.selector.dot.useDatapointColor ? s.color : e.value.style.chart.selector.dot.fill, style: { pointerEvents: "none" } }, null, 8, Pa)) : y("", !0), f.value && f.value.index === d ? (r(), u("text", { key: 1, x: Ee( l.x, g(fe)( e.value.style.chart.selector.labels.formatter, l.value, g(ge)({ p: e.value.style.chart.xAxis.labels.prefix, v: l.value, s: e.value.style.chart.xAxis.labels.suffix, r: e.value.style.chart.selector.labels.rounding }) ), e.value.style.chart.selector.labels.fontSize ) ? l.x - e.value.style.chart.selector.labels.fontSize / 2 : l.x + e.value.style.chart.selector.labels.fontSize / 2, y: l.y + e.value.style.chart.selector.labels.fontSize / 3, "text-anchor": Ee( l.x, g(fe)( e.value.style.chart.selector.labels.formatter, l.value, g(ge)({ p: e.value.style.chart.xAxis.labels.prefix, v: l.value, s: e.value.style.chart.xAxis.labels.suffix, r: e.value.style.chart.selector.labels.rounding }) ), e.value.style.chart.selector.labels.fontSize ) ? "end" : "start", "font-size": e.value.style.chart.selector.labels.fontSize, fill: e.value.style.chart.selector.labels.color, style: { pointerEvents: "none" } }, J(g(fe)( e.value.style.chart.selector.labels.formatter, l.value, g(ge)({ p: e.value.style.chart.xAxis.labels.prefix, v: l.value, s: e.value.style.chart.xAxis.labels.suffix, r: e.value.style.chart.selector.labels.rounding }) )), 9, Ea)) : y("", !0) ], 64))), 256)) ], 64))), 256)) ], 64))), 256)) : y("", !0) ]), x(a.$slots, "svg", { svg: m.value }, void 0, !0) ], 14, ca)) : y("", !0), a.$slots.watermark ? (r(), u("div", Da, [ x(a.$slots, "watermark", de(he({ isPrinting: g(Me) || g(ze) })), void 0, !0) ])) : y("", !0), z.value ? y("", !0) : (r(), P(ta, { key: 6, config: { type: "ridgeline", style: { backgroundColor: e.value.style.chart.backgroundColor, ridgeline: { color: "#CCCCCC" } } } }, null, 8, ["config"])), c("div", { ref_key: "chartLegend", ref: K }, [ e.value.style.chart.legend.show ? (r(), P(Qt, { key: `legend_${Z.value}`, legendSet: we.value, config: ut.value, onClickMarker: n[1] || (n[1] = ({ legend: t }) => Oe(t.id)) }, Ve({ item: $(({ legend: t }) => [ c("div", { style: O(`opacity:${I.value.includes(t.id) ? 0.5 : 1}`), onClick: (s) => t.segregate() }, J(t.name), 13, Na) ]), _: 2 }, [ a.$slots.pattern ? { name: "legend-pattern", fn: $(({ legend: t, index: s }) => [ Ze(ea, { shape: t.shape, radius: 30, stroke: "none", plot: { x: 30, y: 30 }, fill: `url(#pattern_${w.value}_${s})` }, null, 8, ["shape", "fill"]) ]), key: "0" } : void 0 ]), 1032, ["legendSet", "config"])) : y("", !0), x(a.$slots, "legend", { legend: we.value }, void 0, !0) ], 512), a.$slots.source ? (r(), u("div", { key: 7, ref_key: "source", ref: E, dir: "auto" }, [ x(a.$slots, "source", {}, void 0, !0) ], 512)) : y("", !0), z.value ? (r(), P(qt, { key: 8, hideDetails: "", config: { open: ae.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: $(() => [ (r(), P(Kt, { key: `table_${H.value}`, colNames: ue.value.colNames, head: ue.value.head, body: ue.value.body, config: ue.value.config, title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` :${e.value.style.chart.title.subtitle.text}` : ""}`, onClose: n[2] || (n[2] = (t) => ae.value.showTable = !1) }, { th: $(({ th: t }) => [ c("div", { innerHTML: t }, null, 8, Ia) ]), td: $(({ td: t }) => [ je(J(t.name ? t.name : g(fe)( e.value.style.chart.selector.labels.formatter, t, g(ge)({ p: e.value.style.chart.xAxis.labels.prefix, v: t, s: e.value.style.chart.xAxis.labels.suffix, r: e.value.table.td.roundingValue }) )), 1) ]), _: 1 }, 8, ["colNames", "head", "body", "config", "title"])) ]), _: 1 }, 8, ["config"])) : y("", !0), e.value.style.chart.dialog.show ? (r(), P(ia, { key: 9, ref_key: "dialog", ref: v, onClose: n[3] || (n[3] = (t) => i.value = null), backgroundColor: e.value.style.chart.dialog.backgroundColor, color: e.value.style.chart.dialog.color, headerBg: e.value.style.chart.dialog.header.backgroundColor, headerColor: e.value.style.chart.dialog.header.color }, { title: $(() => [ je(J(i.value.name), 1) ]), default: $(() => [ i.value ? (r(), P(la, { key: 0, config: De.value, dataset: Ne.value }, null, 8, ["config", "dataset"])) : y("", !0) ]), _: 1 }, 8, ["backgroundColor", "color", "headerBg", "headerColor"])) : y("", !0) ], 46, ua)); } }, al = /* @__PURE__ */ at(Xa, [["__scopeId", "data-v-9c3affc2"]]); export { al as default };