@wick-charts/vue 0.6.3 → 0.6.4
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 -2
- package/dist/BandSeries.vue.js +50 -0
- package/dist/BandSeries.vue2.js +4 -0
- package/dist/ChartContainer.vue.js +16 -16
- package/dist/LineSeries.vue.js +2 -2
- package/dist/core/dist/animation/config.js +92 -75
- 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.js +168 -167
- package/dist/core/dist/data/decimation.js +58 -39
- package/dist/core/dist/navigator/controller.js +10 -10
- package/dist/core/dist/perf/perf-hud.js +6 -6
- package/dist/core/dist/series/band.js +670 -0
- package/dist/core/dist/series/bar.js +14 -14
- package/dist/core/dist/series/candlestick.js +31 -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 +485 -445
- 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 +36 -35
- package/dist/core/dist/utils/point.js +10 -0
- package/dist/index.d.ts +255 -97
- package/dist/index.js +195 -191
- package/dist/ui/InfoBar.vue.js +100 -81
- package/dist/ui/Tooltip.vue.js +118 -91
- package/dist/ui/YLabel.vue.js +62 -69
- package/package.json +2 -2
- package/src/BandSeries.vue +87 -0
- package/src/index.ts +8 -0
- package/src/ui/InfoBar.vue +20 -1
- package/src/ui/Tooltip.vue +36 -2
- package/src/ui/YLabel.vue +2 -13
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ High-performance timeseries charts for **React**, **Vue**, and **Svelte**. Canva
|
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- **Candlestick, Line, Bar, Pie, Sparkline** — all from one package
|
|
14
|
+
- **Candlestick, Line, Bar, Band, Pie, Sparkline** — all from one package
|
|
15
15
|
- **Real-time streaming** — append/update at 60fps with coordinated animations
|
|
16
16
|
- **22 built-in themes** plus `createTheme()` for custom palettes
|
|
17
17
|
- **Interactive** — zoom, pan, crosshair, tooltips
|
|
@@ -55,7 +55,7 @@ Every component, prop, type, and slot context lives in the docs site:
|
|
|
55
55
|
|
|
56
56
|
[wick-charts.eeff.io/api/chart-container/](https://wick-charts.eeff.io/api/chart-container/)
|
|
57
57
|
|
|
58
|
-
Start there for [ChartContainer](https://wick-charts.eeff.io/api/chart-container/), then drill into the series ([Candlestick](https://wick-charts.eeff.io/api/candlestick-series/), [Line](https://wick-charts.eeff.io/api/line-series/), [Bar](https://wick-charts.eeff.io/api/bar-series/), [Pie](https://wick-charts.eeff.io/api/pie-series/), [Sparkline](https://wick-charts.eeff.io/api/sparkline/)) and overlays ([Tooltip](https://wick-charts.eeff.io/api/tooltip/), [InfoBar](https://wick-charts.eeff.io/api/info-bar/), [Crosshair](https://wick-charts.eeff.io/api/crosshair/), [Legend](https://wick-charts.eeff.io/api/legend/), [YAxis](https://wick-charts.eeff.io/api/y-axis/), [XAxis](https://wick-charts.eeff.io/api/x-axis/), [Navigator](https://wick-charts.eeff.io/api/navigator/), …).
|
|
58
|
+
Start there for [ChartContainer](https://wick-charts.eeff.io/api/chart-container/), then drill into the series ([Candlestick](https://wick-charts.eeff.io/api/candlestick-series/), [Line](https://wick-charts.eeff.io/api/line-series/), [Bar](https://wick-charts.eeff.io/api/bar-series/), [Band](https://wick-charts.eeff.io/api/band-series/), [Pie](https://wick-charts.eeff.io/api/pie-series/), [Sparkline](https://wick-charts.eeff.io/api/sparkline/)) and overlays ([Tooltip](https://wick-charts.eeff.io/api/tooltip/), [InfoBar](https://wick-charts.eeff.io/api/info-bar/), [Crosshair](https://wick-charts.eeff.io/api/crosshair/), [Legend](https://wick-charts.eeff.io/api/legend/), [YAxis](https://wick-charts.eeff.io/api/y-axis/), [XAxis](https://wick-charts.eeff.io/api/x-axis/), [Navigator](https://wick-charts.eeff.io/api/navigator/), …).
|
|
59
59
|
|
|
60
60
|
## No framework? Use the engine directly
|
|
61
61
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { defineComponent as u, ref as d, onMounted as p, onUnmounted as c, watch as n, createCommentVNode as f } from "vue";
|
|
2
|
+
import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as y } from "./core/dist/data/sync.js";
|
|
3
|
+
import { BandSeriesDef as S } from "./core/dist/series/band.js";
|
|
4
|
+
import { useChartInstance as _ } from "./context.js";
|
|
5
|
+
const E = /* @__PURE__ */ u({
|
|
6
|
+
__name: "BandSeries",
|
|
7
|
+
props: {
|
|
8
|
+
data: {},
|
|
9
|
+
options: {},
|
|
10
|
+
id: {},
|
|
11
|
+
visible: { type: Boolean, default: !0 }
|
|
12
|
+
},
|
|
13
|
+
setup(l) {
|
|
14
|
+
const a = l, s = _(), r = d(null);
|
|
15
|
+
let i = [];
|
|
16
|
+
function o(e, t) {
|
|
17
|
+
i = y({ chart: s, id: e, data: t, prev: i });
|
|
18
|
+
}
|
|
19
|
+
return p(() => {
|
|
20
|
+
const e = m(a.data).length, t = s.addSeries(S, {
|
|
21
|
+
...a.options,
|
|
22
|
+
layers: e,
|
|
23
|
+
id: a.id
|
|
24
|
+
});
|
|
25
|
+
r.value = t, i = new Array(e).fill(v), o(t, a.data), s.setSeriesVisible(t, a.visible);
|
|
26
|
+
}), c(() => {
|
|
27
|
+
r.value && s.removeSeries(r.value);
|
|
28
|
+
}), n(
|
|
29
|
+
() => a.data,
|
|
30
|
+
(e) => {
|
|
31
|
+
const t = r.value;
|
|
32
|
+
t && o(t, e);
|
|
33
|
+
}
|
|
34
|
+
), n(
|
|
35
|
+
() => a.options,
|
|
36
|
+
(e) => {
|
|
37
|
+
r.value && e && s.updateSeriesOptions(r.value, e);
|
|
38
|
+
},
|
|
39
|
+
{ deep: !0 }
|
|
40
|
+
), n(
|
|
41
|
+
() => a.visible,
|
|
42
|
+
(e) => {
|
|
43
|
+
r.value && s.setSeriesVisible(r.value, e);
|
|
44
|
+
}
|
|
45
|
+
), (e, t) => f("", !0);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export {
|
|
49
|
+
E as default
|
|
50
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as U, ref as d, shallowRef as
|
|
2
|
-
import { ChartInstance as
|
|
3
|
-
import { deepEqual as
|
|
1
|
+
import { defineComponent as U, ref as d, shallowRef as F, provide as l, watch as r, computed as v, onMounted as G, nextTick as g, onUnmounted as I, openBlock as y, createElementBlock as m, normalizeStyle as q, createElementVNode as o, createCommentVNode as w, renderSlot as J } from "vue";
|
|
2
|
+
import { ChartInstance as P } from "./core/dist/chart.js";
|
|
3
|
+
import { deepEqual as T } from "./core/dist/utils/deep-equal.js";
|
|
4
4
|
import { catppuccin as Q } from "./core/dist/theme/themes/catppuccin.js";
|
|
5
5
|
import { ChartKey as W, ThemeKey as X, TitleAnchorKey as Y, InfoBarAnchorKey as Z, LegendAnchorKey as ee, LegendRightAnchorKey as te, NavigatorAnchorKey as ie } from "./context.js";
|
|
6
6
|
const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-height": "0" } }, oe = { style: { display: "flex", "flex-direction": "column", flex: "1", "min-width": "0", "min-height": "0" } }, ne = {
|
|
@@ -35,7 +35,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
35
35
|
onCrosshairMove: {}
|
|
36
36
|
},
|
|
37
37
|
setup(b) {
|
|
38
|
-
const e = b, u = d(), a =
|
|
38
|
+
const e = b, u = d(), a = F(null), x = F(e.theme), c = e.perf, h = e.onEdgeReached, C = d(null), R = d(null), k = d(null), _ = d(null), E = d(null), B = d(null);
|
|
39
39
|
l(W, a), l(X, x), l(Y, R), l(Z, k), l(ee, _), l(te, E), l(ie, B);
|
|
40
40
|
let f = null;
|
|
41
41
|
const s = d(0);
|
|
@@ -44,12 +44,12 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
44
44
|
([t, i]) => t?.setHeaderHeight(i),
|
|
45
45
|
{ immediate: !0 }
|
|
46
46
|
);
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
47
|
+
const L = v(() => e.fade === !1 ? !1 : typeof e.fade == "object" ? e.fade.top !== void 0 || e.fade.overlap !== void 0 : e.fade === !0), S = v(() => {
|
|
48
|
+
if (!L.value) return 0;
|
|
49
49
|
const t = typeof e.fade == "object" ? e.fade.overlap : void 0;
|
|
50
50
|
return t !== void 0 ? Math.max(0, t) : s.value / 2;
|
|
51
|
-
}),
|
|
52
|
-
if (!
|
|
51
|
+
}), O = v(() => {
|
|
52
|
+
if (!L.value) return 0;
|
|
53
53
|
if (typeof e.fade == "object" && e.fade.top !== void 0) return e.fade.top;
|
|
54
54
|
const t = e.headerLayout === "overlay" ? s.value : 0;
|
|
55
55
|
return t > 0 ? t + z : z;
|
|
@@ -76,7 +76,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
76
76
|
a.value.setFade({ top: 0, right: 0, left: 0 });
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
const t = { top:
|
|
79
|
+
const t = { top: O.value };
|
|
80
80
|
typeof e.fade == "object" && (e.fade.right !== void 0 && (t.right = e.fade.right), e.fade.left !== void 0 && (t.left = e.fade.left)), a.value.setFade(t);
|
|
81
81
|
}
|
|
82
82
|
function V() {
|
|
@@ -99,7 +99,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
99
99
|
G(async () => {
|
|
100
100
|
if (!u.value) return;
|
|
101
101
|
const t = {};
|
|
102
|
-
e.axis && (t.axis = e.axis), e.theme && (t.theme = e.theme), e.padding && (t.padding = e.padding), e.viewport && (t.viewport = e.viewport), e.interactive !== void 0 && (t.interactive = e.interactive), e.grid !== void 0 && (t.grid = e.grid), c !== void 0 && (t.perf = c), h && (t.onEdgeReached = h), e.animations !== void 0 && (t.animations = e.animations), M(t), a.value = new
|
|
102
|
+
e.axis && (t.axis = e.axis), e.theme && (t.theme = e.theme), e.padding && (t.padding = e.padding), e.viewport && (t.viewport = e.viewport), e.interactive !== void 0 && (t.interactive = e.interactive), e.grid !== void 0 && (t.grid = e.grid), c !== void 0 && (t.perf = c), h && (t.onEdgeReached = h), e.animations !== void 0 && (t.animations = e.animations), M(t), a.value = new P(u.value, t), H(a.value), e.onReady?.(a.value), await g(), V();
|
|
103
103
|
}), I(() => {
|
|
104
104
|
f?.disconnect(), f = null, a.value?.destroy(), a.value = null;
|
|
105
105
|
}), r(
|
|
@@ -128,17 +128,17 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
128
128
|
r(
|
|
129
129
|
() => e.animations,
|
|
130
130
|
async (t) => {
|
|
131
|
-
if (
|
|
131
|
+
if (T(t, K) || (K = t, !a.value || !u.value)) return;
|
|
132
132
|
a.value.destroy(), a.value = null, await g();
|
|
133
133
|
const i = {};
|
|
134
|
-
e.axis && (i.axis = e.axis), e.theme && (i.theme = e.theme), e.padding && (i.padding = e.padding), e.viewport && (i.viewport = e.viewport), e.interactive !== void 0 && (i.interactive = e.interactive), e.grid !== void 0 && (i.grid = e.grid), c !== void 0 && (i.perf = c), h && (i.onEdgeReached = h), t !== void 0 && (i.animations = t), M(i), a.value = new
|
|
134
|
+
e.axis && (i.axis = e.axis), e.theme && (i.theme = e.theme), e.padding && (i.padding = e.padding), e.viewport && (i.viewport = e.viewport), e.interactive !== void 0 && (i.interactive = e.interactive), e.grid !== void 0 && (i.grid = e.grid), c !== void 0 && (i.perf = c), h && (i.onEdgeReached = h), t !== void 0 && (i.animations = t), M(i), a.value = new P(u.value, i), H(a.value), e.onReady?.(a.value);
|
|
135
135
|
}
|
|
136
136
|
);
|
|
137
137
|
let p;
|
|
138
138
|
r(
|
|
139
139
|
() => [a.value, e.visibleRange],
|
|
140
140
|
async ([t, i]) => {
|
|
141
|
-
!t || i === void 0 || p !== void 0 && p.instance === t &&
|
|
141
|
+
!t || i === void 0 || p !== void 0 && p.instance === t && T(p.spec, i) || (p = { instance: t, spec: i }, await g(), t.setVisibleRange(i));
|
|
142
142
|
},
|
|
143
143
|
{ immediate: !0 }
|
|
144
144
|
), r(
|
|
@@ -150,10 +150,10 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
150
150
|
j.value
|
|
151
151
|
],
|
|
152
152
|
A
|
|
153
|
-
), r(() => [a.value,
|
|
153
|
+
), r(() => [a.value, O.value, e.fade], $, { immediate: !0 });
|
|
154
154
|
const N = v(() => {
|
|
155
|
-
const t = x.value, [i, n] = t?.chartGradient ?? ["transparent", "transparent"],
|
|
156
|
-
return `position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 240px; overflow: hidden; background: ${e.gradient ? `linear-gradient(to bottom, ${i} 0%, ${
|
|
155
|
+
const t = x.value, [i, n] = t?.chartGradient ?? ["transparent", "transparent"], D = t?.background ?? "transparent";
|
|
156
|
+
return `position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 240px; overflow: hidden; background: ${e.gradient ? `linear-gradient(to bottom, ${i} 0%, ${D} 70%, ${n} 100%)` : D}`;
|
|
157
157
|
});
|
|
158
158
|
return (t, i) => (y(), m("div", {
|
|
159
159
|
style: q(N.value)
|
package/dist/LineSeries.vue.js
CHANGED
|
@@ -2,7 +2,7 @@ import { defineComponent as u, ref as p, onMounted as d, onUnmounted as c, watch
|
|
|
2
2
|
import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as y } from "./core/dist/data/sync.js";
|
|
3
3
|
import { LineSeriesDef as S } from "./core/dist/series/line.js";
|
|
4
4
|
import { useChartInstance as _ } from "./context.js";
|
|
5
|
-
const
|
|
5
|
+
const E = /* @__PURE__ */ u({
|
|
6
6
|
__name: "LineSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
@@ -46,5 +46,5 @@ const V = /* @__PURE__ */ u({
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
E as default
|
|
50
50
|
};
|
|
@@ -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
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ScalarSpring as g } from "../animation/scalar-spring.js";
|
|
2
|
-
const
|
|
3
|
-
class
|
|
2
|
+
const l = 320, V = 0.15;
|
|
3
|
+
class b {
|
|
4
4
|
#t;
|
|
5
5
|
#e;
|
|
6
6
|
#i = !1;
|
|
@@ -8,45 +8,53 @@ class x {
|
|
|
8
8
|
this.#t = new g(i), this.#e = i;
|
|
9
9
|
}
|
|
10
10
|
frame(i) {
|
|
11
|
-
const { target: t, firstVisible: n, introFront:
|
|
12
|
-
if (p || !
|
|
11
|
+
const { target: t, firstVisible: n, introFront: r, now: s, glide: a = !0, countUp: u = !0, reducedMotion: p = !1 } = i;
|
|
12
|
+
if (p || !a && !u)
|
|
13
13
|
return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
16
|
-
return this.#t.snap(
|
|
14
|
+
if (r < 1) {
|
|
15
|
+
const h = n + (t - n) * r, o = u ? h : t;
|
|
16
|
+
return this.#t.snap(o, { now: s }), this.#e = o, this.#i = !0, { positionValue: o, textValue: o, opacity: this.#s(r), animating: !0 };
|
|
17
17
|
}
|
|
18
18
|
if (!this.#i)
|
|
19
19
|
return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
20
|
-
if (!
|
|
20
|
+
if (!a)
|
|
21
21
|
return this.#t.snap(t, { now: s }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
22
|
-
const c = i.settleMs ??
|
|
22
|
+
const c = i.settleMs ?? l;
|
|
23
23
|
if (c <= 0)
|
|
24
24
|
return this.#t.snap(t, { now: s }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
25
|
-
Math.abs(t - this.#e) >
|
|
26
|
-
const
|
|
27
|
-
return { positionValue: this.#t.current, textValue: t, opacity: 1, animating:
|
|
25
|
+
Math.abs(t - this.#e) > d && (this.#t.retarget(t, { now: s, settleMs: c }), this.#e = t);
|
|
26
|
+
const f = this.#t.tick(s);
|
|
27
|
+
return { positionValue: this.#t.current, textValue: t, opacity: 1, animating: f };
|
|
28
28
|
}
|
|
29
29
|
#s(i) {
|
|
30
|
-
return i >= 1 ? 1 :
|
|
30
|
+
return i >= 1 ? 1 : y(i / V);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
function
|
|
33
|
+
const d = 1e-9;
|
|
34
|
+
function y(e) {
|
|
35
35
|
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs:
|
|
37
|
+
function w(e) {
|
|
38
|
+
return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: l } : {
|
|
39
39
|
glide: e.glide ?? !0,
|
|
40
40
|
countUp: e.countUp ?? !0,
|
|
41
|
-
settleMs: e.settleMs ??
|
|
41
|
+
settleMs: e.settleMs ?? l
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function M(e, i, t) {
|
|
45
45
|
const { from: n } = e.getVisibleRange();
|
|
46
46
|
return e.getStackedValueAtTime(i, n) ?? t;
|
|
47
47
|
}
|
|
48
|
+
function S(e, i) {
|
|
49
|
+
if (i !== void 0) return i;
|
|
50
|
+
const t = new Set(e.getSeriesIdsByType("band")), n = (a) => !t.has(a), r = e.getSeriesIdsByType("time", { visibleOnly: !0, singleLayerOnly: !0 }).filter(n);
|
|
51
|
+
if (r.length > 0) return r[0];
|
|
52
|
+
const s = e.getSeriesIdsByType("time", { visibleOnly: !0 }).filter(n);
|
|
53
|
+
return s.length > 0 ? s[0] : null;
|
|
54
|
+
}
|
|
48
55
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
b as BadgeAnimator,
|
|
57
|
+
M as firstVisibleValue,
|
|
58
|
+
w as resolveAnimate,
|
|
59
|
+
S as resolveYLabelSeriesId
|
|
52
60
|
};
|
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import { renderEdgeIndicator as s } from "../components/edge-indicator.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { pointValue as c } from "../utils/point.js";
|
|
3
|
+
function h(e) {
|
|
4
|
+
const t = performance.now();
|
|
5
|
+
for (const o of ["left", "right"]) {
|
|
6
|
+
let r = e.edgeStates[o], n = 1;
|
|
6
7
|
if (r === "idle" || r === "has-more") {
|
|
7
|
-
const a = e.edgeExitFades[
|
|
8
|
+
const a = e.edgeExitFades[o];
|
|
8
9
|
if (a === null) continue;
|
|
9
10
|
r = "loading", n = a;
|
|
10
11
|
}
|
|
11
|
-
const l = e.resolveBoundary(
|
|
12
|
+
const l = e.resolveBoundary(o);
|
|
12
13
|
if (l === null) continue;
|
|
13
|
-
const { context:
|
|
14
|
-
n < 1 && (
|
|
14
|
+
const { context: i } = e.scope;
|
|
15
|
+
n < 1 && (i.save(), i.globalAlpha *= n), s({
|
|
15
16
|
scope: e.scope,
|
|
16
17
|
timeScale: e.timeScale,
|
|
17
18
|
theme: e.theme,
|
|
18
19
|
chartMediaWidth: e.chartMediaWidth,
|
|
19
20
|
chartMediaHeight: e.chartMediaHeight,
|
|
20
21
|
boundaryTime: l,
|
|
21
|
-
side:
|
|
22
|
+
side: o,
|
|
22
23
|
state: r,
|
|
23
|
-
now:
|
|
24
|
-
customIndicator: e.edgeIndicatorFns[
|
|
25
|
-
resolveEdgeAnchor: () => e.resolveEdgeAnchor(
|
|
24
|
+
now: t,
|
|
25
|
+
customIndicator: e.edgeIndicatorFns[o],
|
|
26
|
+
resolveEdgeAnchor: () => e.resolveEdgeAnchor(o, l),
|
|
26
27
|
resolveEdgeBarSpacing: () => e.resolveEdgeBarSpacing(),
|
|
27
|
-
reportPlaceholders: (a) => e.reportPlaceholders(
|
|
28
|
-
}), n < 1 &&
|
|
28
|
+
reportPlaceholders: (a) => e.reportPlaceholders(o, a)
|
|
29
|
+
}), n < 1 && i.restore();
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
32
|
+
function u(e, t, o) {
|
|
33
|
+
return t !== null ? t : e === "left" ? o.first ?? null : o.last ?? null;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
return "close" in
|
|
35
|
+
function f(e, t) {
|
|
36
|
+
return "close" in t ? e === "left" ? t.open : t.close : c(t);
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
h as drawEdgeIndicators,
|
|
40
|
+
f as resolveEdgeAnchorValue,
|
|
41
|
+
u as resolveEdgeBoundary
|
|
41
42
|
};
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import { isTimeSeriesRenderer as
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
1
|
+
import { isTimeSeriesRenderer as d } from "../series/types.js";
|
|
2
|
+
import { isBandPoint as g, pointValue as m } from "../utils/point.js";
|
|
3
|
+
function o(n) {
|
|
4
|
+
return g(n) ? null : m(n);
|
|
5
|
+
}
|
|
6
|
+
function L(n, i, u) {
|
|
7
|
+
const t = i.find((l) => l.id === n);
|
|
5
8
|
if (!t) return null;
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
10
|
-
const { from:
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const r = t.renderer;
|
|
10
|
+
if (!d(r)) return null;
|
|
11
|
+
const e = r.getLastDataPoint();
|
|
12
|
+
if (!e) return null;
|
|
13
|
+
const { from: a, to: c } = u;
|
|
14
|
+
if (e.time >= a && e.time <= c) {
|
|
15
|
+
const l = o(e);
|
|
16
|
+
return l === null ? null : { value: l, isLive: !0 };
|
|
17
|
+
}
|
|
18
|
+
const s = r.getVisibleDataPoints(a, c);
|
|
19
|
+
if (s.length === 0) return null;
|
|
20
|
+
const f = o(s[s.length - 1]);
|
|
21
|
+
return f === null ? null : { value: f, isLive: !1 };
|
|
15
22
|
}
|
|
16
|
-
function
|
|
17
|
-
const t =
|
|
18
|
-
return t ? t.renderer.getStackedLastValue?.() ||
|
|
23
|
+
function p(n, i, u) {
|
|
24
|
+
const t = i.find((e) => e.id === n);
|
|
25
|
+
return t ? t.renderer.getStackedLastValue?.() || L(n, i, u) : null;
|
|
19
26
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
23
|
-
const t =
|
|
24
|
-
if (!
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
+
function V(n, i) {
|
|
28
|
+
const u = i.find((e) => e.id === n);
|
|
29
|
+
if (!u) return null;
|
|
30
|
+
const t = u.renderer;
|
|
31
|
+
if (!d(t)) return null;
|
|
32
|
+
const r = t.getSecondLastDataPoint();
|
|
33
|
+
return r ? o(r) : null;
|
|
27
34
|
}
|
|
28
35
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
L as getLastValue,
|
|
37
|
+
V as getPreviousClose,
|
|
38
|
+
p as getStackedLastValue
|
|
32
39
|
};
|