@wick-charts/vue 0.8.0 → 0.8.2
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 +2 -0
- package/dist/BandSeries.vue.js +43 -32
- package/dist/BarSeries.vue.js +44 -33
- package/dist/CandlestickSeries.vue.js +24 -23
- package/dist/ChartContainer.vue.js +1 -1
- package/dist/HeatmapSeries.vue.js +21 -20
- package/dist/LineSeries.vue.js +43 -32
- package/dist/PieSeries.vue.js +25 -24
- package/dist/composables.js +63 -36
- package/dist/core/dist/axis/dom-labels.js +64 -53
- package/dist/core/dist/chart/badge-animator.js +38 -28
- package/dist/core/dist/chart/options.js +1 -1
- package/dist/core/dist/chart/y-target.js +38 -32
- package/dist/core/dist/chart.js +852 -709
- package/dist/core/dist/data/decimation.js +52 -51
- package/dist/core/dist/data/store.js +38 -20
- package/dist/core/dist/data/sync.js +97 -59
- package/dist/core/dist/navigator/controller.js +11 -11
- package/dist/core/dist/perf/perf-hud.js +3 -3
- package/dist/core/dist/scales/tick-tracker.js +2 -1
- package/dist/core/dist/scales/time-ticks.js +99 -0
- package/dist/core/dist/scales/x-scale.js +33 -27
- package/dist/core/dist/series/band.js +83 -83
- package/dist/core/dist/series/bar.js +240 -211
- package/dist/core/dist/series/base-multi-layer.js +288 -240
- package/dist/core/dist/series/candlestick.js +168 -168
- package/dist/core/dist/series/line.js +545 -455
- package/dist/core/dist/snapshots.js +109 -86
- package/dist/core/dist/utils/point.js +4 -0
- package/dist/core/dist/utils/time.js +42 -26
- package/dist/index.d.ts +67 -28
- package/dist/ui/InfoBar.vue.js +69 -69
- package/dist/ui/NumberFlow.vue.js +36 -27
- package/dist/ui/Tooltip.vue.js +128 -131
- package/dist/ui/YLabel.vue.js +47 -47
- package/package.json +2 -2
- package/src/BandSeries.vue +20 -5
- package/src/BarSeries.vue +20 -5
- package/src/CandlestickSeries.vue +5 -4
- package/src/ChartContainer.vue +15 -9
- package/src/HeatmapSeries.vue +5 -4
- package/src/LineSeries.vue +20 -5
- package/src/PieSeries.vue +6 -5
- package/src/composables.ts +64 -1
- package/src/ui/InfoBar.vue +11 -3
- package/src/ui/NumberFlow.vue +17 -3
- package/src/ui/Tooltip.vue +23 -12
- package/src/ui/YLabel.vue +28 -27
package/dist/ui/InfoBar.vue.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { defineComponent 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 T, computed as s, inject as B, ref as W, onMounted as N, onUnmounted as R, useSlots as A, unref as t, openBlock as l, createBlock as D, Teleport as M, createElementVNode as r, normalizeStyle as i, renderSlot as O, createElementBlock as u, Fragment as m, toDisplayString as p, renderList as F, createCommentVNode as L } from "vue";
|
|
2
|
+
import { buildHoverSnapshots as P, buildLastSnapshots as $, formatHeaderX as j, formatRowValue as U } from "../core/dist/snapshots.js";
|
|
3
|
+
import { resolveCandlestickBodyColor as X } from "../core/dist/theme/resolve.js";
|
|
4
|
+
import { formatCompact as q, formatPriceAdaptive as G } from "../core/dist/utils/format.js";
|
|
5
|
+
import { useCrosshairPosition as J } from "../composables.js";
|
|
6
|
+
import { useChartInstance as Q, ThemeKey as Y, InfoBarAnchorKey as Z } from "../context.js";
|
|
7
|
+
const ee = {
|
|
8
8
|
key: 0,
|
|
9
9
|
style: { display: "inline-flex", alignItems: "center", gap: "4px" }
|
|
10
|
-
},
|
|
10
|
+
}, te = {
|
|
11
11
|
key: 1,
|
|
12
12
|
style: { display: "inline-flex", alignItems: "center", gap: "3px" }
|
|
13
|
-
},
|
|
13
|
+
}, ae = {
|
|
14
14
|
key: 2,
|
|
15
15
|
style: { display: "inline-flex", alignItems: "center", gap: "3px" }
|
|
16
|
-
},
|
|
16
|
+
}, ue = /* @__PURE__ */ T({
|
|
17
17
|
__name: "InfoBar",
|
|
18
18
|
props: {
|
|
19
19
|
sort: {},
|
|
20
20
|
format: { type: Function }
|
|
21
21
|
},
|
|
22
22
|
setup(E) {
|
|
23
|
-
const
|
|
24
|
-
() =>
|
|
25
|
-
),
|
|
23
|
+
const k = E, C = s(() => k.sort ?? "none"), d = s(
|
|
24
|
+
() => k.format ?? ((a, _) => _ === "volume" ? q(a) : G(a))
|
|
25
|
+
), n = Q(), g = J(n), o = B(Y), x = B(Z);
|
|
26
26
|
if (!o)
|
|
27
27
|
throw new Error("<InfoBar> must be used within <ChartContainer>: missing ThemeKey.");
|
|
28
|
-
if (!
|
|
28
|
+
if (!x)
|
|
29
29
|
throw new Error("<InfoBar> must be used within <ChartContainer>: missing InfoBarAnchorKey.");
|
|
30
|
-
const h =
|
|
30
|
+
const h = W(0), y = () => {
|
|
31
31
|
h.value++;
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}),
|
|
36
|
-
|
|
33
|
+
N(() => {
|
|
34
|
+
n.on("overlayChange", y), n.on("seriesFrame", y), n.getSeriesIds().length > 0 && h.value++;
|
|
35
|
+
}), R(() => {
|
|
36
|
+
n.off("overlayChange", y), n.off("seriesFrame", y);
|
|
37
37
|
});
|
|
38
|
-
const
|
|
38
|
+
const b = s(() => {
|
|
39
39
|
h.value;
|
|
40
|
-
const a =
|
|
41
|
-
return a === null ? null :
|
|
42
|
-
}), H =
|
|
43
|
-
() =>
|
|
44
|
-
), K =
|
|
40
|
+
const a = g.value;
|
|
41
|
+
return a === null ? null : P(n, { time: a.time, sort: C.value, cacheKey: "infobar-hover" });
|
|
42
|
+
}), H = s(() => (h.value, $(n, { sort: C.value, cacheKey: "infobar-last" }))), v = s(() => b.value !== null && b.value.length > 0), c = s(
|
|
43
|
+
() => v.value ? b.value : H.value
|
|
44
|
+
), K = s(() => (h.value, n.getDataInterval())), S = s(() => c.value.length === 0 ? 0 : v.value && g.value ? g.value.time : Math.max(...c.value.map((a) => a.data.time))), V = A(), w = s(() => typeof V.default == "function");
|
|
45
45
|
function I(a) {
|
|
46
46
|
return "open" in a;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function z(a) {
|
|
49
49
|
return "high" in a && !I(a);
|
|
50
50
|
}
|
|
51
|
-
return (a, _) => t(
|
|
51
|
+
return (a, _) => t(x) && t(o) && c.value.length > 0 ? (l(), D(M, {
|
|
52
52
|
key: 0,
|
|
53
|
-
to: t(
|
|
53
|
+
to: t(x)
|
|
54
54
|
}, [
|
|
55
|
-
|
|
55
|
+
r("div", {
|
|
56
56
|
"data-tooltip-legend": "",
|
|
57
|
-
style:
|
|
57
|
+
style: i(
|
|
58
58
|
w.value ? {
|
|
59
59
|
display: "flex",
|
|
60
60
|
alignItems: "center",
|
|
@@ -62,7 +62,7 @@ const Z = {
|
|
|
62
62
|
fontSize: t(o).typography.fontSize + "px",
|
|
63
63
|
fontFamily: t(o).typography.fontFamily,
|
|
64
64
|
fontVariantNumeric: "tabular-nums",
|
|
65
|
-
opacity:
|
|
65
|
+
opacity: v.value ? 1 : 0.6,
|
|
66
66
|
transition: "opacity 0.2s ease",
|
|
67
67
|
pointerEvents: "none"
|
|
68
68
|
} : {
|
|
@@ -75,57 +75,57 @@ const Z = {
|
|
|
75
75
|
fontSize: t(o).typography.fontSize + "px",
|
|
76
76
|
fontFamily: t(o).typography.fontFamily,
|
|
77
77
|
fontVariantNumeric: "tabular-nums",
|
|
78
|
-
opacity:
|
|
78
|
+
opacity: v.value ? 1 : 0.6,
|
|
79
79
|
transition: "opacity 0.2s ease",
|
|
80
80
|
pointerEvents: "none"
|
|
81
81
|
}
|
|
82
82
|
)
|
|
83
83
|
}, [
|
|
84
|
-
w.value ?
|
|
84
|
+
w.value ? O(a.$slots, "default", {
|
|
85
85
|
key: 0,
|
|
86
86
|
snapshots: c.value,
|
|
87
87
|
time: S.value,
|
|
88
|
-
isHover:
|
|
89
|
-
}) : (
|
|
90
|
-
|
|
91
|
-
style:
|
|
92
|
-
}, p(t(j)(t(
|
|
93
|
-
(
|
|
88
|
+
isHover: v.value
|
|
89
|
+
}) : (l(), u(m, { key: 1 }, [
|
|
90
|
+
r("span", {
|
|
91
|
+
style: i({ color: t(o).axis.textColor, marginRight: "2px" })
|
|
92
|
+
}, p(t(j)(t(n), { time: S.value, snapshots: c.value, interval: K.value })), 5),
|
|
93
|
+
(l(!0), u(m, null, F(c.value, (e) => (l(), u(m, {
|
|
94
94
|
key: e.id
|
|
95
95
|
}, [
|
|
96
|
-
I(e.data) ? (
|
|
97
|
-
(
|
|
96
|
+
I(e.data) ? (l(), u("span", ee, [
|
|
97
|
+
(l(!0), u(m, null, F([
|
|
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
|
-
], (
|
|
103
|
-
key:
|
|
102
|
+
], (f) => (l(), u(m, {
|
|
103
|
+
key: f.label
|
|
104
104
|
}, [
|
|
105
|
-
|
|
106
|
-
style:
|
|
107
|
-
}, p(
|
|
108
|
-
|
|
109
|
-
style:
|
|
110
|
-
color: t(
|
|
105
|
+
r("span", {
|
|
106
|
+
style: i({ color: t(o).axis.textColor, opacity: 0.5, marginLeft: "5px" })
|
|
107
|
+
}, p(f.label), 5),
|
|
108
|
+
r("span", {
|
|
109
|
+
style: i({
|
|
110
|
+
color: t(X)(
|
|
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(d.value(
|
|
116
|
+
}, p(d.value(f.val, f.field)), 5)
|
|
117
117
|
], 64))), 128)),
|
|
118
|
-
e.data.volume != null ? (
|
|
119
|
-
|
|
120
|
-
style:
|
|
118
|
+
e.data.volume != null ? (l(), u(m, { key: 0 }, [
|
|
119
|
+
r("span", {
|
|
120
|
+
style: i({ color: t(o).axis.textColor, opacity: 0.5, marginLeft: "5px" })
|
|
121
121
|
}, "V", 4),
|
|
122
|
-
|
|
123
|
-
style:
|
|
122
|
+
r("span", {
|
|
123
|
+
style: i({ color: t(o).axis.textColor, fontWeight: 500, marginLeft: "2px" })
|
|
124
124
|
}, p(d.value(e.data.volume, "volume")), 5)
|
|
125
|
-
], 64)) :
|
|
126
|
-
])) :
|
|
127
|
-
|
|
128
|
-
style:
|
|
125
|
+
], 64)) : L("", !0)
|
|
126
|
+
])) : z(e.data) ? (l(), u("span", te, [
|
|
127
|
+
r("span", {
|
|
128
|
+
style: i({
|
|
129
129
|
width: "6px",
|
|
130
130
|
height: "6px",
|
|
131
131
|
borderRadius: "1px",
|
|
@@ -133,12 +133,12 @@ const Z = {
|
|
|
133
133
|
flexShrink: 0
|
|
134
134
|
})
|
|
135
135
|
}, null, 4),
|
|
136
|
-
|
|
137
|
-
style:
|
|
136
|
+
r("span", {
|
|
137
|
+
style: i({ color: e.color, fontWeight: 500 })
|
|
138
138
|
}, p(d.value(e.data.low, "low")) + " – " + p(d.value(e.data.high, "high")), 5)
|
|
139
|
-
])) : (
|
|
140
|
-
|
|
141
|
-
style:
|
|
139
|
+
])) : (l(), u("span", ae, [
|
|
140
|
+
r("span", {
|
|
141
|
+
style: i({
|
|
142
142
|
width: "6px",
|
|
143
143
|
height: "6px",
|
|
144
144
|
borderRadius: "50%",
|
|
@@ -146,16 +146,16 @@ const Z = {
|
|
|
146
146
|
flexShrink: 0
|
|
147
147
|
})
|
|
148
148
|
}, null, 4),
|
|
149
|
-
|
|
150
|
-
style:
|
|
151
|
-
}, p(d.value(
|
|
149
|
+
r("span", {
|
|
150
|
+
style: i({ color: e.color, fontWeight: 500 })
|
|
151
|
+
}, p(t(U)(e, (f) => d.value(f, "value"))), 5)
|
|
152
152
|
]))
|
|
153
153
|
], 64))), 128))
|
|
154
154
|
], 64))
|
|
155
155
|
], 4)
|
|
156
|
-
], 8, ["to"])) :
|
|
156
|
+
], 8, ["to"])) : L("", !0);
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
export {
|
|
160
|
-
|
|
160
|
+
ue as default
|
|
161
161
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as k, ref as f, onMounted as N, computed as m, watch as I, openBlock as a, createElementBlock as l, Fragment as r, renderList as d, createElementVNode as y, normalizeStyle as w, toDisplayString as v } from "vue";
|
|
2
2
|
const x = { style: {
|
|
3
3
|
display: "inline-flex",
|
|
4
4
|
fontVariantNumeric: "tabular-nums",
|
|
@@ -14,7 +14,7 @@ const x = { style: {
|
|
|
14
14
|
}, F = {
|
|
15
15
|
key: 1,
|
|
16
16
|
style: { display: "inline-block" }
|
|
17
|
-
},
|
|
17
|
+
}, S = /* @__PURE__ */ k({
|
|
18
18
|
__name: "NumberFlow",
|
|
19
19
|
props: {
|
|
20
20
|
value: {},
|
|
@@ -22,48 +22,57 @@ const x = { style: {
|
|
|
22
22
|
locale: { default: "en-US" },
|
|
23
23
|
spinDuration: { default: 350 }
|
|
24
24
|
},
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
27
|
-
|
|
25
|
+
setup(h) {
|
|
26
|
+
const o = h, i = f(!1);
|
|
27
|
+
N(() => {
|
|
28
28
|
i.value = !0;
|
|
29
29
|
});
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
if (typeof
|
|
33
|
-
const n = new Intl.NumberFormat(
|
|
34
|
-
return (
|
|
35
|
-
}),
|
|
36
|
-
const
|
|
37
|
-
for (const
|
|
38
|
-
|
|
30
|
+
const u = m(() => {
|
|
31
|
+
const e = o.format;
|
|
32
|
+
if (typeof e == "function") return e;
|
|
33
|
+
const n = new Intl.NumberFormat(o.locale, typeof e == "object" ? e : void 0);
|
|
34
|
+
return (t) => n.format(t);
|
|
35
|
+
}), _ = m(() => {
|
|
36
|
+
const e = u.value(o.value), n = [];
|
|
37
|
+
for (const t of e)
|
|
38
|
+
t >= "0" && t <= "9" ? n.push({ type: "digit", value: t }) : n.push({ type: "symbol", value: t });
|
|
39
39
|
return n;
|
|
40
|
-
}),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
}), s = f(o.spinDuration);
|
|
41
|
+
let c = Number.NEGATIVE_INFINITY;
|
|
42
|
+
I(
|
|
43
|
+
() => u.value(o.value),
|
|
44
|
+
() => {
|
|
45
|
+
const e = performance.now(), n = e - c < o.spinDuration;
|
|
46
|
+
c = e, s.value = n ? 0 : o.spinDuration;
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
const b = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
50
|
+
return (e, n) => (a(), l("span", x, [
|
|
51
|
+
(a(!0), l(r, null, d(_.value, (t, g) => (a(), l(r, { key: g }, [
|
|
52
|
+
t.type === "digit" ? (a(), l("span", D, [
|
|
53
|
+
y("span", {
|
|
54
|
+
style: w({
|
|
46
55
|
display: "flex",
|
|
47
56
|
flexDirection: "column",
|
|
48
|
-
transform: "translateY(" + -parseInt(
|
|
49
|
-
transition: i.value ? "transform " +
|
|
57
|
+
transform: "translateY(" + -parseInt(t.value) * 1.2 + "em)",
|
|
58
|
+
transition: i.value && s.value > 0 ? "transform " + s.value + "ms cubic-bezier(0.16, 1, 0.3, 1)" : "none"
|
|
50
59
|
})
|
|
51
60
|
}, [
|
|
52
|
-
(
|
|
53
|
-
key:
|
|
61
|
+
(a(), l(r, null, d(b, (p) => y("span", {
|
|
62
|
+
key: p,
|
|
54
63
|
style: {
|
|
55
64
|
display: "flex",
|
|
56
65
|
alignItems: "center",
|
|
57
66
|
justifyContent: "center",
|
|
58
67
|
height: "1.2em"
|
|
59
68
|
}
|
|
60
|
-
}, p
|
|
69
|
+
}, v(p), 1)), 64))
|
|
61
70
|
], 4)
|
|
62
|
-
])) : (
|
|
71
|
+
])) : (a(), l("span", F, v(t.value), 1))
|
|
63
72
|
], 64))), 128))
|
|
64
73
|
]));
|
|
65
74
|
}
|
|
66
75
|
});
|
|
67
76
|
export {
|
|
68
|
-
|
|
77
|
+
S as default
|
|
69
78
|
};
|