@wick-charts/vue 0.6.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/BandSeries.vue.js +20 -18
- package/dist/BarSeries.vue.js +15 -13
- package/dist/CandlestickSeries.vue.js +31 -29
- package/dist/ChartContainer.vue.js +77 -70
- package/dist/LineSeries.vue.js +19 -17
- package/dist/composables.js +46 -36
- package/dist/core/dist/animation/viewport-engine.js +155 -96
- package/dist/core/dist/axis/dom-labels.js +56 -51
- package/dist/core/dist/chart/scale-guards.js +23 -5
- package/dist/core/dist/chart/x-guards.js +37 -0
- package/dist/core/dist/chart.js +1286 -843
- package/dist/core/dist/data/sync.js +37 -31
- package/dist/core/dist/navigator/controller.js +37 -37
- package/dist/core/dist/perf/perf-hud.js +3 -3
- package/dist/core/dist/scales/tick-tracker.js +2 -2
- package/dist/core/dist/scales/x-scale.js +167 -53
- package/dist/core/dist/scales/y-scale.js +36 -34
- package/dist/core/dist/series/band.js +266 -213
- package/dist/core/dist/series/bar.js +297 -291
- package/dist/core/dist/series/base-multi-layer.js +283 -237
- package/dist/core/dist/series/candlestick.js +1 -0
- package/dist/core/dist/series/line.js +21 -20
- package/dist/core/dist/snapshots.js +55 -43
- package/dist/index.d.ts +323 -58
- package/dist/index.js +9 -9
- package/dist/ui/Crosshair.vue.js +51 -27
- package/dist/ui/InfoBar.vue.js +37 -37
- package/dist/ui/Marker.vue.js +14 -11
- package/dist/ui/Navigator.vue.js +23 -23
- package/dist/ui/ReferenceLine.vue.js +19 -16
- package/dist/ui/Tooltip.vue.js +91 -86
- package/dist/ui/XAxis.vue.js +48 -0
- package/dist/ui/XAxis.vue2.js +4 -0
- package/dist/ui/YAxis.vue.js +44 -28
- package/dist/ui/YLabel.vue.js +78 -74
- package/package.json +2 -2
- package/src/BandSeries.vue +11 -6
- package/src/BarSeries.vue +13 -6
- package/src/CandlestickSeries.vue +9 -5
- package/src/ChartContainer.vue +20 -0
- package/src/LineSeries.vue +13 -6
- package/src/composables.ts +23 -4
- package/src/index.ts +8 -1
- package/src/ui/Crosshair.vue +41 -1
- package/src/ui/InfoBar.vue +2 -1
- package/src/ui/Marker.vue +5 -1
- package/src/ui/Navigator.vue +2 -1
- package/src/ui/ReferenceLine.vue +5 -1
- package/src/ui/Tooltip.vue +7 -4
- package/src/ui/{TimeAxis.vue → XAxis.vue} +18 -5
- package/src/ui/YAxis.vue +66 -12
- package/src/ui/YLabel.vue +35 -5
- package/dist/ui/TimeAxis.vue.js +0 -44
- package/dist/ui/TimeAxis.vue2.js +0 -4
package/dist/index.js
CHANGED
|
@@ -17,10 +17,10 @@ import { default as y } from "./ui/NumberFlow.vue.js";
|
|
|
17
17
|
import { default as q } from "./ui/PieLegend.vue.js";
|
|
18
18
|
import { default as V } from "./ui/PieTooltip.vue.js";
|
|
19
19
|
import { default as E } from "./ui/ReferenceLine.vue.js";
|
|
20
|
-
import { default as U
|
|
21
|
-
import { default as
|
|
22
|
-
import { default as
|
|
23
|
-
import { default as _ } from "./ui/
|
|
20
|
+
import { default as U } from "./ui/TimeRegion.vue.js";
|
|
21
|
+
import { default as J } from "./ui/Title.vue.js";
|
|
22
|
+
import { default as Q } from "./ui/Tooltip.vue.js";
|
|
23
|
+
import { default as Z, default as _ } from "./ui/XAxis.vue.js";
|
|
24
24
|
import { default as ee } from "./ui/YAxis.vue.js";
|
|
25
25
|
import { default as oe } from "./ui/YLabel.vue.js";
|
|
26
26
|
import { BandSeriesDef as ae } from "./core/dist/series/band.js";
|
|
@@ -107,11 +107,11 @@ export {
|
|
|
107
107
|
Ie as PieSeriesDef,
|
|
108
108
|
V as PieTooltip,
|
|
109
109
|
E as ReferenceLine,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
Z as TimeAxis,
|
|
111
|
+
U as TimeRegion,
|
|
112
|
+
J as Title,
|
|
113
|
+
Q as Tooltip,
|
|
114
|
+
_ as XAxis,
|
|
115
115
|
ve as XScale,
|
|
116
116
|
ee as YAxis,
|
|
117
117
|
oe as YLabel,
|
package/dist/ui/Crosshair.vue.js
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCrosshairPosition as
|
|
3
|
-
import { useChartInstance as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as C, ref as Y, onMounted as _, onUnmounted as I, computed as a, unref as n, openBlock as u, createElementBlock as c, Fragment as g, normalizeStyle as p, toDisplayString as v, createCommentVNode as h, renderList as T, createElementVNode as V } from "vue";
|
|
2
|
+
import { useCrosshairPosition as z } from "../composables.js";
|
|
3
|
+
import { useChartInstance as B } from "../context.js";
|
|
4
|
+
const P = /* @__PURE__ */ C({
|
|
5
5
|
__name: "Crosshair",
|
|
6
|
-
setup(
|
|
7
|
-
const e =
|
|
8
|
-
|
|
6
|
+
setup(E) {
|
|
7
|
+
const e = B(), t = z(e), l = Y(0), d = () => {
|
|
8
|
+
l.value++;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
const
|
|
10
|
+
_(() => e.on("overlayChange", d)), I(() => e.off("overlayChange", d));
|
|
11
|
+
const i = a(() => (l.value, e.getTheme())), f = a(() => e.getDataInterval()), S = a(() => (t.value, e.timeScale.niceTickValues(f.value).tickInterval || f.value)), b = a(() => {
|
|
12
|
+
l.value;
|
|
13
|
+
const o = t.value;
|
|
14
|
+
return o === null ? "" : e.yScale.formatY(o.y);
|
|
15
|
+
}), y = a(() => {
|
|
16
|
+
l.value;
|
|
17
|
+
const o = t.value;
|
|
18
|
+
return o === null ? [] : e.getYScaleIds().flatMap((s) => {
|
|
19
|
+
const r = e.getYScaleColumn(s);
|
|
20
|
+
if (r === null) return [];
|
|
21
|
+
const x = e.getYScale(s);
|
|
22
|
+
return [{ scale: s, position: r.position, text: x.formatY(x.yToValue(o.mediaY)) }];
|
|
23
|
+
});
|
|
24
|
+
}), k = a(() => y.value.some((o) => o.position === e.yAxisPosition)), m = a(() => ({
|
|
12
25
|
// Blend the theme's labelBackground at 80% opacity so the axis grid
|
|
13
26
|
// shows through — keeps the badge from looking like an opaque block
|
|
14
27
|
// while still masking whatever tick sits underneath.
|
|
15
|
-
background: `color-mix(in srgb, ${
|
|
16
|
-
color:
|
|
17
|
-
fontSize:
|
|
18
|
-
fontFamily:
|
|
28
|
+
background: `color-mix(in srgb, ${i.value.crosshair.labelBackground} 80%, transparent)`,
|
|
29
|
+
color: i.value.crosshair.labelTextColor,
|
|
30
|
+
fontSize: i.value.axis.fontSize + "px",
|
|
31
|
+
fontFamily: i.value.typography.fontFamily,
|
|
19
32
|
fontVariantNumeric: "tabular-nums",
|
|
20
33
|
padding: "2px 6px",
|
|
21
34
|
borderRadius: "2px",
|
|
@@ -25,28 +38,39 @@ const E = /* @__PURE__ */ v({
|
|
|
25
38
|
// live last-value stays visible when the crosshair crosses its row.
|
|
26
39
|
zIndex: 2
|
|
27
40
|
}));
|
|
28
|
-
return (
|
|
29
|
-
c("div", {
|
|
30
|
-
|
|
41
|
+
return (o, s) => n(t) ? (u(), c(g, { key: 0 }, [
|
|
42
|
+
k.value ? h("", !0) : (u(), c("div", {
|
|
43
|
+
key: 0,
|
|
44
|
+
style: p({
|
|
31
45
|
position: "absolute",
|
|
32
|
-
[
|
|
33
|
-
top: t
|
|
46
|
+
[n(e).yAxisPosition]: "0",
|
|
47
|
+
top: n(t).mediaY + "px",
|
|
34
48
|
transform: "translateY(-50%)",
|
|
35
|
-
...
|
|
49
|
+
...m.value
|
|
36
50
|
})
|
|
37
|
-
},
|
|
38
|
-
c("div", {
|
|
39
|
-
|
|
51
|
+
}, v(b.value), 5)),
|
|
52
|
+
(u(!0), c(g, null, T(y.value, (r) => (u(), c("div", {
|
|
53
|
+
key: r.scale,
|
|
54
|
+
style: p({
|
|
55
|
+
position: "absolute",
|
|
56
|
+
[r.position]: "0",
|
|
57
|
+
top: n(t).mediaY + "px",
|
|
58
|
+
transform: "translateY(-50%)",
|
|
59
|
+
...m.value
|
|
60
|
+
})
|
|
61
|
+
}, v(r.text), 5))), 128)),
|
|
62
|
+
V("div", {
|
|
63
|
+
style: p({
|
|
40
64
|
position: "absolute",
|
|
41
65
|
bottom: "0",
|
|
42
|
-
left: t
|
|
66
|
+
left: n(t).mediaX + "px",
|
|
43
67
|
transform: "translateX(-50%)",
|
|
44
|
-
...
|
|
68
|
+
...m.value
|
|
45
69
|
})
|
|
46
|
-
},
|
|
47
|
-
], 64)) :
|
|
70
|
+
}, v(n(e).timeScale.formatX(n(t).time, S.value)), 5)
|
|
71
|
+
], 64)) : h("", !0);
|
|
48
72
|
}
|
|
49
73
|
});
|
|
50
74
|
export {
|
|
51
|
-
|
|
75
|
+
P as default
|
|
52
76
|
};
|
package/dist/ui/InfoBar.vue.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { defineComponent as W, computed as i, inject as B, ref as N, onMounted as T, onUnmounted as A, useSlots as O, unref as t, openBlock as n, createBlock as R, Teleport as
|
|
2
|
-
import { buildHoverSnapshots as
|
|
3
|
-
import { resolveCandlestickBodyColor as
|
|
4
|
-
import { formatCompact as
|
|
5
|
-
import { useCrosshairPosition as
|
|
6
|
-
import { useChartInstance as
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as W, computed as i, inject as B, ref as N, onMounted as T, onUnmounted as A, useSlots as O, unref as t, openBlock as n, createBlock as R, Teleport as $, createElementVNode as l, normalizeStyle as r, renderSlot as D, createElementBlock as s, Fragment as f, toDisplayString as p, renderList as L, createCommentVNode as F } from "vue";
|
|
2
|
+
import { buildHoverSnapshots as M, buildLastSnapshots as P, formatHeaderX as j } from "../core/dist/snapshots.js";
|
|
3
|
+
import { resolveCandlestickBodyColor as U } from "../core/dist/theme/resolve.js";
|
|
4
|
+
import { formatCompact as X, formatPriceAdaptive as q } from "../core/dist/utils/format.js";
|
|
5
|
+
import { useCrosshairPosition as G } from "../composables.js";
|
|
6
|
+
import { useChartInstance as J, ThemeKey as Q, InfoBarAnchorKey as Y } from "../context.js";
|
|
7
|
+
const Z = {
|
|
8
8
|
key: 0,
|
|
9
9
|
style: { display: "inline-flex", alignItems: "center", gap: "4px" }
|
|
10
|
-
},
|
|
10
|
+
}, ee = {
|
|
11
11
|
key: 1,
|
|
12
12
|
style: { display: "inline-flex", alignItems: "center", gap: "3px" }
|
|
13
|
-
},
|
|
13
|
+
}, te = {
|
|
14
14
|
key: 2,
|
|
15
15
|
style: { display: "inline-flex", alignItems: "center", gap: "3px" }
|
|
16
|
-
},
|
|
16
|
+
}, se = /* @__PURE__ */ W({
|
|
17
17
|
__name: "InfoBar",
|
|
18
18
|
props: {
|
|
19
19
|
sort: {},
|
|
20
20
|
format: { type: Function }
|
|
21
21
|
},
|
|
22
22
|
setup(E) {
|
|
23
|
-
const b = E, k = i(() => b.sort ?? "none"),
|
|
24
|
-
() => b.format ?? ((a, _) => _ === "volume" ?
|
|
25
|
-
), u =
|
|
23
|
+
const b = E, k = i(() => b.sort ?? "none"), d = i(
|
|
24
|
+
() => b.format ?? ((a, _) => _ === "volume" ? X(a) : q(a))
|
|
25
|
+
), u = J(), y = G(u), o = B(Q), g = B(Y);
|
|
26
26
|
if (!o)
|
|
27
27
|
throw new Error("<InfoBar> must be used within <ChartContainer>: missing ThemeKey.");
|
|
28
28
|
if (!g)
|
|
@@ -38,17 +38,17 @@ const Y = {
|
|
|
38
38
|
const x = i(() => {
|
|
39
39
|
h.value;
|
|
40
40
|
const a = y.value;
|
|
41
|
-
return a === null ? null :
|
|
42
|
-
}),
|
|
43
|
-
() => m.value ? x.value :
|
|
44
|
-
),
|
|
41
|
+
return a === null ? null : M(u, { time: a.time, sort: k.value, cacheKey: "infobar-hover" });
|
|
42
|
+
}), H = i(() => (h.value, P(u, { sort: k.value, cacheKey: "infobar-last" }))), m = i(() => x.value !== null && x.value.length > 0), c = i(
|
|
43
|
+
() => m.value ? x.value : H.value
|
|
44
|
+
), K = i(() => u.getDataInterval()), S = i(() => c.value.length === 0 ? 0 : m.value && y.value ? y.value.time : Math.max(...c.value.map((a) => a.data.time))), z = O(), w = i(() => typeof z.default == "function");
|
|
45
45
|
function I(a) {
|
|
46
46
|
return "open" in a;
|
|
47
47
|
}
|
|
48
48
|
function V(a) {
|
|
49
49
|
return "high" in a && !I(a);
|
|
50
50
|
}
|
|
51
|
-
return (a, _) => t(g) && t(o) &&
|
|
51
|
+
return (a, _) => t(g) && t(o) && c.value.length > 0 ? (n(), R($, {
|
|
52
52
|
key: 0,
|
|
53
53
|
to: t(g)
|
|
54
54
|
}, [
|
|
@@ -81,25 +81,25 @@ const Y = {
|
|
|
81
81
|
}
|
|
82
82
|
)
|
|
83
83
|
}, [
|
|
84
|
-
w.value ?
|
|
84
|
+
w.value ? D(a.$slots, "default", {
|
|
85
85
|
key: 0,
|
|
86
|
-
snapshots:
|
|
86
|
+
snapshots: c.value,
|
|
87
87
|
time: S.value,
|
|
88
88
|
isHover: m.value
|
|
89
|
-
}) : (n(), s(
|
|
89
|
+
}) : (n(), s(f, { key: 1 }, [
|
|
90
90
|
l("span", {
|
|
91
91
|
style: r({ color: t(o).axis.textColor, marginRight: "2px" })
|
|
92
|
-
}, p(t(u)
|
|
93
|
-
(n(!0), s(
|
|
92
|
+
}, p(t(j)(t(u), { time: S.value, snapshots: c.value, interval: K.value })), 5),
|
|
93
|
+
(n(!0), s(f, null, L(c.value, (e) => (n(), s(f, {
|
|
94
94
|
key: e.id
|
|
95
95
|
}, [
|
|
96
|
-
I(e.data) ? (n(), s("span",
|
|
97
|
-
(n(!0), s(
|
|
96
|
+
I(e.data) ? (n(), s("span", Z, [
|
|
97
|
+
(n(!0), s(f, null, L([
|
|
98
98
|
{ label: "O", field: "open", val: e.data.open },
|
|
99
99
|
{ label: "H", field: "high", val: e.data.high },
|
|
100
100
|
{ label: "L", field: "low", val: e.data.low },
|
|
101
101
|
{ label: "C", field: "close", val: e.data.close }
|
|
102
|
-
], (v) => (n(), s(
|
|
102
|
+
], (v) => (n(), s(f, {
|
|
103
103
|
key: v.label
|
|
104
104
|
}, [
|
|
105
105
|
l("span", {
|
|
@@ -107,23 +107,23 @@ const Y = {
|
|
|
107
107
|
}, p(v.label), 5),
|
|
108
108
|
l("span", {
|
|
109
109
|
style: r({
|
|
110
|
-
color: t(
|
|
110
|
+
color: t(U)(
|
|
111
111
|
e.data.close >= e.data.open ? t(o).candlestick.up.body : t(o).candlestick.down.body
|
|
112
112
|
),
|
|
113
113
|
fontWeight: 500,
|
|
114
114
|
marginLeft: "2px"
|
|
115
115
|
})
|
|
116
|
-
}, p(
|
|
116
|
+
}, p(d.value(v.val, v.field)), 5)
|
|
117
117
|
], 64))), 128)),
|
|
118
|
-
e.data.volume != null ? (n(), s(
|
|
118
|
+
e.data.volume != null ? (n(), s(f, { key: 0 }, [
|
|
119
119
|
l("span", {
|
|
120
120
|
style: r({ color: t(o).axis.textColor, opacity: 0.5, marginLeft: "5px" })
|
|
121
121
|
}, "V", 4),
|
|
122
122
|
l("span", {
|
|
123
123
|
style: r({ color: t(o).axis.textColor, fontWeight: 500, marginLeft: "2px" })
|
|
124
|
-
}, p(
|
|
125
|
-
], 64)) :
|
|
126
|
-
])) : V(e.data) ? (n(), s("span",
|
|
124
|
+
}, p(d.value(e.data.volume, "volume")), 5)
|
|
125
|
+
], 64)) : F("", !0)
|
|
126
|
+
])) : V(e.data) ? (n(), s("span", ee, [
|
|
127
127
|
l("span", {
|
|
128
128
|
style: r({
|
|
129
129
|
width: "6px",
|
|
@@ -135,8 +135,8 @@ const Y = {
|
|
|
135
135
|
}, null, 4),
|
|
136
136
|
l("span", {
|
|
137
137
|
style: r({ color: e.color, fontWeight: 500 })
|
|
138
|
-
}, p(
|
|
139
|
-
])) : (n(), s("span",
|
|
138
|
+
}, p(d.value(e.data.low, "low")) + " – " + p(d.value(e.data.high, "high")), 5)
|
|
139
|
+
])) : (n(), s("span", te, [
|
|
140
140
|
l("span", {
|
|
141
141
|
style: r({
|
|
142
142
|
width: "6px",
|
|
@@ -148,14 +148,14 @@ const Y = {
|
|
|
148
148
|
}, null, 4),
|
|
149
149
|
l("span", {
|
|
150
150
|
style: r({ color: e.color, fontWeight: 500 })
|
|
151
|
-
}, p(
|
|
151
|
+
}, p(d.value(e.data.value, "value")), 5)
|
|
152
152
|
]))
|
|
153
153
|
], 64))), 128))
|
|
154
154
|
], 64))
|
|
155
155
|
], 4)
|
|
156
|
-
], 8, ["to"])) :
|
|
156
|
+
], 8, ["to"])) : F("", !0);
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
export {
|
|
160
|
-
|
|
160
|
+
se as default
|
|
161
161
|
};
|
package/dist/ui/Marker.vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as s, onMounted as o, onUnmounted as t, watch as u, createCommentVNode as n } from "vue";
|
|
2
|
-
import { useChartInstance as
|
|
2
|
+
import { useChartInstance as c } from "../context.js";
|
|
3
3
|
const h = /* @__PURE__ */ s({
|
|
4
4
|
__name: "Marker",
|
|
5
5
|
props: {
|
|
@@ -9,37 +9,40 @@ const h = /* @__PURE__ */ s({
|
|
|
9
9
|
shape: {},
|
|
10
10
|
pulse: { type: Boolean },
|
|
11
11
|
label: {},
|
|
12
|
-
color: {}
|
|
12
|
+
color: {},
|
|
13
|
+
scale: {}
|
|
13
14
|
},
|
|
14
|
-
setup(
|
|
15
|
-
const e =
|
|
15
|
+
setup(r) {
|
|
16
|
+
const e = r, a = c();
|
|
16
17
|
let l = null;
|
|
17
18
|
return o(() => {
|
|
18
|
-
l =
|
|
19
|
+
l = a.addMarker({
|
|
19
20
|
time: e.time,
|
|
20
21
|
value: e.value,
|
|
21
22
|
seriesId: e.seriesId,
|
|
22
23
|
shape: e.shape,
|
|
23
24
|
pulse: e.pulse,
|
|
24
25
|
label: e.label,
|
|
25
|
-
color: e.color
|
|
26
|
+
color: e.color,
|
|
27
|
+
scale: e.scale
|
|
26
28
|
});
|
|
27
29
|
}), t(() => {
|
|
28
|
-
l !== null &&
|
|
30
|
+
l !== null && a.removeMarker(l), l = null;
|
|
29
31
|
}), u(
|
|
30
|
-
() => [e.time, e.value, e.seriesId, e.shape, e.pulse, e.label, e.color],
|
|
32
|
+
() => [e.time, e.value, e.seriesId, e.shape, e.pulse, e.label, e.color, e.scale],
|
|
31
33
|
() => {
|
|
32
|
-
l !== null &&
|
|
34
|
+
l !== null && a.updateMarker(l, {
|
|
33
35
|
time: e.time,
|
|
34
36
|
value: e.value,
|
|
35
37
|
seriesId: e.seriesId,
|
|
36
38
|
shape: e.shape,
|
|
37
39
|
pulse: e.pulse,
|
|
38
40
|
label: e.label,
|
|
39
|
-
color: e.color
|
|
41
|
+
color: e.color,
|
|
42
|
+
scale: e.scale
|
|
40
43
|
});
|
|
41
44
|
}
|
|
42
|
-
), (
|
|
45
|
+
), (p, i) => n("", !0);
|
|
43
46
|
}
|
|
44
47
|
});
|
|
45
48
|
export {
|
package/dist/ui/Navigator.vue.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { NavigatorController as
|
|
3
|
-
import { NavigatorAnchorKey as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as d, inject as n, ref as p, shallowRef as g, computed as u, watch as l, onBeforeUnmount as y, unref as c, openBlock as _, createBlock as w, Teleport as N, createElementVNode as k, normalizeStyle as C, createCommentVNode as R } from "vue";
|
|
2
|
+
import { NavigatorController as x } from "../core/dist/navigator/controller.js";
|
|
3
|
+
import { NavigatorAnchorKey as B, ChartKey as K, ThemeKey as T } from "../context.js";
|
|
4
|
+
const S = /* @__PURE__ */ d({
|
|
5
5
|
__name: "Navigator",
|
|
6
6
|
props: {
|
|
7
7
|
data: {},
|
|
8
8
|
height: {}
|
|
9
9
|
},
|
|
10
|
-
setup(
|
|
11
|
-
const t =
|
|
12
|
-
if (!a || !
|
|
10
|
+
setup(v) {
|
|
11
|
+
const t = v, a = n(B), r = n(K), h = n(T);
|
|
12
|
+
if (!a || !r || !h)
|
|
13
13
|
throw new Error("<Navigator> must be used within <ChartContainer>.");
|
|
14
|
-
const s =
|
|
15
|
-
return
|
|
16
|
-
[s, () =>
|
|
17
|
-
([e,
|
|
18
|
-
!e || !
|
|
14
|
+
const s = p(null), o = g(null), m = u(() => t.height ?? h.value.navigator.height), f = u(() => r.value?.checkTimeOnlyFeature("Navigator") ?? !1);
|
|
15
|
+
return l(
|
|
16
|
+
[s, () => r.value],
|
|
17
|
+
([e, i]) => {
|
|
18
|
+
!e || !i || o.value || (o.value = new x({
|
|
19
19
|
container: e,
|
|
20
|
-
chart:
|
|
20
|
+
chart: i,
|
|
21
21
|
data: t.data,
|
|
22
22
|
options: t.height !== void 0 ? { height: t.height } : void 0
|
|
23
23
|
}));
|
|
24
24
|
},
|
|
25
25
|
{ flush: "post", immediate: !0 }
|
|
26
|
-
),
|
|
26
|
+
), l(
|
|
27
27
|
() => t.data,
|
|
28
28
|
(e) => {
|
|
29
29
|
o.value?.setData(e);
|
|
30
30
|
}
|
|
31
|
-
),
|
|
31
|
+
), l(
|
|
32
32
|
() => t.height,
|
|
33
33
|
(e) => {
|
|
34
34
|
o.value?.setOptions(e !== void 0 ? { height: e } : {});
|
|
35
35
|
}
|
|
36
|
-
),
|
|
36
|
+
), y(() => {
|
|
37
37
|
o.value?.destroy(), o.value = null;
|
|
38
|
-
}), (e,
|
|
38
|
+
}), (e, i) => c(a) && f.value ? (_(), w(N, {
|
|
39
39
|
key: 0,
|
|
40
|
-
to:
|
|
40
|
+
to: c(a)
|
|
41
41
|
}, [
|
|
42
|
-
|
|
42
|
+
k("div", {
|
|
43
43
|
ref_key: "stripRef",
|
|
44
44
|
ref: s,
|
|
45
45
|
"data-chart-navigator": "",
|
|
46
|
-
style:
|
|
46
|
+
style: C({
|
|
47
47
|
position: "relative",
|
|
48
48
|
width: "100%",
|
|
49
|
-
height:
|
|
49
|
+
height: m.value + "px",
|
|
50
50
|
flexShrink: 0
|
|
51
51
|
})
|
|
52
52
|
}, null, 4)
|
|
53
|
-
], 8, ["to"])) :
|
|
53
|
+
], 8, ["to"])) : R("", !0);
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
export {
|
|
57
|
-
|
|
57
|
+
S as default
|
|
58
58
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useChartInstance as
|
|
3
|
-
const p = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as a, onMounted as n, onUnmounted as r, watch as c, createCommentVNode as i } from "vue";
|
|
2
|
+
import { useChartInstance as s } from "../context.js";
|
|
3
|
+
const p = /* @__PURE__ */ a({
|
|
4
4
|
__name: "ReferenceLine",
|
|
5
5
|
props: {
|
|
6
6
|
value: {},
|
|
@@ -8,35 +8,38 @@ const p = /* @__PURE__ */ n({
|
|
|
8
8
|
color: {},
|
|
9
9
|
label: {},
|
|
10
10
|
style: {},
|
|
11
|
-
width: {}
|
|
11
|
+
width: {},
|
|
12
|
+
scale: {}
|
|
12
13
|
},
|
|
13
14
|
setup(o) {
|
|
14
|
-
const e = o,
|
|
15
|
-
let
|
|
16
|
-
return
|
|
17
|
-
|
|
15
|
+
const e = o, t = s();
|
|
16
|
+
let l = null;
|
|
17
|
+
return n(() => {
|
|
18
|
+
l = t.addLine({
|
|
18
19
|
value: e.value,
|
|
19
20
|
time: e.time,
|
|
20
21
|
color: e.color,
|
|
21
22
|
label: e.label,
|
|
22
23
|
style: e.style,
|
|
23
|
-
width: e.width
|
|
24
|
+
width: e.width,
|
|
25
|
+
scale: e.scale
|
|
24
26
|
});
|
|
25
|
-
}),
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
() => [e.value, e.time, e.color, e.label, e.style, e.width],
|
|
27
|
+
}), r(() => {
|
|
28
|
+
l !== null && t.removeLine(l), l = null;
|
|
29
|
+
}), c(
|
|
30
|
+
() => [e.value, e.time, e.color, e.label, e.style, e.width, e.scale],
|
|
29
31
|
() => {
|
|
30
|
-
|
|
32
|
+
l !== null && t.updateLine(l, {
|
|
31
33
|
value: e.value,
|
|
32
34
|
time: e.time,
|
|
33
35
|
color: e.color,
|
|
34
36
|
label: e.label,
|
|
35
37
|
style: e.style,
|
|
36
|
-
width: e.width
|
|
38
|
+
width: e.width,
|
|
39
|
+
scale: e.scale
|
|
37
40
|
});
|
|
38
41
|
}
|
|
39
|
-
), (
|
|
42
|
+
), (u, m) => i("", !0);
|
|
40
43
|
}
|
|
41
44
|
});
|
|
42
45
|
export {
|