vue-data-ui
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
739 lines (738 loc) • 31.7 kB
JavaScript
import { defineAsyncComponent as G, computed as y, ref as m, watch as be, shallowRef as _e, onMounted as De, onBeforeUnmount as Ve, createElementBlock as u, openBlock as s, unref as n, normalizeStyle as q, normalizeClass as we, createBlock as U, createCommentVNode as c, createElementVNode as g, withCtx as I, toDisplayString as P, createSlots as qe, renderSlot as x, normalizeProps as W, guardReactiveProps as j, createVNode as He, Fragment as k, renderList as S, mergeProps as A } from "vue";
import { u as Ze, c as Je, t as Ke, p as xe, a as Qe, b as et, o as Se, d as tt, e as T, g as $e, m as H, N as C, O as at, X as lt, s as Z, n as rt, i as J, f as K, E as Q } from "./index-BLtEpj8j.js";
import { t as st, u as ot } from "./useResponsive-DfdjqQps.js";
import { u as ze } from "./useNestedProp-Bw1KcAmj.js";
import { u as ut } from "./usePrinter-DnRwTdvS.js";
import { u as nt } from "./useUserOptionState-BIvW1Kz7.js";
import { u as it } from "./useChartAccessibility-9icAAmYg.js";
import ct from "./Title-DkG60EPg.js";
import vt from "./img-D-vWHxhM.js";
import { _ as dt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const ht = ["id"], yt = { key: 0 }, ft = ["xmlns", "viewBox"], mt = ["width", "height"], pt = ["id"], gt = ["stop-color"], kt = ["stop-color"], bt = ["stop-color"], _t = ["id"], wt = ["stdDeviation"], xt = { key: 1 }, St = ["d", "fill", "stroke"], $t = ["d", "fill", "stroke"], zt = ["d", "fill"], Ct = ["id", "d"], Ft = ["fill", "font-size", "font-weight"], Ot = ["href", "startOffset"], Mt = ["x", "y", "text-anchor", "fill", "font-size", "font-weight"], Pt = ["d", "filter"], Nt = ["stroke", "stroke-width"], Xt = ["stroke", "stroke-width"], It = ["stroke", "stroke-width"], Yt = ["stroke", "stroke-width"], At = { key: 8 }, Rt = ["x", "y", "text-anchor", "font-size", "font-weight", "fill"], Et = ["x", "y", "font-size", "font-weight", "fill"], Gt = { key: 0 }, Ut = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], Wt = ["x1", "y1", "x2", "y2", "stroke", "stroke-width"], jt = ["x1", "y1", "x2", "y2", "stroke-width", "filter"], Tt = { key: 1 }, Lt = ["d", "fill", "stroke", "stroke-width"], Bt = ["cx", "cy", "fill", "r", "stroke-width", "stroke"], Dt = ["x", "y", "font-size", "fill"], Vt = {
key: 5,
class: "vue-data-ui-watermark"
}, qt = {
__name: "vue-ui-gauge",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Object,
default() {
return {};
}
}
},
setup(L, { expose: Ce }) {
const Fe = G(() => import("./PenAndPaper-7BWf7zgA.js")), Oe = G(() => import("./vue-ui-skeleton-CsMU8DwQ.js")), Me = G(() => import("./UserOptions-DGw0HvSp.js")), Pe = G(() => import("./PackageVersion-CnRyWKP-.js")), { vue_ui_gauge: Ne } = Ze(), d = L, R = y(() => !!d.dataset && Object.keys(d.dataset).length > 0 && d.dataset.series && d.dataset.series.length), w = m(Je()), Xe = m(null), ee = m(0), F = m(null), te = m(null), ae = m(null), le = m(null), re = m(null), se = m(0), e = y({
get: () => ie(),
set: (t) => t
}), { userOptionsVisible: B, setUserOptionsVisibility: oe, keepUserOptionState: ue } = nt({ config: e.value }), { svgRef: ne } = it({ config: e.value.style.chart.title });
be(() => d.config, (t) => {
e.value = ie(), B.value = !e.value.userOptions.showOnChartHover, fe(), se.value += 1;
}, { deep: !0 });
function ie() {
const t = ze({
userConfig: d.config,
defaultConfig: Ne
});
return t.theme ? {
...ze({
userConfig: Qe.vue_ui_gauge[t.theme] || d.config,
defaultConfig: t
}),
customPalette: Ke[t.theme] || xe
} : t;
}
const { isPrinting: ce, isImaging: ve, generatePdf: de, generateImage: he } = ut({
elementId: `vue-ui-gauge_${w.value}`,
fileName: e.value.style.chart.title.text || "vue-ui-gauge",
options: e.value.userOptions.print
}), Ie = y(() => e.value.userOptions.show && !e.value.style.chart.title.text), Ye = y(() => et(e.value.customPalette)), O = y(() => {
if (!R.value || Se(d.dataset.series || {}))
return {
value: 0,
series: [
{
from: 0,
to: 0
}
]
};
const t = [];
(d.dataset.series || []).forEach((a) => {
t.push(a.from || 1e-7), t.push(a.to || 1e-7);
});
const o = Math.max(...t);
return {
...d.dataset,
series: (d.dataset.series || []).map((a, r) => ({
...a,
color: tt(a.color) || Ye.value[r] || xe[r],
value: ((a.to || 0) - (a.from || 0)) / o * 100
}))
};
}), b = m(512), l = m({
height: 358.4,
width: b.value,
top: 0,
bottom: 358.4,
centerX: 179.2,
centerY: b.value / 2,
labelFontSize: 18,
legendFontSize: e.value.style.chart.legend.fontSize,
pointerRadius: e.value.style.chart.layout.pointer.circle.radius,
trackSize: e.value.style.chart.layout.track.size,
pointerSize: e.value.style.chart.layout.pointer.size,
pointerStrokeWidth: e.value.style.chart.layout.pointer.strokeWidth,
markerOffset: e.value.style.chart.layout.markers.offsetY + 3,
segmentFontSize: e.value.style.chart.layout.segmentNames.fontSize
}), N = m(0), $ = m(0), f = m(
e.value.style.chart.animation.use ? Math.min(...d.dataset.series.map((t) => t.from)) : d.dataset.value
);
be(() => d.dataset.value, () => {
me(d.dataset.value);
});
const i = y(() => {
const t = l.value.width / 2, o = v.value.base, a = Math.PI * ((f.value + 0 - $.value) / (N.value - $.value)) + Math.PI;
return {
x1: t,
y1: o,
x2: t + v.value.pointerSize * l.value.pointerSize * 0.9 * Math.cos(a),
y2: o + v.value.pointerSize * l.value.pointerSize * 0.9 * Math.sin(a)
};
}), ye = y(() => {
const t = l.value.width / 2, o = v.value.base, a = Math.PI * ((f.value + 0 - $.value) / (N.value - $.value)) + Math.PI, r = t + v.value.pointerSize * l.value.pointerSize * 0.9 * Math.cos(a), p = o + v.value.pointerSize * l.value.pointerSize * 0.9 * Math.sin(a), _ = l.value.pointerRadius, je = t + _ * Math.cos(a + Math.PI / 2), Te = o + _ * Math.sin(a + Math.PI / 2), Le = t + _ * Math.cos(a - Math.PI / 2), Be = o + _ * Math.sin(a - Math.PI / 2);
return isNaN(r) ? null : `M ${r},${p} ${je},${Te} ${Le},${Be} Z`;
}), D = y(() => {
for (let t = 0; t < O.value.series.length; t += 1) {
const { color: o, from: a, to: r } = O.value.series[t];
if (f.value >= a && f.value <= r)
return o;
}
return "#2D353C";
}), z = _e(null), X = _e(null);
function fe() {
if (Se(d.dataset) ? T({
componentName: "VueUiGauge",
type: "dataset"
}) : ($e({
datasetObject: d.dataset,
requiredAttributes: ["value", "series"]
}).forEach((t) => {
T({
componentName: "VueUiGauge",
type: "datasetAttribute",
property: t
});
}), Object.hasOwn(d.dataset, "series") && (d.dataset.series.length ? d.dataset.series.forEach((t, o) => {
$e({
datasetObject: t,
requiredAttributes: ["from", "to"]
}).forEach((a) => {
T({
componentName: "VueUiGauge",
type: "datasetSerieAttribute",
property: a,
index: o
});
});
}) : T({
componentName: "VueUiGauge",
type: "datasetAttributeEmpty",
property: "series"
}))), me(d.dataset.value || 0), e.value.responsive) {
const t = st(() => {
const { width: o, height: a } = ot({
chart: F.value,
title: e.value.style.chart.title.text ? te.value : null,
legend: ae.value,
source: le.value,
noTitle: re.value
});
requestAnimationFrame(() => {
l.value.width = o, l.value.height = a, l.value.centerX = o / 2, l.value.centerY = b.value / 2 / 358.4 * a, l.value.bottom = a, l.value.labelFontSize = 18 / b.value * Math.min(a, o) < 10 ? 10 : 18 / b.value * Math.min(a, o), l.value.legendFontSize = e.value.style.chart.legend.fontSize / b.value * Math.min(a, o) < 14 ? 14 : e.value.style.chart.legend.fontSize / b.value * Math.min(a, o), l.value.pointerRadius = e.value.style.chart.layout.pointer.circle.radius / b.value * Math.min(a, o), l.value.trackSize = e.value.style.chart.layout.track.size / b.value * Math.min(a, o), l.value.pointerStrokeWidth = Q({
relator: Math.min(o, a),
adjuster: b.value,
source: e.value.style.chart.layout.pointer.strokeWidth,
threshold: 2,
fallback: 2
}), l.value.markerOffset = Q({
relator: Math.max(o, a),
adjuster: b.value,
source: e.value.style.chart.layout.markers.offsetY + 3,
threshold: 2,
fallback: 2
}), l.value.segmentFontSize = Q({
relator: Math.min(o, a),
adjuster: b.value,
source: e.value.style.chart.layout.segmentNames.fontSize,
threshold: 8,
fallback: 8
});
});
});
z.value && (X.value && z.value.unobserve(X.value), z.value.disconnect()), z.value = new ResizeObserver(t), X.value = F.value.parentNode, z.value.observe(X.value);
}
}
De(() => {
fe();
}), Ve(() => {
z.value && (X.value && z.value.unobserve(X.value), z.value.disconnect());
});
function me(t) {
const o = [];
(O.value.series || []).forEach((_) => {
o.push(_.from || 0), o.push(_.to || 0);
}), N.value = Math.max(...o), $.value = Math.min(...o);
let a = e.value.style.chart.animation.speed;
const r = Math.abs(t - f.value) / (a * 60);
function p() {
f.value < t ? f.value = Math.min(f.value + r, t) : f.value > t && (f.value = Math.max(f.value - r, t)), f.value !== t && requestAnimationFrame(p);
}
p();
}
const v = y(() => {
const t = e.value.responsive ? Math.min(l.value.width, l.value.height) : l.value.width, o = 2.5 / e.value.style.chart.layout.radiusRatio;
return {
arcs: t / o,
gradients: t / (o * 1.1),
base: e.value.responsive ? l.value.height / 2 : l.value.height * 0.7,
ratingBase: e.value.responsive ? l.value.height / 2 + l.value.height / 4 : l.value.height * 0.9,
pointerSize: e.value.responsive ? Math.min(l.value.width, l.value.height) / 3 : l.value.width / 3.2
};
}), h = y(() => H(
{ series: O.value.series },
l.value.width / 2,
v.value.base,
v.value.arcs,
v.value.arcs,
1,
1,
1,
180,
109.9495,
40 * l.value.trackSize
)), Ae = y(() => H(
{ series: O.value.series },
l.value.width / 2,
v.value.base,
v.value.arcs * e.value.style.chart.layout.segmentNames.offsetRatio,
v.value.arcs * e.value.style.chart.layout.segmentNames.offsetRatio,
1,
1,
1,
180,
109.9495,
40 * l.value.trackSize
)), M = y(() => h.value.map((t) => v.value.arcs * e.value.style.chart.layout.segmentNames.offsetRatio * (t.nameOffsetRatio || 1))), pe = y(() => {
const { x: t, y: o } = C({
initX: h.value[0].firstSeparator.x,
initY: h.value[0].firstSeparator.y,
centerX: i.value.x1,
centerY: i.value.y1,
offset: -e.value.style.chart.layout.segmentSeparators.offsetIn
}), { x: a, y: r } = C({
initX: h.value[0].startX,
initY: h.value[0].startY,
centerX: i.value.x1,
centerY: i.value.y1,
offset: e.value.style.chart.layout.segmentSeparators.offsetOut
});
return { x1: t, y1: o, x2: a, y2: r };
}), ge = y(() => h.value.map((t) => {
const { x: o, y: a } = C({
initX: t.separator.x,
initY: t.separator.y,
centerX: i.value.x1,
centerY: i.value.y1,
offset: -e.value.style.chart.layout.segmentSeparators.offsetIn
}), { x: r, y: p } = C({
initX: t.endX,
initY: t.endY,
centerX: i.value.x1,
centerY: i.value.y1,
offset: e.value.style.chart.layout.segmentSeparators.offsetOut
});
return { x1: o, y1: a, x2: r, y2: p };
}));
function Re(t) {
if (t.reduce((p, _) => p + _, 0) > 100)
throw new Error("Total % must not exceed 100");
const a = 50;
let r = 0;
return t.map((p) => (r += p, `${r / 100 * a - p / 4}%`));
}
const Ee = y(() => Re(h.value.map((t) => t.proportion * 100))), Ge = y(() => H(
{ series: O.value.series },
l.value.width / 2,
v.value.base,
v.value.gradients,
v.value.gradients,
0.95,
1,
1,
180,
110.02,
2 * l.value.trackSize
)), Ue = y(() => {
const t = $.value >= 0 ? -$.value : Math.abs($.value);
return at(
{
radius: e.value.style.chart.layout.indicatorArc.radius * l.value.trackSize,
centerX: l.value.width / 2,
centerY: v.value.base,
percentage: (f.value + t) / (N.value + t)
}
);
}), Y = m(!1);
function ke(t) {
Y.value = t, ee.value += 1;
}
const E = m(!1);
function V() {
E.value = !E.value;
}
async function We({ scale: t = 2 } = {}) {
if (!F.value) return;
const { width: o, height: a } = F.value.getBoundingClientRect(), r = o / a, { imageUri: p, base64: _ } = await vt({ domElement: F.value, base64: !0, img: !0, scale: t });
return {
imageUri: p,
base64: _,
title: e.value.style.chart.title.text,
width: o,
height: a,
aspectRatio: r
};
}
return Ce({
getImage: We,
generatePdf: de,
generateImage: he,
toggleAnnotator: V,
toggleFullscreen: ke
}), (t, o) => (s(), u("div", {
class: we(`vue-ui-gauge ${Y.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
ref_key: "gaugeChart",
ref: F,
id: `vue-ui-gauge_${w.value}`,
style: q(`font-family:${e.value.style.fontFamily};width:100%; text-align:center;background:${e.value.style.chart.backgroundColor};${e.value.responsive ? "height: 100%" : ""}`),
onMouseenter: o[0] || (o[0] = () => n(oe)(!0)),
onMouseleave: o[1] || (o[1] = () => n(oe)(!1))
}, [
e.value.userOptions.buttons.annotator ? (s(), U(n(Fe), {
key: 0,
svgRef: n(ne),
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
active: E.value,
onClose: V
}, null, 8, ["svgRef", "backgroundColor", "color", "active"])) : c("", !0),
Ie.value ? (s(), u("div", {
key: 1,
ref_key: "noTitle",
ref: re,
class: "vue-data-ui-no-title-space",
style: "height:36px; width: 100%;background:transparent"
}, null, 512)) : c("", !0),
e.value.style.chart.title.text ? (s(), u("div", {
key: 2,
ref_key: "chartTitle",
ref: te,
style: "width:100%;background:transparent;padding-bottom:12px"
}, [
(s(), U(ct, {
key: `title_${se.value}`,
config: {
title: {
cy: "gauge-div-title",
...e.value.style.chart.title
},
subtitle: {
cy: "gauge-div-subtitle",
...e.value.style.chart.title.subtitle
}
}
}, {
default: I(() => [
e.value.translations.base && L.dataset.base ? (s(), u("span", yt, P(e.value.translations.base) + ": " + P(L.dataset.base), 1)) : c("", !0)
]),
_: 1
}, 8, ["config"]))
], 512)) : c("", !0),
e.value.userOptions.show && R.value && (n(ue) || n(B)) ? (s(), U(n(Me), {
ref_key: "details",
ref: Xe,
key: `user_options_${ee.value}`,
backgroundColor: e.value.style.chart.backgroundColor,
color: e.value.style.chart.color,
isImaging: n(ve),
isPrinting: n(ce),
uid: w.value,
hasXls: !1,
hasPdf: e.value.userOptions.buttons.pdf,
hasImg: e.value.userOptions.buttons.img,
hasFullscreen: e.value.userOptions.buttons.fullscreen,
isFullscreen: Y.value,
titles: { ...e.value.userOptions.buttonTitles },
chartElement: F.value,
callbacks: e.value.userOptions.callbacks,
printScale: e.value.userOptions.print.scale,
position: e.value.userOptions.position,
hasAnnotator: e.value.userOptions.buttons.annotator,
isAnnotation: E.value,
onToggleFullscreen: ke,
onGeneratePdf: n(de),
onGenerateImage: n(he),
onToggleAnnotator: V,
style: q({
visibility: n(ue) ? n(B) ? "visible" : "hidden" : "visible"
})
}, qe({ _: 2 }, [
t.$slots.menuIcon ? {
name: "menuIcon",
fn: I(({ isOpen: a, color: r }) => [
x(t.$slots, "menuIcon", W(j({ isOpen: a, color: r })), void 0, !0)
]),
key: "0"
} : void 0,
t.$slots.optionPdf ? {
name: "optionPdf",
fn: I(() => [
x(t.$slots, "optionPdf", {}, void 0, !0)
]),
key: "1"
} : void 0,
t.$slots.optionImg ? {
name: "optionImg",
fn: I(() => [
x(t.$slots, "optionImg", {}, void 0, !0)
]),
key: "2"
} : void 0,
t.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: I(({ toggleFullscreen: a, isFullscreen: r }) => [
x(t.$slots, "optionFullscreen", W(j({ toggleFullscreen: a, isFullscreen: r })), void 0, !0)
]),
key: "3"
} : void 0,
t.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: I(({ toggleAnnotator: a, isAnnotator: r }) => [
x(t.$slots, "optionAnnotator", W(j({ toggleAnnotator: a, isAnnotator: r })), void 0, !0)
]),
key: "4"
} : void 0
]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasPdf", "hasImg", "hasFullscreen", "isFullscreen", "titles", "chartElement", "callbacks", "printScale", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : c("", !0),
R.value ? (s(), u("svg", {
key: 4,
ref_key: "svgRef",
ref: ne,
xmlns: n(lt),
class: we({ "vue-data-ui-fullscreen--on": Y.value, "vue-data-ui-fulscreen--off": !Y.value }),
viewBox: `0 0 ${l.value.width <= 0 ? 10 : l.value.width} ${l.value.height <= 0 ? 10 : l.value.height}`,
style: q(`max-width:100%;overflow:hidden !important;background:transparent;color:${e.value.style.chart.color}`)
}, [
He(n(Pe)),
t.$slots["chart-background"] ? (s(), u("foreignObject", {
key: 0,
x: 0,
y: 0,
width: l.value.width <= 0 ? 10 : l.value.width,
height: l.value.height <= 0 ? 10 : l.value.height,
style: {
pointerEvents: "none"
}
}, [
x(t.$slots, "chart-background", {}, void 0, !0)
], 8, mt)) : c("", !0),
g("defs", null, [
g("radialGradient", {
id: `gradient_${w.value}`,
cx: "50%",
cy: "50%",
r: "50%",
fx: "50%",
fy: "50%"
}, [
g("stop", {
offset: "0%",
"stop-color": n(Z)("#FFFFFF", 1)
}, null, 8, gt),
g("stop", {
offset: "80%",
"stop-color": n(Z)("#FFFFFF", e.value.style.chart.layout.track.gradientIntensity)
}, null, 8, kt),
g("stop", {
offset: "100%",
"stop-color": n(Z)("#FFFFFF", 1)
}, null, 8, bt)
], 8, pt)
]),
g("defs", null, [
g("filter", {
id: `blur_${w.value}`,
x: "-50%",
y: "-50%",
width: "200%",
height: "200%"
}, [
g("feGaussianBlur", {
in: "SourceGraphic",
stdDeviation: 100 / e.value.style.chart.layout.track.gradientIntensity
}, null, 8, wt)
], 8, _t)
]),
t.$slots.pattern ? (s(), u("g", xt, [
(s(!0), u(k, null, S(h.value, (a, r) => (s(), u("defs", null, [
x(t.$slots, "pattern", A({ ref_for: !0 }, { seriesIndex: r, patternId: `pattern_${w.value}_${r}` }), void 0, !0)
]))), 256))
])) : c("", !0),
(s(!0), u(k, null, S(h.value, (a, r) => (s(), u("path", {
key: `arc_${r}`,
d: a.arcSlice,
fill: a.color,
stroke: e.value.style.chart.backgroundColor,
"stroke-linecap": "round"
}, null, 8, St))), 128)),
t.$slots.pattern ? (s(!0), u(k, { key: 2 }, S(h.value, (a, r) => (s(), u("path", {
key: `arc_${r}`,
d: a.arcSlice,
fill: `url(#pattern_${w.value}_${r})`,
stroke: e.value.style.chart.backgroundColor,
"stroke-linecap": "round"
}, null, 8, $t))), 128)) : c("", !0),
e.value.style.chart.layout.indicatorArc.show ? (s(), u("path", {
key: 3,
d: Ue.value,
fill: e.value.style.chart.layout.indicatorArc.fill
}, null, 8, zt)) : c("", !0),
e.value.style.chart.layout.segmentNames.show && e.value.style.chart.layout.segmentNames.curved ? (s(), u(k, { key: 4 }, [
(s(!0), u(k, null, S(h.value, (a, r) => (s(), u("path", {
id: `curve_${w.value}_${r}`,
d: `M ${i.value.x1},${i.value.y1} m -${M.value[r]},0 a ${M.value[r]},${M.value[r]} 0 1,1 ${2 * M.value[r]},0 a ${M.value[r]},${M.value[r]} 0 1,1 -${2 * M.value[r]},0`,
fill: "transparent"
}, null, 8, Ct))), 256)),
(s(!0), u(k, null, S(h.value, (a, r) => (s(), u("text", {
fill: e.value.style.chart.layout.segmentNames.useSerieColor ? a.color : e.value.style.chart.layout.segmentNames.color,
"font-size": l.value.segmentFontSize,
"font-weight": e.value.style.chart.layout.segmentNames.bold ? "bold" : "normal",
"text-anchor": "middle"
}, [
g("textPath", {
href: `#curve_${w.value}_${r}`,
startOffset: Ee.value[r]
}, P(a.name || ""), 9, Ot)
], 8, Ft))), 256))
], 64)) : c("", !0),
e.value.style.chart.layout.segmentNames.show && !e.value.style.chart.layout.segmentNames.curved ? (s(!0), u(k, { key: 5 }, S(Ae.value, (a, r) => (s(), u("text", {
x: a.center.endX,
y: a.center.endY,
"text-anchor": n(rt)(a, !1, 12).anchor,
fill: e.value.style.chart.layout.segmentNames.useSerieColor ? a.color : e.value.style.chart.layout.segmentNames.color,
"font-size": l.value.segmentFontSize,
"font-weight": e.value.style.chart.layout.segmentNames.bold ? "bold" : "normal"
}, P(a.name || ""), 9, Mt))), 256)) : c("", !0),
e.value.style.chart.layout.track.useGradient ? (s(!0), u(k, { key: 6 }, S(Ge.value, (a, r) => (s(), u("path", {
key: `arc_${r}`,
d: a.arcSlice,
fill: "#FFFFFF",
stroke: "none",
"stroke-linecap": "round",
filter: `url(#blur_${w.value})`
}, null, 8, Pt))), 128)) : c("", !0),
e.value.style.chart.layout.segmentSeparators.show ? (s(), u(k, { key: 7 }, [
g("line", A(pe.value, {
stroke: e.value.style.chart.backgroundColor,
"stroke-width": e.value.style.chart.layout.segmentSeparators.strokeWidth + 2,
"stroke-linecap": "round"
}), null, 16, Nt),
g("line", A(pe.value, {
stroke: e.value.style.chart.layout.segmentSeparators.stroke,
"stroke-width": e.value.style.chart.layout.segmentSeparators.strokeWidth,
"stroke-linecap": "round"
}), null, 16, Xt),
(s(!0), u(k, null, S(ge.value, (a) => (s(), u("line", A({ ref_for: !0 }, a, {
stroke: e.value.style.chart.backgroundColor,
"stroke-width": e.value.style.chart.layout.segmentSeparators.strokeWidth + 2,
"stroke-linecap": "round"
}), null, 16, It))), 256)),
(s(!0), u(k, null, S(ge.value, (a) => (s(), u("line", A({ ref_for: !0 }, a, {
stroke: e.value.style.chart.layout.segmentSeparators.stroke,
"stroke-width": e.value.style.chart.layout.segmentSeparators.strokeWidth,
"stroke-linecap": "round"
}), null, 16, Yt))), 256))
], 64)) : c("", !0),
e.value.style.chart.layout.markers.show ? (s(), u("g", At, [
(s(!0), u(k, null, S(h.value, (a, r) => (s(), u("text", {
x: n(C)({
centerX: i.value.x1,
centerY: v.value.base,
initX: a.center.startX,
initY: a.center.startY,
offset: l.value.markerOffset
}).x,
y: n(C)({
centerX: i.value.x1,
centerY: v.value.base,
initX: a.center.startX,
initY: a.center.startY,
offset: l.value.markerOffset
}).y,
"text-anchor": a.center.startX < i.value.x1 - 5 ? "end" : a.center.startX > i.value.x1 + 5 ? "start" : "middle",
"font-size": l.value.labelFontSize * e.value.style.chart.layout.markers.fontSizeRatio,
"font-weight": `${e.value.style.chart.layout.markers.bold ? "bold" : "normal"}`,
fill: e.value.style.chart.layout.markers.color
}, P(n(J)(
e.value.style.chart.layout.markers.formatter,
a.from,
n(K)({
p: e.value.style.chart.layout.markers.prefix,
v: a.from,
s: e.value.style.chart.layout.markers.suffix,
r: e.value.style.chart.layout.markers.roundingValue
})
)), 9, Rt))), 256))
])) : c("", !0),
e.value.style.chart.layout.markers.show ? (s(), u("text", {
key: 9,
x: n(C)({
centerX: l.value.width / 2,
centerY: v.value.base,
initX: h.value.at(-1).endX,
initY: h.value.at(-1).endY,
offset: l.value.markerOffset
}).x,
y: n(C)({
centerX: l.value.width / 2,
centerY: v.value.base,
initX: h.value.at(-1).endX,
initY: h.value.at(-1).endY,
offset: l.value.markerOffset
}).y,
"text-anchor": "start",
"font-size": l.value.labelFontSize * e.value.style.chart.layout.markers.fontSizeRatio,
"font-weight": `${e.value.style.chart.layout.markers.bold ? "bold" : "normal"}`,
fill: e.value.style.chart.layout.markers.color
}, P(n(J)(
e.value.style.chart.layout.markers.formatter,
N.value,
n(K)({
p: e.value.style.chart.layout.markers.prefix,
v: N.value,
s: e.value.style.chart.layout.markers.suffix,
r: e.value.style.chart.layout.markers.roundingValue
})
)), 9, Et)) : c("", !0),
e.value.style.chart.layout.pointer.show ? (s(), u(k, { key: 10 }, [
e.value.style.chart.layout.pointer.type === "rounded" ? (s(), u("g", Gt, [
isNaN(i.value.x2) ? c("", !0) : (s(), u("line", {
key: 0,
x1: i.value.x1,
y1: i.value.y1,
x2: i.value.x2,
y2: i.value.y2,
stroke: e.value.style.chart.layout.pointer.stroke,
"stroke-width": l.value.pointerStrokeWidth,
"stroke-linecap": "round"
}, null, 8, Ut)),
isNaN(i.value.x2) ? c("", !0) : (s(), u("line", {
key: 1,
x1: i.value.x1,
y1: i.value.y1,
x2: i.value.x2,
y2: i.value.y2,
stroke: e.value.style.chart.layout.pointer.useRatingColor ? D.value : e.value.style.chart.layout.pointer.color,
"stroke-linecap": "round",
"stroke-width": l.value.pointerStrokeWidth * 0.7
}, null, 8, Wt)),
!isNaN(i.value.x2) && e.value.style.chart.layout.track.useGradient ? (s(), u("line", {
key: 2,
x1: i.value.x1,
y1: i.value.y1,
x2: i.value.x2,
y2: i.value.y2,
stroke: "white",
"stroke-linecap": "round",
"stroke-width": l.value.pointerStrokeWidth * 0.3,
filter: `url(#blur_${w.value})`
}, null, 8, jt)) : c("", !0)
])) : (s(), u("g", Tt, [
ye.value ? (s(), u("path", {
key: 0,
d: ye.value,
fill: e.value.style.chart.layout.pointer.useRatingColor ? D.value : e.value.style.chart.layout.pointer.color,
stroke: e.value.style.chart.layout.pointer.stroke,
"stroke-width": e.value.style.chart.layout.pointer.circle.strokeWidth,
"stroke-linejoin": "round"
}, null, 8, Lt)) : c("", !0)
])),
g("circle", {
cx: l.value.width / 2,
cy: v.value.base,
fill: e.value.style.chart.layout.pointer.circle.color,
r: l.value.pointerRadius <= 0 ? 1e-4 : l.value.pointerRadius,
"stroke-width": e.value.style.chart.layout.pointer.circle.strokeWidth,
stroke: e.value.style.chart.layout.pointer.circle.stroke
}, null, 8, Bt)
], 64)) : c("", !0),
e.value.style.chart.legend.show ? (s(), u("text", {
key: 11,
x: l.value.width / 2,
y: v.value.ratingBase,
"text-anchor": "middle",
"font-size": l.value.legendFontSize,
"font-weight": "bold",
fill: e.value.style.chart.legend.useRatingColor ? D.value : e.value.style.chart.legend.color
}, P(n(J)(
e.value.style.chart.legend.formatter,
f.value,
n(K)({
p: e.value.style.chart.legend.prefix + (e.value.style.chart.legend.showPlusSymbol && f.value > 0 ? "+" : ""),
v: f.value,
s: e.value.style.chart.legend.suffix,
r: e.value.style.chart.legend.roundingValue
})
)), 9, Dt)) : c("", !0),
x(t.$slots, "svg", { svg: l.value }, void 0, !0)
], 14, ft)) : c("", !0),
t.$slots.watermark ? (s(), u("div", Vt, [
x(t.$slots, "watermark", W(j({ isPrinting: n(ce) || n(ve) })), void 0, !0)
])) : c("", !0),
R.value ? c("", !0) : (s(), U(n(Oe), {
key: 6,
config: {
type: "gauge",
style: {
backgroundColor: e.value.style.chart.backgroundColor,
gauge: {
color: "#CCCCCC"
}
}
}
}, null, 8, ["config"])),
g("div", {
ref_key: "chartLegend",
ref: ae
}, [
x(t.$slots, "legend", { legend: O.value }, void 0, !0)
], 512),
t.$slots.source ? (s(), u("div", {
key: 7,
ref_key: "source",
ref: le,
dir: "auto"
}, [
x(t.$slots, "source", {}, void 0, !0)
], 512)) : c("", !0)
], 46, ht));
}
}, sa = /* @__PURE__ */ dt(qt, [["__scopeId", "data-v-4b47d12e"]]);
export {
sa as default
};