@wick-charts/vue 0.5.1 → 0.6.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.
Files changed (82) hide show
  1. package/README.md +45 -6
  2. package/dist/BarSeries.vue.js +26 -20
  3. package/dist/CandlestickSeries.vue.js +30 -24
  4. package/dist/ChartContainer.vue.js +125 -72
  5. package/dist/HeatmapSeries.vue.js +40 -0
  6. package/dist/HeatmapSeries.vue2.js +4 -0
  7. package/dist/LineSeries.vue.js +26 -20
  8. package/dist/PieSeries.vue.js +24 -18
  9. package/dist/core/dist/animation/animator.js +21 -21
  10. package/dist/core/dist/animation/config.js +114 -87
  11. package/dist/core/dist/animation/easing.js +3 -1
  12. package/dist/core/dist/animation/intro-wave.js +68 -0
  13. package/dist/core/dist/axis/dom-labels.js +13 -14
  14. package/dist/core/dist/chart/badge-animator.js +56 -0
  15. package/dist/core/dist/chart/edge-indicators.js +28 -13
  16. package/dist/core/dist/chart/last-value.js +18 -17
  17. package/dist/core/dist/chart/options.js +27 -16
  18. package/dist/core/dist/chart/y-target.js +13 -12
  19. package/dist/core/dist/chart.js +868 -441
  20. package/dist/core/dist/components/annotation-chip.js +28 -0
  21. package/dist/core/dist/components/crosshair.js +8 -6
  22. package/dist/core/dist/components/edge-indicator.js +58 -26
  23. package/dist/core/dist/components/loading-indicator.js +46 -0
  24. package/dist/core/dist/components/marker.js +49 -31
  25. package/dist/core/dist/components/reference-line.js +27 -36
  26. package/dist/core/dist/components/time-region.js +30 -28
  27. package/dist/core/dist/data/store.js +38 -19
  28. package/dist/core/dist/data/sync.js +60 -38
  29. package/dist/core/dist/heatmap-tooltip.js +16 -0
  30. package/dist/core/dist/interactions/handler.js +86 -46
  31. package/dist/core/dist/perf/perf-hud.js +5 -5
  32. package/dist/core/dist/scales/x-scale.js +85 -37
  33. package/dist/core/dist/scales/y-scale.js +38 -27
  34. package/dist/core/dist/series/bar-intro.js +18 -0
  35. package/dist/core/dist/series/bar.js +337 -205
  36. package/dist/core/dist/series/base-multi-layer.js +224 -96
  37. package/dist/core/dist/series/candlestick-intro.js +57 -0
  38. package/dist/core/dist/series/candlestick.js +454 -276
  39. package/dist/core/dist/series/heatmap.js +387 -0
  40. package/dist/core/dist/series/line-intro.js +85 -0
  41. package/dist/core/dist/series/line.js +590 -282
  42. package/dist/core/dist/series/painters/builtins.js +2 -2
  43. package/dist/core/dist/series/pie.js +396 -259
  44. package/dist/core/dist/series/register-builtins.js +8 -7
  45. package/dist/core/dist/series/types.js +6 -0
  46. package/dist/core/dist/series/wave-intro.js +26 -0
  47. package/dist/core/dist/theme/create.js +69 -63
  48. package/dist/core/dist/theme/themes/mint-breeze.js +2 -2
  49. package/dist/core/dist/theme/themes/sand-dune.js +2 -2
  50. package/dist/core/dist/utils/color.js +109 -34
  51. package/dist/core/dist/utils/deep-equal.js +18 -0
  52. package/dist/core/dist/utils/time.js +25 -19
  53. package/dist/index.d.ts +1494 -122
  54. package/dist/index.js +177 -130
  55. package/dist/ui/Crosshair.vue.js +20 -21
  56. package/dist/ui/HeatmapTooltip.vue.js +96 -0
  57. package/dist/ui/HeatmapTooltip.vue2.js +4 -0
  58. package/dist/ui/InfoBar.vue.js +46 -47
  59. package/dist/ui/Legend.vue.js +80 -79
  60. package/dist/ui/PieLegend.vue.js +5 -5
  61. package/dist/ui/PieTooltip.vue.js +77 -67
  62. package/dist/ui/Tooltip.vue.js +60 -60
  63. package/dist/ui/YAxis.vue.js +2 -2
  64. package/dist/ui/YLabel.vue.js +94 -61
  65. package/package.json +2 -2
  66. package/src/BarSeries.vue +23 -7
  67. package/src/CandlestickSeries.vue +23 -7
  68. package/src/ChartContainer.vue +250 -13
  69. package/src/HeatmapSeries.vue +69 -0
  70. package/src/LineSeries.vue +23 -7
  71. package/src/PieSeries.vue +22 -6
  72. package/src/index.ts +84 -3
  73. package/src/ui/Crosshair.vue +1 -2
  74. package/src/ui/HeatmapTooltip.vue +144 -0
  75. package/src/ui/InfoBar.vue +1 -2
  76. package/src/ui/Legend.vue +13 -0
  77. package/src/ui/Marker.vue +1 -1
  78. package/src/ui/PieTooltip.vue +10 -0
  79. package/src/ui/ReferenceLine.vue +2 -2
  80. package/src/ui/TimeRegion.vue +2 -2
  81. package/src/ui/Tooltip.vue +2 -2
  82. package/src/ui/YLabel.vue +123 -8
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  High-performance timeseries charts for **React**, **Vue**, and **Svelte**. Canvas-rendered, tree-shakeable, zero runtime dependencies.
9
9
 
10
- [Live Demo](https://wick-charts.eeff.io/) · [Docs](https://wick-charts.eeff.io/api/chart-container)
10
+ [Live Demo](https://wick-charts.eeff.io/) · [Docs](https://wick-charts.eeff.io/api/chart-container/)
11
11
 
12
12
  ## Features
13
13
 
@@ -53,9 +53,48 @@ const props = defineProps(['data']);
53
53
 
54
54
  Every component, prop, type, and slot context lives in the docs site:
55
55
 
56
- [wick-charts.eeff.io/api/chart-container](https://wick-charts.eeff.io/api/chart-container)
56
+ [wick-charts.eeff.io/api/chart-container/](https://wick-charts.eeff.io/api/chart-container/)
57
57
 
58
- Start there for [ChartContainer](https://wick-charts.eeff.io/api/chart-container), then drill into the series ([Candlestick](https://wick-charts.eeff.io/api/candlestick-series), [Line](https://wick-charts.eeff.io/api/line-series), [Bar](https://wick-charts.eeff.io/api/bar-series), [Pie](https://wick-charts.eeff.io/api/pie-series), [Sparkline](https://wick-charts.eeff.io/api/sparkline)) and overlays ([Tooltip](https://wick-charts.eeff.io/api/tooltip), [InfoBar](https://wick-charts.eeff.io/api/info-bar), [Crosshair](https://wick-charts.eeff.io/api/crosshair), [Legend](https://wick-charts.eeff.io/api/legend), [YAxis](https://wick-charts.eeff.io/api/y-axis), [XAxis](https://wick-charts.eeff.io/api/x-axis), [Navigator](https://wick-charts.eeff.io/api/navigator), …).
58
+ Start there for [ChartContainer](https://wick-charts.eeff.io/api/chart-container/), then drill into the series ([Candlestick](https://wick-charts.eeff.io/api/candlestick-series/), [Line](https://wick-charts.eeff.io/api/line-series/), [Bar](https://wick-charts.eeff.io/api/bar-series/), [Pie](https://wick-charts.eeff.io/api/pie-series/), [Sparkline](https://wick-charts.eeff.io/api/sparkline/)) and overlays ([Tooltip](https://wick-charts.eeff.io/api/tooltip/), [InfoBar](https://wick-charts.eeff.io/api/info-bar/), [Crosshair](https://wick-charts.eeff.io/api/crosshair/), [Legend](https://wick-charts.eeff.io/api/legend/), [YAxis](https://wick-charts.eeff.io/api/y-axis/), [XAxis](https://wick-charts.eeff.io/api/x-axis/), [Navigator](https://wick-charts.eeff.io/api/navigator/), …).
59
+
60
+ ## No framework? Use the engine directly
61
+
62
+ `ChartInstance` and every series/theme/painter has no framework dependency — it's a plain canvas engine that each of `@wick-charts/react`, `@wick-charts/vue`, and `@wick-charts/svelte` bundles and re-exports in full. Any one of them is a supported vanilla entry point; you don't need React/Vue/Svelte installed to use it this way (`sideEffects: false` + per-module ESM means the framework-specific components tree-shake out when unused):
63
+
64
+ ```ts
65
+ import { CandlestickSeriesDef, ChartInstance, registerBuiltinSeries } from '@wick-charts/react';
66
+
67
+ registerBuiltinSeries();
68
+ const chart = new ChartInstance(document.getElementById('chart')!);
69
+ const seriesId = chart.addSeries(CandlestickSeriesDef, {});
70
+ chart.setSeriesData(seriesId, data);
71
+ ```
72
+
73
+ There's no separate `@wick-charts/core` package on npm — the three framework packages are the supported way to install the engine.
74
+
75
+ ### Drop-in `<script>` — no build step
76
+
77
+ For a CodePen, JSFiddle, or a plain HTML page, load the prebuilt UMD bundle from a CDN — no npm, no bundler. It exposes the whole engine (every `ChartInstance`, series def, theme, and painter) as a `WickCharts` global:
78
+
79
+ ```html
80
+ <div id="chart" style="width: 640px; height: 320px"></div>
81
+
82
+ <script src="https://cdn.jsdelivr.net/npm/@wick-charts/react/dist/wick-charts.umd.min.js"></script>
83
+ <script>
84
+ const { ChartInstance, LineSeriesDef } = WickCharts;
85
+
86
+ const chart = new ChartInstance(document.getElementById('chart'));
87
+ const id = chart.addSeries(LineSeriesDef);
88
+ chart.setLayerColors(id, ['#22c55e']);
89
+ chart.setSeriesData(id, [
90
+ { time: Date.now() - 2 * 86_400_000, value: 100 },
91
+ { time: Date.now() - 86_400_000, value: 118 },
92
+ { time: Date.now(), value: 109 },
93
+ ]);
94
+ </script>
95
+ ```
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.
59
98
 
60
99
  ## Bundle size
61
100
 
@@ -65,9 +104,9 @@ Tree-shaken React scenarios via `pnpm size` (esbuild, minified, browser target,
65
104
 
66
105
  | Scenario | Raw | Gzip | Brotli |
67
106
  |---|---:|---:|---:|
68
- | Candlestick only | 83.3 kB | 25.9 kB | 22.9 kB |
69
- | Line only | 91.3 kB | 28.3 kB | 25.0 kB |
70
- | Full React | 180.3 kB | 55.5 kB | 47.1 kB |
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 |
71
110
 
72
111
  ## Migration
73
112
 
@@ -1,44 +1,50 @@
1
- import { defineComponent as p, ref as d, onMounted as c, onUnmounted as l, watch as i, createCommentVNode as m } from "vue";
2
- import { toLayers as f, EMPTY_SYNC_STATE as v, syncLayers as y } from "./core/dist/data/sync.js";
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
3
  import { BarSeriesDef as S } from "./core/dist/series/bar.js";
4
4
  import { useChartInstance as _ } from "./context.js";
5
- const w = /* @__PURE__ */ p({
5
+ const E = /* @__PURE__ */ u({
6
6
  __name: "BarSeries",
7
7
  props: {
8
8
  data: {},
9
9
  options: {},
10
- id: {}
10
+ id: {},
11
+ visible: { type: Boolean, default: !0 }
11
12
  },
12
- setup(u) {
13
- const a = u, o = _(), r = d(null);
14
- let n = [];
15
- function s(e, t) {
16
- n = y({ chart: o, id: e, data: t, prev: n });
13
+ setup(l) {
14
+ const a = l, s = _(), r = p(null);
15
+ let i = [];
16
+ function n(e, t) {
17
+ i = y({ chart: s, id: e, data: t, prev: i });
17
18
  }
18
- return c(() => {
19
- const e = f(a.data).length, t = o.addSeries(S, {
19
+ return d(() => {
20
+ const e = m(a.data).length, t = s.addSeries(S, {
20
21
  ...a.options,
21
22
  layers: e,
22
23
  id: a.id
23
24
  });
24
- r.value = t, n = new Array(e).fill(v), s(t, a.data);
25
- }), l(() => {
26
- r.value && o.removeSeries(r.value);
27
- }), i(
25
+ r.value = t, i = new Array(e).fill(v), n(t, a.data), s.setSeriesVisible(t, a.visible);
26
+ }), c(() => {
27
+ r.value && s.removeSeries(r.value);
28
+ }), o(
28
29
  () => a.data,
29
30
  (e) => {
30
31
  const t = r.value;
31
- t && s(t, e);
32
+ t && n(t, e);
32
33
  }
33
- ), i(
34
+ ), o(
34
35
  () => a.options,
35
36
  (e) => {
36
- r.value && e && o.updateSeriesOptions(r.value, e);
37
+ r.value && e && s.updateSeriesOptions(r.value, e);
37
38
  },
38
39
  { deep: !0 }
39
- ), (e, t) => m("", !0);
40
+ ), o(
41
+ () => a.visible,
42
+ (e) => {
43
+ r.value && s.setSeriesVisible(r.value, e);
44
+ }
45
+ ), (e, t) => f("", !0);
40
46
  }
41
47
  });
42
48
  export {
43
- w as default
49
+ E as default
44
50
  };
@@ -1,45 +1,51 @@
1
- import { defineComponent as p, ref as u, onMounted as m, onUnmounted as f, watch as d, createCommentVNode as S } from "vue";
2
- import { toLayers as l, syncSeriesLayer as v, EMPTY_SYNC_STATE as _ } from "./core/dist/data/sync.js";
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
3
  import { CandlestickSeriesDef as y } from "./core/dist/series/candlestick.js";
4
- import { useChartInstance as C } from "./context.js";
5
- const k = /* @__PURE__ */ p({
4
+ import { useChartInstance as _ } from "./context.js";
5
+ const V = /* @__PURE__ */ p({
6
6
  __name: "CandlestickSeries",
7
7
  props: {
8
8
  data: {},
9
9
  options: {},
10
- id: {}
10
+ id: {},
11
+ visible: { type: Boolean, default: !0 }
11
12
  },
12
- setup(c) {
13
- const t = c, r = C(), a = u(null);
14
- let o = _;
15
- function n(e, s) {
16
- const i = l(s)[0];
17
- r.setSeriesLabels(e, [i.label]), o = v({ chart: r, id: e, data: i.data, prev: o });
13
+ setup(u) {
14
+ const t = u, s = _(), a = c(null);
15
+ 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 });
18
19
  }
19
- return m(() => {
20
- const e = r.addSeries(y, {
20
+ return f(() => {
21
+ const e = s.addSeries(y, {
21
22
  ...t.options,
22
23
  id: t.id,
23
- label: l(t.data)[0].label
24
+ label: d(t.data)[0].label
24
25
  });
25
- a.value = e, n(e, t.data);
26
- }), f(() => {
27
- a.value && r.removeSeries(a.value);
28
- }), d(
26
+ a.value = e, n(e, t.data), s.setSeriesVisible(e, t.visible);
27
+ }), m(() => {
28
+ a.value && s.removeSeries(a.value);
29
+ }), r(
29
30
  () => t.data,
30
31
  (e) => {
31
- const s = a.value;
32
- s && n(s, e);
32
+ const i = a.value;
33
+ i && n(i, e);
33
34
  }
34
- ), d(
35
+ ), r(
35
36
  () => t.options,
36
37
  (e) => {
37
- a.value && e && r.updateSeriesOptions(a.value, e);
38
+ a.value && e && s.updateSeriesOptions(a.value, e);
38
39
  },
39
40
  { deep: !0 }
40
- ), (e, s) => S("", !0);
41
+ ), r(
42
+ () => t.visible,
43
+ (e) => {
44
+ a.value && s.setSeriesVisible(a.value, e);
45
+ }
46
+ ), (e, i) => v("", !0);
41
47
  }
42
48
  });
43
49
  export {
44
- k as default
50
+ V as default
45
51
  };
@@ -1,162 +1,215 @@
1
- import { defineComponent as T, ref as a, shallowRef as O, provide as r, computed as C, onMounted as j, nextTick as b, onUnmounted as M, watch as l, openBlock as u, createElementBlock as v, normalizeStyle as N, createElementVNode as o, createCommentVNode as k, renderSlot as S } from "vue";
2
- import { ChartInstance as K } from "./core/dist/chart.js";
3
- import { catppuccin as G } from "./core/dist/theme/themes/catppuccin.js";
4
- import { ChartKey as H, ThemeKey as I, TitleAnchorKey as P, InfoBarAnchorKey as V, LegendAnchorKey as U, LegendRightAnchorKey as q, NavigatorAnchorKey as D } from "./context.js";
5
- const F = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-height": "0" } }, J = { style: { display: "flex", "flex-direction": "column", flex: "1", "min-width": "0", "min-height": "0" } }, Q = {
1
+ import { defineComponent as U, ref as r, shallowRef as P, provide as l, computed as v, onMounted as G, nextTick as g, onUnmounted as I, watch as d, openBlock as y, createElementBlock as m, normalizeStyle as q, createElementVNode as o, createCommentVNode as w, renderSlot as J } from "vue";
2
+ import { ChartInstance as T } from "./core/dist/chart.js";
3
+ import { deepEqual as z } from "./core/dist/utils/deep-equal.js";
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 = {
6
7
  key: 0,
7
8
  "data-chart-header": "",
8
9
  style: { "flex-shrink": "0", display: "flex", "flex-direction": "column", "pointer-events": "none" }
9
- }, W = {
10
+ }, re = {
10
11
  key: 1,
11
12
  "data-chart-series-overlay": "",
12
13
  style: { position: "absolute", inset: "0", "pointer-events": "none", "z-index": "3" }
13
- }, ne = /* @__PURE__ */ T({
14
+ }, H = 24, ce = /* @__PURE__ */ U({
14
15
  __name: "ChartContainer",
15
16
  props: {
16
- theme: { default: () => G.theme },
17
+ theme: { default: () => Q.theme },
17
18
  axis: {},
18
19
  padding: {},
19
20
  viewport: {},
21
+ visibleRange: {},
20
22
  gradient: { type: Boolean, default: !0 },
21
- interactive: { type: Boolean },
23
+ interactive: { type: Boolean, default: !0 },
22
24
  grid: {},
25
+ fade: { type: [Boolean, Object], default: void 0 },
23
26
  headerLayout: { default: "overlay" },
24
27
  animations: { type: [Boolean, Object] },
25
28
  perf: {},
26
- onEdgeReached: {}
29
+ onEdgeReached: {},
30
+ onPointClick: {},
31
+ onPointDoubleClick: {},
32
+ onSeriesHover: {},
33
+ onReady: {},
34
+ onVisibleRangeChange: {},
35
+ onCrosshairMove: {}
27
36
  },
28
- setup(h) {
29
- const e = h, c = a(), i = O(null), p = O(e.theme), s = e.perf, f = e.onEdgeReached, A = a(null), g = a(null), y = a(null), w = a(null), _ = a(null), R = a(null);
30
- r(H, i), r(I, p), r(P, g), r(V, y), r(U, w), r(q, _), r(D, R);
31
- let d = null;
32
- const m = a(0), B = C(() => e.headerLayout === "overlay" ? m.value : 0);
33
- function x() {
34
- if (!i.value) return;
35
- const n = { top: (e.padding?.top ?? 20) + B.value };
36
- e.padding?.bottom !== void 0 && (n.bottom = e.padding.bottom), e.padding?.right !== void 0 && (n.right = e.padding.right), e.padding?.left !== void 0 && (n.left = e.padding.left), i.value.setPadding(n);
37
+ setup(b) {
38
+ const e = b, s = r(), a = P(null), x = P(e.theme), c = e.perf, p = e.onEdgeReached, C = r(null), R = r(null), k = r(null), _ = r(null), E = r(null), B = r(null);
39
+ l(W, a), l(X, x), l(Y, R), l(Z, k), l(ee, _), l(te, E), l(ie, B);
40
+ let f = null;
41
+ const u = r(0), O = v(() => e.fade === !1 ? !1 : typeof e.fade == "object" ? e.fade.top !== void 0 || e.fade.overlap !== void 0 : e.fade === !0), S = v(() => {
42
+ if (!O.value) return 0;
43
+ const t = typeof e.fade == "object" ? e.fade.overlap : void 0;
44
+ return t !== void 0 ? Math.max(0, t) : u.value / 2;
45
+ }), j = v(() => {
46
+ if (!O.value) return 0;
47
+ if (typeof e.fade == "object" && e.fade.top !== void 0) return e.fade.top;
48
+ const t = e.headerLayout === "overlay" ? u.value : 0;
49
+ return t > 0 ? t + H : H;
50
+ }), L = v(
51
+ () => e.headerLayout === "overlay" ? Math.max(0, u.value - S.value) : 0
52
+ );
53
+ function A() {
54
+ if (!a.value) return;
55
+ const i = { top: (e.padding?.top ?? 20) + L.value };
56
+ 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);
57
+ }
58
+ function M(t) {
59
+ if (e.fade === !1) {
60
+ t.fade = { top: 0, right: 0, left: 0 };
61
+ return;
62
+ }
63
+ if (typeof e.fade != "object") return;
64
+ const i = {};
65
+ 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;
66
+ }
67
+ function $() {
68
+ if (!a.value) return;
69
+ if (e.fade === !1) {
70
+ a.value.setFade({ top: 0, right: 0, left: 0 });
71
+ return;
72
+ }
73
+ const t = { top: j.value };
74
+ 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);
37
75
  }
38
- function E() {
39
- d?.disconnect(), d = null;
40
- const t = e.headerLayout === "overlay" ? A.value : null;
76
+ function V() {
77
+ f?.disconnect(), f = null;
78
+ const t = e.headerLayout === "overlay" ? C.value : null;
41
79
  if (!t) {
42
- m.value = 0, x();
80
+ u.value = 0, A();
43
81
  return;
44
82
  }
45
- const n = () => {
46
- m.value = t.getBoundingClientRect().height, x();
83
+ const i = () => {
84
+ u.value = t.getBoundingClientRect().height, A();
47
85
  };
48
- n(), d = new ResizeObserver(n), d.observe(t);
86
+ i(), f = new ResizeObserver(i), f.observe(t);
87
+ }
88
+ function K(t) {
89
+ 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));
90
+ const i = () => e.onVisibleRangeChange?.(t.getVisibleRange());
91
+ t.on("viewportChange", i), t.on("dataUpdate", i), t.on("seriesChange", i);
49
92
  }
50
- j(async () => {
51
- if (!c.value) return;
93
+ G(async () => {
94
+ if (!s.value) return;
52
95
  const t = {};
53
- 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), s !== void 0 && (t.perf = s), f && (t.onEdgeReached = f), e.animations !== void 0 && (t.animations = e.animations), i.value = new K(c.value, t), await b(), E();
54
- }), M(() => {
55
- d?.disconnect(), d = null, i.value?.destroy(), i.value = null;
56
- }), l(
96
+ 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), p && (t.onEdgeReached = p), e.animations !== void 0 && (t.animations = e.animations), M(t), a.value = new T(s.value, t), K(a.value), e.onReady?.(a.value), await g(), V();
97
+ }), I(() => {
98
+ f?.disconnect(), f = null, a.value?.destroy(), a.value = null;
99
+ }), d(
57
100
  () => e.headerLayout,
58
101
  async () => {
59
- i.value && (await b(), E());
102
+ a.value && (await g(), V());
60
103
  }
61
- ), l(
104
+ ), d(
62
105
  () => e.theme,
63
106
  (t) => {
64
- i.value && t && (i.value.setTheme(t), p.value = t);
107
+ a.value && t && (a.value.setTheme(t), x.value = t);
65
108
  }
66
- ), l(
109
+ ), d(
67
110
  () => e.axis,
68
111
  (t) => {
69
- i.value && t && i.value.setAxis(t);
112
+ a.value && t && a.value.setAxis(t);
70
113
  },
71
114
  { deep: !0 }
72
- ), l(
115
+ ), d(
73
116
  () => e.grid?.visible,
74
117
  () => {
75
- i.value && e.grid !== void 0 && i.value.setGrid(e.grid);
118
+ a.value && e.grid !== void 0 && a.value.setGrid(e.grid);
76
119
  }
77
- ), l(
120
+ );
121
+ let D = e.animations;
122
+ d(
78
123
  () => e.animations,
79
124
  async (t) => {
80
- if (!i.value || !c.value) return;
81
- i.value.destroy(), i.value = null, await b();
82
- const n = {};
83
- e.axis && (n.axis = e.axis), e.theme && (n.theme = e.theme), e.padding && (n.padding = e.padding), e.viewport && (n.viewport = e.viewport), e.interactive !== void 0 && (n.interactive = e.interactive), e.grid !== void 0 && (n.grid = e.grid), s !== void 0 && (n.perf = s), f && (n.onEdgeReached = f), t !== void 0 && (n.animations = t), i.value = new K(c.value, n);
125
+ if (z(t, D) || (D = t, !a.value || !s.value)) return;
126
+ a.value.destroy(), a.value = null, await g();
127
+ const i = {};
128
+ 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), p && (i.onEdgeReached = p), t !== void 0 && (i.animations = t), M(i), a.value = new T(s.value, i), K(a.value), e.onReady?.(a.value);
84
129
  }
85
- ), l(
130
+ );
131
+ let h;
132
+ d(
133
+ () => [a.value, e.visibleRange],
134
+ async ([t, i]) => {
135
+ !t || i === void 0 || h !== void 0 && h.instance === t && z(h.spec, i) || (h = { instance: t, spec: i }, await g(), t.setVisibleRange(i));
136
+ },
137
+ { immediate: !0 }
138
+ ), d(
86
139
  () => [
87
140
  e.padding?.top,
88
141
  e.padding?.bottom,
89
142
  typeof e.padding?.right == "object" ? e.padding.right.intervals : e.padding?.right,
90
143
  typeof e.padding?.left == "object" ? e.padding.left.intervals : e.padding?.left,
91
- B.value
144
+ L.value
92
145
  ],
93
- x
94
- );
95
- const z = C(() => {
96
- const t = p.value, [n, $] = t?.chartGradient ?? ["transparent", "transparent"], L = t?.background ?? "transparent";
97
- return `position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; overflow: hidden; background: ${e.gradient ? `linear-gradient(to bottom, ${n} 0%, ${L} 70%, ${$} 100%)` : L}`;
146
+ A
147
+ ), d(() => [a.value, j.value, e.fade], $, { immediate: !0 });
148
+ const N = v(() => {
149
+ const t = x.value, [i, n] = t?.chartGradient ?? ["transparent", "transparent"], F = t?.background ?? "transparent";
150
+ 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%, ${F} 70%, ${n} 100%)` : F}`;
98
151
  });
99
- return (t, n) => (u(), v("div", {
100
- style: N(z.value)
152
+ return (t, i) => (y(), m("div", {
153
+ style: q(N.value)
101
154
  }, [
102
- o("div", F, [
103
- o("div", J, [
104
- h.headerLayout === "inline" ? (u(), v("div", Q, [
155
+ o("div", ae, [
156
+ o("div", oe, [
157
+ b.headerLayout === "inline" ? (y(), m("div", ne, [
105
158
  o("div", {
106
159
  ref_key: "titleAnchor",
107
- ref: g,
160
+ ref: R,
108
161
  "data-chart-title-anchor": ""
109
162
  }, null, 512),
110
163
  o("div", {
111
164
  ref_key: "infoBarAnchor",
112
- ref: y,
165
+ ref: k,
113
166
  "data-tooltip-legend-anchor": ""
114
167
  }, null, 512)
115
- ])) : k("", !0),
168
+ ])) : w("", !0),
116
169
  o("div", {
117
170
  ref_key: "containerRef",
118
- ref: c,
171
+ ref: s,
119
172
  style: { position: "relative", flex: "1", "min-width": "0", "min-height": "0", overflow: "hidden" }
120
173
  }, [
121
- h.headerLayout === "overlay" ? (u(), v("div", {
174
+ b.headerLayout === "overlay" ? (y(), m("div", {
122
175
  key: 0,
123
176
  ref_key: "topOverlayRef",
124
- ref: A,
177
+ ref: C,
125
178
  "data-chart-top-overlay": "",
126
179
  style: { position: "absolute", top: "0", left: "0", right: "0", "z-index": "2", "pointer-events": "none", display: "flex", "flex-direction": "column" }
127
180
  }, [
128
181
  o("div", {
129
182
  ref_key: "titleAnchor",
130
- ref: g,
183
+ ref: R,
131
184
  "data-chart-title-anchor": ""
132
185
  }, null, 512),
133
186
  o("div", {
134
187
  ref_key: "infoBarAnchor",
135
- ref: y,
188
+ ref: k,
136
189
  "data-tooltip-legend-anchor": ""
137
190
  }, null, 512)
138
- ], 512)) : k("", !0),
139
- i.value ? (u(), v("div", W, [
140
- S(t.$slots, "default")
141
- ])) : k("", !0)
191
+ ], 512)) : w("", !0),
192
+ a.value ? (y(), m("div", re, [
193
+ J(t.$slots, "default")
194
+ ])) : w("", !0)
142
195
  ], 512)
143
196
  ]),
144
197
  o("div", {
145
198
  ref_key: "legendRightAnchor",
146
- ref: _,
199
+ ref: E,
147
200
  "data-legend-right-anchor": "",
148
201
  style: { flex: "0 0 auto" }
149
202
  }, null, 512)
150
203
  ]),
151
204
  o("div", {
152
205
  ref_key: "legendAnchor",
153
- ref: w,
206
+ ref: _,
154
207
  "data-legend-anchor": "",
155
208
  style: { flex: "0 0 auto" }
156
209
  }, null, 512),
157
210
  o("div", {
158
211
  ref_key: "navigatorAnchor",
159
- ref: R,
212
+ ref: B,
160
213
  "data-navigator-anchor": "",
161
214
  style: { flex: "0 0 auto" }
162
215
  }, null, 512)
@@ -164,5 +217,5 @@ const F = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-h
164
217
  }
165
218
  });
166
219
  export {
167
- ne as default
220
+ ce as default
168
221
  };
@@ -0,0 +1,40 @@
1
+ import { defineComponent as o, ref as n, onMounted as u, onUnmounted as l, watch as s, createCommentVNode as d } from "vue";
2
+ import { HeatmapSeriesDef as p } from "./core/dist/series/heatmap.js";
3
+ import { useChartInstance as m } from "./context.js";
4
+ const _ = /* @__PURE__ */ o({
5
+ __name: "HeatmapSeries",
6
+ props: {
7
+ data: {},
8
+ options: {},
9
+ id: {},
10
+ visible: { type: Boolean, default: !0 }
11
+ },
12
+ setup(r) {
13
+ const a = r, i = m(), t = n(null);
14
+ return u(() => {
15
+ const e = i.addSeries(p, { ...a.options, id: a.id });
16
+ t.value = e, a.data.length > 0 && i.setSeriesData(e, a.data), i.setSeriesVisible(e, a.visible);
17
+ }), l(() => {
18
+ t.value && i.removeSeries(t.value);
19
+ }), s(
20
+ () => a.data,
21
+ (e) => {
22
+ t.value && i.setSeriesData(t.value, e);
23
+ }
24
+ ), s(
25
+ () => a.options,
26
+ (e) => {
27
+ t.value && e && i.updateSeriesOptions(t.value, e);
28
+ },
29
+ { deep: !0 }
30
+ ), s(
31
+ () => a.visible,
32
+ (e) => {
33
+ t.value && i.setSeriesVisible(t.value, e);
34
+ }
35
+ ), (e, f) => d("", !0);
36
+ }
37
+ });
38
+ export {
39
+ _ as default
40
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./HeatmapSeries.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,44 +1,50 @@
1
- import { defineComponent as p, ref as d, onMounted as c, onUnmounted as l, watch as i, createCommentVNode as m } from "vue";
2
- import { toLayers as f, EMPTY_SYNC_STATE as v, syncLayers as y } from "./core/dist/data/sync.js";
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
3
  import { LineSeriesDef as S } from "./core/dist/series/line.js";
4
4
  import { useChartInstance as _ } from "./context.js";
5
- const A = /* @__PURE__ */ p({
5
+ const E = /* @__PURE__ */ u({
6
6
  __name: "LineSeries",
7
7
  props: {
8
8
  data: {},
9
9
  options: {},
10
- id: {}
10
+ id: {},
11
+ visible: { type: Boolean, default: !0 }
11
12
  },
12
- setup(u) {
13
- const a = u, n = _(), r = d(null);
14
- let o = [];
15
- function s(e, t) {
16
- o = y({ chart: n, id: e, data: t, prev: o });
13
+ setup(l) {
14
+ const a = l, s = _(), r = p(null);
15
+ let i = [];
16
+ function o(e, t) {
17
+ i = y({ chart: s, id: e, data: t, prev: i });
17
18
  }
18
- return c(() => {
19
- const e = f(a.data).length, t = n.addSeries(S, {
19
+ return d(() => {
20
+ const e = m(a.data).length, t = s.addSeries(S, {
20
21
  ...a.options,
21
22
  layers: e,
22
23
  id: a.id
23
24
  });
24
- r.value = t, o = new Array(e).fill(v), s(t, a.data);
25
- }), l(() => {
26
- r.value && n.removeSeries(r.value);
27
- }), i(
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);
28
+ }), n(
28
29
  () => a.data,
29
30
  (e) => {
30
31
  const t = r.value;
31
- t && s(t, e);
32
+ t && o(t, e);
32
33
  }
33
- ), i(
34
+ ), n(
34
35
  () => a.options,
35
36
  (e) => {
36
- r.value && e && n.updateSeriesOptions(r.value, e);
37
+ r.value && e && s.updateSeriesOptions(r.value, e);
37
38
  },
38
39
  { deep: !0 }
39
- ), (e, t) => m("", !0);
40
+ ), n(
41
+ () => a.visible,
42
+ (e) => {
43
+ r.value && s.setSeriesVisible(r.value, e);
44
+ }
45
+ ), (e, t) => f("", !0);
40
46
  }
41
47
  });
42
48
  export {
43
- A as default
49
+ E as default
44
50
  };