@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
|
@@ -2,7 +2,7 @@ import { hexToRgba as h } from "../../utils/color.js";
|
|
|
2
2
|
import { fillRoundedRect as d, tracePath as n } from "./canvas-path.js";
|
|
3
3
|
const c = 0.25, u = (e, t) => {
|
|
4
4
|
n(e, { points: t.points, kind: "straight", settledOnly: !1 });
|
|
5
|
-
},
|
|
5
|
+
}, m = (e, t) => {
|
|
6
6
|
n(e, { points: t.points, kind: "stepped", settledOnly: !1 });
|
|
7
7
|
}, y = (e, t) => {
|
|
8
8
|
n(e, { points: t.points, kind: "smooth", settledOnly: t.grew });
|
|
@@ -16,7 +16,7 @@ const c = 0.25, u = (e, t) => {
|
|
|
16
16
|
radius: l,
|
|
17
17
|
corners: r
|
|
18
18
|
});
|
|
19
|
-
},
|
|
19
|
+
}, x = (e, t) => {
|
|
20
20
|
const { ctx: i } = e, { geom: s, fillStyle: o, corners: r, radius: l } = t;
|
|
21
21
|
i.fillStyle = o, d(i, {
|
|
22
22
|
x: s.x,
|
|
@@ -29,8 +29,8 @@ const c = 0.25, u = (e, t) => {
|
|
|
29
29
|
};
|
|
30
30
|
export {
|
|
31
31
|
f as roundedBarFill,
|
|
32
|
-
|
|
32
|
+
x as roundedCandleFill,
|
|
33
33
|
y as smoothCurve,
|
|
34
|
-
|
|
34
|
+
m as steppedCurve,
|
|
35
35
|
u as straightCurve
|
|
36
36
|
};
|
|
@@ -1,79 +1,91 @@
|
|
|
1
|
-
function
|
|
2
|
-
const { x:
|
|
3
|
-
if (!(
|
|
4
|
-
|
|
1
|
+
function b(n, l) {
|
|
2
|
+
const { x: t, y: r, width: o, height: c, corners: i } = l, e = Math.min(l.radius, o / 2, c / 2);
|
|
3
|
+
if (!(i.tl || i.tr || i.br || i.bl) || e < 1 || o <= 0 || c <= 0) {
|
|
4
|
+
n.fillRect(t, r, o, c);
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
|
-
const s =
|
|
8
|
-
|
|
7
|
+
const s = i.tl ? e : 0, y = i.tr ? e : 0, u = i.br ? e : 0, x = i.bl ? e : 0, f = t + o, p = r + c;
|
|
8
|
+
n.beginPath(), n.moveTo(t + s, r), n.lineTo(f - y, r), y > 0 && n.arcTo(f, r, f, r + y, y), n.lineTo(f, p - u), u > 0 && n.arcTo(f, p, f - u, p, u), n.lineTo(t + x, p), x > 0 && n.arcTo(t, p, t, p - x, x), n.lineTo(t, r + s), s > 0 && n.arcTo(t, r, t + s, r, s), n.closePath(), n.fill();
|
|
9
9
|
}
|
|
10
|
-
function a(
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
if (
|
|
14
|
-
for (let
|
|
15
|
-
|
|
16
|
-
return
|
|
10
|
+
function a(n, l, t) {
|
|
11
|
+
const r = [];
|
|
12
|
+
if (n.length < 2) return r;
|
|
13
|
+
if (l === "stepped") {
|
|
14
|
+
for (let o = 1; o < n.length; o++)
|
|
15
|
+
r.push({ kind: "line", x: n[o].x, y: n[o - 1].y }), r.push({ kind: "line", x: n[o].x, y: n[o].y });
|
|
16
|
+
return r;
|
|
17
17
|
}
|
|
18
|
-
if (
|
|
19
|
-
for (let
|
|
20
|
-
|
|
21
|
-
return
|
|
18
|
+
if (l === "straight" || n.length === 2) {
|
|
19
|
+
for (let o = 1; o < n.length; o++)
|
|
20
|
+
r.push({ kind: "line", x: n[o].x, y: n[o].y });
|
|
21
|
+
return r;
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return h(n, t);
|
|
24
24
|
}
|
|
25
|
-
function d(
|
|
26
|
-
const { ctx:
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
for (const c of
|
|
31
|
-
c.kind === "line" ?
|
|
25
|
+
function d(n, l) {
|
|
26
|
+
const { ctx: t } = n, { points: r } = l;
|
|
27
|
+
if (r.length === 0) return;
|
|
28
|
+
t.moveTo(r[0].x, r[0].y);
|
|
29
|
+
const o = a(r, l.kind, l.settledOnly);
|
|
30
|
+
for (const c of o)
|
|
31
|
+
c.kind === "line" ? t.lineTo(c.x, c.y) : t.bezierCurveTo(c.cp1x, c.cp1y, c.cp2x, c.cp2y, c.x, c.y);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
-
for (let
|
|
36
|
-
const
|
|
37
|
-
i
|
|
33
|
+
function h(n, l) {
|
|
34
|
+
const t = n.length, r = new Array(t - 1);
|
|
35
|
+
for (let i = 0; i < t - 1; i++) {
|
|
36
|
+
const e = n[i + 1].x - n[i].x;
|
|
37
|
+
r[i] = e > 0 ? (n[i + 1].y - n[i].y) / e : Number.NaN;
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
for (let
|
|
42
|
-
const
|
|
43
|
-
!Number.isFinite(
|
|
39
|
+
const o = new Array(t);
|
|
40
|
+
o[0] = Number.isFinite(r[0]) ? r[0] : 0;
|
|
41
|
+
for (let i = 1; i < t - 1; i++) {
|
|
42
|
+
const e = r[i - 1], s = r[i];
|
|
43
|
+
!Number.isFinite(e) || !Number.isFinite(s) ? o[i] = Number.isFinite(e) ? e : Number.isFinite(s) ? s : 0 : e * s <= 0 ? o[i] = 0 : o[i] = (e + s) / 2;
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
for (let
|
|
47
|
-
const
|
|
48
|
-
if (!Number.isFinite(
|
|
49
|
-
const s =
|
|
50
|
-
if (
|
|
51
|
-
const
|
|
52
|
-
|
|
45
|
+
o[t - 1] = Number.isFinite(r[t - 2]) ? r[t - 2] : 0;
|
|
46
|
+
for (let i = 0; i < t - 1; i++) {
|
|
47
|
+
const e = r[i];
|
|
48
|
+
if (!Number.isFinite(e) || e === 0) continue;
|
|
49
|
+
const s = o[i] / e, y = o[i + 1] / e, u = s * s + y * y;
|
|
50
|
+
if (u > 9) {
|
|
51
|
+
const x = 3 / Math.sqrt(u);
|
|
52
|
+
o[i] = x * s * e, o[i + 1] = x * y * e;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
const c = [];
|
|
56
|
-
for (let
|
|
57
|
-
const
|
|
58
|
-
if (!Number.isFinite(i
|
|
56
|
+
for (let i = 0; i < t - 1; i++) {
|
|
57
|
+
const e = n[i], s = n[i + 1], y = i === t - 2;
|
|
58
|
+
if (!Number.isFinite(r[i]) || l && y) {
|
|
59
59
|
c.push({ kind: "line", x: s.x, y: s.y });
|
|
60
60
|
continue;
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const u = s.x - e.x;
|
|
63
63
|
c.push({
|
|
64
64
|
kind: "bezier",
|
|
65
|
-
cp1x:
|
|
66
|
-
cp1y:
|
|
67
|
-
cp2x: s.x -
|
|
68
|
-
cp2y: s.y -
|
|
65
|
+
cp1x: e.x + u / 3,
|
|
66
|
+
cp1y: e.y + o[i] * u / 3,
|
|
67
|
+
cp2x: s.x - u / 3,
|
|
68
|
+
cp2y: s.y - o[i + 1] * u / 3,
|
|
69
69
|
x: s.x,
|
|
70
70
|
y: s.y
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
return c;
|
|
74
74
|
}
|
|
75
|
+
function T(n, l) {
|
|
76
|
+
for (const t of l)
|
|
77
|
+
t.kind === "line" ? n.lineTo(t.x, t.y) : n.bezierCurveTo(t.cp1x, t.cp1y, t.cp2x, t.cp2y, t.x, t.y);
|
|
78
|
+
}
|
|
79
|
+
function m(n, l, t) {
|
|
80
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
81
|
+
const o = t[r], c = r > 0 ? t[r - 1] : l[0];
|
|
82
|
+
o.kind === "line" ? n.lineTo(c.x, c.y) : n.bezierCurveTo(o.cp2x, o.cp2y, o.cp1x, o.cp1y, c.x, c.y);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
75
85
|
export {
|
|
76
86
|
a as buildCurveSegments,
|
|
77
|
-
|
|
87
|
+
b as fillRoundedRect,
|
|
88
|
+
T as replaySegmentsForward,
|
|
89
|
+
m as replaySegmentsReversed,
|
|
78
90
|
d as tracePath
|
|
79
91
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BandSeriesDef as r } from "./band.js";
|
|
2
|
+
import { BarSeriesDef as i } from "./bar.js";
|
|
3
|
+
import { CandlestickSeriesDef as t } from "./candlestick.js";
|
|
3
4
|
import { registerSeriesDefinition as e } from "./definition.js";
|
|
4
|
-
import { HeatmapSeriesDef as
|
|
5
|
-
import { LineSeriesDef as
|
|
6
|
-
import { PieSeriesDef as
|
|
7
|
-
function
|
|
8
|
-
e(
|
|
5
|
+
import { HeatmapSeriesDef as s } from "./heatmap.js";
|
|
6
|
+
import { LineSeriesDef as o } from "./line.js";
|
|
7
|
+
import { PieSeriesDef as f } from "./pie.js";
|
|
8
|
+
function B() {
|
|
9
|
+
e(t), e(o), e(i), e(r), e(f), e(s);
|
|
9
10
|
}
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
+
B as registerBuiltinSeries
|
|
12
13
|
};
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
import { pointValue as y } from "./utils/point.js";
|
|
1
2
|
const f = /* @__PURE__ */ new WeakMap();
|
|
2
|
-
function
|
|
3
|
+
function g(e, r) {
|
|
3
4
|
return f.get(e)?.get(r);
|
|
4
5
|
}
|
|
5
|
-
function
|
|
6
|
-
let
|
|
7
|
-
|
|
6
|
+
function h(e, r, n) {
|
|
7
|
+
let a = f.get(e);
|
|
8
|
+
a || (a = /* @__PURE__ */ new Map(), f.set(e, a)), a.set(r, n);
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
10
|
+
function I(e) {
|
|
11
|
+
return e.low !== void 0 && e.high !== void 0 ? { time: e.time, low: e.low, high: e.high } : { time: e.time, value: e.value };
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
+
function b(e, r) {
|
|
13
14
|
if (r === "none" || e.length <= 1) return e;
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
const i = y(
|
|
15
|
+
const n = [...e];
|
|
16
|
+
return n.sort((a, s) => {
|
|
17
|
+
const i = y(a.data), l = y(s.data);
|
|
17
18
|
return r === "asc" ? i - l : l - i;
|
|
18
|
-
}),
|
|
19
|
+
}), n;
|
|
19
20
|
}
|
|
20
21
|
function u(e) {
|
|
21
|
-
const r = Object.freeze({ ...e.data }),
|
|
22
|
+
const r = Object.freeze({ ...e.data }), n = {
|
|
22
23
|
id: e.id,
|
|
23
24
|
seriesId: e.seriesId,
|
|
24
25
|
layerIndex: e.layerIndex,
|
|
@@ -26,11 +27,11 @@ function u(e) {
|
|
|
26
27
|
data: r,
|
|
27
28
|
color: e.color
|
|
28
29
|
};
|
|
29
|
-
return Object.freeze(
|
|
30
|
+
return Object.freeze(n);
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
if (s && s.version ===
|
|
32
|
+
function p(e, r) {
|
|
33
|
+
const n = r.sort ?? "none", a = e.getOverlayVersion(), s = g(e, r.cacheKey);
|
|
34
|
+
if (s && s.version === a && s.time === r.time && s.sort === n)
|
|
34
35
|
return s.data;
|
|
35
36
|
const i = [];
|
|
36
37
|
for (const t of e.getSeriesIds()) {
|
|
@@ -38,15 +39,15 @@ function m(e, r) {
|
|
|
38
39
|
if (e.getSeriesLayers(t) !== null) {
|
|
39
40
|
const d = e.getLayerSnapshots(t, r.time);
|
|
40
41
|
if (!d) continue;
|
|
41
|
-
for (const
|
|
42
|
+
for (const o of d)
|
|
42
43
|
i.push(
|
|
43
44
|
u({
|
|
44
|
-
id: `${t}_layer${
|
|
45
|
+
id: `${t}_layer${o.layerIndex}`,
|
|
45
46
|
seriesId: t,
|
|
46
|
-
layerIndex:
|
|
47
|
-
label: e.getLayerLabel(t,
|
|
48
|
-
data:
|
|
49
|
-
color:
|
|
47
|
+
layerIndex: o.layerIndex,
|
|
48
|
+
label: e.getLayerLabel(t, o.layerIndex),
|
|
49
|
+
data: I(o),
|
|
50
|
+
color: o.color
|
|
50
51
|
})
|
|
51
52
|
);
|
|
52
53
|
continue;
|
|
@@ -62,27 +63,27 @@ function m(e, r) {
|
|
|
62
63
|
})
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
|
-
const l = Object.freeze(
|
|
66
|
-
return
|
|
66
|
+
const l = Object.freeze(b(i, n));
|
|
67
|
+
return h(e, r.cacheKey, { version: a, time: r.time, sort: n, data: l }), l;
|
|
67
68
|
}
|
|
68
69
|
function S(e, r) {
|
|
69
|
-
const
|
|
70
|
-
if (s && s.version ===
|
|
70
|
+
const n = r.sort ?? "none", a = e.getOverlayVersion(), s = g(e, r.cacheKey);
|
|
71
|
+
if (s && s.version === a && s.time === null && s.sort === n)
|
|
71
72
|
return s.data;
|
|
72
73
|
const i = [];
|
|
73
74
|
for (const t of e.getSeriesIds()) {
|
|
74
75
|
if (!e.isSeriesVisible(t)) continue;
|
|
75
76
|
const c = e.getLayerLastSnapshots(t);
|
|
76
77
|
if (c) {
|
|
77
|
-
for (const
|
|
78
|
+
for (const o of c)
|
|
78
79
|
i.push(
|
|
79
80
|
u({
|
|
80
|
-
id: `${t}_layer${
|
|
81
|
+
id: `${t}_layer${o.layerIndex}`,
|
|
81
82
|
seriesId: t,
|
|
82
|
-
layerIndex:
|
|
83
|
-
label: e.getLayerLabel(t,
|
|
84
|
-
data:
|
|
85
|
-
color:
|
|
83
|
+
layerIndex: o.layerIndex,
|
|
84
|
+
label: e.getLayerLabel(t, o.layerIndex),
|
|
85
|
+
data: I(o),
|
|
86
|
+
color: o.color
|
|
86
87
|
})
|
|
87
88
|
);
|
|
88
89
|
continue;
|
|
@@ -98,10 +99,10 @@ function S(e, r) {
|
|
|
98
99
|
})
|
|
99
100
|
);
|
|
100
101
|
}
|
|
101
|
-
const l = Object.freeze(
|
|
102
|
-
return
|
|
102
|
+
const l = Object.freeze(b(i, n));
|
|
103
|
+
return h(e, r.cacheKey, { version: a, time: null, sort: n, data: l }), l;
|
|
103
104
|
}
|
|
104
105
|
export {
|
|
105
|
-
|
|
106
|
+
p as buildHoverSnapshots,
|
|
106
107
|
S as buildLastSnapshots
|
|
107
108
|
};
|