@wick-charts/vue 0.6.3 → 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 +6 -6
- package/dist/BandSeries.vue.js +52 -0
- package/dist/BandSeries.vue2.js +4 -0
- package/dist/BarSeries.vue.js +15 -13
- package/dist/CandlestickSeries.vue.js +31 -29
- package/dist/ChartContainer.vue.js +75 -68
- package/dist/LineSeries.vue.js +19 -17
- package/dist/composables.js +46 -36
- package/dist/core/dist/animation/config.js +92 -75
- 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/badge-animator.js +30 -22
- package/dist/core/dist/chart/edge-indicators.js +22 -21
- package/dist/core/dist/chart/last-value.js +33 -26
- 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 -842
- package/dist/core/dist/data/decimation.js +58 -39
- package/dist/core/dist/data/sync.js +37 -31
- package/dist/core/dist/navigator/controller.js +41 -41
- 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 +723 -0
- 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 +32 -31
- package/dist/core/dist/series/heatmap.js +5 -5
- package/dist/core/dist/series/line-intro.js +47 -37
- package/dist/core/dist/series/line.js +489 -448
- package/dist/core/dist/series/painters/builtins.js +4 -4
- package/dist/core/dist/series/painters/canvas-path.js +64 -52
- package/dist/core/dist/series/register-builtins.js +9 -8
- package/dist/core/dist/snapshots.js +59 -46
- package/dist/core/dist/utils/point.js +10 -0
- package/dist/index.d.ts +552 -129
- package/dist/index.js +195 -191
- package/dist/ui/Crosshair.vue.js +51 -27
- package/dist/ui/InfoBar.vue.js +98 -79
- 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 +116 -84
- 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 +82 -85
- package/package.json +2 -2
- package/src/BandSeries.vue +92 -0
- 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 +16 -1
- package/src/ui/Crosshair.vue +41 -1
- package/src/ui/InfoBar.vue +22 -2
- 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 +43 -6
- package/src/ui/{TimeAxis.vue → XAxis.vue} +18 -5
- package/src/ui/YAxis.vue +66 -12
- package/src/ui/YLabel.vue +37 -18
- package/dist/ui/TimeAxis.vue.js +0 -44
- package/dist/ui/TimeAxis.vue2.js +0 -4
package/dist/composables.js
CHANGED
|
@@ -1,57 +1,67 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
function
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
import { ref as l, onMounted as u, onUnmounted as a } from "vue";
|
|
2
|
+
function A(e) {
|
|
3
|
+
const n = l(e.getVisibleRange()), i = () => {
|
|
4
|
+
n.value = e.getVisibleRange();
|
|
5
5
|
};
|
|
6
|
-
return
|
|
6
|
+
return u(() => e.on("viewportChange", i)), a(() => e.off("viewportChange", i)), n;
|
|
7
7
|
}
|
|
8
8
|
function d(e) {
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const n = l(e.getYRange()), i = () => {
|
|
10
|
+
n.value = e.getYRange();
|
|
11
11
|
};
|
|
12
|
-
return
|
|
12
|
+
return u(() => e.on("viewportChange", i)), a(() => e.off("viewportChange", i)), n;
|
|
13
13
|
}
|
|
14
14
|
function r(e) {
|
|
15
|
-
return {
|
|
15
|
+
return {
|
|
16
|
+
yAxisPosition: e.yAxisPosition,
|
|
17
|
+
yAxisWidth: e.yAxisWidth,
|
|
18
|
+
xAxisHeight: e.xAxisHeight,
|
|
19
|
+
leftAxisWidth: e.getAxisColumnWidth("left"),
|
|
20
|
+
rightAxisWidth: e.getAxisColumnWidth("right"),
|
|
21
|
+
leftAxisScale: e.getAxisColumnScale("left"),
|
|
22
|
+
rightAxisScale: e.getAxisColumnScale("right")
|
|
23
|
+
};
|
|
16
24
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
25
|
+
function h(e) {
|
|
26
|
+
const n = l(r(e)), i = () => {
|
|
27
|
+
const t = r(e), o = n.value;
|
|
28
|
+
o.yAxisPosition === t.yAxisPosition && o.yAxisWidth === t.yAxisWidth && o.xAxisHeight === t.xAxisHeight && o.leftAxisWidth === t.leftAxisWidth && o.rightAxisWidth === t.rightAxisWidth && o.leftAxisScale === t.leftAxisScale && o.rightAxisScale === t.rightAxisScale || (n.value = t);
|
|
21
29
|
};
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
}),
|
|
30
|
+
return u(() => {
|
|
31
|
+
i(), e.on("viewportChange", i);
|
|
32
|
+
}), a(() => e.off("viewportChange", i)), n;
|
|
25
33
|
}
|
|
26
|
-
function
|
|
27
|
-
let
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
function p(e, n) {
|
|
35
|
+
let i = e.getLastValue(n);
|
|
36
|
+
const t = () => e.getYScale(e.getSeriesScale(n));
|
|
37
|
+
let o = i ? t().valueToY(i.value) : null;
|
|
38
|
+
const x = l(i), g = () => {
|
|
39
|
+
const s = e.getLastValue(n), f = s ? t().valueToY(s.value) : null;
|
|
40
|
+
i?.value === s?.value && i?.isLive === s?.isLive && o === f || (i = s, o = f, x.value = s);
|
|
31
41
|
};
|
|
32
|
-
return
|
|
42
|
+
return u(() => {
|
|
33
43
|
e.on("dataUpdate", g), e.on("viewportChange", g);
|
|
34
|
-
}),
|
|
44
|
+
}), a(() => {
|
|
35
45
|
e.off("dataUpdate", g), e.off("viewportChange", g);
|
|
36
|
-
}),
|
|
46
|
+
}), x;
|
|
37
47
|
}
|
|
38
|
-
function C(e,
|
|
39
|
-
const
|
|
40
|
-
|
|
48
|
+
function C(e, n) {
|
|
49
|
+
const i = l(e.getPreviousClose(n)), t = () => {
|
|
50
|
+
i.value = e.getPreviousClose(n);
|
|
41
51
|
};
|
|
42
|
-
return
|
|
52
|
+
return u(() => e.on("dataUpdate", t)), a(() => e.off("dataUpdate", t)), i;
|
|
43
53
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
|
|
54
|
+
function c(e) {
|
|
55
|
+
const n = l(e.getCrosshairPosition()), i = () => {
|
|
56
|
+
n.value = e.getCrosshairPosition();
|
|
47
57
|
};
|
|
48
|
-
return
|
|
58
|
+
return u(() => e.on("crosshairMove", i)), a(() => e.off("crosshairMove", i)), n;
|
|
49
59
|
}
|
|
50
60
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
h as useAxisLayout,
|
|
62
|
+
c as useCrosshairPosition,
|
|
63
|
+
p as useLastYValue,
|
|
54
64
|
C as usePreviousClose,
|
|
55
|
-
|
|
65
|
+
A as useVisibleRange,
|
|
56
66
|
d as useYRange
|
|
57
67
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { spring as U } from "./spring.js";
|
|
2
2
|
import { resolveAnimationTime as r } from "./time.js";
|
|
3
3
|
import { hermite as S } from "./y-range-hermite.js";
|
|
4
|
-
import { snap as
|
|
5
|
-
const E = 250,
|
|
4
|
+
import { snap as y } from "./y-range-snap.js";
|
|
5
|
+
const E = 250, _ = 250, T = 500, rs = 400, k = E, N = _, g = T, I = 600, R = E, b = _, v = T, O = E, Y = _, C = T, x = E, H = _, P = T, B = 600, K = 250, G = 600, X = 300, $ = 200, w = 150, j = 250, A = 2500, f = 500, V = 100, q = 250, z = 250, J = 400, L = {
|
|
6
6
|
line: { entryMs: 0, smoothMs: 0, pulseMs: 0, introMs: 0 },
|
|
7
7
|
candlestick: { entryMs: 0, smoothMs: 0, introMs: 0 },
|
|
8
8
|
bar: { entryMs: 0, smoothMs: 0, introMs: 0 },
|
|
9
|
+
band: { entryMs: 0, smoothMs: 0, introMs: 0 },
|
|
9
10
|
pie: { entryMs: 0, updateMs: 0 },
|
|
10
11
|
heatmap: { entryMs: 0, updateMs: 0 }
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
-
if (
|
|
13
|
+
function Q(o) {
|
|
14
|
+
if (o !== null && typeof o == "object")
|
|
14
15
|
return {
|
|
15
|
-
stickyMs: r(
|
|
16
|
-
stickyFloorMs: r(
|
|
16
|
+
stickyMs: r(o.max, A),
|
|
17
|
+
stickyFloorMs: r(o.min, f)
|
|
17
18
|
};
|
|
18
|
-
if (
|
|
19
|
-
return { stickyMs:
|
|
20
|
-
const e = r(
|
|
19
|
+
if (o === void 0)
|
|
20
|
+
return { stickyMs: A, stickyFloorMs: f };
|
|
21
|
+
const e = r(o, A);
|
|
21
22
|
return { stickyMs: e, stickyFloorMs: e };
|
|
22
23
|
}
|
|
23
|
-
class
|
|
24
|
+
class p {
|
|
24
25
|
axis;
|
|
25
26
|
toggleMs;
|
|
26
27
|
series;
|
|
@@ -35,37 +36,37 @@ class y {
|
|
|
35
36
|
*/
|
|
36
37
|
static resolve(e) {
|
|
37
38
|
if (e === !1)
|
|
38
|
-
return new
|
|
39
|
+
return new p(
|
|
39
40
|
{
|
|
40
|
-
y: { curve:
|
|
41
|
-
x: { curve:
|
|
41
|
+
y: { curve: y(), settleMs: 0, stickyMs: 0, stickyFloorMs: 0, gestureMs: 0 },
|
|
42
|
+
x: { curve: y(), settleMs: 0, gestureMs: 0 },
|
|
42
43
|
ticksMs: 0,
|
|
43
44
|
gridMs: 0
|
|
44
45
|
},
|
|
45
46
|
0,
|
|
46
|
-
|
|
47
|
+
L
|
|
47
48
|
);
|
|
48
|
-
const s = e === !0 || e === void 0 ? void 0 : e, t = s?.axis, M = t === !1 ? !1 : t?.y,
|
|
49
|
-
curve:
|
|
49
|
+
const s = e === !0 || e === void 0 ? void 0 : e, t = s?.axis, M = t === !1 ? !1 : t?.y, i = t === !1 ? !1 : t?.x, n = t === !1 ? !1 : t?.ticks, a = t === !1 ? !1 : t?.grid, l = s?.toggle, u = s?.series, c = M === !1 ? {
|
|
50
|
+
curve: y(),
|
|
50
51
|
settleMs: 0,
|
|
51
52
|
stickyMs: 0,
|
|
52
53
|
stickyFloorMs: 0,
|
|
53
54
|
gestureMs: 0
|
|
54
55
|
} : {
|
|
55
56
|
curve: M?.curve ?? S(),
|
|
56
|
-
settleMs: r(M?.settle,
|
|
57
|
-
...
|
|
58
|
-
gestureMs: r(M?.gesture,
|
|
59
|
-
},
|
|
60
|
-
curve:
|
|
57
|
+
settleMs: r(M?.settle, j),
|
|
58
|
+
...Q(M?.sticky),
|
|
59
|
+
gestureMs: r(M?.gesture, V)
|
|
60
|
+
}, h = i === !1 ? {
|
|
61
|
+
curve: y(),
|
|
61
62
|
settleMs: 0,
|
|
62
63
|
gestureMs: 0
|
|
63
64
|
} : {
|
|
64
|
-
curve:
|
|
65
|
-
settleMs: r(
|
|
66
|
-
gestureMs: r(
|
|
67
|
-
},
|
|
68
|
-
return new
|
|
65
|
+
curve: i?.curve ?? U(),
|
|
66
|
+
settleMs: r(i?.settle, $),
|
|
67
|
+
gestureMs: r(i?.gesture, w)
|
|
68
|
+
}, m = n === !1 ? 0 : r(n, z), D = a === !1 ? 0 : r(a, J), d = r(l, q), F = W(u);
|
|
69
|
+
return new p({ y: c, x: h, ticksMs: m, gridMs: D }, d, F);
|
|
69
70
|
}
|
|
70
71
|
/**
|
|
71
72
|
* Per-renderer-type chart-level option payload — merged BEFORE user
|
|
@@ -76,8 +77,8 @@ class y {
|
|
|
76
77
|
*/
|
|
77
78
|
defaults(e) {
|
|
78
79
|
if (e === "line") {
|
|
79
|
-
const { entryMs: s, smoothMs: t, pulseMs: M, introMs:
|
|
80
|
-
return { entryMs: s, smoothMs: t, pulseMs: M, introMs:
|
|
80
|
+
const { entryMs: s, smoothMs: t, pulseMs: M, introMs: i } = this.series.line;
|
|
81
|
+
return { entryMs: s, smoothMs: t, pulseMs: M, introMs: i };
|
|
81
82
|
}
|
|
82
83
|
if (e === "candlestick") {
|
|
83
84
|
const { entryMs: s, smoothMs: t, introMs: M } = this.series.candlestick;
|
|
@@ -95,6 +96,10 @@ class y {
|
|
|
95
96
|
const { entryMs: s, smoothMs: t, introMs: M } = this.series.bar;
|
|
96
97
|
return { entryMs: s, smoothMs: t, introMs: M };
|
|
97
98
|
}
|
|
99
|
+
if (e === "band") {
|
|
100
|
+
const { entryMs: s, smoothMs: t, introMs: M } = this.series.band;
|
|
101
|
+
return { entryMs: s, smoothMs: t, introMs: M };
|
|
102
|
+
}
|
|
98
103
|
return {};
|
|
99
104
|
}
|
|
100
105
|
/**
|
|
@@ -106,69 +111,81 @@ class y {
|
|
|
106
111
|
overrides(e) {
|
|
107
112
|
const s = {};
|
|
108
113
|
if (e === "line") {
|
|
109
|
-
const { entryMs:
|
|
110
|
-
return
|
|
114
|
+
const { entryMs: a, smoothMs: l, pulseMs: u, introMs: c } = this.series.line;
|
|
115
|
+
return a === 0 && (s.entryMs = 0), l === 0 && (s.smoothMs = 0), u === 0 && (s.pulseMs = 0), c === 0 && (s.introMs = 0), s;
|
|
111
116
|
}
|
|
112
117
|
if (e === "pie")
|
|
113
118
|
return this.series.pie.entryMs === 0 && (s.entryMs = 0), s;
|
|
114
119
|
if (e === "heatmap") {
|
|
115
|
-
const { entryMs:
|
|
116
|
-
return
|
|
120
|
+
const { entryMs: a, updateMs: l } = this.series.heatmap;
|
|
121
|
+
return a === 0 && (s.entryMs = 0), l === 0 && (s.updateMs = 0), s;
|
|
117
122
|
}
|
|
118
|
-
|
|
123
|
+
const t = this.#s(e);
|
|
124
|
+
if (t === null)
|
|
119
125
|
return s;
|
|
120
|
-
const { entryMs:
|
|
121
|
-
return
|
|
126
|
+
const { entryMs: M, smoothMs: i, introMs: n } = t;
|
|
127
|
+
return M === 0 && (s.entryMs = 0), i === 0 && (s.smoothMs = 0), n === 0 && (s.introMs = 0), s;
|
|
128
|
+
}
|
|
129
|
+
/** Durations of a series type with entry / smooth / intro knobs, or `null` for any other kind. */
|
|
130
|
+
#s(e) {
|
|
131
|
+
return e === "candlestick" ? this.series.candlestick : e === "bar" ? this.series.bar : e === "band" ? this.series.band : null;
|
|
122
132
|
}
|
|
123
133
|
}
|
|
124
|
-
function
|
|
125
|
-
if (
|
|
126
|
-
const e =
|
|
134
|
+
function W(o) {
|
|
135
|
+
if (o === !1) return L;
|
|
136
|
+
const e = o?.line, s = o?.candlestick, t = o?.bar, M = o?.band, i = o?.pie, n = o?.heatmap, a = e === !1 ? { entryMs: 0, smoothMs: 0, pulseMs: 0, introMs: 0 } : {
|
|
127
137
|
entryMs: r(e?.entry, k),
|
|
128
|
-
smoothMs: r(e?.smooth,
|
|
129
|
-
pulseMs: r(e?.pulse,
|
|
130
|
-
introMs: r(e?.intro,
|
|
131
|
-
},
|
|
138
|
+
smoothMs: r(e?.smooth, N),
|
|
139
|
+
pulseMs: r(e?.pulse, I),
|
|
140
|
+
introMs: r(e?.intro, g)
|
|
141
|
+
}, l = s === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
|
|
132
142
|
entryMs: r(s?.entry, R),
|
|
133
|
-
smoothMs: r(s?.smooth,
|
|
134
|
-
introMs: r(s?.intro,
|
|
135
|
-
},
|
|
143
|
+
smoothMs: r(s?.smooth, b),
|
|
144
|
+
introMs: r(s?.intro, v)
|
|
145
|
+
}, u = t === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
|
|
136
146
|
entryMs: r(t?.entry, O),
|
|
137
|
-
smoothMs: r(t?.smooth,
|
|
138
|
-
introMs: r(t?.intro,
|
|
139
|
-
}, c = M === !1 ? { entryMs: 0,
|
|
147
|
+
smoothMs: r(t?.smooth, Y),
|
|
148
|
+
introMs: r(t?.intro, C)
|
|
149
|
+
}, c = M === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
|
|
140
150
|
entryMs: r(M?.entry, x),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
151
|
+
smoothMs: r(M?.smooth, H),
|
|
152
|
+
introMs: r(M?.intro, P)
|
|
153
|
+
}, h = i === !1 ? { entryMs: 0, updateMs: 0 } : {
|
|
154
|
+
entryMs: r(i?.entry, B),
|
|
155
|
+
updateMs: r(i?.update, K)
|
|
156
|
+
}, m = n === !1 ? { entryMs: 0, updateMs: 0 } : {
|
|
157
|
+
entryMs: r(n?.entry, G),
|
|
158
|
+
updateMs: r(n?.update, X)
|
|
145
159
|
};
|
|
146
|
-
return { line:
|
|
160
|
+
return { line: a, candlestick: l, bar: u, band: c, pie: h, heatmap: m };
|
|
147
161
|
}
|
|
148
162
|
export {
|
|
149
|
-
|
|
163
|
+
p as AnimationConfig,
|
|
164
|
+
x as DEFAULT_BAND_ENTRY,
|
|
165
|
+
P as DEFAULT_BAND_INTRO,
|
|
166
|
+
H as DEFAULT_BAND_SMOOTH,
|
|
150
167
|
O as DEFAULT_BAR_ENTRY,
|
|
151
|
-
|
|
152
|
-
|
|
168
|
+
C as DEFAULT_BAR_INTRO,
|
|
169
|
+
Y as DEFAULT_BAR_SMOOTH,
|
|
153
170
|
R as DEFAULT_CANDLESTICK_ENTRY,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
v as DEFAULT_CANDLESTICK_INTRO,
|
|
172
|
+
b as DEFAULT_CANDLESTICK_SMOOTH,
|
|
173
|
+
J as DEFAULT_GRID_MS,
|
|
174
|
+
G as DEFAULT_HEATMAP_ENTRY,
|
|
175
|
+
X as DEFAULT_HEATMAP_UPDATE,
|
|
176
|
+
rs as DEFAULT_HISTORY_REVEAL,
|
|
160
177
|
k as DEFAULT_LINE_ENTRY,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
178
|
+
g as DEFAULT_LINE_INTRO,
|
|
179
|
+
I as DEFAULT_LINE_PULSE,
|
|
180
|
+
N as DEFAULT_LINE_SMOOTH,
|
|
181
|
+
B as DEFAULT_PIE_ENTRY,
|
|
182
|
+
K as DEFAULT_PIE_UPDATE,
|
|
183
|
+
z as DEFAULT_TICKS_MS,
|
|
184
|
+
q as DEFAULT_TOGGLE_MS,
|
|
185
|
+
w as DEFAULT_X_GESTURE_MS,
|
|
186
|
+
$ as DEFAULT_X_SETTLE_MS,
|
|
187
|
+
V as DEFAULT_Y_GESTURE_MS,
|
|
188
|
+
j as DEFAULT_Y_SETTLE_MS,
|
|
189
|
+
A as DEFAULT_Y_STICKY_MAX_MS,
|
|
190
|
+
f as DEFAULT_Y_STICKY_MIN_MS
|
|
174
191
|
};
|