@wick-charts/vue 0.6.2 → 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 +45 -39
- package/dist/composables.js +39 -26
- package/dist/core/dist/animation/config.js +92 -75
- package/dist/core/dist/axis/dom-labels.js +56 -43
- 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/options.js +5 -5
- package/dist/core/dist/chart/scale-guards.js +26 -0
- package/dist/core/dist/chart/y-target.js +46 -19
- package/dist/core/dist/chart.js +670 -518
- package/dist/core/dist/components/crosshair.js +8 -8
- package/dist/core/dist/components/grid.js +26 -17
- package/dist/core/dist/components/marker.js +28 -28
- package/dist/core/dist/components/reference-line.js +16 -16
- package/dist/core/dist/data/decimation.js +58 -39
- package/dist/core/dist/interactions/handler.js +3 -2
- package/dist/core/dist/interactions/zoom.js +6 -5
- package/dist/core/dist/navigator/controller.js +47 -44
- package/dist/core/dist/perf/perf-hud.js +3 -3
- package/dist/core/dist/scales/log-scale.js +76 -0
- package/dist/core/dist/scales/y-scale.js +134 -35
- package/dist/core/dist/series/band.js +670 -0
- package/dist/core/dist/series/bar-intro.js +11 -11
- package/dist/core/dist/series/bar.js +301 -251
- package/dist/core/dist/series/base-multi-layer.js +100 -76
- package/dist/core/dist/series/candlestick.js +238 -235
- package/dist/core/dist/series/heatmap.js +5 -5
- package/dist/core/dist/series/line-intro.js +50 -40
- package/dist/core/dist/series/line.js +561 -483
- 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/series/scale-stack.js +25 -0
- package/dist/core/dist/snapshots.js +36 -35
- package/dist/core/dist/tooltip-position.js +5 -5
- package/dist/core/dist/utils/point.js +10 -0
- package/dist/index.d.ts +501 -128
- package/dist/index.js +195 -189
- package/dist/ui/Crosshair.vue.js +14 -14
- package/dist/ui/HeatmapTooltip.vue.js +6 -6
- package/dist/ui/InfoBar.vue.js +100 -81
- package/dist/ui/PieTooltip.vue.js +4 -4
- package/dist/ui/TimeAxis.vue.js +23 -22
- package/dist/ui/Tooltip.vue.js +140 -111
- package/dist/ui/YAxis.vue.js +25 -24
- package/dist/ui/YLabel.vue.js +63 -70
- package/package.json +2 -2
- package/src/BandSeries.vue +87 -0
- package/src/ChartContainer.vue +20 -8
- package/src/composables.ts +35 -1
- package/src/index.ts +13 -0
- package/src/ui/Crosshair.vue +2 -2
- package/src/ui/InfoBar.vue +20 -1
- package/src/ui/TimeAxis.vue +7 -4
- package/src/ui/Tooltip.vue +40 -3
- package/src/ui/YAxis.vue +5 -3
- package/src/ui/YLabel.vue +5 -16
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
|
|
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 = {
|
|
@@ -11,7 +11,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
11
11
|
key: 1,
|
|
12
12
|
"data-chart-series-overlay": "",
|
|
13
13
|
style: { position: "absolute", inset: "0", "pointer-events": "none", "z-index": "3" }
|
|
14
|
-
},
|
|
14
|
+
}, z = 24, ce = /* @__PURE__ */ U({
|
|
15
15
|
__name: "ChartContainer",
|
|
16
16
|
props: {
|
|
17
17
|
theme: { default: () => Q.theme },
|
|
@@ -19,7 +19,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
19
19
|
padding: {},
|
|
20
20
|
viewport: {},
|
|
21
21
|
visibleRange: {},
|
|
22
|
-
gradient: { type: Boolean, default: !
|
|
22
|
+
gradient: { type: Boolean, default: !1 },
|
|
23
23
|
interactive: { type: Boolean, default: !0 },
|
|
24
24
|
grid: {},
|
|
25
25
|
fade: { type: [Boolean, Object], default: void 0 },
|
|
@@ -35,24 +35,30 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
35
35
|
onCrosshairMove: {}
|
|
36
36
|
},
|
|
37
37
|
setup(b) {
|
|
38
|
-
const e = b,
|
|
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
|
-
const
|
|
42
|
-
|
|
41
|
+
const s = d(0);
|
|
42
|
+
r(
|
|
43
|
+
() => [a.value, e.headerLayout === "overlay" ? s.value : 0],
|
|
44
|
+
([t, i]) => t?.setHeaderHeight(i),
|
|
45
|
+
{ immediate: !0 }
|
|
46
|
+
);
|
|
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;
|
|
43
49
|
const t = typeof e.fade == "object" ? e.fade.overlap : void 0;
|
|
44
|
-
return t !== void 0 ? Math.max(0, t) :
|
|
45
|
-
}),
|
|
46
|
-
if (!
|
|
50
|
+
return t !== void 0 ? Math.max(0, t) : s.value / 2;
|
|
51
|
+
}), O = v(() => {
|
|
52
|
+
if (!L.value) return 0;
|
|
47
53
|
if (typeof e.fade == "object" && e.fade.top !== void 0) return e.fade.top;
|
|
48
|
-
const t = e.headerLayout === "overlay" ?
|
|
49
|
-
return t > 0 ? t +
|
|
50
|
-
}),
|
|
51
|
-
() => e.headerLayout === "overlay" ? Math.max(0,
|
|
54
|
+
const t = e.headerLayout === "overlay" ? s.value : 0;
|
|
55
|
+
return t > 0 ? t + z : z;
|
|
56
|
+
}), j = v(
|
|
57
|
+
() => e.headerLayout === "overlay" ? Math.max(0, s.value - S.value) : 0
|
|
52
58
|
);
|
|
53
59
|
function A() {
|
|
54
60
|
if (!a.value) return;
|
|
55
|
-
const i = { top: (e.padding?.top ?? 20) +
|
|
61
|
+
const i = { top: (e.padding?.top ?? 20) + j.value };
|
|
56
62
|
e.padding?.bottom !== void 0 && (i.bottom = e.padding.bottom), e.padding?.right !== void 0 && (i.right = e.padding.right), e.padding?.left !== void 0 && (i.left = e.padding.left), a.value.setPadding(i);
|
|
57
63
|
}
|
|
58
64
|
function M(t) {
|
|
@@ -70,84 +76,84 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
70
76
|
a.value.setFade({ top: 0, right: 0, left: 0 });
|
|
71
77
|
return;
|
|
72
78
|
}
|
|
73
|
-
const t = { top:
|
|
79
|
+
const t = { top: O.value };
|
|
74
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);
|
|
75
81
|
}
|
|
76
82
|
function V() {
|
|
77
83
|
f?.disconnect(), f = null;
|
|
78
84
|
const t = e.headerLayout === "overlay" ? C.value : null;
|
|
79
85
|
if (!t) {
|
|
80
|
-
|
|
86
|
+
s.value = 0, A();
|
|
81
87
|
return;
|
|
82
88
|
}
|
|
83
89
|
const i = () => {
|
|
84
|
-
|
|
90
|
+
s.value = t.getBoundingClientRect().height, A();
|
|
85
91
|
};
|
|
86
92
|
i(), f = new ResizeObserver(i), f.observe(t);
|
|
87
93
|
}
|
|
88
|
-
function
|
|
94
|
+
function H(t) {
|
|
89
95
|
t.on("pointClick", (n) => e.onPointClick?.(n)), t.on("pointDoubleClick", (n) => e.onPointDoubleClick?.(n)), t.on("seriesHover", (n) => e.onSeriesHover?.(n)), t.on("crosshairMove", (n) => e.onCrosshairMove?.(n));
|
|
90
96
|
const i = () => e.onVisibleRangeChange?.(t.getVisibleRange());
|
|
91
97
|
t.on("viewportChange", i), t.on("dataUpdate", i), t.on("seriesChange", i);
|
|
92
98
|
}
|
|
93
99
|
G(async () => {
|
|
94
|
-
if (!
|
|
100
|
+
if (!u.value) return;
|
|
95
101
|
const t = {};
|
|
96
|
-
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),
|
|
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();
|
|
97
103
|
}), I(() => {
|
|
98
104
|
f?.disconnect(), f = null, a.value?.destroy(), a.value = null;
|
|
99
|
-
}),
|
|
105
|
+
}), r(
|
|
100
106
|
() => e.headerLayout,
|
|
101
107
|
async () => {
|
|
102
108
|
a.value && (await g(), V());
|
|
103
109
|
}
|
|
104
|
-
),
|
|
110
|
+
), r(
|
|
105
111
|
() => e.theme,
|
|
106
112
|
(t) => {
|
|
107
113
|
a.value && t && (a.value.setTheme(t), x.value = t);
|
|
108
114
|
}
|
|
109
|
-
),
|
|
115
|
+
), r(
|
|
110
116
|
() => e.axis,
|
|
111
117
|
(t) => {
|
|
112
118
|
a.value && t && a.value.setAxis(t);
|
|
113
119
|
},
|
|
114
120
|
{ deep: !0 }
|
|
115
|
-
),
|
|
121
|
+
), r(
|
|
116
122
|
() => e.grid?.visible,
|
|
117
123
|
() => {
|
|
118
124
|
a.value && e.grid !== void 0 && a.value.setGrid(e.grid);
|
|
119
125
|
}
|
|
120
126
|
);
|
|
121
|
-
let
|
|
122
|
-
|
|
127
|
+
let K = e.animations;
|
|
128
|
+
r(
|
|
123
129
|
() => e.animations,
|
|
124
130
|
async (t) => {
|
|
125
|
-
if (
|
|
131
|
+
if (T(t, K) || (K = t, !a.value || !u.value)) return;
|
|
126
132
|
a.value.destroy(), a.value = null, await g();
|
|
127
133
|
const i = {};
|
|
128
|
-
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),
|
|
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);
|
|
129
135
|
}
|
|
130
136
|
);
|
|
131
|
-
let
|
|
132
|
-
|
|
137
|
+
let p;
|
|
138
|
+
r(
|
|
133
139
|
() => [a.value, e.visibleRange],
|
|
134
140
|
async ([t, i]) => {
|
|
135
|
-
!t || i === void 0 ||
|
|
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));
|
|
136
142
|
},
|
|
137
143
|
{ immediate: !0 }
|
|
138
|
-
),
|
|
144
|
+
), r(
|
|
139
145
|
() => [
|
|
140
146
|
e.padding?.top,
|
|
141
147
|
e.padding?.bottom,
|
|
142
148
|
typeof e.padding?.right == "object" ? e.padding.right.intervals : e.padding?.right,
|
|
143
149
|
typeof e.padding?.left == "object" ? e.padding.left.intervals : e.padding?.left,
|
|
144
|
-
|
|
150
|
+
j.value
|
|
145
151
|
],
|
|
146
152
|
A
|
|
147
|
-
),
|
|
153
|
+
), r(() => [a.value, O.value, e.fade], $, { immediate: !0 });
|
|
148
154
|
const N = v(() => {
|
|
149
|
-
const t = x.value, [i, n] = t?.chartGradient ?? ["transparent", "transparent"],
|
|
150
|
-
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}`;
|
|
151
157
|
});
|
|
152
158
|
return (t, i) => (y(), m("div", {
|
|
153
159
|
style: q(N.value)
|
|
@@ -168,7 +174,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
168
174
|
])) : w("", !0),
|
|
169
175
|
o("div", {
|
|
170
176
|
ref_key: "containerRef",
|
|
171
|
-
ref:
|
|
177
|
+
ref: u,
|
|
172
178
|
style: { position: "relative", flex: "1", "min-width": "0", "min-height": "0", overflow: "hidden" }
|
|
173
179
|
}, [
|
|
174
180
|
b.headerLayout === "overlay" ? (y(), m("div", {
|
package/dist/composables.js
CHANGED
|
@@ -1,44 +1,57 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
function
|
|
3
|
-
const o =
|
|
1
|
+
import { ref as u, onMounted as a, onUnmounted as l } from "vue";
|
|
2
|
+
function x(e) {
|
|
3
|
+
const o = u(e.getVisibleRange()), n = () => {
|
|
4
4
|
o.value = e.getVisibleRange();
|
|
5
5
|
};
|
|
6
|
-
return
|
|
6
|
+
return a(() => e.on("viewportChange", n)), l(() => e.off("viewportChange", n)), o;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const o =
|
|
8
|
+
function d(e) {
|
|
9
|
+
const o = u(e.getYRange()), n = () => {
|
|
10
10
|
o.value = e.getYRange();
|
|
11
11
|
};
|
|
12
|
-
return
|
|
12
|
+
return a(() => e.on("viewportChange", n)), l(() => e.off("viewportChange", n)), o;
|
|
13
|
+
}
|
|
14
|
+
function r(e) {
|
|
15
|
+
return { yAxisPosition: e.yAxisPosition, yAxisWidth: e.yAxisWidth, xAxisHeight: e.xAxisHeight };
|
|
16
|
+
}
|
|
17
|
+
function p(e) {
|
|
18
|
+
const o = u(r(e)), n = () => {
|
|
19
|
+
const i = r(e), s = o.value;
|
|
20
|
+
s.yAxisPosition === i.yAxisPosition && s.yAxisWidth === i.yAxisWidth && s.xAxisHeight === i.xAxisHeight || (o.value = i);
|
|
21
|
+
};
|
|
22
|
+
return a(() => {
|
|
23
|
+
n(), e.on("viewportChange", n);
|
|
24
|
+
}), l(() => e.off("viewportChange", n)), o;
|
|
13
25
|
}
|
|
14
|
-
function
|
|
15
|
-
let n = e.getLastValue(o),
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
n?.value ===
|
|
26
|
+
function A(e, o) {
|
|
27
|
+
let n = e.getLastValue(o), i = n ? e.yScale.valueToY(n.value) : null;
|
|
28
|
+
const s = u(n), g = () => {
|
|
29
|
+
const t = e.getLastValue(o), v = t ? e.yScale.valueToY(t.value) : null;
|
|
30
|
+
n?.value === t?.value && n?.isLive === t?.isLive && i === v || (n = t, i = v, s.value = t);
|
|
19
31
|
};
|
|
20
|
-
return
|
|
21
|
-
e.on("dataUpdate",
|
|
22
|
-
}),
|
|
23
|
-
e.off("dataUpdate",
|
|
24
|
-
}),
|
|
32
|
+
return a(() => {
|
|
33
|
+
e.on("dataUpdate", g), e.on("viewportChange", g);
|
|
34
|
+
}), l(() => {
|
|
35
|
+
e.off("dataUpdate", g), e.off("viewportChange", g);
|
|
36
|
+
}), s;
|
|
25
37
|
}
|
|
26
38
|
function C(e, o) {
|
|
27
|
-
const n =
|
|
39
|
+
const n = u(e.getPreviousClose(o)), i = () => {
|
|
28
40
|
n.value = e.getPreviousClose(o);
|
|
29
41
|
};
|
|
30
|
-
return
|
|
42
|
+
return a(() => e.on("dataUpdate", i)), l(() => e.off("dataUpdate", i)), n;
|
|
31
43
|
}
|
|
32
|
-
function
|
|
33
|
-
const o =
|
|
44
|
+
function y(e) {
|
|
45
|
+
const o = u(e.getCrosshairPosition()), n = () => {
|
|
34
46
|
o.value = e.getCrosshairPosition();
|
|
35
47
|
};
|
|
36
|
-
return
|
|
48
|
+
return a(() => e.on("crosshairMove", n)), l(() => e.off("crosshairMove", n)), o;
|
|
37
49
|
}
|
|
38
50
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
p as useAxisLayout,
|
|
52
|
+
y as useCrosshairPosition,
|
|
53
|
+
A as useLastYValue,
|
|
41
54
|
C as usePreviousClose,
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
x as useVisibleRange,
|
|
56
|
+
d as useYRange
|
|
44
57
|
};
|
|
@@ -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
|
};
|