UNPKG

vue-data-ui

Version:

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

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