vue-data-ui-hq
Version:
A user-empowering data visualization Vue 3 components library for eloquent data storytelling
759 lines (758 loc) • 34.9 kB
JavaScript
import { computed as g, ref as u, watch as Se, onMounted as qe, onBeforeUnmount as Je, nextTick as V, openBlock as i, createElementBlock as n, normalizeClass as Ne, unref as e, normalizeStyle as ee, createBlock as _, createCommentVNode as c, createSlots as Ke, withCtx as m, renderSlot as f, normalizeProps as T, guardReactiveProps as I, createVNode as Ae, createElementVNode as d, Fragment as F, renderList as L, toDisplayString as P, createTextVNode as Qe } from "vue";
import { u as Ze, c as et, t as tt, C as Te, o as ot, e as z, D as lt, v as U, X as st, w as X, E as at, s as it, x as nt, y as rt, q as ut, r as dt, F as Ie } from "./index-WrV3SAID.js";
import { t as yt, u as ct } from "./useResponsive-CoxXLe23.js";
import { _ as ht } from "./Title-BR-xoRp4.js";
import { u as vt, U as pt } from "./usePrinter-kVpf1iV8.js";
import { _ as ft } from "./Tooltip-ho4JxRm-.js";
import { D as gt } from "./DataTable-DNPvKWC0.js";
import mt from "./vue-ui-skeleton-Qec_XSRf.js";
import { S as xt } from "./Slicer-B6THn4h_.js";
import bt from "./vue-ui-accordion-BQCDXXDs.js";
import { u as Fe } from "./useNestedProp-Cj0kHD7k.js";
import { _ as kt } from "./PackageVersion-1NslmM8M.js";
import { P as wt } from "./PenAndPaper-BF1ZRVm3.js";
import { u as $t } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as Ct } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const _t = ["id"], zt = ["xmlns", "viewBox"], St = ["x", "y", "width", "height"], Nt = { key: 1 }, At = ["id"], Tt = ["stop-color"], It = ["stop-color"], Ft = ["stop-color"], Lt = ["id"], Ot = ["stop-color"], Rt = ["stop-color"], Vt = ["stop-color"], Pt = { key: 0 }, Ut = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Bt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Et = { key: 1 }, Mt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Dt = ["x", "y", "font-size", "fill", "font-weight"], Wt = { key: 2 }, Gt = ["transform", "text-anchor", "font-size", "fill", "font-weight"], jt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Xt = { key: 0 }, Ht = ["cx", "cy", "r", "fill"], Yt = ["cx", "cy", "r", "fill"], qt = { key: 1 }, Jt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Kt = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Qt = ["x", "y", "height", "width", "fill", "rx"], Zt = ["x", "y", "height", "width", "fill", "rx", "stroke", "stroke-width"], eo = ["x", "y", "height", "width", "fill", "onMouseover"], to = {
key: 5,
class: "vue-data-ui-watermark"
}, oo = ["innerHTML"], lo = {
__name: "vue-ui-candlestick",
props: {
config: {
type: Object,
default() {
return {};
}
},
dataset: {
type: Array,
default() {
return [];
}
}
},
setup($, { expose: Le }) {
const { vue_ui_candlestick: Oe } = Ze(), v = $, O = g(() => !!v.dataset && v.dataset.length), k = u(et()), Re = u(null), H = u(!1), Y = u(""), q = u(void 0), te = u(0), S = u(null), oe = u(null), le = u(null), se = u(null), ae = u(null), ie = u(null), B = u(0), ne = u(0), re = u(0), t = g({
get: () => ye(),
set: (o) => o
}), { userOptionsVisible: J, setUserOptionsVisibility: ue, keepUserOptionState: de } = $t({ config: t.value });
function ye() {
const o = Fe({
userConfig: v.config,
defaultConfig: Oe
});
let s = {};
return o.theme ? s = {
...Fe({
userConfig: tt.vue_ui_candlestick[o.theme] || v.config,
defaultConfig: o
})
} : s = o, v.config && Te(v.config, "style.zoom.startIndex") ? s.style.zoom.startIndex = v.config.style.zoom.startIndex : s.style.zoom.startIndex = null, v.config && Te(v.config, "style.zoom.endIndex") ? s.style.zoom.endIndex = v.config.style.zoom.endIndex : s.style.zoom.endIndex = null, s;
}
Se(() => v.config, (o) => {
t.value = ye(), J.value = !t.value.showOnChartHover, ce(), B.value += 1, re.value += 1, ne.value += 1;
}, { deep: !0 }), Se(() => v.dataset, (o) => {
p.value.start = 0, p.value.end = o.length, B.value += 1;
}, { deep: !0 });
const h = u({
height: t.value.style.height,
width: t.value.style.width,
xAxisFontSize: t.value.style.layout.grid.xAxis.dataLabels.fontSize,
yAxisFontSize: t.value.style.layout.grid.yAxis.dataLabels.fontSize
}), E = u(null);
qe(() => {
ce();
});
function ce() {
if (ot(v.dataset) && z({
componentName: "VueUiCandlestick",
type: "dataset"
}), t.value.responsive) {
const o = yt(() => {
const { width: s, height: l } = ct({
chart: S.value,
title: t.value.style.title.text ? oe.value : null,
slicer: se.value,
legend: le.value,
source: ae.value,
noTitle: ie.value
});
h.value.width = s, h.value.height = l, h.value.xAxisFontSize = Ie({
relator: Math.min(s, l),
adjuster: t.value.style.width,
source: t.value.style.layout.grid.xAxis.dataLabels.fontSize,
threshold: 6,
fallback: 6
}), h.value.yAxisFontSize = Ie({
relator: Math.min(s, l),
adjuster: t.value.style.width,
source: t.value.style.layout.grid.yAxis.dataLabels.fontSize,
threshold: 6,
fallback: 6
});
});
E.value = new ResizeObserver(o), E.value.observe(S.value.parentNode);
}
xe();
}
Je(() => {
E.value && E.value.disconnect();
});
const { isPrinting: he, isImaging: ve, generatePdf: pe, generateImage: fe } = vt({
elementId: `vue-ui-candlestick_${k.value}`,
fileName: t.value.style.title.text || "vue-ui-candlestick"
}), Ve = g(() => t.value.userOptions.show && !t.value.style.title.text), w = u({
showTable: t.value.table.show,
showTooltip: t.value.style.tooltip.show
}), r = g(() => {
const { top: o, right: s, bottom: l, left: a } = t.value.style.layout.padding;
return {
top: o,
right: h.value.width - s,
left: a,
bottom: h.value.height - l,
width: h.value.width - a - s,
height: h.value.height - o - l
};
}), R = g(() => v.dataset.length), p = u({
start: 0,
end: R.value
}), ge = g(() => v.dataset.slice(p.value.start, p.value.end)), K = g(() => (v.dataset.forEach((o, s) => {
[null, void 0].includes(o[0]) && z({
componentName: "VueUiCandlestick",
type: "datasetAttribute",
property: "period (index 0)",
index: s
}), [null, void 0].includes(o[1]) && z({
componentName: "VueUiCandlestick",
type: "datasetAttribute",
property: "open (index 1)",
index: s
}), [null, void 0].includes(o[2]) && z({
componentName: "VueUiCandlestick",
type: "datasetAttribute",
property: "high (index 2)",
index: s
}), [null, void 0].includes(o[3]) && z({
componentName: "VueUiCandlestick",
type: "datasetAttribute",
property: "low (index 3)",
index: s
}), [null, void 0].includes(o[4]) && z({
componentName: "VueUiCandlestick",
type: "datasetAttribute",
property: "last (index 4)",
index: s
}), [null, void 0].includes(o[5]) && z({
componentName: "VueUiCandlestick",
type: "datasetAttribute",
property: "volume (index 5)",
index: s
});
}), ge.value.map((o) => ({
period: o[0],
open: o[1],
high: o[2],
low: o[3],
last: o[4],
volume: o[5]
})))), y = g(() => r.value.width / ge.value.length), me = g(() => ({
max: Math.max(...K.value.map((o) => o.high)),
min: 0
})), C = g(() => lt(me.value.min, me.value.max, t.value.style.layout.grid.yAxis.dataLabels.steps));
function M(o, s) {
return {
...o,
x: U(r.value.left + s * y.value + y.value / 2),
y: U(r.value.top + (1 - o / C.value.max) * r.value.height),
value: U(o)
};
}
const x = g(() => K.value.map((o, s) => {
const l = M(o.open, s), a = M(o.high, s), b = M(o.low, s), G = M(o.last, s), j = o.last > o.open;
return {
period: o.period,
open: l,
high: a,
low: b,
last: G,
volume: o.volume,
isBullish: j
};
}));
function Pe(o) {
return U(o / C.value.max);
}
const Ue = g(() => C.value.ticks.map((o) => ({
y: r.value.bottom - r.value.height * Pe(o),
value: U(o)
}))), Be = g(() => K.value.map((o) => o.period)), Q = u(null);
function Ee(o, s) {
q.value = o, Q.value = {
datapoint: s,
seriesIndex: o,
series: x.value,
config: t.value
};
const l = t.value.style.tooltip.customFormat;
if (nt(l) && rt(() => l({
seriesIndex: o,
datapoint: s,
series: x.value,
config: t.value
})))
Y.value = l({
seriesIndex: o,
datapoint: s,
series: x.value,
config: t.value
});
else if (t.value.style.tooltip.show) {
let a = "";
const { period: b, open: G, high: j, low: $e, last: Ce, volume: _e, isBullish: ze } = x.value[o], { period: so, open: Ge, high: je, low: Xe, last: He, volume: Ye } = t.value.translations;
a += `<div><svg style="margin-right:6px" viewBox="0 0 12 12" height="12" width="12"><rect x="0" y="0" height="12" width="12" rx="${t.value.style.layout.candle.borderRadius * 3}" stroke="${t.value.style.layout.candle.stroke}" stroke-width="${t.value.style.layout.candle.strokeWidth}"
fill="${t.value.style.layout.candle.gradient.show ? ze ? `url(#bullish_gradient_${k.value})` : `url(#bearish_gradient_${k.value})` : ze ? t.value.style.layout.candle.colors.bullish : t.value.style.layout.candle.colors.bearish}"/></svg>${b}</div>`, a += `${Ye} : <b>${isNaN(_e) ? "-" : Number(_e.toFixed(t.value.style.tooltip.roundingValue)).toLocaleString()}</b>`, a += `<div style="margin-top:6px;padding-top:6px;border-top:1px solid ${t.value.style.tooltip.borderColor}">`, a += `<div>${Ge}: <b>${t.value.style.tooltip.prefix} ${isNaN(G.value) ? "-" : Number(G.value.toFixed(t.value.style.tooltip.roundingValue)).toLocaleString()} ${t.value.style.tooltip.suffix}</b></div>`, a += `<div>${je}: <b>${t.value.style.tooltip.prefix} ${isNaN(j.value) ? "-" : Number(j.value.toFixed(t.value.style.tooltip.roundingValue)).toLocaleString()} ${t.value.style.tooltip.suffix}</b></div>`, a += `<div>${Xe}: <b>${t.value.style.tooltip.prefix} ${isNaN($e.value) ? "-" : Number($e.value.toFixed(t.value.style.tooltip.roundingValue)).toLocaleString()} ${t.value.style.tooltip.suffix}</b></div>`, a += `<div>${He}: <b>${t.value.style.tooltip.prefix} ${isNaN(Ce.value) ? "-" : Number(Ce.value.toFixed(t.value.style.tooltip.roundingValue)).toLocaleString()} ${t.value.style.tooltip.suffix}</b></div>`, a += "</div>", Y.value = `<div style="text-align:right">${a}</div>`;
}
H.value = !0;
}
function Me() {
xe();
}
const N = u(null);
async function xe() {
(t.value.style.zoom.startIndex !== null || t.value.style.zoom.endIndex !== null) && N.value ? (t.value.style.zoom.startIndex !== null && (await V(), await V(), N.value && N.value.setStartValue(t.value.style.zoom.startIndex)), t.value.style.zoom.endIndex !== null && (await V(), await V(), N.value && N.value.setEndValue(De(t.value.style.zoom.endIndex + 1)))) : (p.value = {
start: 0,
end: R.value
}, B.value += 1);
}
function De(o) {
const s = R.value;
return o > s ? s : o < 0 || t.value.style.zoom.startIndex !== null && o < t.value.style.zoom.startIndex ? t.value.style.zoom.startIndex !== null ? t.value.style.zoom.startIndex + 1 : 1 : o;
}
function be() {
V(() => {
const o = [t.value.translations.period, t.value.translations.open, t.value.translations.high, t.value.translations.low, t.value.translations.last, t.value.translations.volume], s = x.value.map((b) => [
b.period,
b.open.value,
b.high.value,
b.low.value,
b.last.value,
b.volume
]), l = [[t.value.style.title.text], [t.value.style.title.subtitle.text], [[""], [""], [""]]].concat([o]).concat(s), a = ut(l);
dt({ csvContent: a, title: t.value.style.title.text || "vue-ui-candlestick" });
});
}
const D = g(() => {
const o = x.value.map((a) => [
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" height="12" width="12" style="margin-right: 6px"><rect x="0" y="0" height="12" width="12" :rx="${t.value.style.layout.candle.borderRadius * 3}" fill="${t.value.style.layout.candle.gradient.show ? a.isBullish ? `url(#bullish_gradient_${k.value}` : `url(#bearish_gradient_${k.value})` : a.isBullish ? t.value.style.layout.candle.colors.bullish : t.value.style.layout.candle.colors.bearish}"/></svg> ${a.period}`,
`${t.value.table.td.prefix} ${isNaN(a.open.value) ? "-" : Number(a.open.value.toFixed(t.value.table.td.roundingValue)).toLocaleString()} ${t.value.table.td.suffix}`,
`${t.value.table.td.prefix} ${isNaN(a.high.value) ? "-" : Number(a.high.value.toFixed(t.value.table.td.roundingValue)).toLocaleString()} ${t.value.table.td.suffix}`,
`${t.value.table.td.prefix} ${isNaN(a.low.value) ? "-" : Number(a.low.value.toFixed(t.value.table.td.roundingValue)).toLocaleString()} ${t.value.table.td.suffix}`,
`${t.value.table.td.prefix} ${isNaN(a.last.value) ? "-" : Number(a.last.value.toFixed(t.value.table.td.roundingValue)).toLocaleString()} ${t.value.table.td.suffix}`,
`${isNaN(a.volume) ? "-" : a.volume.toLocaleString()}`
]), s = {
th: {
backgroundColor: t.value.table.th.backgroundColor,
color: t.value.table.th.color,
outline: t.value.table.th.outline
},
td: {
backgroundColor: t.value.table.td.backgroundColor,
color: t.value.table.td.color,
outline: t.value.table.td.outline
},
breakpoint: t.value.table.responsiveBreakpoint
}, l = [
t.value.translations.period,
t.value.translations.open,
t.value.translations.high,
t.value.translations.low,
t.value.translations.last,
t.value.translations.volume
];
return { head: l, body: o, config: s, colNames: l };
}), A = u(!1);
function We(o) {
A.value = o, te.value += 1;
}
function ke() {
w.value.showTable = !w.value.showTable;
}
function we() {
w.value.showTooltip = !w.value.showTooltip;
}
const W = u(!1);
function Z() {
W.value = !W.value;
}
return Le({
generatePdf: pe,
generateCsv: be,
generateImage: fe,
toggleTable: ke,
toggleTooltip: we,
toggleAnnotator: Z
}), (o, s) => (i(), n("div", {
ref_key: "candlestickChart",
ref: S,
class: Ne(`vue-ui-candlestick ${e(A) ? "vue-data-ui-wrapper-fullscreen" : ""} ${e(t).useCssAnimation ? "" : "vue-ui-dna"}`),
style: ee(`position:relative;font-family:${e(t).style.fontFamily}; text-align:center;background:${e(t).style.backgroundColor}; ${e(t).responsive ? "height: 100%" : ""}`),
id: `vue-ui-candlestick_${e(k)}`,
onMouseenter: s[4] || (s[4] = () => e(ue)(!0)),
onMouseleave: s[5] || (s[5] = () => e(ue)(!1))
}, [
e(t).userOptions.buttons.annotator ? (i(), _(wt, {
key: 0,
parent: e(S),
backgroundColor: e(t).style.backgroundColor,
color: e(t).style.color,
active: e(W),
onClose: Z
}, null, 8, ["parent", "backgroundColor", "color", "active"])) : c("", !0),
e(Ve) ? (i(), n("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(t).style.title.text ? (i(), n("div", {
key: 2,
ref_key: "chartTitle",
ref: oe,
style: "width:100%;background:transparent"
}, [
(i(), _(ht, {
key: `title_${e(re)}`,
config: {
title: {
cy: "candlestick-div-title",
...e(t).style.title
},
subtitle: {
cy: "candlestick-div-subtitle",
...e(t).style.title.subtitle
}
}
}, null, 8, ["config"]))
], 512)) : c("", !0),
e(t).userOptions.show && e(O) && (e(de) || e(J)) ? (i(), _(pt, {
ref_key: "details",
ref: Re,
key: `user_options_${e(te)}`,
backgroundColor: e(t).style.backgroundColor,
color: e(t).style.color,
isImaging: e(ve),
isPrinting: e(he),
uid: e(k),
hasTooltip: e(t).userOptions.buttons.tooltip && e(t).style.tooltip.show,
hasPdf: e(t).userOptions.buttons.pdf,
hasImg: e(t).userOptions.buttons.img,
hasXls: e(t).userOptions.buttons.csv,
hasTable: e(t).userOptions.buttons.table,
hasFullscreen: e(t).userOptions.buttons.fullscreen,
isFullscreen: e(A),
isTooltip: e(w).showTooltip,
titles: { ...e(t).userOptions.buttonTitles },
chartElement: e(S),
position: e(t).userOptions.position,
hasAnnotator: e(t).userOptions.buttons.annotator,
isAnnotation: e(W),
onToggleFullscreen: We,
onGeneratePdf: e(pe),
onGenerateCsv: be,
onGenerateImage: e(fe),
onToggleTable: ke,
onToggleTooltip: we,
onToggleAnnotator: Z,
style: ee({
visibility: e(de) ? e(J) ? "visible" : "hidden" : "visible"
})
}, Ke({ _: 2 }, [
o.$slots.optionTooltip ? {
name: "optionTooltip",
fn: m(() => [
f(o.$slots, "optionTooltip", {}, void 0, !0)
]),
key: "0"
} : void 0,
o.$slots.optionPdf ? {
name: "optionPdf",
fn: m(() => [
f(o.$slots, "optionPdf", {}, void 0, !0)
]),
key: "1"
} : void 0,
o.$slots.optionCsv ? {
name: "optionCsv",
fn: m(() => [
f(o.$slots, "optionCsv", {}, void 0, !0)
]),
key: "2"
} : void 0,
o.$slots.optionImg ? {
name: "optionImg",
fn: m(() => [
f(o.$slots, "optionImg", {}, void 0, !0)
]),
key: "3"
} : void 0,
o.$slots.optionTable ? {
name: "optionTable",
fn: m(() => [
f(o.$slots, "optionTable", {}, void 0, !0)
]),
key: "4"
} : void 0,
o.$slots.optionFullscreen ? {
name: "optionFullscreen",
fn: m(({ toggleFullscreen: l, isFullscreen: a }) => [
f(o.$slots, "optionFullscreen", T(I({ toggleFullscreen: l, isFullscreen: a })), void 0, !0)
]),
key: "5"
} : void 0,
o.$slots.optionAnnotator ? {
name: "optionAnnotator",
fn: m(({ toggleAnnotator: l, isAnnotator: a }) => [
f(o.$slots, "optionAnnotator", T(I({ toggleAnnotator: l, isAnnotator: a })), void 0, !0)
]),
key: "6"
} : void 0
]), 1032, ["backgroundColor", "color", "isImaging", "isPrinting", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : c("", !0),
e(O) ? (i(), n("svg", {
key: 4,
xmlns: e(st),
class: Ne({ "vue-data-ui-fullscreen--on": e(A), "vue-data-ui-fulscreen--off": !e(A) }),
viewBox: `0 0 ${e(h).width <= 0 ? 10 : e(h).width} ${e(h).height <= 0 ? 10 : e(h).height}`,
style: ee(`max-width:100%;overflow:visible;background:transparent;color:${e(t).style.color}`)
}, [
Ae(kt),
o.$slots["chart-background"] ? (i(), n("foreignObject", {
key: 0,
x: e(r).left,
y: e(r).top,
width: e(r).width,
height: e(r).height,
style: {
pointerEvents: "none"
}
}, [
f(o.$slots, "chart-background", {}, void 0, !0)
], 8, St)) : c("", !0),
e(x).length > 0 ? (i(), n("g", Nt, [
d("defs", null, [
d("linearGradient", {
id: `bearish_gradient_${e(k)}`,
x2: "0%",
y2: "100%"
}, [
d("stop", {
offset: "0%",
"stop-color": e(t).style.layout.candle.colors.bearish
}, null, 8, Tt),
d("stop", {
offset: "50%",
"stop-color": `${e(X)(e(t).style.layout.candle.colors.bearish, 0.02)}DE`
}, null, 8, It),
d("stop", {
offset: "100%",
"stop-color": `${e(X)(e(t).style.layout.candle.colors.bearish, 0.05)}66`
}, null, 8, Ft)
], 8, At),
d("linearGradient", {
id: `bullish_gradient_${e(k)}`,
x2: "0%",
y2: "100%"
}, [
d("stop", {
offset: "0%",
"stop-color": e(t).style.layout.candle.colors.bullish
}, null, 8, Ot),
d("stop", {
offset: "50%",
"stop-color": `${e(X)(e(t).style.layout.candle.colors.bullish, 0.02)}DE`
}, null, 8, Rt),
d("stop", {
offset: "100%",
"stop-color": `${e(X)(e(t).style.layout.candle.colors.bullish, 0.05)}66`
}, null, 8, Vt)
], 8, Lt)
]),
e(t).style.layout.grid.show ? (i(), n("g", Pt, [
d("line", {
x1: e(r).left,
x2: e(r).left,
y1: e(r).top,
y2: e(r).bottom,
stroke: e(t).style.layout.grid.stroke,
"stroke-width": e(t).style.layout.grid.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Ut),
d("line", {
x1: e(r).left,
x2: e(r).right,
y1: e(r).bottom,
y2: e(r).bottom,
stroke: e(t).style.layout.grid.stroke,
"stroke-width": e(t).style.layout.grid.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Bt)
])) : c("", !0),
e(t).style.layout.grid.yAxis.dataLabels.show ? (i(), n("g", Et, [
(i(!0), n(F, null, L(e(Ue), (l, a) => (i(), n("g", null, [
l.value >= e(C).min && l.value <= e(C).max ? (i(), n("line", {
key: 0,
x1: e(r).left,
x2: e(r).left - 5,
y1: l.y,
y2: l.y,
stroke: e(t).style.layout.grid.stroke,
"stroke-width": e(t).style.layout.grid.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Mt)) : c("", !0),
l.value >= e(C).min && l.value <= e(C).max ? (i(), n("text", {
key: 1,
x: e(r).left - 8 + e(t).style.layout.grid.yAxis.dataLabels.offsetX,
y: l.y + e(h).yAxisFontSize / 3,
"font-size": e(h).yAxisFontSize,
"text-anchor": "end",
fill: e(t).style.layout.grid.yAxis.dataLabels.color,
"font-weight": e(t).style.layout.grid.yAxis.dataLabels.bold ? "bold" : "normal"
}, P(e(t).style.layout.grid.yAxis.dataLabels.prefix) + " " + P(e(at)(l.value) ? l.value.toFixed(e(t).style.layout.grid.yAxis.dataLabels.roundingValue) : "") + " " + P(e(t).style.layout.grid.yAxis.dataLabels.suffix), 9, Dt)) : c("", !0)
]))), 256))
])) : c("", !0),
e(t).style.layout.grid.xAxis.dataLabels.show ? (i(), n("g", Wt, [
(i(!0), n(F, null, L(e(Be), (l, a) => (i(), n("g", null, [
d("text", {
transform: `translate(${e(r).left + e(y) * a + e(y) / 2}, ${e(r).bottom + e(h).xAxisFontSize * 2 + e(t).style.layout.grid.xAxis.dataLabels.offsetY}), rotate(${e(t).style.layout.grid.xAxis.dataLabels.rotation})`,
"text-anchor": e(t).style.layout.grid.xAxis.dataLabels.rotation > 0 ? "start" : e(t).style.layout.grid.xAxis.dataLabels.rotation < 0 ? "end" : "middle",
"font-size": e(h).xAxisFontSize,
fill: e(t).style.layout.grid.xAxis.dataLabels.color,
"font-weight": e(t).style.layout.grid.xAxis.dataLabels.bold ? "bold" : "normal"
}, P(l), 9, Gt)
]))), 256))
])) : c("", !0),
d("g", null, [
(i(!0), n(F, null, L(e(x), (l, a) => (i(), n("g", null, [
d("line", {
x1: l.open.x,
x2: l.open.x,
y1: l.high.y,
y2: l.low.y,
stroke: e(t).style.layout.wick.stroke,
"stroke-width": e(t).style.layout.wick.strokeWidth,
"stroke-linecap": "round"
}, null, 8, jt),
e(t).style.layout.wick.extremity.shape === "circle" ? (i(), n("g", Xt, [
d("circle", {
cx: l.high.x,
cy: l.high.y,
r: e(t).style.layout.wick.extremity.size === "auto" ? e(y) / 20 : e(t).style.layout.wick.extremity.size,
fill: e(t).style.layout.wick.extremity.color
}, null, 8, Ht),
d("circle", {
cx: l.low.x,
cy: l.low.y,
r: e(t).style.layout.wick.extremity.size === "auto" ? e(y) / 20 : e(t).style.layout.wick.extremity.size,
fill: e(t).style.layout.wick.extremity.color
}, null, 8, Yt)
])) : c("", !0),
e(t).style.layout.wick.extremity.shape === "line" ? (i(), n("g", qt, [
d("line", {
x1: l.high.x - (e(t).style.layout.wick.extremity.size === "auto" ? e(y) * e(t).style.layout.candle.widthRatio : e(t).style.layout.wick.extremity.size) / 2,
x2: l.high.x + (e(t).style.layout.wick.extremity.size === "auto" ? e(y) * e(t).style.layout.candle.widthRatio : e(t).style.layout.wick.extremity.size) / 2,
y1: l.high.y,
y2: l.high.y,
stroke: e(t).style.layout.wick.extremity.color,
"stroke-width": e(t).style.layout.wick.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Jt),
d("line", {
x1: l.low.x - (e(t).style.layout.wick.extremity.size === "auto" ? e(y) * e(t).style.layout.candle.widthRatio : e(t).style.layout.wick.extremity.size) / 2,
x2: l.low.x + (e(t).style.layout.wick.extremity.size === "auto" ? e(y) * e(t).style.layout.candle.widthRatio : e(t).style.layout.wick.extremity.size) / 2,
y1: l.low.y,
y2: l.low.y,
stroke: e(t).style.layout.wick.extremity.color,
"stroke-width": e(t).style.layout.wick.strokeWidth,
"stroke-linecap": "round"
}, null, 8, Kt)
])) : c("", !0)
]))), 256))
]),
d("g", null, [
(i(!0), n(F, null, L(e(x), (l, a) => (i(), n("rect", {
x: l.open.x - e(y) / 2 + e(y) * (1 - e(t).style.layout.candle.widthRatio) / 2,
y: l.isBullish ? l.last.y : l.open.y,
height: Math.abs(l.last.y - l.open.y) <= 0 ? 1e-4 : Math.abs(l.last.y - l.open.y),
width: e(y) * e(t).style.layout.candle.widthRatio <= 0 ? 1e-4 : e(y) * e(t).style.layout.candle.widthRatio,
fill: e(t).style.layout.candle.gradient.underlayer,
rx: e(t).style.layout.candle.borderRadius,
stroke: "none"
}, null, 8, Qt))), 256)),
(i(!0), n(F, null, L(e(x), (l, a) => (i(), n("rect", {
x: l.open.x - e(y) / 2 + e(y) * (1 - e(t).style.layout.candle.widthRatio) / 2,
y: l.isBullish ? l.last.y : l.open.y,
height: Math.abs(l.last.y - l.open.y) <= 0 ? 1e-4 : Math.abs(l.last.y - l.open.y),
width: e(y) * e(t).style.layout.candle.widthRatio <= 0 ? 1e-4 : e(y) * e(t).style.layout.candle.widthRatio,
fill: l.isBullish ? e(t).style.layout.candle.gradient.show ? `url(#bullish_gradient_${e(k)})` : e(t).style.layout.candle.colors.bullish : e(t).style.layout.candle.gradient.show ? `url(#bearish_gradient_${e(k)})` : e(t).style.layout.candle.colors.bearish,
rx: e(t).style.layout.candle.borderRadius,
stroke: e(t).style.layout.candle.stroke,
"stroke-width": e(t).style.layout.candle.strokeWidth,
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null, 8, Zt))), 256))
]),
d("g", null, [
(i(!0), n(F, null, L(e(x), (l, a) => (i(), n("rect", {
x: e(r).left + a * e(y),
y: e(r).top,
height: e(r).height <= 0 ? 1e-4 : e(r).height,
width: e(y) <= 0 ? 1e-4 : e(y),
fill: e(q) === a ? e(it)(e(t).style.layout.selector.color, e(t).style.layout.selector.opacity) : "transparent",
onMouseover: (b) => Ee(a, l),
onMouseleave: s[0] || (s[0] = (b) => {
q.value = void 0, H.value = !1;
})
}, null, 40, eo))), 256))
])
])) : c("", !0),
f(o.$slots, "svg", { svg: e(h) }, void 0, !0)
], 14, zt)) : c("", !0),
o.$slots.watermark ? (i(), n("div", to, [
f(o.$slots, "watermark", T(I({ isPrinting: e(he) || e(ve) })), void 0, !0)
])) : c("", !0),
e(O) ? c("", !0) : (i(), _(mt, {
key: 6,
config: {
type: "candlesticks",
style: {
backgroundColor: e(t).style.backgroundColor,
candlesticks: {
axis: {
color: "#CCCCCC"
},
candle: {
color: "#CCCCCC"
}
}
}
}
}, null, 8, ["config"])),
e(t).style.zoom.show && e(O) ? (i(), n("div", {
key: 7,
ref_key: "chartSlicer",
ref: se
}, [
(i(), _(xt, {
ref_key: "slicerComponent",
ref: N,
key: `slicer_${e(B)}`,
background: e(t).style.zoom.color,
borderColor: e(t).style.backgroundColor,
fontSize: e(t).style.zoom.fontSize,
useResetSlot: e(t).style.zoom.useResetSlot,
labelLeft: $.dataset[e(p).start] ? $.dataset[e(p).start][0] : $.dataset[0][0],
labelRight: $.dataset[e(p).end - 1] ? $.dataset[e(p).end - 1][0] : $.dataset.at(-1)[0],
textColor: e(t).style.color,
inputColor: e(t).style.zoom.color,
selectColor: e(t).style.zoom.highlightColor,
max: e(R),
min: 0,
valueStart: e(p).start,
valueEnd: e(p).end,
start: e(p).start,
"onUpdate:start": s[1] || (s[1] = (l) => e(p).start = l),
end: e(p).end,
"onUpdate:end": s[2] || (s[2] = (l) => e(p).end = l),
refreshStartPoint: e(t).style.zoom.startIndex !== null ? e(t).style.zoom.startIndex : 0,
refreshEndPoint: e(t).style.zoom.endIndex !== null ? e(t).style.zoom.endIndex + 1 : e(R),
onReset: Me
}, {
"reset-action": m(({ reset: l }) => [
f(o.$slots, "reset-action", T(I({ reset: l })), void 0, !0)
]),
_: 3
}, 8, ["background", "borderColor", "fontSize", "useResetSlot", "labelLeft", "labelRight", "textColor", "inputColor", "selectColor", "max", "valueStart", "valueEnd", "start", "end", "refreshStartPoint", "refreshEndPoint"]))
], 512)) : c("", !0),
d("div", {
ref_key: "chartLegend",
ref: le
}, [
f(o.$slots, "legend", { legend: e(x) }, void 0, !0)
], 512),
o.$slots.source ? (i(), n("div", {
key: 8,
ref_key: "source",
ref: ae,
dir: "auto"
}, [
f(o.$slots, "source", {}, void 0, !0)
], 512)) : c("", !0),
Ae(ft, {
show: e(w).showTooltip && e(H),
backgroundColor: e(t).style.tooltip.backgroundColor,
color: e(t).style.tooltip.color,
borderRadius: e(t).style.tooltip.borderRadius,
borderColor: e(t).style.tooltip.borderColor,
borderWidth: e(t).style.tooltip.borderWidth,
fontSize: e(t).style.tooltip.fontSize,
backgroundOpacity: e(t).style.tooltip.backgroundOpacity,
position: e(t).style.tooltip.position,
offsetY: e(t).style.tooltip.offsetY,
parent: e(S),
content: e(Y),
isFullscreen: e(A),
isCustom: e(t).style.tooltip.customFormat && typeof e(t).style.tooltip.customFormat == "function"
}, {
"tooltip-before": m(() => [
f(o.$slots, "tooltip-before", T(I({ ...e(Q) })), void 0, !0)
]),
"tooltip-after": m(() => [
f(o.$slots, "tooltip-after", T(I({ ...e(Q) })), void 0, !0)
]),
_: 3
}, 8, ["show", "backgroundColor", "color", "borderRadius", "borderColor", "borderWidth", "fontSize", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
e(O) ? (i(), _(bt, {
key: 9,
hideDetails: "",
config: {
open: e(w).showTable,
maxHeight: 1e4,
body: {
backgroundColor: e(t).style.backgroundColor,
color: e(t).style.color
},
head: {
backgroundColor: e(t).style.backgroundColor,
color: e(t).style.color
}
}
}, {
content: m(() => [
(i(), _(gt, {
key: `table_${e(ne)}`,
colNames: e(D).colNames,
head: e(D).head,
body: e(D).body,
config: e(D).config,
title: `${e(t).style.title.text}${e(t).style.title.subtitle.text ? ` : ${e(t).style.title.subtitle.text}` : ""}`,
onClose: s[3] || (s[3] = (l) => e(w).showTable = !1)
}, {
th: m(({ th: l }) => [
Qe(P(l), 1)
]),
td: m(({ td: l }) => [
d("div", { innerHTML: l }, null, 8, oo)
]),
_: 1
}, 8, ["colNames", "head", "body", "config", "title"]))
]),
_: 1
}, 8, ["config"])) : c("", !0)
], 46, _t));
}
}, ko = /* @__PURE__ */ Ct(lo, [["__scopeId", "data-v-0dd3964d"]]);
export {
ko as default
};