@wick-charts/vue 0.8.0 → 0.8.1
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 +40 -30
- package/dist/BarSeries.vue.js +39 -29
- package/dist/CandlestickSeries.vue.js +2 -2
- package/dist/ChartContainer.vue.js +1 -1
- package/dist/LineSeries.vue.js +40 -30
- package/dist/core/dist/chart/badge-animator.js +38 -28
- package/dist/core/dist/chart.js +801 -694
- package/dist/core/dist/data/sync.js +77 -50
- package/dist/core/dist/navigator/controller.js +11 -11
- 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 +82 -82
- package/dist/core/dist/series/bar.js +1 -1
- package/dist/core/dist/series/base-multi-layer.js +182 -152
- package/dist/core/dist/series/candlestick.js +96 -96
- package/dist/core/dist/series/line.js +297 -292
- package/dist/core/dist/snapshots.js +39 -35
- package/dist/core/dist/utils/point.js +4 -0
- package/dist/core/dist/utils/time.js +42 -26
- package/dist/index.d.ts +45 -24
- package/dist/ui/InfoBar.vue.js +13 -13
- package/dist/ui/Tooltip.vue.js +11 -11
- package/dist/ui/YLabel.vue.js +47 -47
- package/package.json +2 -2
- package/src/BandSeries.vue +16 -3
- package/src/BarSeries.vue +16 -3
- package/src/ChartContainer.vue +14 -8
- package/src/LineSeries.vue +16 -3
- package/src/ui/YLabel.vue +28 -27
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { pointValue as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
return
|
|
1
|
+
import { isGapPoint as f, pointValue as y } from "./utils/point.js";
|
|
2
|
+
const g = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function I(e, r) {
|
|
4
|
+
return g.get(e)?.get(r);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
let o =
|
|
8
|
-
o || (o = /* @__PURE__ */ new Map(),
|
|
6
|
+
function b(e, r, n) {
|
|
7
|
+
let o = g.get(e);
|
|
8
|
+
o || (o = /* @__PURE__ */ new Map(), g.set(e, o)), o.set(r, n);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function h(e) {
|
|
11
11
|
const r = e.low !== void 0 && e.high !== void 0 ? { time: e.time, low: e.low, high: e.high } : { time: e.time, value: e.value };
|
|
12
12
|
return e.x !== void 0 && (r.x = e.x), r;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function S(e, r) {
|
|
15
15
|
if (r === "none" || e.length <= 1) return e;
|
|
16
16
|
const n = [...e];
|
|
17
17
|
return n.sort((o, a) => {
|
|
18
|
-
const s =
|
|
18
|
+
const s = y(o.data), i = y(a.data);
|
|
19
19
|
return r === "asc" ? s - i : i - s;
|
|
20
20
|
}), n;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function m(e) {
|
|
23
23
|
const r = Object.freeze({ ...e.data }), n = {
|
|
24
24
|
id: e.id,
|
|
25
25
|
seriesId: e.seriesId,
|
|
@@ -30,8 +30,8 @@ function u(e) {
|
|
|
30
30
|
};
|
|
31
31
|
return Object.freeze(n);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const n = r.sort ?? "none", o = e.getOverlayVersion(), a =
|
|
33
|
+
function x(e, r) {
|
|
34
|
+
const n = r.sort ?? "none", o = e.getOverlayVersion(), a = I(e, r.cacheKey);
|
|
35
35
|
if (a && a.version === o && a.time === r.time && a.sort === n)
|
|
36
36
|
return a.data;
|
|
37
37
|
const s = [];
|
|
@@ -40,22 +40,24 @@ function S(e, r) {
|
|
|
40
40
|
if (e.getSeriesLayers(t) !== null) {
|
|
41
41
|
const d = e.getLayerSnapshots(t, r.time);
|
|
42
42
|
if (!d) continue;
|
|
43
|
-
for (const l of d)
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
for (const l of d) {
|
|
44
|
+
const u = h(l);
|
|
45
|
+
f(u) || s.push(
|
|
46
|
+
m({
|
|
46
47
|
id: `${t}_layer${l.layerIndex}`,
|
|
47
48
|
seriesId: t,
|
|
48
49
|
layerIndex: l.layerIndex,
|
|
49
50
|
label: e.getLayerLabel(t, l.layerIndex),
|
|
50
|
-
data:
|
|
51
|
+
data: u,
|
|
51
52
|
color: l.color
|
|
52
53
|
})
|
|
53
54
|
);
|
|
55
|
+
}
|
|
54
56
|
continue;
|
|
55
57
|
}
|
|
56
58
|
const c = e.getDataAtTime(t, r.time);
|
|
57
|
-
c
|
|
58
|
-
|
|
59
|
+
!c || f(c) || s.push(
|
|
60
|
+
m({
|
|
59
61
|
id: t,
|
|
60
62
|
seriesId: t,
|
|
61
63
|
label: e.getSeriesLabel(t),
|
|
@@ -64,10 +66,10 @@ function S(e, r) {
|
|
|
64
66
|
})
|
|
65
67
|
);
|
|
66
68
|
}
|
|
67
|
-
const i = Object.freeze(
|
|
68
|
-
return
|
|
69
|
+
const i = Object.freeze(S(s, n));
|
|
70
|
+
return b(e, r.cacheKey, { version: o, time: r.time, sort: n, data: i }), i;
|
|
69
71
|
}
|
|
70
|
-
function
|
|
72
|
+
function v(e, r) {
|
|
71
73
|
const { time: n, snapshots: o, interval: a } = r;
|
|
72
74
|
if (e.timeScale.getType() !== "numeric") return e.timeScale.formatX(n, a);
|
|
73
75
|
let s = n, i = Number.POSITIVE_INFINITY;
|
|
@@ -77,8 +79,8 @@ function p(e, r) {
|
|
|
77
79
|
}
|
|
78
80
|
return e.timeScale.formatPointX(s, a);
|
|
79
81
|
}
|
|
80
|
-
function
|
|
81
|
-
const n = r.sort ?? "none", o = e.getOverlayVersion(), a =
|
|
82
|
+
function L(e, r) {
|
|
83
|
+
const n = r.sort ?? "none", o = e.getOverlayVersion(), a = I(e, r.cacheKey);
|
|
82
84
|
if (a && a.version === o && a.time === null && a.sort === n)
|
|
83
85
|
return a.data;
|
|
84
86
|
const s = [];
|
|
@@ -86,22 +88,24 @@ function x(e, r) {
|
|
|
86
88
|
if (!e.isSeriesVisible(t)) continue;
|
|
87
89
|
const c = e.getLayerLastSnapshots(t);
|
|
88
90
|
if (c) {
|
|
89
|
-
for (const l of c)
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
for (const l of c) {
|
|
92
|
+
const u = h(l);
|
|
93
|
+
f(u) || s.push(
|
|
94
|
+
m({
|
|
92
95
|
id: `${t}_layer${l.layerIndex}`,
|
|
93
96
|
seriesId: t,
|
|
94
97
|
layerIndex: l.layerIndex,
|
|
95
98
|
label: e.getLayerLabel(t, l.layerIndex),
|
|
96
|
-
data:
|
|
99
|
+
data: u,
|
|
97
100
|
color: l.color
|
|
98
101
|
})
|
|
99
102
|
);
|
|
103
|
+
}
|
|
100
104
|
continue;
|
|
101
105
|
}
|
|
102
106
|
const d = e.getLastData(t);
|
|
103
|
-
d
|
|
104
|
-
|
|
107
|
+
!d || f(d) || s.push(
|
|
108
|
+
m({
|
|
105
109
|
id: t,
|
|
106
110
|
seriesId: t,
|
|
107
111
|
label: e.getSeriesLabel(t),
|
|
@@ -110,11 +114,11 @@ function x(e, r) {
|
|
|
110
114
|
})
|
|
111
115
|
);
|
|
112
116
|
}
|
|
113
|
-
const i = Object.freeze(
|
|
114
|
-
return
|
|
117
|
+
const i = Object.freeze(S(s, n));
|
|
118
|
+
return b(e, r.cacheKey, { version: o, time: null, sort: n, data: i }), i;
|
|
115
119
|
}
|
|
116
120
|
export {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
x as buildHoverSnapshots,
|
|
122
|
+
L as buildLastSnapshots,
|
|
123
|
+
v as formatHeaderX
|
|
120
124
|
};
|
|
@@ -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
|
/**
|
|
@@ -305,19 +308,23 @@ declare type __VLS_Props_4 = {
|
|
|
305
308
|
*/
|
|
306
309
|
viewport?: {
|
|
307
310
|
/**
|
|
308
|
-
*
|
|
309
|
-
* to
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* Default: 200.
|
|
311
|
+
* Most bars the chart's own fit shows. The first data load fits every bar
|
|
312
|
+
* up to this count; while the data holds fewer, streamed bars widen the
|
|
313
|
+
* window, and once it is full the window keeps its width and follows the
|
|
314
|
+
* latest bar. `fitContent()` and an explicit bar count are not capped.
|
|
315
|
+
* Default: 200. Values below 2 are clamped.
|
|
314
316
|
*/
|
|
315
317
|
maxVisibleBars?: number;
|
|
316
318
|
/**
|
|
317
319
|
* Initial visible range applied before the first paint with data. Same
|
|
318
320
|
* shape as the imperative `chart.setVisibleRange` — pass a bar count
|
|
319
321
|
* (e.g. `35`), an explicit `{from, to}` window, or `{from, bars}` for
|
|
320
|
-
* a warm-up pair.
|
|
322
|
+
* a warm-up pair.
|
|
323
|
+
*
|
|
324
|
+
* It stays the chart's window until the user zooms or pans or the app
|
|
325
|
+
* sets a range, so a series that loads later or data set again keeps it.
|
|
326
|
+
* A bar count widens with streamed bars until it holds that many; a
|
|
327
|
+
* `{from, …}` window ends once streaming moves it. Captured at mount.
|
|
321
328
|
*/
|
|
322
329
|
initialRange?: VisibleRangeSpec;
|
|
323
330
|
};
|
|
@@ -329,7 +336,7 @@ declare type __VLS_Props_4 = {
|
|
|
329
336
|
* two-way binding; a same-value literal (compared structurally) is a
|
|
330
337
|
* no-op, so an inline object doesn't re-apply on every render.
|
|
331
338
|
*
|
|
332
|
-
* For
|
|
339
|
+
* For an initial window that isn't re-applied on every prop
|
|
333
340
|
* change, use `viewport.initialRange` instead.
|
|
334
341
|
*/
|
|
335
342
|
visibleRange?: VisibleRangeSpec;
|
|
@@ -2316,7 +2323,7 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> implements
|
|
|
2316
2323
|
*/
|
|
2317
2324
|
setLayerVisible(seriesId: string, layerIndex: number, visible: boolean): void;
|
|
2318
2325
|
isLayerVisible(seriesId: string, layerIndex: number): boolean;
|
|
2319
|
-
/** Auto-fit the viewport to show all data across every series. */
|
|
2326
|
+
/** Auto-fit the viewport to show all data across every series, however many bars that is. */
|
|
2320
2327
|
fitContent(): void;
|
|
2321
2328
|
getVisibleRange(): XRange;
|
|
2322
2329
|
/**
|
|
@@ -2609,6 +2616,7 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> implements
|
|
|
2609
2616
|
/** Compute the earliest and latest timestamps across all series. */
|
|
2610
2617
|
private getDataBounds;
|
|
2611
2618
|
private onDataChanged;
|
|
2619
|
+
/** `full`: the data was replaced, so a long series is read whole instead of from its tail. */
|
|
2612
2620
|
private updateDataInterval;
|
|
2613
2621
|
/**
|
|
2614
2622
|
* Shift the visible time range by `timeDelta` ms. Hard-clamped so at
|
|
@@ -2687,11 +2695,10 @@ export declare interface ChartOptions {
|
|
|
2687
2695
|
*/
|
|
2688
2696
|
viewport?: {
|
|
2689
2697
|
/**
|
|
2690
|
-
*
|
|
2691
|
-
*
|
|
2692
|
-
*
|
|
2693
|
-
*
|
|
2694
|
-
* holds at this width and slides forward as new data arrives.
|
|
2698
|
+
* Most bars the chart's own fit shows. The first data load fits every bar
|
|
2699
|
+
* up to this count; while the data holds fewer, streamed bars widen the
|
|
2700
|
+
* window, and once it is full the window keeps its width and follows the
|
|
2701
|
+
* latest bar. `fitContent()` and an explicit bar count are not capped.
|
|
2695
2702
|
* Default: 200. Values below 2 are clamped.
|
|
2696
2703
|
*/
|
|
2697
2704
|
maxVisibleBars?: number;
|
|
@@ -2704,8 +2711,10 @@ export declare interface ChartOptions {
|
|
|
2704
2711
|
* the same intent into the first render so the very first paint
|
|
2705
2712
|
* already shows the requested window.
|
|
2706
2713
|
*
|
|
2707
|
-
*
|
|
2708
|
-
*
|
|
2714
|
+
* It stays the chart's window until the user zooms or pans or the app
|
|
2715
|
+
* sets a range, so a series that loads later or data set again keeps it.
|
|
2716
|
+
* A bar count widens with streamed bars until it holds that many; a
|
|
2717
|
+
* `{from, …}` window ends once streaming moves it.
|
|
2709
2718
|
*/
|
|
2710
2719
|
initialRange?: VisibleRangeSpec;
|
|
2711
2720
|
};
|
|
@@ -3077,7 +3086,12 @@ containerRef: HTMLDivElement;
|
|
|
3077
3086
|
export { _default as TimeAxis }
|
|
3078
3087
|
export { _default as XAxis }
|
|
3079
3088
|
|
|
3080
|
-
|
|
3089
|
+
/**
|
|
3090
|
+
* The bar step of an ascending time array: the smallest median step over any
|
|
3091
|
+
* run of 20 points, so a series that switches to a finer resolution part-way
|
|
3092
|
+
* through is sized for its finest part. `DAY` without two distinct times.
|
|
3093
|
+
*/
|
|
3094
|
+
export declare function detectInterval(times: readonly number[]): number;
|
|
3081
3095
|
|
|
3082
3096
|
export declare const dracula: ThemePreset;
|
|
3083
3097
|
|
|
@@ -5092,9 +5106,10 @@ export declare interface TimePoint {
|
|
|
5092
5106
|
x?: number | string;
|
|
5093
5107
|
}
|
|
5094
5108
|
|
|
5095
|
-
/** {@link TimePoint} that also accepts `Date` for the time field. */
|
|
5096
|
-
export declare type TimePointInput = Omit<TimePoint, 'time' | 'x'> & {
|
|
5109
|
+
/** {@link TimePoint} that also accepts `Date` for the time field, and `null` for a gap. */
|
|
5110
|
+
export declare type TimePointInput = Omit<TimePoint, 'time' | 'x' | 'value'> & {
|
|
5097
5111
|
time: TimeValue;
|
|
5112
|
+
value: number | null;
|
|
5098
5113
|
};
|
|
5099
5114
|
|
|
5100
5115
|
export declare const TimeRegion: DefineComponent<__VLS_Props_17, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_17> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
@@ -5147,8 +5162,11 @@ export declare interface TimeSeriesRenderer extends BaseSeriesRenderer {
|
|
|
5147
5162
|
getLastDataPoint(): OHLCData | TimePoint | BandPoint | null;
|
|
5148
5163
|
/** Second-to-last data point (layer 0 for multi-layer), or null. */
|
|
5149
5164
|
getSecondLastDataPoint(): OHLCData | TimePoint | BandPoint | null;
|
|
5150
|
-
/**
|
|
5151
|
-
|
|
5165
|
+
/**
|
|
5166
|
+
* First `maxCount` sample times from the first populated layer — feeds
|
|
5167
|
+
* interval detection. With `'end'`, the last `maxCount` of that same layer.
|
|
5168
|
+
*/
|
|
5169
|
+
sampleTimes(maxCount: number, from?: 'start' | 'end'): number[];
|
|
5152
5170
|
/** Visible points in `[from, to]` (layer 0 for multi-layer). */
|
|
5153
5171
|
getVisibleDataPoints(from: number, to: number): readonly (OHLCData | TimePoint | BandPoint)[];
|
|
5154
5172
|
/**
|
|
@@ -5526,7 +5544,8 @@ export declare interface XBandPointInput {
|
|
|
5526
5544
|
*/
|
|
5527
5545
|
export declare interface XPointInput {
|
|
5528
5546
|
x: number | string;
|
|
5529
|
-
value:
|
|
5547
|
+
/** `null` (or any non-finite value) is a gap: the line breaks there and the tooltip leaves the point out. */
|
|
5548
|
+
value: number | null;
|
|
5530
5549
|
}
|
|
5531
5550
|
|
|
5532
5551
|
/** Time range (timestamps in milliseconds) of the currently visible portion of the chart. */
|
|
@@ -5654,7 +5673,9 @@ export declare class XScale {
|
|
|
5654
5673
|
barWidthMedia(dataInterval: number): number;
|
|
5655
5674
|
barWidthBitmap(dataInterval: number): number;
|
|
5656
5675
|
/**
|
|
5657
|
-
*
|
|
5676
|
+
* "Nice" tick values. A time axis puts them on calendar boundaries in the
|
|
5677
|
+
* installed time zone (Jan 1, the 1st of a month, midnight), so their gaps
|
|
5678
|
+
* vary; `tickInterval` is the tier's nominal span. Resolution uses the cached
|
|
5658
5679
|
* `dataInterval` set by `update()`; callers that bypass `update()` can
|
|
5659
5680
|
* still pass it here for back-compat.
|
|
5660
5681
|
*/
|
package/dist/ui/InfoBar.vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as W, computed as i, inject as B, ref as N, onMounted as
|
|
1
|
+
import { defineComponent as W, computed as i, inject as B, ref as N, onMounted as O, onUnmounted as T, useSlots as A, unref as t, openBlock as n, createBlock as R, Teleport as $, createElementVNode as l, normalizeStyle as r, renderSlot as D, createElementBlock as s, Fragment as f, toDisplayString as p, renderList as F, createCommentVNode as L } from "vue";
|
|
2
2
|
import { buildHoverSnapshots as M, buildLastSnapshots as P, formatHeaderX as j } from "../core/dist/snapshots.js";
|
|
3
3
|
import { resolveCandlestickBodyColor as U } from "../core/dist/theme/resolve.js";
|
|
4
4
|
import { formatCompact as X, formatPriceAdaptive as q } from "../core/dist/utils/format.js";
|
|
@@ -19,8 +19,8 @@ const Z = {
|
|
|
19
19
|
sort: {},
|
|
20
20
|
format: { type: Function }
|
|
21
21
|
},
|
|
22
|
-
setup(
|
|
23
|
-
const b =
|
|
22
|
+
setup(z) {
|
|
23
|
+
const b = z, k = i(() => b.sort ?? "none"), d = i(
|
|
24
24
|
() => b.format ?? ((a, _) => _ === "volume" ? X(a) : q(a))
|
|
25
25
|
), u = J(), y = G(u), o = B(Q), g = B(Y);
|
|
26
26
|
if (!o)
|
|
@@ -30,18 +30,18 @@ const Z = {
|
|
|
30
30
|
const h = N(0), C = () => {
|
|
31
31
|
h.value++;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
O(() => {
|
|
34
34
|
u.on("overlayChange", C), u.getSeriesIds().length > 0 && h.value++;
|
|
35
|
-
}),
|
|
35
|
+
}), T(() => {
|
|
36
36
|
u.off("overlayChange", C);
|
|
37
37
|
});
|
|
38
38
|
const x = i(() => {
|
|
39
39
|
h.value;
|
|
40
40
|
const a = y.value;
|
|
41
41
|
return a === null ? null : M(u, { time: a.time, sort: k.value, cacheKey: "infobar-hover" });
|
|
42
|
-
}),
|
|
43
|
-
() => m.value ? x.value :
|
|
44
|
-
),
|
|
42
|
+
}), E = i(() => (h.value, P(u, { sort: k.value, cacheKey: "infobar-last" }))), m = i(() => x.value !== null && x.value.length > 0), c = i(
|
|
43
|
+
() => m.value ? x.value : E.value
|
|
44
|
+
), H = i(() => u.getDataInterval()), S = i(() => c.value.length === 0 ? 0 : m.value && y.value ? y.value.time : Math.max(...c.value.map((a) => a.data.time))), K = A(), w = i(() => typeof K.default == "function");
|
|
45
45
|
function I(a) {
|
|
46
46
|
return "open" in a;
|
|
47
47
|
}
|
|
@@ -89,12 +89,12 @@ const Z = {
|
|
|
89
89
|
}) : (n(), s(f, { key: 1 }, [
|
|
90
90
|
l("span", {
|
|
91
91
|
style: r({ color: t(o).axis.textColor, marginRight: "2px" })
|
|
92
|
-
}, p(t(j)(t(u), { time: S.value, snapshots: c.value, interval:
|
|
93
|
-
(n(!0), s(f, null,
|
|
92
|
+
}, p(t(j)(t(u), { time: S.value, snapshots: c.value, interval: H.value })), 5),
|
|
93
|
+
(n(!0), s(f, null, F(c.value, (e) => (n(), s(f, {
|
|
94
94
|
key: e.id
|
|
95
95
|
}, [
|
|
96
96
|
I(e.data) ? (n(), s("span", Z, [
|
|
97
|
-
(n(!0), s(f, null,
|
|
97
|
+
(n(!0), s(f, null, F([
|
|
98
98
|
{ label: "O", field: "open", val: e.data.open },
|
|
99
99
|
{ label: "H", field: "high", val: e.data.high },
|
|
100
100
|
{ label: "L", field: "low", val: e.data.low },
|
|
@@ -122,7 +122,7 @@ const Z = {
|
|
|
122
122
|
l("span", {
|
|
123
123
|
style: r({ color: t(o).axis.textColor, fontWeight: 500, marginLeft: "2px" })
|
|
124
124
|
}, p(d.value(e.data.volume, "volume")), 5)
|
|
125
|
-
], 64)) :
|
|
125
|
+
], 64)) : L("", !0)
|
|
126
126
|
])) : V(e.data) ? (n(), s("span", ee, [
|
|
127
127
|
l("span", {
|
|
128
128
|
style: r({
|
|
@@ -153,7 +153,7 @@ const Z = {
|
|
|
153
153
|
], 64))), 128))
|
|
154
154
|
], 64))
|
|
155
155
|
], 4)
|
|
156
|
-
], 8, ["to"])) :
|
|
156
|
+
], 8, ["to"])) : L("", !0);
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
export {
|
package/dist/ui/Tooltip.vue.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as X, computed as h, ref as z, onMounted as
|
|
1
|
+
import { defineComponent as X, computed as h, ref as z, onMounted as $, onUnmounted as Y, useSlots as Z, watchEffect as K, openBlock as i, createElementBlock as n, Fragment as f, unref as d, normalizeStyle as m, createElementVNode as s, createTextVNode as H, toDisplayString as c, createCommentVNode as w, renderList as L, renderSlot as U } from "vue";
|
|
2
2
|
import { buildHoverSnapshots as j, formatHeaderX as q } from "../core/dist/snapshots.js";
|
|
3
3
|
import { resolveCandlestickBodyColor as G } from "../core/dist/theme/resolve.js";
|
|
4
4
|
import { computeTooltipPosition as I } from "../core/dist/tooltip-position.js";
|
|
@@ -34,16 +34,16 @@ const ae = {
|
|
|
34
34
|
), t = oe(), u = te(t), C = z(0), W = () => {
|
|
35
35
|
C.value++;
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
$(() => {
|
|
38
38
|
t.on("overlayChange", W), t.getSeriesIds().length > 0 && C.value++;
|
|
39
|
-
}),
|
|
39
|
+
}), Y(() => {
|
|
40
40
|
t.off("overlayChange", W);
|
|
41
41
|
});
|
|
42
42
|
const o = h(() => t.getTheme()), V = h(() => t.getDataInterval()), v = h(() => (C.value, u.value ? j(t, {
|
|
43
43
|
time: u.value.time,
|
|
44
44
|
sort: O.value,
|
|
45
45
|
cacheKey: "tooltip"
|
|
46
|
-
}) : [])), _ = h(() => u.value?.time ?? 0), A =
|
|
46
|
+
}) : [])), _ = h(() => u.value?.time ?? 0), A = Z(), y = h(() => typeof A.default == "function"), B = z(null), b = z(null);
|
|
47
47
|
let S = null;
|
|
48
48
|
K((a) => {
|
|
49
49
|
if (!y.value) return;
|
|
@@ -83,11 +83,11 @@ const ae = {
|
|
|
83
83
|
tooltipHeight: M
|
|
84
84
|
});
|
|
85
85
|
}), E = h(() => !y.value || b.value !== null);
|
|
86
|
-
function
|
|
86
|
+
function R(a) {
|
|
87
87
|
return "open" in a;
|
|
88
88
|
}
|
|
89
89
|
function N(a) {
|
|
90
|
-
return "high" in a && !
|
|
90
|
+
return "high" in a && !R(a);
|
|
91
91
|
}
|
|
92
92
|
return (a, r) => (i(), n(f, null, [
|
|
93
93
|
d(u) && v.value.length > 0 && g.value && !y.value ? (i(), n("div", {
|
|
@@ -124,15 +124,15 @@ const ae = {
|
|
|
124
124
|
})
|
|
125
125
|
}, [
|
|
126
126
|
d(t).timeScale.getType() === "time" ? (i(), n(f, { key: 0 }, [
|
|
127
|
-
|
|
127
|
+
H(c(d(ee)(_.value, { locale: d(t).timeScale.getLocale(), timeZone: d(t).timeScale.getTimeZone() })), 1)
|
|
128
128
|
], 64)) : w("", !0),
|
|
129
|
-
|
|
129
|
+
H(" " + c(d(q)(d(t), { time: _.value, snapshots: v.value, interval: V.value })), 1)
|
|
130
130
|
], 4),
|
|
131
|
-
(i(!0), n(f, null,
|
|
131
|
+
(i(!0), n(f, null, L(v.value, (e) => (i(), n(f, {
|
|
132
132
|
key: e.id
|
|
133
133
|
}, [
|
|
134
|
-
|
|
135
|
-
(i(!0), n(f, null,
|
|
134
|
+
R(e.data) ? (i(), n("div", ae, [
|
|
135
|
+
(i(!0), n(f, null, L([
|
|
136
136
|
{ label: "Open", val: e.data.open, field: "open" },
|
|
137
137
|
{ label: "High", val: e.data.high, field: "high" },
|
|
138
138
|
{ label: "Low", val: e.data.low, field: "low" },
|