@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.
- package/README.md +45 -6
- package/dist/BarSeries.vue.js +26 -20
- package/dist/CandlestickSeries.vue.js +30 -24
- package/dist/ChartContainer.vue.js +125 -72
- package/dist/HeatmapSeries.vue.js +40 -0
- package/dist/HeatmapSeries.vue2.js +4 -0
- package/dist/LineSeries.vue.js +26 -20
- package/dist/PieSeries.vue.js +24 -18
- package/dist/core/dist/animation/animator.js +21 -21
- package/dist/core/dist/animation/config.js +114 -87
- package/dist/core/dist/animation/easing.js +3 -1
- package/dist/core/dist/animation/intro-wave.js +68 -0
- package/dist/core/dist/axis/dom-labels.js +13 -14
- package/dist/core/dist/chart/badge-animator.js +56 -0
- package/dist/core/dist/chart/edge-indicators.js +28 -13
- package/dist/core/dist/chart/last-value.js +18 -17
- package/dist/core/dist/chart/options.js +27 -16
- package/dist/core/dist/chart/y-target.js +13 -12
- package/dist/core/dist/chart.js +868 -441
- package/dist/core/dist/components/annotation-chip.js +28 -0
- package/dist/core/dist/components/crosshair.js +8 -6
- package/dist/core/dist/components/edge-indicator.js +58 -26
- package/dist/core/dist/components/loading-indicator.js +46 -0
- package/dist/core/dist/components/marker.js +49 -31
- package/dist/core/dist/components/reference-line.js +27 -36
- package/dist/core/dist/components/time-region.js +30 -28
- package/dist/core/dist/data/store.js +38 -19
- package/dist/core/dist/data/sync.js +60 -38
- package/dist/core/dist/heatmap-tooltip.js +16 -0
- package/dist/core/dist/interactions/handler.js +86 -46
- package/dist/core/dist/perf/perf-hud.js +5 -5
- package/dist/core/dist/scales/x-scale.js +85 -37
- package/dist/core/dist/scales/y-scale.js +38 -27
- package/dist/core/dist/series/bar-intro.js +18 -0
- package/dist/core/dist/series/bar.js +337 -205
- package/dist/core/dist/series/base-multi-layer.js +224 -96
- package/dist/core/dist/series/candlestick-intro.js +57 -0
- package/dist/core/dist/series/candlestick.js +454 -276
- package/dist/core/dist/series/heatmap.js +387 -0
- package/dist/core/dist/series/line-intro.js +85 -0
- package/dist/core/dist/series/line.js +590 -282
- package/dist/core/dist/series/painters/builtins.js +2 -2
- package/dist/core/dist/series/pie.js +396 -259
- package/dist/core/dist/series/register-builtins.js +8 -7
- package/dist/core/dist/series/types.js +6 -0
- package/dist/core/dist/series/wave-intro.js +26 -0
- package/dist/core/dist/theme/create.js +69 -63
- package/dist/core/dist/theme/themes/mint-breeze.js +2 -2
- package/dist/core/dist/theme/themes/sand-dune.js +2 -2
- package/dist/core/dist/utils/color.js +109 -34
- package/dist/core/dist/utils/deep-equal.js +18 -0
- package/dist/core/dist/utils/time.js +25 -19
- package/dist/index.d.ts +1494 -122
- package/dist/index.js +177 -130
- package/dist/ui/Crosshair.vue.js +20 -21
- package/dist/ui/HeatmapTooltip.vue.js +96 -0
- package/dist/ui/HeatmapTooltip.vue2.js +4 -0
- package/dist/ui/InfoBar.vue.js +46 -47
- package/dist/ui/Legend.vue.js +80 -79
- package/dist/ui/PieLegend.vue.js +5 -5
- package/dist/ui/PieTooltip.vue.js +77 -67
- package/dist/ui/Tooltip.vue.js +60 -60
- package/dist/ui/YAxis.vue.js +2 -2
- package/dist/ui/YLabel.vue.js +94 -61
- package/package.json +2 -2
- package/src/BarSeries.vue +23 -7
- package/src/CandlestickSeries.vue +23 -7
- package/src/ChartContainer.vue +250 -13
- package/src/HeatmapSeries.vue +69 -0
- package/src/LineSeries.vue +23 -7
- package/src/PieSeries.vue +22 -6
- package/src/index.ts +84 -3
- package/src/ui/Crosshair.vue +1 -2
- package/src/ui/HeatmapTooltip.vue +144 -0
- package/src/ui/InfoBar.vue +1 -2
- package/src/ui/Legend.vue +13 -0
- package/src/ui/Marker.vue +1 -1
- package/src/ui/PieTooltip.vue +10 -0
- package/src/ui/ReferenceLine.vue +2 -2
- package/src/ui/TimeRegion.vue +2 -2
- package/src/ui/Tooltip.vue +2 -2
- 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 |
|
|
69
|
-
| Line only |
|
|
70
|
-
| Full React |
|
|
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
|
|
package/dist/BarSeries.vue.js
CHANGED
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { toLayers as
|
|
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
|
|
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(
|
|
13
|
-
const a =
|
|
14
|
-
let
|
|
15
|
-
function
|
|
16
|
-
|
|
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
|
|
19
|
-
const e =
|
|
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,
|
|
25
|
-
}),
|
|
26
|
-
r.value &&
|
|
27
|
-
}),
|
|
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 &&
|
|
32
|
+
t && n(t, e);
|
|
32
33
|
}
|
|
33
|
-
),
|
|
34
|
+
), o(
|
|
34
35
|
() => a.options,
|
|
35
36
|
(e) => {
|
|
36
|
-
r.value && e &&
|
|
37
|
+
r.value && e && s.updateSeriesOptions(r.value, e);
|
|
37
38
|
},
|
|
38
39
|
{ deep: !0 }
|
|
39
|
-
), (
|
|
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
|
-
|
|
49
|
+
E as default
|
|
44
50
|
};
|
|
@@ -1,45 +1,51 @@
|
|
|
1
|
-
import { defineComponent as p, ref as
|
|
2
|
-
import { toLayers as
|
|
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
|
|
5
|
-
const
|
|
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(
|
|
13
|
-
const t =
|
|
14
|
-
let o =
|
|
15
|
-
function n(e,
|
|
16
|
-
const
|
|
17
|
-
|
|
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
|
|
20
|
-
const e =
|
|
20
|
+
return f(() => {
|
|
21
|
+
const e = s.addSeries(y, {
|
|
21
22
|
...t.options,
|
|
22
23
|
id: t.id,
|
|
23
|
-
label:
|
|
24
|
+
label: d(t.data)[0].label
|
|
24
25
|
});
|
|
25
|
-
a.value = e, n(e, t.data);
|
|
26
|
-
}),
|
|
27
|
-
a.value &&
|
|
28
|
-
}),
|
|
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
|
|
32
|
-
|
|
32
|
+
const i = a.value;
|
|
33
|
+
i && n(i, e);
|
|
33
34
|
}
|
|
34
|
-
),
|
|
35
|
+
), r(
|
|
35
36
|
() => t.options,
|
|
36
37
|
(e) => {
|
|
37
|
-
a.value && e &&
|
|
38
|
+
a.value && e && s.updateSeriesOptions(a.value, e);
|
|
38
39
|
},
|
|
39
40
|
{ deep: !0 }
|
|
40
|
-
), (
|
|
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
|
-
|
|
50
|
+
V as default
|
|
45
51
|
};
|
|
@@ -1,162 +1,215 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ChartInstance as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
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
|
-
},
|
|
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
|
-
},
|
|
14
|
+
}, H = 24, ce = /* @__PURE__ */ U({
|
|
14
15
|
__name: "ChartContainer",
|
|
15
16
|
props: {
|
|
16
|
-
theme: { default: () =>
|
|
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(
|
|
29
|
-
const e =
|
|
30
|
-
|
|
31
|
-
let
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
39
|
-
|
|
40
|
-
const t = e.headerLayout === "overlay" ?
|
|
76
|
+
function V() {
|
|
77
|
+
f?.disconnect(), f = null;
|
|
78
|
+
const t = e.headerLayout === "overlay" ? C.value : null;
|
|
41
79
|
if (!t) {
|
|
42
|
-
|
|
80
|
+
u.value = 0, A();
|
|
43
81
|
return;
|
|
44
82
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
83
|
+
const i = () => {
|
|
84
|
+
u.value = t.getBoundingClientRect().height, A();
|
|
47
85
|
};
|
|
48
|
-
|
|
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
|
-
|
|
51
|
-
if (!
|
|
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),
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
}),
|
|
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
|
-
|
|
102
|
+
a.value && (await g(), V());
|
|
60
103
|
}
|
|
61
|
-
),
|
|
104
|
+
), d(
|
|
62
105
|
() => e.theme,
|
|
63
106
|
(t) => {
|
|
64
|
-
|
|
107
|
+
a.value && t && (a.value.setTheme(t), x.value = t);
|
|
65
108
|
}
|
|
66
|
-
),
|
|
109
|
+
), d(
|
|
67
110
|
() => e.axis,
|
|
68
111
|
(t) => {
|
|
69
|
-
|
|
112
|
+
a.value && t && a.value.setAxis(t);
|
|
70
113
|
},
|
|
71
114
|
{ deep: !0 }
|
|
72
|
-
),
|
|
115
|
+
), d(
|
|
73
116
|
() => e.grid?.visible,
|
|
74
117
|
() => {
|
|
75
|
-
|
|
118
|
+
a.value && e.grid !== void 0 && a.value.setGrid(e.grid);
|
|
76
119
|
}
|
|
77
|
-
)
|
|
120
|
+
);
|
|
121
|
+
let D = e.animations;
|
|
122
|
+
d(
|
|
78
123
|
() => e.animations,
|
|
79
124
|
async (t) => {
|
|
80
|
-
if (!
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
e.axis && (
|
|
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
|
-
)
|
|
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
|
-
|
|
144
|
+
L.value
|
|
92
145
|
],
|
|
93
|
-
|
|
94
|
-
);
|
|
95
|
-
const
|
|
96
|
-
const t =
|
|
97
|
-
return `position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; overflow: hidden; background: ${e.gradient ? `linear-gradient(to bottom, ${
|
|
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,
|
|
100
|
-
style: N
|
|
152
|
+
return (t, i) => (y(), m("div", {
|
|
153
|
+
style: q(N.value)
|
|
101
154
|
}, [
|
|
102
|
-
o("div",
|
|
103
|
-
o("div",
|
|
104
|
-
|
|
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:
|
|
160
|
+
ref: R,
|
|
108
161
|
"data-chart-title-anchor": ""
|
|
109
162
|
}, null, 512),
|
|
110
163
|
o("div", {
|
|
111
164
|
ref_key: "infoBarAnchor",
|
|
112
|
-
ref:
|
|
165
|
+
ref: k,
|
|
113
166
|
"data-tooltip-legend-anchor": ""
|
|
114
167
|
}, null, 512)
|
|
115
|
-
])) :
|
|
168
|
+
])) : w("", !0),
|
|
116
169
|
o("div", {
|
|
117
170
|
ref_key: "containerRef",
|
|
118
|
-
ref:
|
|
171
|
+
ref: s,
|
|
119
172
|
style: { position: "relative", flex: "1", "min-width": "0", "min-height": "0", overflow: "hidden" }
|
|
120
173
|
}, [
|
|
121
|
-
|
|
174
|
+
b.headerLayout === "overlay" ? (y(), m("div", {
|
|
122
175
|
key: 0,
|
|
123
176
|
ref_key: "topOverlayRef",
|
|
124
|
-
ref:
|
|
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:
|
|
183
|
+
ref: R,
|
|
131
184
|
"data-chart-title-anchor": ""
|
|
132
185
|
}, null, 512),
|
|
133
186
|
o("div", {
|
|
134
187
|
ref_key: "infoBarAnchor",
|
|
135
|
-
ref:
|
|
188
|
+
ref: k,
|
|
136
189
|
"data-tooltip-legend-anchor": ""
|
|
137
190
|
}, null, 512)
|
|
138
|
-
], 512)) :
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
])) :
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
+
};
|
package/dist/LineSeries.vue.js
CHANGED
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { toLayers as
|
|
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
|
|
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(
|
|
13
|
-
const a =
|
|
14
|
-
let
|
|
15
|
-
function
|
|
16
|
-
|
|
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
|
|
19
|
-
const e =
|
|
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,
|
|
25
|
-
}),
|
|
26
|
-
r.value &&
|
|
27
|
-
}),
|
|
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 &&
|
|
32
|
+
t && o(t, e);
|
|
32
33
|
}
|
|
33
|
-
),
|
|
34
|
+
), n(
|
|
34
35
|
() => a.options,
|
|
35
36
|
(e) => {
|
|
36
|
-
r.value && e &&
|
|
37
|
+
r.value && e && s.updateSeriesOptions(r.value, e);
|
|
37
38
|
},
|
|
38
39
|
{ deep: !0 }
|
|
39
|
-
), (
|
|
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
|
-
|
|
49
|
+
E as default
|
|
44
50
|
};
|