@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.
Files changed (55) hide show
  1. package/README.md +4 -4
  2. package/dist/BandSeries.vue.js +20 -18
  3. package/dist/BarSeries.vue.js +15 -13
  4. package/dist/CandlestickSeries.vue.js +31 -29
  5. package/dist/ChartContainer.vue.js +77 -70
  6. package/dist/LineSeries.vue.js +19 -17
  7. package/dist/composables.js +46 -36
  8. package/dist/core/dist/animation/viewport-engine.js +155 -96
  9. package/dist/core/dist/axis/dom-labels.js +56 -51
  10. package/dist/core/dist/chart/scale-guards.js +23 -5
  11. package/dist/core/dist/chart/x-guards.js +37 -0
  12. package/dist/core/dist/chart.js +1286 -843
  13. package/dist/core/dist/data/sync.js +37 -31
  14. package/dist/core/dist/navigator/controller.js +37 -37
  15. package/dist/core/dist/perf/perf-hud.js +3 -3
  16. package/dist/core/dist/scales/tick-tracker.js +2 -2
  17. package/dist/core/dist/scales/x-scale.js +167 -53
  18. package/dist/core/dist/scales/y-scale.js +36 -34
  19. package/dist/core/dist/series/band.js +266 -213
  20. package/dist/core/dist/series/bar.js +297 -291
  21. package/dist/core/dist/series/base-multi-layer.js +283 -237
  22. package/dist/core/dist/series/candlestick.js +1 -0
  23. package/dist/core/dist/series/line.js +21 -20
  24. package/dist/core/dist/snapshots.js +55 -43
  25. package/dist/index.d.ts +323 -58
  26. package/dist/index.js +9 -9
  27. package/dist/ui/Crosshair.vue.js +51 -27
  28. package/dist/ui/InfoBar.vue.js +37 -37
  29. package/dist/ui/Marker.vue.js +14 -11
  30. package/dist/ui/Navigator.vue.js +23 -23
  31. package/dist/ui/ReferenceLine.vue.js +19 -16
  32. package/dist/ui/Tooltip.vue.js +91 -86
  33. package/dist/ui/XAxis.vue.js +48 -0
  34. package/dist/ui/XAxis.vue2.js +4 -0
  35. package/dist/ui/YAxis.vue.js +44 -28
  36. package/dist/ui/YLabel.vue.js +78 -74
  37. package/package.json +2 -2
  38. package/src/BandSeries.vue +11 -6
  39. package/src/BarSeries.vue +13 -6
  40. package/src/CandlestickSeries.vue +9 -5
  41. package/src/ChartContainer.vue +20 -0
  42. package/src/LineSeries.vue +13 -6
  43. package/src/composables.ts +23 -4
  44. package/src/index.ts +8 -1
  45. package/src/ui/Crosshair.vue +41 -1
  46. package/src/ui/InfoBar.vue +2 -1
  47. package/src/ui/Marker.vue +5 -1
  48. package/src/ui/Navigator.vue +2 -1
  49. package/src/ui/ReferenceLine.vue +5 -1
  50. package/src/ui/Tooltip.vue +7 -4
  51. package/src/ui/{TimeAxis.vue → XAxis.vue} +18 -5
  52. package/src/ui/YAxis.vue +66 -12
  53. package/src/ui/YLabel.vue +35 -5
  54. package/dist/ui/TimeAxis.vue.js +0 -44
  55. 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. ~72 kB gzipped, self-contained.
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 | 109.8 kB | 34.1 kB | 30.0 kB |
108
- | Line only | 125.6 kB | 38.7 kB | 33.8 kB |
109
- | Full React | 253.5 kB | 78.1 kB | 65.6 kB |
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
 
@@ -1,50 +1,52 @@
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";
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 E = /* @__PURE__ */ u({
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, s = _(), r = d(null);
15
+ const a = l, r = _(), s = d(null);
15
16
  let i = [];
16
17
  function o(e, t) {
17
- i = y({ chart: s, id: e, data: t, prev: i });
18
+ i = S({ chart: r, id: e, data: t, prev: i });
18
19
  }
19
- return p(() => {
20
- const e = m(a.data).length, t = s.addSeries(S, {
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
- 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);
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 = r.value;
33
+ const t = s.value;
32
34
  t && o(t, e);
33
35
  }
34
36
  ), n(
35
- () => a.options,
36
- (e) => {
37
- r.value && e && s.updateSeriesOptions(r.value, e);
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
- r.value && s.setSeriesVisible(r.value, e);
45
+ s.value && r.setSeriesVisible(s.value, e);
44
46
  }
45
47
  ), (e, t) => f("", !0);
46
48
  }
47
49
  });
48
50
  export {
49
- E as default
51
+ B as default
50
52
  };
@@ -1,29 +1,31 @@
1
- import { defineComponent as u, ref as p, onMounted as d, onUnmounted as c, watch as o, 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 { BarSeriesDef as S } from "./core/dist/series/bar.js";
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 E = /* @__PURE__ */ u({
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 = p(null);
15
+ const a = l, s = _(), r = c(null);
15
16
  let i = [];
16
17
  function n(e, t) {
17
- i = y({ chart: s, id: e, data: t, prev: 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(S, {
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
- }), c(() => {
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 && e && s.updateSeriesOptions(r.value, e);
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
- E as default
51
+ B as default
50
52
  };
@@ -1,49 +1,51 @@
1
- import { defineComponent as p, ref as c, onMounted as f, onUnmounted as m, watch as r, createCommentVNode as v } from "vue";
2
- import { toLayers as d, syncSeriesLayer as S, EMPTY_SYNC_STATE as b } from "./core/dist/data/sync.js";
3
- import { CandlestickSeriesDef as y } from "./core/dist/series/candlestick.js";
4
- import { useChartInstance as _ } from "./context.js";
5
- const V = /* @__PURE__ */ p({
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(u) {
14
- const t = u, s = _(), a = c(null);
14
+ setup(c) {
15
+ const a = c, r = y(), t = p(null);
15
16
  let o = b;
16
- function n(e, i) {
17
- const l = d(i)[0];
18
- s.setSeriesLabels(e, [l.label]), o = S({ chart: s, id: e, data: l.data, prev: o });
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 = s.addSeries(y, {
22
- ...t.options,
23
- id: t.id,
24
- label: d(t.data)[0].label
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
- a.value = e, n(e, t.data), s.setSeriesVisible(e, t.visible);
28
+ t.value = e, n(e, a.data), r.setSeriesVisible(e, a.visible);
27
29
  }), m(() => {
28
- a.value && s.removeSeries(a.value);
29
- }), r(
30
- () => t.data,
30
+ t.value && r.removeSeries(t.value);
31
+ }), i(
32
+ () => a.data,
31
33
  (e) => {
32
- const i = a.value;
33
- i && n(i, e);
34
+ const s = t.value;
35
+ s && n(s, e);
34
36
  }
35
- ), r(
36
- () => t.options,
37
- (e) => {
38
- a.value && e && s.updateSeriesOptions(a.value, e);
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
- ), r(
42
- () => t.visible,
43
+ ), i(
44
+ () => a.visible,
43
45
  (e) => {
44
- a.value && s.setSeriesVisible(a.value, e);
46
+ t.value && r.setSeriesVisible(t.value, e);
45
47
  }
46
- ), (e, i) => v("", !0);
48
+ ), (e, s) => v("", !0);
47
49
  }
48
50
  });
49
51
  export {
@@ -1,9 +1,9 @@
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";
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 T } from "./core/dist/utils/deep-equal.js";
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 ie } from "./context.js";
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 = {
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
- }, z = 24, ce = /* @__PURE__ */ U({
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 = 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
- l(W, a), l(X, x), l(Y, R), l(Z, k), l(ee, _), l(te, E), l(ie, B);
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 = d(0);
42
- r(
43
- () => [a.value, e.headerLayout === "overlay" ? s.value : 0],
44
- ([t, i]) => t?.setHeaderHeight(i),
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 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;
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
- }), O = v(() => {
52
- if (!L.value) return 0;
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 + z : z;
56
- }), j = v(
57
- () => e.headerLayout === "overlay" ? Math.max(0, s.value - S.value) : 0
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 (!a.value) return;
61
- const i = { top: (e.padding?.top ?? 20) + j.value };
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);
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 i = {};
71
- e.fade.top !== void 0 && (i.top = e.fade.top), e.fade.right !== void 0 && (i.right = e.fade.right), e.fade.left !== void 0 && (i.left = e.fade.left), t.fade = i;
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 (!a.value) return;
75
+ if (!i.value) return;
75
76
  if (e.fade === !1) {
76
- a.value.setFade({ top: 0, right: 0, left: 0 });
77
+ i.value.setFade({ top: 0, right: 0, left: 0 });
77
78
  return;
78
79
  }
79
- const t = { top: O.value };
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);
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 i = () => {
90
+ const a = () => {
90
91
  s.value = t.getBoundingClientRect().height, A();
91
92
  };
92
- i(), f = new ResizeObserver(i), f.observe(t);
93
+ a(), f = new ResizeObserver(a), f.observe(t);
93
94
  }
94
95
  function H(t) {
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));
96
- const i = () => e.onVisibleRangeChange?.(t.getVisibleRange());
97
- t.on("viewportChange", i), t.on("dataUpdate", i), t.on("seriesChange", i);
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), 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();
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, a.value?.destroy(), a.value = null;
105
- }), r(
105
+ f?.disconnect(), f = null, i.value?.destroy(), i.value = null;
106
+ }), o(
106
107
  () => e.headerLayout,
107
108
  async () => {
108
- a.value && (await g(), V());
109
+ i.value && (await g(), V());
109
110
  }
110
- ), r(
111
+ ), o(
111
112
  () => e.theme,
112
113
  (t) => {
113
- a.value && t && (a.value.setTheme(t), x.value = t);
114
+ i.value && t && (i.value.setTheme(t), x.value = t);
114
115
  }
115
- ), r(
116
+ ), o(
116
117
  () => e.axis,
117
118
  (t) => {
118
- a.value && t && a.value.setAxis(t);
119
+ i.value && t && i.value.setAxis(t);
119
120
  },
120
121
  { deep: !0 }
121
- ), r(
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
- a.value && e.grid !== void 0 && a.value.setGrid(e.grid);
131
+ i.value && e.grid !== void 0 && i.value.setGrid(e.grid);
125
132
  }
126
133
  );
127
134
  let K = e.animations;
128
- r(
135
+ o(
129
136
  () => e.animations,
130
137
  async (t) => {
131
- if (T(t, K) || (K = t, !a.value || !u.value)) return;
132
- a.value.destroy(), a.value = null, await g();
133
- const i = {};
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);
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 p;
138
- r(
139
- () => [a.value, e.visibleRange],
140
- async ([t, i]) => {
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));
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
- ), r(
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
- ), r(() => [a.value, O.value, e.fade], $, { immediate: !0 });
154
- const N = v(() => {
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}`;
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, i) => (y(), m("div", {
165
+ return (t, a) => (y(), m("div", {
159
166
  style: q(N.value)
160
167
  }, [
161
- o("div", ae, [
162
- o("div", oe, [
168
+ n("div", ie, [
169
+ n("div", oe, [
163
170
  b.headerLayout === "inline" ? (y(), m("div", ne, [
164
- o("div", {
171
+ n("div", {
165
172
  ref_key: "titleAnchor",
166
173
  ref: R,
167
174
  "data-chart-title-anchor": ""
168
175
  }, null, 512),
169
- o("div", {
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
- o("div", {
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
- o("div", {
194
+ n("div", {
188
195
  ref_key: "titleAnchor",
189
196
  ref: R,
190
197
  "data-chart-title-anchor": ""
191
198
  }, null, 512),
192
- o("div", {
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
- a.value ? (y(), m("div", re, [
205
+ i.value ? (y(), m("div", re, [
199
206
  J(t.$slots, "default")
200
207
  ])) : w("", !0)
201
208
  ], 512)
202
209
  ]),
203
- o("div", {
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
- o("div", {
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
- o("div", {
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
- ce as default
233
+ ve as default
227
234
  };
@@ -1,50 +1,52 @@
1
- import { defineComponent as u, ref as p, onMounted as d, 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 { LineSeriesDef as S } from "./core/dist/series/line.js";
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 E = /* @__PURE__ */ u({
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, s = _(), r = p(null);
15
+ const a = l, r = _(), s = c(null);
15
16
  let i = [];
16
17
  function o(e, t) {
17
- i = y({ chart: s, id: e, data: t, prev: 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 = s.addSeries(S, {
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
- 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);
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 = r.value;
33
+ const t = s.value;
32
34
  t && o(t, e);
33
35
  }
34
36
  ), n(
35
- () => a.options,
36
- (e) => {
37
- r.value && e && s.updateSeriesOptions(r.value, e);
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
- r.value && s.setSeriesVisible(r.value, e);
45
+ s.value && r.setSeriesVisible(s.value, e);
44
46
  }
45
47
  ), (e, t) => f("", !0);
46
48
  }
47
49
  });
48
50
  export {
49
- E as default
51
+ T as default
50
52
  };