@wick-charts/vue 0.6.4 → 0.7.0
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 +4 -4
- package/dist/BandSeries.vue.js +20 -18
- package/dist/BarSeries.vue.js +15 -13
- package/dist/CandlestickSeries.vue.js +31 -29
- package/dist/ChartContainer.vue.js +77 -70
- package/dist/LineSeries.vue.js +19 -17
- package/dist/composables.js +46 -36
- package/dist/core/dist/animation/viewport-engine.js +155 -96
- package/dist/core/dist/axis/dom-labels.js +56 -51
- package/dist/core/dist/chart/scale-guards.js +23 -5
- package/dist/core/dist/chart/x-guards.js +37 -0
- package/dist/core/dist/chart.js +1286 -843
- package/dist/core/dist/data/sync.js +37 -31
- package/dist/core/dist/navigator/controller.js +37 -37
- package/dist/core/dist/perf/perf-hud.js +3 -3
- package/dist/core/dist/scales/tick-tracker.js +2 -2
- package/dist/core/dist/scales/x-scale.js +167 -53
- package/dist/core/dist/scales/y-scale.js +36 -34
- package/dist/core/dist/series/band.js +266 -213
- package/dist/core/dist/series/bar.js +297 -291
- package/dist/core/dist/series/base-multi-layer.js +283 -237
- package/dist/core/dist/series/candlestick.js +1 -0
- package/dist/core/dist/series/line.js +21 -20
- package/dist/core/dist/snapshots.js +55 -43
- package/dist/index.d.ts +323 -58
- package/dist/index.js +9 -9
- package/dist/ui/Crosshair.vue.js +51 -27
- package/dist/ui/InfoBar.vue.js +37 -37
- package/dist/ui/Marker.vue.js +14 -11
- package/dist/ui/Navigator.vue.js +23 -23
- package/dist/ui/ReferenceLine.vue.js +19 -16
- package/dist/ui/Tooltip.vue.js +91 -86
- package/dist/ui/XAxis.vue.js +48 -0
- package/dist/ui/XAxis.vue2.js +4 -0
- package/dist/ui/YAxis.vue.js +44 -28
- package/dist/ui/YLabel.vue.js +78 -74
- package/package.json +2 -2
- package/src/BandSeries.vue +11 -6
- package/src/BarSeries.vue +13 -6
- package/src/CandlestickSeries.vue +9 -5
- package/src/ChartContainer.vue +20 -0
- package/src/LineSeries.vue +13 -6
- package/src/composables.ts +23 -4
- package/src/index.ts +8 -1
- package/src/ui/Crosshair.vue +41 -1
- package/src/ui/InfoBar.vue +2 -1
- package/src/ui/Marker.vue +5 -1
- package/src/ui/Navigator.vue +2 -1
- package/src/ui/ReferenceLine.vue +5 -1
- package/src/ui/Tooltip.vue +7 -4
- package/src/ui/{TimeAxis.vue → XAxis.vue} +18 -5
- package/src/ui/YAxis.vue +66 -12
- package/src/ui/YLabel.vue +35 -5
- package/dist/ui/TimeAxis.vue.js +0 -44
- package/dist/ui/TimeAxis.vue2.js +0 -4
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ For a CodePen, JSFiddle, or a plain HTML page, load the prebuilt UMD bundle from
|
|
|
94
94
|
</script>
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
The same file is on unpkg (`https://unpkg.com/@wick-charts/react/dist/wick-charts.umd.min.js`); pin a version with `@x.y.z` for production. ~
|
|
97
|
+
The same file is on unpkg (`https://unpkg.com/@wick-charts/react/dist/wick-charts.umd.min.js`); pin a version with `@x.y.z` for production. ~86 kB gzipped, self-contained.
|
|
98
98
|
|
|
99
99
|
## Bundle size
|
|
100
100
|
|
|
@@ -104,9 +104,9 @@ Tree-shaken React scenarios via `pnpm size` (esbuild, minified, browser target,
|
|
|
104
104
|
|
|
105
105
|
| Scenario | Raw | Gzip | Brotli |
|
|
106
106
|
|---|---:|---:|---:|
|
|
107
|
-
| Candlestick only |
|
|
108
|
-
| Line only |
|
|
109
|
-
| Full React |
|
|
107
|
+
| Candlestick only | 137.6 kB | 42.9 kB | 37.6 kB |
|
|
108
|
+
| Line only | 158.4 kB | 49.0 kB | 42.7 kB |
|
|
109
|
+
| Full React | 307.9 kB | 94.9 kB | 79.5 kB |
|
|
110
110
|
|
|
111
111
|
## Migration
|
|
112
112
|
|
package/dist/BandSeries.vue.js
CHANGED
|
@@ -1,50 +1,52 @@
|
|
|
1
|
-
import { defineComponent as u, ref as d, onMounted as
|
|
2
|
-
import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as
|
|
3
|
-
import { BandSeriesDef as
|
|
1
|
+
import { defineComponent as u, ref as d, onMounted as c, onUnmounted as p, watch as n, createCommentVNode as f } from "vue";
|
|
2
|
+
import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as S } from "./core/dist/data/sync.js";
|
|
3
|
+
import { BandSeriesDef as y } from "./core/dist/series/band.js";
|
|
4
4
|
import { useChartInstance as _ } from "./context.js";
|
|
5
|
-
const
|
|
5
|
+
const B = /* @__PURE__ */ u({
|
|
6
6
|
__name: "BandSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
9
9
|
options: {},
|
|
10
10
|
id: {},
|
|
11
|
-
visible: { type: Boolean, default: !0 }
|
|
11
|
+
visible: { type: Boolean, default: !0 },
|
|
12
|
+
scale: {}
|
|
12
13
|
},
|
|
13
14
|
setup(l) {
|
|
14
|
-
const a = l,
|
|
15
|
+
const a = l, r = _(), s = d(null);
|
|
15
16
|
let i = [];
|
|
16
17
|
function o(e, t) {
|
|
17
|
-
i =
|
|
18
|
+
i = S({ chart: r, id: e, data: t, prev: i });
|
|
18
19
|
}
|
|
19
|
-
return
|
|
20
|
-
const e = m(a.data).length, t =
|
|
20
|
+
return c(() => {
|
|
21
|
+
const e = m(a.data).length, t = r.addSeries(y, {
|
|
21
22
|
...a.options,
|
|
23
|
+
scale: a.scale,
|
|
22
24
|
layers: e,
|
|
23
25
|
id: a.id
|
|
24
26
|
});
|
|
25
|
-
|
|
26
|
-
}),
|
|
27
|
-
|
|
27
|
+
s.value = t, i = new Array(e).fill(v), o(t, a.data), r.setSeriesVisible(t, a.visible);
|
|
28
|
+
}), p(() => {
|
|
29
|
+
s.value && r.removeSeries(s.value);
|
|
28
30
|
}), n(
|
|
29
31
|
() => a.data,
|
|
30
32
|
(e) => {
|
|
31
|
-
const t =
|
|
33
|
+
const t = s.value;
|
|
32
34
|
t && o(t, e);
|
|
33
35
|
}
|
|
34
36
|
), n(
|
|
35
|
-
() => a.options,
|
|
36
|
-
(e) => {
|
|
37
|
-
|
|
37
|
+
() => [a.options, a.scale],
|
|
38
|
+
([e, t]) => {
|
|
39
|
+
s.value && r.updateSeriesOptions(s.value, e ? { ...e, scale: t } : { scale: t });
|
|
38
40
|
},
|
|
39
41
|
{ deep: !0 }
|
|
40
42
|
), n(
|
|
41
43
|
() => a.visible,
|
|
42
44
|
(e) => {
|
|
43
|
-
|
|
45
|
+
s.value && r.setSeriesVisible(s.value, e);
|
|
44
46
|
}
|
|
45
47
|
), (e, t) => f("", !0);
|
|
46
48
|
}
|
|
47
49
|
});
|
|
48
50
|
export {
|
|
49
|
-
|
|
51
|
+
B as default
|
|
50
52
|
};
|
package/dist/BarSeries.vue.js
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
import { defineComponent as u, ref as
|
|
2
|
-
import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as
|
|
3
|
-
import { BarSeriesDef as
|
|
1
|
+
import { defineComponent as u, ref as c, onMounted as d, onUnmounted as p, watch as o, createCommentVNode as f } from "vue";
|
|
2
|
+
import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as S } from "./core/dist/data/sync.js";
|
|
3
|
+
import { BarSeriesDef as y } from "./core/dist/series/bar.js";
|
|
4
4
|
import { useChartInstance as _ } from "./context.js";
|
|
5
|
-
const
|
|
5
|
+
const B = /* @__PURE__ */ u({
|
|
6
6
|
__name: "BarSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
9
9
|
options: {},
|
|
10
10
|
id: {},
|
|
11
|
-
visible: { type: Boolean, default: !0 }
|
|
11
|
+
visible: { type: Boolean, default: !0 },
|
|
12
|
+
scale: {}
|
|
12
13
|
},
|
|
13
14
|
setup(l) {
|
|
14
|
-
const a = l, s = _(), r =
|
|
15
|
+
const a = l, s = _(), r = c(null);
|
|
15
16
|
let i = [];
|
|
16
17
|
function n(e, t) {
|
|
17
|
-
i =
|
|
18
|
+
i = S({ chart: s, id: e, data: t, prev: i });
|
|
18
19
|
}
|
|
19
20
|
return d(() => {
|
|
20
|
-
const e = m(a.data).length, t = s.addSeries(
|
|
21
|
+
const e = m(a.data).length, t = s.addSeries(y, {
|
|
21
22
|
...a.options,
|
|
23
|
+
scale: a.scale,
|
|
22
24
|
layers: e,
|
|
23
25
|
id: a.id
|
|
24
26
|
});
|
|
25
27
|
r.value = t, i = new Array(e).fill(v), n(t, a.data), s.setSeriesVisible(t, a.visible);
|
|
26
|
-
}),
|
|
28
|
+
}), p(() => {
|
|
27
29
|
r.value && s.removeSeries(r.value);
|
|
28
30
|
}), o(
|
|
29
31
|
() => a.data,
|
|
@@ -32,9 +34,9 @@ const E = /* @__PURE__ */ u({
|
|
|
32
34
|
t && n(t, e);
|
|
33
35
|
}
|
|
34
36
|
), o(
|
|
35
|
-
() => a.options,
|
|
36
|
-
(e) => {
|
|
37
|
-
r.value &&
|
|
37
|
+
() => [a.options, a.scale],
|
|
38
|
+
([e, t]) => {
|
|
39
|
+
r.value && s.updateSeriesOptions(r.value, e ? { ...e, scale: t } : { scale: t });
|
|
38
40
|
},
|
|
39
41
|
{ deep: !0 }
|
|
40
42
|
), o(
|
|
@@ -46,5 +48,5 @@ const E = /* @__PURE__ */ u({
|
|
|
46
48
|
}
|
|
47
49
|
});
|
|
48
50
|
export {
|
|
49
|
-
|
|
51
|
+
B as default
|
|
50
52
|
};
|
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { toLayers as
|
|
3
|
-
import { CandlestickSeriesDef as
|
|
4
|
-
import { useChartInstance as
|
|
5
|
-
const V = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as d, ref as p, onMounted as f, onUnmounted as m, watch as i, createCommentVNode as v } from "vue";
|
|
2
|
+
import { toLayers as u, syncSeriesLayer as S, EMPTY_SYNC_STATE as b } from "./core/dist/data/sync.js";
|
|
3
|
+
import { CandlestickSeriesDef as _ } from "./core/dist/series/candlestick.js";
|
|
4
|
+
import { useChartInstance as y } from "./context.js";
|
|
5
|
+
const V = /* @__PURE__ */ d({
|
|
6
6
|
__name: "CandlestickSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
9
9
|
options: {},
|
|
10
10
|
id: {},
|
|
11
|
-
visible: { type: Boolean, default: !0 }
|
|
11
|
+
visible: { type: Boolean, default: !0 },
|
|
12
|
+
scale: {}
|
|
12
13
|
},
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
14
|
+
setup(c) {
|
|
15
|
+
const a = c, r = y(), t = p(null);
|
|
15
16
|
let o = b;
|
|
16
|
-
function n(e,
|
|
17
|
-
const l =
|
|
18
|
-
|
|
17
|
+
function n(e, s) {
|
|
18
|
+
const l = u(s)[0];
|
|
19
|
+
r.setSeriesLabels(e, [l.label]), o = S({ chart: r, id: e, data: l.data, prev: o });
|
|
19
20
|
}
|
|
20
21
|
return f(() => {
|
|
21
|
-
const e =
|
|
22
|
-
...
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const e = r.addSeries(_, {
|
|
23
|
+
...a.options,
|
|
24
|
+
scale: a.scale,
|
|
25
|
+
id: a.id,
|
|
26
|
+
label: u(a.data)[0].label
|
|
25
27
|
});
|
|
26
|
-
|
|
28
|
+
t.value = e, n(e, a.data), r.setSeriesVisible(e, a.visible);
|
|
27
29
|
}), m(() => {
|
|
28
|
-
|
|
29
|
-
}),
|
|
30
|
-
() =>
|
|
30
|
+
t.value && r.removeSeries(t.value);
|
|
31
|
+
}), i(
|
|
32
|
+
() => a.data,
|
|
31
33
|
(e) => {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
+
const s = t.value;
|
|
35
|
+
s && n(s, e);
|
|
34
36
|
}
|
|
35
|
-
),
|
|
36
|
-
() =>
|
|
37
|
-
(e) => {
|
|
38
|
-
|
|
37
|
+
), i(
|
|
38
|
+
() => [a.options, a.scale],
|
|
39
|
+
([e, s]) => {
|
|
40
|
+
t.value && r.updateSeriesOptions(t.value, e ? { ...e, scale: s } : { scale: s });
|
|
39
41
|
},
|
|
40
42
|
{ deep: !0 }
|
|
41
|
-
),
|
|
42
|
-
() =>
|
|
43
|
+
), i(
|
|
44
|
+
() => a.visible,
|
|
43
45
|
(e) => {
|
|
44
|
-
|
|
46
|
+
t.value && r.setSeriesVisible(t.value, e);
|
|
45
47
|
}
|
|
46
|
-
), (e,
|
|
48
|
+
), (e, s) => v("", !0);
|
|
47
49
|
}
|
|
48
50
|
});
|
|
49
51
|
export {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as U, ref as
|
|
1
|
+
import { defineComponent as U, ref as l, shallowRef as F, provide as d, watch as o, computed as c, onMounted as G, nextTick as g, onUnmounted as I, openBlock as y, createElementBlock as m, normalizeStyle as q, createElementVNode as n, createCommentVNode as w, renderSlot as J } from "vue";
|
|
2
2
|
import { ChartInstance as P } from "./core/dist/chart.js";
|
|
3
|
-
import { deepEqual as
|
|
3
|
+
import { deepEqual as S } from "./core/dist/utils/deep-equal.js";
|
|
4
4
|
import { catppuccin as Q } from "./core/dist/theme/themes/catppuccin.js";
|
|
5
|
-
import { ChartKey as W, ThemeKey as X, TitleAnchorKey as Y, InfoBarAnchorKey as Z, LegendAnchorKey as ee, LegendRightAnchorKey as te, NavigatorAnchorKey as
|
|
6
|
-
const
|
|
5
|
+
import { ChartKey as W, ThemeKey as X, TitleAnchorKey as Y, InfoBarAnchorKey as Z, LegendAnchorKey as ee, LegendRightAnchorKey as te, NavigatorAnchorKey as ae } from "./context.js";
|
|
6
|
+
const ie = { 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 = {
|
|
7
7
|
key: 0,
|
|
8
8
|
"data-chart-header": "",
|
|
9
9
|
style: { "flex-shrink": "0", display: "flex", "flex-direction": "column", "pointer-events": "none" }
|
|
@@ -11,11 +11,12 @@ 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
|
+
}, T = 24, ve = /* @__PURE__ */ U({
|
|
15
15
|
__name: "ChartContainer",
|
|
16
16
|
props: {
|
|
17
17
|
theme: { default: () => Q.theme },
|
|
18
18
|
axis: {},
|
|
19
|
+
scales: {},
|
|
19
20
|
padding: {},
|
|
20
21
|
viewport: {},
|
|
21
22
|
visibleRange: {},
|
|
@@ -35,31 +36,31 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
35
36
|
onCrosshairMove: {}
|
|
36
37
|
},
|
|
37
38
|
setup(b) {
|
|
38
|
-
const e = b, u =
|
|
39
|
-
|
|
39
|
+
const e = b, u = l(), i = F(null), x = F(e.theme), v = e.perf, p = e.onEdgeReached, C = l(null), R = l(null), k = l(null), _ = l(null), E = l(null), B = l(null);
|
|
40
|
+
d(W, i), d(X, x), d(Y, R), d(Z, k), d(ee, _), d(te, E), d(ae, B);
|
|
40
41
|
let f = null;
|
|
41
|
-
const s =
|
|
42
|
-
|
|
43
|
-
() => [
|
|
44
|
-
([t,
|
|
42
|
+
const s = l(0);
|
|
43
|
+
o(
|
|
44
|
+
() => [i.value, e.headerLayout === "overlay" ? s.value : 0],
|
|
45
|
+
([t, a]) => t?.setHeaderHeight(a),
|
|
45
46
|
{ immediate: !0 }
|
|
46
47
|
);
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
48
|
+
const O = c(() => e.fade === !1 ? !1 : typeof e.fade == "object" ? e.fade.top !== void 0 || e.fade.overlap !== void 0 : e.fade === !0), z = c(() => {
|
|
49
|
+
if (!O.value) return 0;
|
|
49
50
|
const t = typeof e.fade == "object" ? e.fade.overlap : void 0;
|
|
50
51
|
return t !== void 0 ? Math.max(0, t) : s.value / 2;
|
|
51
|
-
}),
|
|
52
|
-
if (!
|
|
52
|
+
}), L = c(() => {
|
|
53
|
+
if (!O.value) return 0;
|
|
53
54
|
if (typeof e.fade == "object" && e.fade.top !== void 0) return e.fade.top;
|
|
54
55
|
const t = e.headerLayout === "overlay" ? s.value : 0;
|
|
55
|
-
return t > 0 ? t +
|
|
56
|
-
}), j =
|
|
57
|
-
() => e.headerLayout === "overlay" ? Math.max(0, s.value -
|
|
56
|
+
return t > 0 ? t + T : T;
|
|
57
|
+
}), j = c(
|
|
58
|
+
() => e.headerLayout === "overlay" ? Math.max(0, s.value - z.value) : 0
|
|
58
59
|
);
|
|
59
60
|
function A() {
|
|
60
|
-
if (!
|
|
61
|
-
const
|
|
62
|
-
e.padding?.bottom !== void 0 && (
|
|
61
|
+
if (!i.value) return;
|
|
62
|
+
const a = { top: (e.padding?.top ?? 20) + j.value };
|
|
63
|
+
e.padding?.bottom !== void 0 && (a.bottom = e.padding.bottom), e.padding?.right !== void 0 && (a.right = e.padding.right), e.padding?.left !== void 0 && (a.left = e.padding.left), i.value.setPadding(a);
|
|
63
64
|
}
|
|
64
65
|
function M(t) {
|
|
65
66
|
if (e.fade === !1) {
|
|
@@ -67,17 +68,17 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
70
|
if (typeof e.fade != "object") return;
|
|
70
|
-
const
|
|
71
|
-
e.fade.top !== void 0 && (
|
|
71
|
+
const a = {};
|
|
72
|
+
e.fade.top !== void 0 && (a.top = e.fade.top), e.fade.right !== void 0 && (a.right = e.fade.right), e.fade.left !== void 0 && (a.left = e.fade.left), t.fade = a;
|
|
72
73
|
}
|
|
73
74
|
function $() {
|
|
74
|
-
if (!
|
|
75
|
+
if (!i.value) return;
|
|
75
76
|
if (e.fade === !1) {
|
|
76
|
-
|
|
77
|
+
i.value.setFade({ top: 0, right: 0, left: 0 });
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
79
|
-
const t = { top:
|
|
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)),
|
|
80
|
+
const t = { top: L.value };
|
|
81
|
+
typeof e.fade == "object" && (e.fade.right !== void 0 && (t.right = e.fade.right), e.fade.left !== void 0 && (t.left = e.fade.left)), i.value.setFade(t);
|
|
81
82
|
}
|
|
82
83
|
function V() {
|
|
83
84
|
f?.disconnect(), f = null;
|
|
@@ -86,62 +87,68 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
86
87
|
s.value = 0, A();
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
|
-
const
|
|
90
|
+
const a = () => {
|
|
90
91
|
s.value = t.getBoundingClientRect().height, A();
|
|
91
92
|
};
|
|
92
|
-
|
|
93
|
+
a(), f = new ResizeObserver(a), f.observe(t);
|
|
93
94
|
}
|
|
94
95
|
function H(t) {
|
|
95
|
-
t.on("pointClick", (
|
|
96
|
-
const
|
|
97
|
-
t.on("viewportChange",
|
|
96
|
+
t.on("pointClick", (r) => e.onPointClick?.(r)), t.on("pointDoubleClick", (r) => e.onPointDoubleClick?.(r)), t.on("seriesHover", (r) => e.onSeriesHover?.(r)), t.on("crosshairMove", (r) => e.onCrosshairMove?.(r));
|
|
97
|
+
const a = () => e.onVisibleRangeChange?.(t.getVisibleRange());
|
|
98
|
+
t.on("viewportChange", a), t.on("dataUpdate", a), t.on("seriesChange", a);
|
|
98
99
|
}
|
|
99
100
|
G(async () => {
|
|
100
101
|
if (!u.value) return;
|
|
101
102
|
const t = {};
|
|
102
|
-
e.axis && (t.axis = e.axis), e.theme && (t.theme = e.theme), e.padding && (t.padding = e.padding), e.viewport && (t.viewport = e.viewport), e.interactive !== void 0 && (t.interactive = e.interactive), e.grid !== void 0 && (t.grid = e.grid),
|
|
103
|
+
e.axis && (t.axis = e.axis), e.scales && (t.scales = e.scales), 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), v !== void 0 && (t.perf = v), p && (t.onEdgeReached = p), e.animations !== void 0 && (t.animations = e.animations), M(t), i.value = new P(u.value, t), H(i.value), e.onReady?.(i.value), await g(), V();
|
|
103
104
|
}), I(() => {
|
|
104
|
-
f?.disconnect(), f = null,
|
|
105
|
-
}),
|
|
105
|
+
f?.disconnect(), f = null, i.value?.destroy(), i.value = null;
|
|
106
|
+
}), o(
|
|
106
107
|
() => e.headerLayout,
|
|
107
108
|
async () => {
|
|
108
|
-
|
|
109
|
+
i.value && (await g(), V());
|
|
109
110
|
}
|
|
110
|
-
),
|
|
111
|
+
), o(
|
|
111
112
|
() => e.theme,
|
|
112
113
|
(t) => {
|
|
113
|
-
|
|
114
|
+
i.value && t && (i.value.setTheme(t), x.value = t);
|
|
114
115
|
}
|
|
115
|
-
),
|
|
116
|
+
), o(
|
|
116
117
|
() => e.axis,
|
|
117
118
|
(t) => {
|
|
118
|
-
|
|
119
|
+
i.value && t && i.value.setAxis(t);
|
|
119
120
|
},
|
|
120
121
|
{ deep: !0 }
|
|
121
|
-
),
|
|
122
|
+
), o(
|
|
123
|
+
() => e.scales,
|
|
124
|
+
(t) => {
|
|
125
|
+
i.value?.setScales(t);
|
|
126
|
+
},
|
|
127
|
+
{ deep: !0 }
|
|
128
|
+
), o(
|
|
122
129
|
() => e.grid?.visible,
|
|
123
130
|
() => {
|
|
124
|
-
|
|
131
|
+
i.value && e.grid !== void 0 && i.value.setGrid(e.grid);
|
|
125
132
|
}
|
|
126
133
|
);
|
|
127
134
|
let K = e.animations;
|
|
128
|
-
|
|
135
|
+
o(
|
|
129
136
|
() => e.animations,
|
|
130
137
|
async (t) => {
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
e.axis && (
|
|
138
|
+
if (S(t, K) || (K = t, !i.value || !u.value)) return;
|
|
139
|
+
i.value.destroy(), i.value = null, await g();
|
|
140
|
+
const a = {};
|
|
141
|
+
e.axis && (a.axis = e.axis), e.scales && (a.scales = e.scales), e.theme && (a.theme = e.theme), e.padding && (a.padding = e.padding), e.viewport && (a.viewport = e.viewport), e.interactive !== void 0 && (a.interactive = e.interactive), e.grid !== void 0 && (a.grid = e.grid), v !== void 0 && (a.perf = v), p && (a.onEdgeReached = p), t !== void 0 && (a.animations = t), M(a), i.value = new P(u.value, a), H(i.value), e.onReady?.(i.value);
|
|
135
142
|
}
|
|
136
143
|
);
|
|
137
|
-
let
|
|
138
|
-
|
|
139
|
-
() => [
|
|
140
|
-
async ([t,
|
|
141
|
-
!t ||
|
|
144
|
+
let h;
|
|
145
|
+
o(
|
|
146
|
+
() => [i.value, e.visibleRange],
|
|
147
|
+
async ([t, a]) => {
|
|
148
|
+
!t || a === void 0 || h !== void 0 && h.instance === t && S(h.spec, a) || (h = { instance: t, spec: a }, await g(), t.setVisibleRange(a));
|
|
142
149
|
},
|
|
143
150
|
{ immediate: !0 }
|
|
144
|
-
),
|
|
151
|
+
), o(
|
|
145
152
|
() => [
|
|
146
153
|
e.padding?.top,
|
|
147
154
|
e.padding?.bottom,
|
|
@@ -150,29 +157,29 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
150
157
|
j.value
|
|
151
158
|
],
|
|
152
159
|
A
|
|
153
|
-
),
|
|
154
|
-
const N =
|
|
155
|
-
const t = x.value, [
|
|
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, ${
|
|
160
|
+
), o(() => [i.value, L.value, e.fade], $, { immediate: !0 });
|
|
161
|
+
const N = c(() => {
|
|
162
|
+
const t = x.value, [a, r] = t?.chartGradient ?? ["transparent", "transparent"], D = t?.background ?? "transparent";
|
|
163
|
+
return `position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 240px; overflow: hidden; background: ${e.gradient ? `linear-gradient(to bottom, ${a} 0%, ${D} 70%, ${r} 100%)` : D}`;
|
|
157
164
|
});
|
|
158
|
-
return (t,
|
|
165
|
+
return (t, a) => (y(), m("div", {
|
|
159
166
|
style: q(N.value)
|
|
160
167
|
}, [
|
|
161
|
-
|
|
162
|
-
|
|
168
|
+
n("div", ie, [
|
|
169
|
+
n("div", oe, [
|
|
163
170
|
b.headerLayout === "inline" ? (y(), m("div", ne, [
|
|
164
|
-
|
|
171
|
+
n("div", {
|
|
165
172
|
ref_key: "titleAnchor",
|
|
166
173
|
ref: R,
|
|
167
174
|
"data-chart-title-anchor": ""
|
|
168
175
|
}, null, 512),
|
|
169
|
-
|
|
176
|
+
n("div", {
|
|
170
177
|
ref_key: "infoBarAnchor",
|
|
171
178
|
ref: k,
|
|
172
179
|
"data-tooltip-legend-anchor": ""
|
|
173
180
|
}, null, 512)
|
|
174
181
|
])) : w("", !0),
|
|
175
|
-
|
|
182
|
+
n("div", {
|
|
176
183
|
ref_key: "containerRef",
|
|
177
184
|
ref: u,
|
|
178
185
|
style: { position: "relative", flex: "1", "min-width": "0", "min-height": "0", overflow: "hidden" }
|
|
@@ -184,36 +191,36 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
184
191
|
"data-chart-top-overlay": "",
|
|
185
192
|
style: { position: "absolute", top: "0", left: "0", right: "0", "z-index": "2", "pointer-events": "none", display: "flex", "flex-direction": "column" }
|
|
186
193
|
}, [
|
|
187
|
-
|
|
194
|
+
n("div", {
|
|
188
195
|
ref_key: "titleAnchor",
|
|
189
196
|
ref: R,
|
|
190
197
|
"data-chart-title-anchor": ""
|
|
191
198
|
}, null, 512),
|
|
192
|
-
|
|
199
|
+
n("div", {
|
|
193
200
|
ref_key: "infoBarAnchor",
|
|
194
201
|
ref: k,
|
|
195
202
|
"data-tooltip-legend-anchor": ""
|
|
196
203
|
}, null, 512)
|
|
197
204
|
], 512)) : w("", !0),
|
|
198
|
-
|
|
205
|
+
i.value ? (y(), m("div", re, [
|
|
199
206
|
J(t.$slots, "default")
|
|
200
207
|
])) : w("", !0)
|
|
201
208
|
], 512)
|
|
202
209
|
]),
|
|
203
|
-
|
|
210
|
+
n("div", {
|
|
204
211
|
ref_key: "legendRightAnchor",
|
|
205
212
|
ref: E,
|
|
206
213
|
"data-legend-right-anchor": "",
|
|
207
214
|
style: { flex: "0 0 auto" }
|
|
208
215
|
}, null, 512)
|
|
209
216
|
]),
|
|
210
|
-
|
|
217
|
+
n("div", {
|
|
211
218
|
ref_key: "legendAnchor",
|
|
212
219
|
ref: _,
|
|
213
220
|
"data-legend-anchor": "",
|
|
214
221
|
style: { flex: "0 0 auto" }
|
|
215
222
|
}, null, 512),
|
|
216
|
-
|
|
223
|
+
n("div", {
|
|
217
224
|
ref_key: "navigatorAnchor",
|
|
218
225
|
ref: B,
|
|
219
226
|
"data-navigator-anchor": "",
|
|
@@ -223,5 +230,5 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
223
230
|
}
|
|
224
231
|
});
|
|
225
232
|
export {
|
|
226
|
-
|
|
233
|
+
ve as default
|
|
227
234
|
};
|
package/dist/LineSeries.vue.js
CHANGED
|
@@ -1,50 +1,52 @@
|
|
|
1
|
-
import { defineComponent as u, ref as
|
|
2
|
-
import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as
|
|
3
|
-
import { LineSeriesDef as
|
|
1
|
+
import { defineComponent as u, ref as c, onMounted as d, onUnmounted as p, watch as n, createCommentVNode as f } from "vue";
|
|
2
|
+
import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as S } from "./core/dist/data/sync.js";
|
|
3
|
+
import { LineSeriesDef as y } from "./core/dist/series/line.js";
|
|
4
4
|
import { useChartInstance as _ } from "./context.js";
|
|
5
|
-
const
|
|
5
|
+
const T = /* @__PURE__ */ u({
|
|
6
6
|
__name: "LineSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
9
9
|
options: {},
|
|
10
10
|
id: {},
|
|
11
|
-
visible: { type: Boolean, default: !0 }
|
|
11
|
+
visible: { type: Boolean, default: !0 },
|
|
12
|
+
scale: {}
|
|
12
13
|
},
|
|
13
14
|
setup(l) {
|
|
14
|
-
const a = l,
|
|
15
|
+
const a = l, r = _(), s = c(null);
|
|
15
16
|
let i = [];
|
|
16
17
|
function o(e, t) {
|
|
17
|
-
i =
|
|
18
|
+
i = S({ chart: r, id: e, data: t, prev: i });
|
|
18
19
|
}
|
|
19
20
|
return d(() => {
|
|
20
|
-
const e = m(a.data).length, t =
|
|
21
|
+
const e = m(a.data).length, t = r.addSeries(y, {
|
|
21
22
|
...a.options,
|
|
23
|
+
scale: a.scale,
|
|
22
24
|
layers: e,
|
|
23
25
|
id: a.id
|
|
24
26
|
});
|
|
25
|
-
|
|
26
|
-
}),
|
|
27
|
-
|
|
27
|
+
s.value = t, i = new Array(e).fill(v), o(t, a.data), r.setSeriesVisible(t, a.visible);
|
|
28
|
+
}), p(() => {
|
|
29
|
+
s.value && r.removeSeries(s.value);
|
|
28
30
|
}), n(
|
|
29
31
|
() => a.data,
|
|
30
32
|
(e) => {
|
|
31
|
-
const t =
|
|
33
|
+
const t = s.value;
|
|
32
34
|
t && o(t, e);
|
|
33
35
|
}
|
|
34
36
|
), n(
|
|
35
|
-
() => a.options,
|
|
36
|
-
(e) => {
|
|
37
|
-
|
|
37
|
+
() => [a.options, a.scale],
|
|
38
|
+
([e, t]) => {
|
|
39
|
+
s.value && r.updateSeriesOptions(s.value, e ? { ...e, scale: t } : { scale: t });
|
|
38
40
|
},
|
|
39
41
|
{ deep: !0 }
|
|
40
42
|
), n(
|
|
41
43
|
() => a.visible,
|
|
42
44
|
(e) => {
|
|
43
|
-
|
|
45
|
+
s.value && r.setSeriesVisible(s.value, e);
|
|
44
46
|
}
|
|
45
47
|
), (e, t) => f("", !0);
|
|
46
48
|
}
|
|
47
49
|
});
|
|
48
50
|
export {
|
|
49
|
-
|
|
51
|
+
T as default
|
|
50
52
|
};
|