@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
|
@@ -1,120 +1,143 @@
|
|
|
1
|
-
import { pointValue as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { isGapPoint as f, pointValue as h } from "./utils/point.js";
|
|
2
|
+
import { formatDate as x } from "./utils/time.js";
|
|
3
|
+
const g = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
function I(e, t) {
|
|
5
|
+
return g.get(e)?.get(t);
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
|
|
7
|
+
function y(e, t, o) {
|
|
8
|
+
let n = g.get(e);
|
|
9
|
+
n || (n = /* @__PURE__ */ new Map(), g.set(e, n)), n.set(t, o);
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
return e.x !== void 0 && (
|
|
11
|
+
function b(e) {
|
|
12
|
+
const t = e.low !== void 0 && e.high !== void 0 ? { time: e.time, low: e.low, high: e.high } : { time: e.time, value: e.value };
|
|
13
|
+
return e.x !== void 0 && (t.x = e.x), t;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
const s =
|
|
19
|
-
return
|
|
20
|
-
}),
|
|
15
|
+
function S(e, t) {
|
|
16
|
+
if (t === "none" || e.length <= 1) return e;
|
|
17
|
+
const o = [...e];
|
|
18
|
+
return o.sort((n, r) => {
|
|
19
|
+
const s = h(n.data), c = h(r.data);
|
|
20
|
+
return t === "asc" ? s - c : c - s;
|
|
21
|
+
}), o;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
23
|
+
function m(e) {
|
|
24
|
+
const t = Object.freeze({ ...e.data }), o = {
|
|
24
25
|
id: e.id,
|
|
25
26
|
seriesId: e.seriesId,
|
|
26
27
|
layerIndex: e.layerIndex,
|
|
27
28
|
label: e.label,
|
|
28
|
-
data:
|
|
29
|
-
color: e.color
|
|
29
|
+
data: t,
|
|
30
|
+
color: e.color,
|
|
31
|
+
...e.share === void 0 ? {} : { share: e.share }
|
|
30
32
|
};
|
|
31
|
-
return Object.freeze(
|
|
33
|
+
return Object.freeze(o);
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
return
|
|
35
|
+
function w(e, t) {
|
|
36
|
+
const o = t.sort ?? "none", n = e.getSnapshotVersion(), r = I(e, t.cacheKey);
|
|
37
|
+
if (r && r.version === n && r.time === t.time && r.sort === o)
|
|
38
|
+
return r.data;
|
|
37
39
|
const s = [];
|
|
38
|
-
for (const
|
|
39
|
-
if (!e.isSeriesVisible(
|
|
40
|
-
if (e.getSeriesLayers(
|
|
41
|
-
const d = e.getLayerSnapshots(
|
|
40
|
+
for (const a of e.getSeriesIds()) {
|
|
41
|
+
if (!e.isSeriesVisible(a)) continue;
|
|
42
|
+
if (e.getSeriesLayers(a) !== null) {
|
|
43
|
+
const d = e.getLayerSnapshots(a, t.time);
|
|
42
44
|
if (!d) continue;
|
|
43
|
-
for (const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
for (const i of d) {
|
|
46
|
+
const u = b(i);
|
|
47
|
+
f(u) || s.push(
|
|
48
|
+
m({
|
|
49
|
+
id: `${a}_layer${i.layerIndex}`,
|
|
50
|
+
seriesId: a,
|
|
51
|
+
layerIndex: i.layerIndex,
|
|
52
|
+
label: e.getLayerLabel(a, i.layerIndex),
|
|
53
|
+
data: u,
|
|
54
|
+
color: i.color,
|
|
55
|
+
share: i.share
|
|
52
56
|
})
|
|
53
57
|
);
|
|
58
|
+
}
|
|
54
59
|
continue;
|
|
55
60
|
}
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
id:
|
|
60
|
-
seriesId:
|
|
61
|
-
label: e.getSeriesLabel(
|
|
62
|
-
data:
|
|
63
|
-
color: e.getSeriesColor(
|
|
61
|
+
const l = e.getDataAtTime(a, t.time);
|
|
62
|
+
!l || f(l) || s.push(
|
|
63
|
+
m({
|
|
64
|
+
id: a,
|
|
65
|
+
seriesId: a,
|
|
66
|
+
label: e.getSeriesLabel(a),
|
|
67
|
+
data: l,
|
|
68
|
+
color: e.getSeriesColor(a) ?? "#888"
|
|
64
69
|
})
|
|
65
70
|
);
|
|
66
71
|
}
|
|
67
|
-
const
|
|
68
|
-
return
|
|
72
|
+
const c = Object.freeze(S(s, o));
|
|
73
|
+
return y(e, t.cacheKey, { version: n, time: t.time, sort: o, data: c }), c;
|
|
69
74
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
c > i || d || (i = c, s = t.data.time);
|
|
75
|
+
const v = 864e5;
|
|
76
|
+
function p(e, t) {
|
|
77
|
+
let o = e, n = Number.POSITIVE_INFINITY;
|
|
78
|
+
for (const r of t) {
|
|
79
|
+
const s = Math.abs(r.data.time - e), c = s === n && r.data.time <= o;
|
|
80
|
+
s > n || c || (n = s, o = r.data.time);
|
|
77
81
|
}
|
|
78
|
-
return
|
|
82
|
+
return o;
|
|
79
83
|
}
|
|
80
|
-
function
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
function L(e, t) {
|
|
85
|
+
const o = p(t.time, t.snapshots);
|
|
86
|
+
return e.timeScale.formatPointX(o, t.interval);
|
|
87
|
+
}
|
|
88
|
+
function T(e, t) {
|
|
89
|
+
const o = L(e, t);
|
|
90
|
+
if (e.timeScale.getType() !== "time") return o;
|
|
91
|
+
const n = p(t.time, t.snapshots), r = x(n, { locale: e.timeScale.getLocale(), timeZone: e.timeScale.getTimeZone() });
|
|
92
|
+
return t.interval >= v && e.timeScale.getFormat() === null ? r : `${r} ${o}`;
|
|
93
|
+
}
|
|
94
|
+
function O(e, t) {
|
|
95
|
+
const o = t(h(e.data));
|
|
96
|
+
return e.share === void 0 ? o : `${Number(e.share.toFixed(1))}% · ${o}`;
|
|
97
|
+
}
|
|
98
|
+
function j(e, t) {
|
|
99
|
+
const o = t.sort ?? "none", n = e.getSnapshotVersion(), r = I(e, t.cacheKey);
|
|
100
|
+
if (r && r.version === n && r.time === null && r.sort === o)
|
|
101
|
+
return r.data;
|
|
84
102
|
const s = [];
|
|
85
|
-
for (const
|
|
86
|
-
if (!e.isSeriesVisible(
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
for (const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
for (const a of e.getSeriesIds()) {
|
|
104
|
+
if (!e.isSeriesVisible(a)) continue;
|
|
105
|
+
const l = e.getLayerLastSnapshots(a);
|
|
106
|
+
if (l) {
|
|
107
|
+
for (const i of l) {
|
|
108
|
+
const u = b(i);
|
|
109
|
+
f(u) || s.push(
|
|
110
|
+
m({
|
|
111
|
+
id: `${a}_layer${i.layerIndex}`,
|
|
112
|
+
seriesId: a,
|
|
113
|
+
layerIndex: i.layerIndex,
|
|
114
|
+
label: e.getLayerLabel(a, i.layerIndex),
|
|
115
|
+
data: u,
|
|
116
|
+
color: i.color,
|
|
117
|
+
share: i.share
|
|
98
118
|
})
|
|
99
119
|
);
|
|
120
|
+
}
|
|
100
121
|
continue;
|
|
101
122
|
}
|
|
102
|
-
const d = e.getLastData(
|
|
103
|
-
d
|
|
104
|
-
|
|
105
|
-
id:
|
|
106
|
-
seriesId:
|
|
107
|
-
label: e.getSeriesLabel(
|
|
123
|
+
const d = e.getLastData(a);
|
|
124
|
+
!d || f(d) || s.push(
|
|
125
|
+
m({
|
|
126
|
+
id: a,
|
|
127
|
+
seriesId: a,
|
|
128
|
+
label: e.getSeriesLabel(a),
|
|
108
129
|
data: d,
|
|
109
|
-
color: e.getSeriesColor(
|
|
130
|
+
color: e.getSeriesColor(a) ?? "#888"
|
|
110
131
|
})
|
|
111
132
|
);
|
|
112
133
|
}
|
|
113
|
-
const
|
|
114
|
-
return
|
|
134
|
+
const c = Object.freeze(S(s, o));
|
|
135
|
+
return y(e, t.cacheKey, { version: n, time: null, sort: o, data: c }), c;
|
|
115
136
|
}
|
|
116
137
|
export {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
138
|
+
w as buildHoverSnapshots,
|
|
139
|
+
j as buildLastSnapshots,
|
|
140
|
+
L as formatHeaderX,
|
|
141
|
+
O as formatRowValue,
|
|
142
|
+
T as formatTooltipHeader
|
|
120
143
|
};
|
|
@@ -1,30 +1,45 @@
|
|
|
1
|
-
function
|
|
1
|
+
function l(e) {
|
|
2
2
|
return e instanceof Date ? e.getTime() : e;
|
|
3
3
|
}
|
|
4
|
-
function c(e) {
|
|
5
|
-
return e.length === 0 || !e.some((t) => t.time instanceof Date) ? e : e.map((t) => ({ ...t, time: m(t.time) }));
|
|
6
|
-
}
|
|
7
4
|
function u(e) {
|
|
8
|
-
return e.length === 0 || !e.some((t) => t.time instanceof Date) ? e : e.map((t) => ({ ...t, time:
|
|
5
|
+
return e.length === 0 || !e.some((t) => t.time instanceof Date) ? e : e.map((t) => ({ ...t, time: l(t.time) }));
|
|
9
6
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
7
|
+
function s(e) {
|
|
8
|
+
return e.length === 0 || !e.some((t) => t.time instanceof Date) ? e : e.map((t) => ({ ...t, time: l(t.time) }));
|
|
9
|
+
}
|
|
10
|
+
const a = 19;
|
|
11
|
+
function h(e) {
|
|
12
12
|
const t = [];
|
|
13
|
-
for (let n = 1; n <
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
for (let n = 1; n < e.length; n++) {
|
|
14
|
+
const r = e[n] - e[n - 1];
|
|
15
|
+
r > 0 && t.push(r);
|
|
16
|
+
}
|
|
17
|
+
if (t.length === 0) return 864e5;
|
|
18
|
+
if (t.length <= a) return c(t);
|
|
19
|
+
const o = Math.ceil(a / 2);
|
|
20
|
+
let i = Number.POSITIVE_INFINITY;
|
|
21
|
+
for (let n = a; i = Math.min(i, c(t.slice(n - a, n))), n !== t.length; n = Math.min(n + o, t.length))
|
|
22
|
+
;
|
|
23
|
+
return i;
|
|
16
24
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
return
|
|
25
|
+
function f(e, t) {
|
|
26
|
+
const { maxCount: o, from: i } = t;
|
|
27
|
+
return i === "start" ? e.slice(0, o) : e.slice(Math.max(0, e.length - o));
|
|
28
|
+
}
|
|
29
|
+
function c(e) {
|
|
30
|
+
return e.sort((t, o) => t - o), e[Math.floor(e.length / 2)];
|
|
31
|
+
}
|
|
32
|
+
function g(e, t, o) {
|
|
33
|
+
const i = new Date(e), n = o?.locale ?? "en-US", r = o?.timeZone, m = o?.hour12 ?? !1;
|
|
34
|
+
return t >= 31536e6 ? i.toLocaleDateString(n, { year: "numeric", timeZone: r }) : t >= 864e5 ? i.toLocaleDateString(n, { month: "short", day: "numeric", timeZone: r }) : t >= 36e5 ? i.toLocaleTimeString(n, { hour: "2-digit", minute: "2-digit", hour12: m, timeZone: r }) : i.toLocaleTimeString(n, {
|
|
20
35
|
hour: "2-digit",
|
|
21
36
|
minute: "2-digit",
|
|
22
37
|
second: "2-digit",
|
|
23
|
-
hour12:
|
|
24
|
-
timeZone:
|
|
38
|
+
hour12: m,
|
|
39
|
+
timeZone: r
|
|
25
40
|
});
|
|
26
41
|
}
|
|
27
|
-
function
|
|
42
|
+
function d(e, t) {
|
|
28
43
|
return new Date(e).toLocaleDateString(t?.locale ?? "en-US", {
|
|
29
44
|
month: "short",
|
|
30
45
|
day: "numeric",
|
|
@@ -32,16 +47,17 @@ function f(e, t) {
|
|
|
32
47
|
timeZone: t?.timeZone
|
|
33
48
|
});
|
|
34
49
|
}
|
|
35
|
-
function
|
|
36
|
-
const t = [1e3, 5e3, 1e4, 15e3, 3e4],
|
|
37
|
-
return e < 6e4 ? [...t, ...
|
|
50
|
+
function D(e) {
|
|
51
|
+
const t = [1e3, 5e3, 1e4, 15e3, 3e4], o = [6e4, 5 * 6e4, 10 * 6e4, 15 * 6e4, 30 * 6e4], i = [36e5, 2 * 36e5, 4 * 36e5, 6 * 36e5, 12 * 36e5], n = [864e5, 7 * 864e5, 30 * 864e5, 90 * 864e5], r = [31536e6, 2 * 31536e6, 5 * 31536e6, 10 * 31536e6, 25 * 31536e6, 50 * 31536e6, 100 * 31536e6];
|
|
52
|
+
return e < 6e4 ? [...t, ...o, ...i, ...n, ...r] : e < 36e5 ? [...o, ...i, ...n, ...r] : e < 864e5 ? [...i, ...n, ...r] : e < 31536e6 ? [...n, ...r] : r;
|
|
38
53
|
}
|
|
39
54
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
h as detectInterval,
|
|
56
|
+
d as formatDate,
|
|
57
|
+
g as formatTime,
|
|
58
|
+
D as niceTimeIntervals,
|
|
59
|
+
u as normalizeOHLCArray,
|
|
60
|
+
l as normalizeTime,
|
|
61
|
+
s as normalizeTimePointArray,
|
|
62
|
+
f as sliceSample
|
|
47
63
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ gradient: boolean;
|
|
|
16
16
|
theme: ChartTheme;
|
|
17
17
|
interactive: boolean;
|
|
18
18
|
headerLayout: "overlay" | "inline";
|
|
19
|
+
animations: boolean | AnimationsConfig;
|
|
19
20
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
20
21
|
titleAnchor: HTMLDivElement;
|
|
21
22
|
infoBarAnchor: HTMLDivElement;
|
|
@@ -49,7 +50,9 @@ declare const __VLS_component_7: DefineComponent<__VLS_Props_19, {}, {}, {}, {},
|
|
|
49
50
|
containerRef: HTMLDivElement;
|
|
50
51
|
}, any>;
|
|
51
52
|
|
|
52
|
-
declare const __VLS_component_8: DefineComponent<__VLS_Props_22, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_22> & Readonly<{}>, {
|
|
53
|
+
declare const __VLS_component_8: DefineComponent<__VLS_Props_22, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_22> & Readonly<{}>, {
|
|
54
|
+
animate: YLabelAnimate;
|
|
55
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
53
56
|
|
|
54
57
|
declare type __VLS_Props = {
|
|
55
58
|
/**
|
|
@@ -113,6 +116,7 @@ declare type __VLS_Props_13 = {
|
|
|
113
116
|
*/
|
|
114
117
|
format?: ((value: number) => string) | Intl.NumberFormatOptions;
|
|
115
118
|
locale?: string;
|
|
119
|
+
/** Per-digit spin duration in ms. A value that arrives sooner than this after the previous one snaps instead. */
|
|
116
120
|
spinDuration?: number;
|
|
117
121
|
};
|
|
118
122
|
|
|
@@ -287,7 +291,7 @@ declare type __VLS_Props_4 = {
|
|
|
287
291
|
* Viewport padding. `top`/`bottom` are in pixels. `left`/`right` accept either pixels (`50`)
|
|
288
292
|
* or data intervals (`{ intervals: 3 }`). Set to 0 for edge-to-edge sparklines. Updates are
|
|
289
293
|
* applied reactively when this prop or the measured header height changes.
|
|
290
|
-
* Defaults: `{ top: 20, bottom: 20, right: { intervals: 3 }, left: { intervals: 0 } }`.
|
|
294
|
+
* Defaults: `{ top: 20, bottom: 20, right: { intervals: 3 }, left: { intervals: 0.5 } }`.
|
|
291
295
|
*/
|
|
292
296
|
padding?: {
|
|
293
297
|
top?: number;
|
|
@@ -305,19 +309,23 @@ declare type __VLS_Props_4 = {
|
|
|
305
309
|
*/
|
|
306
310
|
viewport?: {
|
|
307
311
|
/**
|
|
308
|
-
*
|
|
309
|
-
* to
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* Default: 200.
|
|
312
|
+
* Most bars the chart's own fit shows. The first data load fits every bar
|
|
313
|
+
* up to this count; while the data holds fewer, streamed bars widen the
|
|
314
|
+
* window, and once it is full the window keeps its width and follows the
|
|
315
|
+
* latest bar. `fitContent()` and an explicit bar count are not capped.
|
|
316
|
+
* Default: 200. Values below 2 are clamped.
|
|
314
317
|
*/
|
|
315
318
|
maxVisibleBars?: number;
|
|
316
319
|
/**
|
|
317
320
|
* Initial visible range applied before the first paint with data. Same
|
|
318
321
|
* shape as the imperative `chart.setVisibleRange` — pass a bar count
|
|
319
322
|
* (e.g. `35`), an explicit `{from, to}` window, or `{from, bars}` for
|
|
320
|
-
* a warm-up pair.
|
|
323
|
+
* a warm-up pair.
|
|
324
|
+
*
|
|
325
|
+
* It stays the chart's window until the user zooms or pans or the app
|
|
326
|
+
* sets a range, so a series that loads later or data set again keeps it.
|
|
327
|
+
* A bar count widens with streamed bars until it holds that many; a
|
|
328
|
+
* `{from, …}` window ends once streaming moves it. Captured at mount.
|
|
321
329
|
*/
|
|
322
330
|
initialRange?: VisibleRangeSpec;
|
|
323
331
|
};
|
|
@@ -329,7 +337,7 @@ declare type __VLS_Props_4 = {
|
|
|
329
337
|
* two-way binding; a same-value literal (compared structurally) is a
|
|
330
338
|
* no-op, so an inline object doesn't re-apply on every render.
|
|
331
339
|
*
|
|
332
|
-
* For
|
|
340
|
+
* For an initial window that isn't re-applied on every prop
|
|
333
341
|
* change, use `viewport.initialRange` instead.
|
|
334
342
|
*/
|
|
335
343
|
visibleRange?: VisibleRangeSpec;
|
|
@@ -1721,7 +1729,7 @@ export declare interface BitmapCoordinateSpace {
|
|
|
1721
1729
|
* actually be drawing.
|
|
1722
1730
|
*
|
|
1723
1731
|
* The result is cached per `(chart, cacheKey)` slot; as long as
|
|
1724
|
-
* `chart.
|
|
1732
|
+
* `chart.getSnapshotVersion()` hasn't changed and `time`/`sort` match the
|
|
1725
1733
|
* cached call, the **same reference** is returned. This makes
|
|
1726
1734
|
* `React.memo((a, b) => a.snapshots === b.snapshots)` skip renders on
|
|
1727
1735
|
* crosshair moves that stay within one data point.
|
|
@@ -1748,7 +1756,7 @@ export declare interface BuildHoverSnapshotsArgs {
|
|
|
1748
1756
|
* at the primary layer's timestamp.
|
|
1749
1757
|
*
|
|
1750
1758
|
* Cached by `(chart, cacheKey)` + `sort`, invalidated on
|
|
1751
|
-
* `chart.
|
|
1759
|
+
* `chart.getSnapshotVersion()` bump. `time` is not an input, so the slot is
|
|
1752
1760
|
* stored with `time: null`.
|
|
1753
1761
|
*/
|
|
1754
1762
|
export declare function buildLastSnapshots(chart: ChartInstance, args: BuildLastSnapshotsArgs): readonly SeriesSnapshot[];
|
|
@@ -2075,6 +2083,13 @@ declare interface ChartEvents {
|
|
|
2075
2083
|
* tracked tick has reached its target opacity.
|
|
2076
2084
|
*/
|
|
2077
2085
|
tickFrame: () => void;
|
|
2086
|
+
/**
|
|
2087
|
+
* Fired once per main-layer frame while a series' displayed values animate
|
|
2088
|
+
* (value smoothing, entrance, layer fade, intro), and once on the frame they
|
|
2089
|
+
* settle. Snapshot readers (`InfoBar`, `Tooltip`) refresh off it, as
|
|
2090
|
+
* `buildHoverSnapshots` / `buildLastSnapshots` report those animated values.
|
|
2091
|
+
*/
|
|
2092
|
+
seriesFrame: () => void;
|
|
2078
2093
|
}
|
|
2079
2094
|
|
|
2080
2095
|
/**
|
|
@@ -2316,7 +2331,7 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> implements
|
|
|
2316
2331
|
*/
|
|
2317
2332
|
setLayerVisible(seriesId: string, layerIndex: number, visible: boolean): void;
|
|
2318
2333
|
isLayerVisible(seriesId: string, layerIndex: number): boolean;
|
|
2319
|
-
/** Auto-fit the viewport to show all data across every series. */
|
|
2334
|
+
/** Auto-fit the viewport to show all data across every series, however many bars that is. */
|
|
2320
2335
|
fitContent(): void;
|
|
2321
2336
|
getVisibleRange(): XRange;
|
|
2322
2337
|
/**
|
|
@@ -2609,6 +2624,7 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> implements
|
|
|
2609
2624
|
/** Compute the earliest and latest timestamps across all series. */
|
|
2610
2625
|
private getDataBounds;
|
|
2611
2626
|
private onDataChanged;
|
|
2627
|
+
/** `full`: the data was replaced, so a long series is read whole instead of from its tail. */
|
|
2612
2628
|
private updateDataInterval;
|
|
2613
2629
|
/**
|
|
2614
2630
|
* Shift the visible time range by `timeDelta` ms. Hard-clamped so at
|
|
@@ -2674,7 +2690,7 @@ export declare interface ChartOptions {
|
|
|
2674
2690
|
scales?: Record<string, YAxisConfig>;
|
|
2675
2691
|
/**
|
|
2676
2692
|
* Viewport padding. `top`/`bottom` are in pixels. `left`/`right` accept either pixels (`50`)
|
|
2677
|
-
* or data intervals (`{ intervals: 3 }`). Defaults: `{ top: 20, bottom: 20, right: { intervals: 3 }, left: { intervals: 0 } }`.
|
|
2693
|
+
* or data intervals (`{ intervals: 3 }`). Defaults: `{ top: 20, bottom: 20, right: { intervals: 3 }, left: { intervals: 0.5 } }`.
|
|
2678
2694
|
*/
|
|
2679
2695
|
padding?: {
|
|
2680
2696
|
top?: number;
|
|
@@ -2687,11 +2703,10 @@ export declare interface ChartOptions {
|
|
|
2687
2703
|
*/
|
|
2688
2704
|
viewport?: {
|
|
2689
2705
|
/**
|
|
2690
|
-
*
|
|
2691
|
-
*
|
|
2692
|
-
*
|
|
2693
|
-
*
|
|
2694
|
-
* holds at this width and slides forward as new data arrives.
|
|
2706
|
+
* Most bars the chart's own fit shows. The first data load fits every bar
|
|
2707
|
+
* up to this count; while the data holds fewer, streamed bars widen the
|
|
2708
|
+
* window, and once it is full the window keeps its width and follows the
|
|
2709
|
+
* latest bar. `fitContent()` and an explicit bar count are not capped.
|
|
2695
2710
|
* Default: 200. Values below 2 are clamped.
|
|
2696
2711
|
*/
|
|
2697
2712
|
maxVisibleBars?: number;
|
|
@@ -2704,8 +2719,10 @@ export declare interface ChartOptions {
|
|
|
2704
2719
|
* the same intent into the first render so the very first paint
|
|
2705
2720
|
* already shows the requested window.
|
|
2706
2721
|
*
|
|
2707
|
-
*
|
|
2708
|
-
*
|
|
2722
|
+
* It stays the chart's window until the user zooms or pans or the app
|
|
2723
|
+
* sets a range, so a series that loads later or data set again keeps it.
|
|
2724
|
+
* A bar count widens with streamed bars until it holds that many; a
|
|
2725
|
+
* `{from, …}` window ends once streaming moves it.
|
|
2709
2726
|
*/
|
|
2710
2727
|
initialRange?: VisibleRangeSpec;
|
|
2711
2728
|
};
|
|
@@ -3077,7 +3094,12 @@ containerRef: HTMLDivElement;
|
|
|
3077
3094
|
export { _default as TimeAxis }
|
|
3078
3095
|
export { _default as XAxis }
|
|
3079
3096
|
|
|
3080
|
-
|
|
3097
|
+
/**
|
|
3098
|
+
* The bar step of an ascending time array: the smallest median step over any
|
|
3099
|
+
* run of 20 points, so a series that switches to a finer resolution part-way
|
|
3100
|
+
* through is sized for its finest part. `DAY` without two distinct times.
|
|
3101
|
+
*/
|
|
3102
|
+
export declare function detectInterval(times: readonly number[]): number;
|
|
3081
3103
|
|
|
3082
3104
|
export declare const dracula: ThemePreset;
|
|
3083
3105
|
|
|
@@ -3339,6 +3361,8 @@ export declare interface LayerSnapshot {
|
|
|
3339
3361
|
high?: number;
|
|
3340
3362
|
/** The sample's own X on a numeric or category axis. */
|
|
3341
3363
|
x?: number | string;
|
|
3364
|
+
/** On a percent stack, the row's percent of the rows listed with it. Absent elsewhere, and when they sum to 0. */
|
|
3365
|
+
share?: number;
|
|
3342
3366
|
}
|
|
3343
3367
|
|
|
3344
3368
|
export declare const Legend: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
|
|
@@ -4758,6 +4782,12 @@ export declare interface SeriesCreateEnv {
|
|
|
4758
4782
|
theme: ChartTheme;
|
|
4759
4783
|
/** Number of stacked layers requested via `layers` (`1` when omitted). */
|
|
4760
4784
|
layerCount: number;
|
|
4785
|
+
/**
|
|
4786
|
+
* First `theme.seriesColors` slot for this series' default layer colours:
|
|
4787
|
+
* the lowest run of `layerCount` slots no other series of the same type
|
|
4788
|
+
* holds, so two series don't both default to the first colour. `0` when omitted.
|
|
4789
|
+
*/
|
|
4790
|
+
paletteIndex?: number;
|
|
4761
4791
|
}
|
|
4762
4792
|
|
|
4763
4793
|
/**
|
|
@@ -4867,6 +4897,8 @@ export declare interface SeriesSnapshot {
|
|
|
4867
4897
|
readonly label?: string;
|
|
4868
4898
|
readonly data: Readonly<OHLCData> | Readonly<TimePoint> | Readonly<BandPoint>;
|
|
4869
4899
|
readonly color: string;
|
|
4900
|
+
/** On a percent stack, the layer's share of the column in percent — what the chart draws it at. */
|
|
4901
|
+
readonly share?: number;
|
|
4870
4902
|
}
|
|
4871
4903
|
|
|
4872
4904
|
/** Primary series types. Open-ended — a custom {@link SeriesDefinition} picks any string that isn't a built-in. */
|
|
@@ -5092,9 +5124,10 @@ export declare interface TimePoint {
|
|
|
5092
5124
|
x?: number | string;
|
|
5093
5125
|
}
|
|
5094
5126
|
|
|
5095
|
-
/** {@link TimePoint} that also accepts `Date` for the time field. */
|
|
5096
|
-
export declare type TimePointInput = Omit<TimePoint, 'time' | 'x'> & {
|
|
5127
|
+
/** {@link TimePoint} that also accepts `Date` for the time field, and `null` for a gap. */
|
|
5128
|
+
export declare type TimePointInput = Omit<TimePoint, 'time' | 'x' | 'value'> & {
|
|
5097
5129
|
time: TimeValue;
|
|
5130
|
+
value: number | null;
|
|
5098
5131
|
};
|
|
5099
5132
|
|
|
5100
5133
|
export declare const TimeRegion: DefineComponent<__VLS_Props_17, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_17> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
@@ -5147,8 +5180,11 @@ export declare interface TimeSeriesRenderer extends BaseSeriesRenderer {
|
|
|
5147
5180
|
getLastDataPoint(): OHLCData | TimePoint | BandPoint | null;
|
|
5148
5181
|
/** Second-to-last data point (layer 0 for multi-layer), or null. */
|
|
5149
5182
|
getSecondLastDataPoint(): OHLCData | TimePoint | BandPoint | null;
|
|
5150
|
-
/**
|
|
5151
|
-
|
|
5183
|
+
/**
|
|
5184
|
+
* First `maxCount` sample times from the first populated layer — feeds
|
|
5185
|
+
* interval detection. With `'end'`, the last `maxCount` of that same layer.
|
|
5186
|
+
*/
|
|
5187
|
+
sampleTimes(maxCount: number, from?: 'start' | 'end'): number[];
|
|
5152
5188
|
/** Visible points in `[from, to]` (layer 0 for multi-layer). */
|
|
5153
5189
|
getVisibleDataPoints(from: number, to: number): readonly (OHLCData | TimePoint | BandPoint)[];
|
|
5154
5190
|
/**
|
|
@@ -5526,7 +5562,8 @@ export declare interface XBandPointInput {
|
|
|
5526
5562
|
*/
|
|
5527
5563
|
export declare interface XPointInput {
|
|
5528
5564
|
x: number | string;
|
|
5529
|
-
value:
|
|
5565
|
+
/** `null` (or any non-finite value) is a gap: the line breaks there and the tooltip leaves the point out. */
|
|
5566
|
+
value: number | null;
|
|
5530
5567
|
}
|
|
5531
5568
|
|
|
5532
5569
|
/** Time range (timestamps in milliseconds) of the currently visible portion of the chart. */
|
|
@@ -5654,7 +5691,9 @@ export declare class XScale {
|
|
|
5654
5691
|
barWidthMedia(dataInterval: number): number;
|
|
5655
5692
|
barWidthBitmap(dataInterval: number): number;
|
|
5656
5693
|
/**
|
|
5657
|
-
*
|
|
5694
|
+
* "Nice" tick values. A time axis puts them on calendar boundaries in the
|
|
5695
|
+
* installed time zone (Jan 1, the 1st of a month, midnight), so their gaps
|
|
5696
|
+
* vary; `tickInterval` is the tier's nominal span. Resolution uses the cached
|
|
5658
5697
|
* `dataInterval` set by `update()`; callers that bypass `update()` can
|
|
5659
5698
|
* still pass it here for back-compat.
|
|
5660
5699
|
*/
|