@wick-charts/vue 0.7.0 → 0.8.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 +19 -3
- package/dist/BandSeries.vue.js +40 -30
- package/dist/BarSeries.vue.js +39 -29
- package/dist/CandlestickSeries.vue.js +2 -2
- package/dist/ChartContainer.vue.js +1 -1
- package/dist/LineSeries.vue.js +40 -30
- package/dist/core/dist/chart/badge-animator.js +38 -28
- package/dist/core/dist/chart.js +801 -694
- package/dist/core/dist/data/sync.js +77 -50
- package/dist/core/dist/navigator/controller.js +11 -11
- package/dist/core/dist/scales/time-ticks.js +99 -0
- package/dist/core/dist/scales/x-scale.js +33 -27
- package/dist/core/dist/series/band.js +82 -82
- package/dist/core/dist/series/bar.js +1 -1
- package/dist/core/dist/series/base-multi-layer.js +182 -152
- package/dist/core/dist/series/candlestick.js +96 -96
- package/dist/core/dist/series/line.js +297 -292
- package/dist/core/dist/snapshots.js +39 -35
- package/dist/core/dist/utils/point.js +4 -0
- package/dist/core/dist/utils/time.js +42 -26
- package/dist/index.d.ts +45 -24
- package/dist/ui/InfoBar.vue.js +13 -13
- package/dist/ui/Tooltip.vue.js +11 -11
- package/dist/ui/YLabel.vue.js +47 -47
- package/package.json +9 -3
- package/src/BandSeries.vue +16 -3
- package/src/BarSeries.vue +16 -3
- package/src/ChartContainer.vue +14 -8
- package/src/LineSeries.vue +16 -3
- package/src/ui/YLabel.vue +28 -27
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
[](https://codecov.io/gh/mo4islona/wick-charts) [](./LICENSE)
|
|
6
6
|
[](https://www.npmjs.com/package/@wick-charts/vue)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Realtime, animated charts for **React**, **Vue** and **Svelte**. Canvas-rendered, tree-shakeable, zero runtime dependencies.
|
|
9
9
|
|
|
10
10
|
[Live Demo](https://wick-charts.eeff.io/) · [Docs](https://wick-charts.eeff.io/api/chart-container/)
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- **
|
|
14
|
+
- **Chart types** — candlestick, line and area, band, bar, heatmap, pie and donut, sparkline, all from one package
|
|
15
15
|
- **Real-time streaming** — append/update at 60fps with coordinated animations
|
|
16
16
|
- **22 built-in themes** plus `createTheme()` for custom palettes
|
|
17
17
|
- **Interactive** — zoom, pan, crosshair, tooltips
|
|
@@ -49,13 +49,15 @@ const props = defineProps(['data']);
|
|
|
49
49
|
</template>
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
`ChartContainer` fills its parent (`width` and `height` are `100%`), so give the parent a height. The container also has a 240px `min-height`, so a parent with no height still shows a chart. For a smaller chart, such as a sparkline in a table row, set `min-height: 0` (`minHeight: 0` in React) in the container's `style`.
|
|
53
|
+
|
|
52
54
|
## API
|
|
53
55
|
|
|
54
56
|
Every component, prop, type, and slot context lives in the docs site:
|
|
55
57
|
|
|
56
58
|
[wick-charts.eeff.io/api/chart-container/](https://wick-charts.eeff.io/api/chart-container/)
|
|
57
59
|
|
|
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/), [Band](https://wick-charts.eeff.io/api/band-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/), …).
|
|
60
|
+
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/), [Band](https://wick-charts.eeff.io/api/band-series/), [Pie](https://wick-charts.eeff.io/api/pie-series/), [Heatmap](https://wick-charts.eeff.io/api/heatmap-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
61
|
|
|
60
62
|
## No framework? Use the engine directly
|
|
61
63
|
|
|
@@ -112,6 +114,20 @@ Tree-shaken React scenarios via `pnpm size` (esbuild, minified, browser target,
|
|
|
112
114
|
|
|
113
115
|
Upgrading across versions? See [MIGRATION.md](https://github.com/mo4islona/wick-charts/blob/main/MIGRATION.md) for per-version breaking-change notes and code snippets.
|
|
114
116
|
|
|
117
|
+
## Contributing
|
|
118
|
+
|
|
119
|
+
Bug reports, feature requests and pull requests are welcome. Open an [issue](https://github.com/mo4islona/wick-charts/issues) first for anything larger than a small fix, so we can agree on the approach.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
pnpm install
|
|
123
|
+
pnpm dev # docs site with every chart type at http://localhost:5173
|
|
124
|
+
pnpm test # unit and integration tests
|
|
125
|
+
pnpm lint # Biome
|
|
126
|
+
pnpm typecheck
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
A pull request should pass `pnpm test`, `pnpm lint` and `pnpm typecheck`, and add a test for each bug fix.
|
|
130
|
+
|
|
115
131
|
## License
|
|
116
132
|
|
|
117
133
|
MIT
|
package/dist/BandSeries.vue.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { toLayers as
|
|
3
|
-
import { BandSeriesDef as
|
|
4
|
-
import { useChartInstance as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as d, ref as f, onMounted as m, onUnmounted as v, watch as o, createCommentVNode as S } from "vue";
|
|
2
|
+
import { toLayers as c, syncLayers as y, EMPTY_SYNC_STATE as _ } from "./core/dist/data/sync.js";
|
|
3
|
+
import { BandSeriesDef as b } from "./core/dist/series/band.js";
|
|
4
|
+
import { useChartInstance as h } from "./context.js";
|
|
5
|
+
const V = /* @__PURE__ */ d({
|
|
6
6
|
__name: "BandSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
@@ -11,42 +11,52 @@ const B = /* @__PURE__ */ u({
|
|
|
11
11
|
visible: { type: Boolean, default: !0 },
|
|
12
12
|
scale: {}
|
|
13
13
|
},
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
function
|
|
18
|
-
|
|
14
|
+
setup(p) {
|
|
15
|
+
const r = p, i = h(), s = f(null);
|
|
16
|
+
let a = [], n = 0;
|
|
17
|
+
function l(e, t) {
|
|
18
|
+
a = y({ chart: i, id: e, data: t, prev: a });
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
function u(e) {
|
|
21
|
+
n = c(e).length;
|
|
22
|
+
const t = i.addSeries(b, {
|
|
23
|
+
...r.options,
|
|
24
|
+
scale: r.scale,
|
|
25
|
+
layers: n,
|
|
26
|
+
id: r.id
|
|
26
27
|
});
|
|
27
|
-
s.value = t,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
s.value = t, a = new Array(n).fill(_), l(t, e), i.setSeriesVisible(t, r.visible);
|
|
29
|
+
}
|
|
30
|
+
return m(() => {
|
|
31
|
+
u(r.data);
|
|
32
|
+
}), v(() => {
|
|
33
|
+
s.value && i.removeSeries(s.value);
|
|
34
|
+
}), o(
|
|
35
|
+
() => r.data,
|
|
32
36
|
(e) => {
|
|
33
37
|
const t = s.value;
|
|
34
|
-
|
|
38
|
+
if (t) {
|
|
39
|
+
if (c(e).length !== n) {
|
|
40
|
+
i.removeSeries(t), u(e);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
l(t, e);
|
|
44
|
+
}
|
|
35
45
|
}
|
|
36
|
-
),
|
|
37
|
-
() => [
|
|
46
|
+
), o(
|
|
47
|
+
() => [r.options, r.scale],
|
|
38
48
|
([e, t]) => {
|
|
39
|
-
s.value &&
|
|
49
|
+
s.value && i.updateSeriesOptions(s.value, e ? { ...e, scale: t } : { scale: t });
|
|
40
50
|
},
|
|
41
51
|
{ deep: !0 }
|
|
42
|
-
),
|
|
43
|
-
() =>
|
|
52
|
+
), o(
|
|
53
|
+
() => r.visible,
|
|
44
54
|
(e) => {
|
|
45
|
-
s.value &&
|
|
55
|
+
s.value && i.setSeriesVisible(s.value, e);
|
|
46
56
|
}
|
|
47
|
-
), (e, t) =>
|
|
57
|
+
), (e, t) => S("", !0);
|
|
48
58
|
}
|
|
49
59
|
});
|
|
50
60
|
export {
|
|
51
|
-
|
|
61
|
+
V as default
|
|
52
62
|
};
|
package/dist/BarSeries.vue.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { toLayers as
|
|
3
|
-
import { BarSeriesDef as
|
|
4
|
-
import { useChartInstance as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as f, ref as d, onMounted as m, onUnmounted as v, watch as o, createCommentVNode as S } from "vue";
|
|
2
|
+
import { toLayers as c, syncLayers as y, EMPTY_SYNC_STATE as _ } from "./core/dist/data/sync.js";
|
|
3
|
+
import { BarSeriesDef as b } from "./core/dist/series/bar.js";
|
|
4
|
+
import { useChartInstance as h } from "./context.js";
|
|
5
|
+
const g = /* @__PURE__ */ f({
|
|
6
6
|
__name: "BarSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
@@ -11,42 +11,52 @@ const B = /* @__PURE__ */ u({
|
|
|
11
11
|
visible: { type: Boolean, default: !0 },
|
|
12
12
|
scale: {}
|
|
13
13
|
},
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
function
|
|
18
|
-
|
|
14
|
+
setup(p) {
|
|
15
|
+
const t = p, i = h(), s = d(null);
|
|
16
|
+
let n = [], a = 0;
|
|
17
|
+
function l(e, r) {
|
|
18
|
+
n = y({ chart: i, id: e, data: r, prev: n });
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
function u(e) {
|
|
21
|
+
a = c(e).length;
|
|
22
|
+
const r = i.addSeries(b, {
|
|
23
|
+
...t.options,
|
|
24
|
+
scale: t.scale,
|
|
25
|
+
layers: a,
|
|
26
|
+
id: t.id
|
|
26
27
|
});
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
28
|
+
s.value = r, n = new Array(a).fill(_), l(r, e), i.setSeriesVisible(r, t.visible);
|
|
29
|
+
}
|
|
30
|
+
return m(() => {
|
|
31
|
+
u(t.data);
|
|
32
|
+
}), v(() => {
|
|
33
|
+
s.value && i.removeSeries(s.value);
|
|
30
34
|
}), o(
|
|
31
|
-
() =>
|
|
35
|
+
() => t.data,
|
|
32
36
|
(e) => {
|
|
33
|
-
const
|
|
34
|
-
|
|
37
|
+
const r = s.value;
|
|
38
|
+
if (r) {
|
|
39
|
+
if (c(e).length !== a) {
|
|
40
|
+
i.removeSeries(r), u(e);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
l(r, e);
|
|
44
|
+
}
|
|
35
45
|
}
|
|
36
46
|
), o(
|
|
37
|
-
() => [
|
|
38
|
-
([e,
|
|
39
|
-
|
|
47
|
+
() => [t.options, t.scale],
|
|
48
|
+
([e, r]) => {
|
|
49
|
+
s.value && i.updateSeriesOptions(s.value, e ? { ...e, scale: r } : { scale: r });
|
|
40
50
|
},
|
|
41
51
|
{ deep: !0 }
|
|
42
52
|
), o(
|
|
43
|
-
() =>
|
|
53
|
+
() => t.visible,
|
|
44
54
|
(e) => {
|
|
45
|
-
|
|
55
|
+
s.value && i.setSeriesVisible(s.value, e);
|
|
46
56
|
}
|
|
47
|
-
), (e,
|
|
57
|
+
), (e, r) => S("", !0);
|
|
48
58
|
}
|
|
49
59
|
});
|
|
50
60
|
export {
|
|
51
|
-
|
|
61
|
+
g as default
|
|
52
62
|
};
|
|
@@ -2,7 +2,7 @@ import { defineComponent as d, ref as p, onMounted as f, onUnmounted as m, watch
|
|
|
2
2
|
import { toLayers as u, syncSeriesLayer as S, EMPTY_SYNC_STATE as b } from "./core/dist/data/sync.js";
|
|
3
3
|
import { CandlestickSeriesDef as _ } from "./core/dist/series/candlestick.js";
|
|
4
4
|
import { useChartInstance as y } from "./context.js";
|
|
5
|
-
const
|
|
5
|
+
const T = /* @__PURE__ */ d({
|
|
6
6
|
__name: "CandlestickSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
@@ -49,5 +49,5 @@ const V = /* @__PURE__ */ d({
|
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
export {
|
|
52
|
-
|
|
52
|
+
T as default
|
|
53
53
|
};
|
|
@@ -25,7 +25,7 @@ const ie = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
25
25
|
grid: {},
|
|
26
26
|
fade: { type: [Boolean, Object], default: void 0 },
|
|
27
27
|
headerLayout: { default: "overlay" },
|
|
28
|
-
animations: { type: [Boolean, Object] },
|
|
28
|
+
animations: { type: [Boolean, Object], default: void 0 },
|
|
29
29
|
perf: {},
|
|
30
30
|
onEdgeReached: {},
|
|
31
31
|
onPointClick: {},
|
package/dist/LineSeries.vue.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { toLayers as
|
|
3
|
-
import { LineSeriesDef as
|
|
4
|
-
import { useChartInstance as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as f, ref as d, onMounted as m, onUnmounted as v, watch as o, createCommentVNode as S } from "vue";
|
|
2
|
+
import { toLayers as c, syncLayers as y, EMPTY_SYNC_STATE as _ } from "./core/dist/data/sync.js";
|
|
3
|
+
import { LineSeriesDef as b } from "./core/dist/series/line.js";
|
|
4
|
+
import { useChartInstance as h } from "./context.js";
|
|
5
|
+
const g = /* @__PURE__ */ f({
|
|
6
6
|
__name: "LineSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
@@ -11,42 +11,52 @@ const T = /* @__PURE__ */ u({
|
|
|
11
11
|
visible: { type: Boolean, default: !0 },
|
|
12
12
|
scale: {}
|
|
13
13
|
},
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
let
|
|
17
|
-
function
|
|
18
|
-
|
|
14
|
+
setup(p) {
|
|
15
|
+
const r = p, i = h(), s = d(null);
|
|
16
|
+
let a = [], n = 0;
|
|
17
|
+
function l(e, t) {
|
|
18
|
+
a = y({ chart: i, id: e, data: t, prev: a });
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
function u(e) {
|
|
21
|
+
n = c(e).length;
|
|
22
|
+
const t = i.addSeries(b, {
|
|
23
|
+
...r.options,
|
|
24
|
+
scale: r.scale,
|
|
25
|
+
layers: n,
|
|
26
|
+
id: r.id
|
|
26
27
|
});
|
|
27
|
-
s.value = t,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
s.value = t, a = new Array(n).fill(_), l(t, e), i.setSeriesVisible(t, r.visible);
|
|
29
|
+
}
|
|
30
|
+
return m(() => {
|
|
31
|
+
u(r.data);
|
|
32
|
+
}), v(() => {
|
|
33
|
+
s.value && i.removeSeries(s.value);
|
|
34
|
+
}), o(
|
|
35
|
+
() => r.data,
|
|
32
36
|
(e) => {
|
|
33
37
|
const t = s.value;
|
|
34
|
-
|
|
38
|
+
if (t) {
|
|
39
|
+
if (c(e).length !== n) {
|
|
40
|
+
i.removeSeries(t), u(e);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
l(t, e);
|
|
44
|
+
}
|
|
35
45
|
}
|
|
36
|
-
),
|
|
37
|
-
() => [
|
|
46
|
+
), o(
|
|
47
|
+
() => [r.options, r.scale],
|
|
38
48
|
([e, t]) => {
|
|
39
|
-
s.value &&
|
|
49
|
+
s.value && i.updateSeriesOptions(s.value, e ? { ...e, scale: t } : { scale: t });
|
|
40
50
|
},
|
|
41
51
|
{ deep: !0 }
|
|
42
|
-
),
|
|
43
|
-
() =>
|
|
52
|
+
), o(
|
|
53
|
+
() => r.visible,
|
|
44
54
|
(e) => {
|
|
45
|
-
s.value &&
|
|
55
|
+
s.value && i.setSeriesVisible(s.value, e);
|
|
46
56
|
}
|
|
47
|
-
), (e, t) =>
|
|
57
|
+
), (e, t) => S("", !0);
|
|
48
58
|
}
|
|
49
59
|
});
|
|
50
60
|
export {
|
|
51
|
-
|
|
61
|
+
g as default
|
|
52
62
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ScalarSpring as g } from "../animation/scalar-spring.js";
|
|
2
|
-
const
|
|
2
|
+
const u = 320, m = 0.15;
|
|
3
3
|
class b {
|
|
4
4
|
#t;
|
|
5
5
|
#e;
|
|
@@ -8,53 +8,63 @@ class b {
|
|
|
8
8
|
this.#t = new g(i), this.#e = i;
|
|
9
9
|
}
|
|
10
10
|
frame(i) {
|
|
11
|
-
const { target: t, firstVisible:
|
|
12
|
-
if (
|
|
13
|
-
return this.#t.snap(t, { now:
|
|
11
|
+
const { target: t, firstVisible: s, introFront: r, now: n, glide: a = !0, countUp: l = !0, reducedMotion: f = !1 } = i;
|
|
12
|
+
if (f || !a && !l)
|
|
13
|
+
return this.#t.snap(t, { now: n }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
14
14
|
if (r < 1) {
|
|
15
|
-
const
|
|
16
|
-
return this.#t.snap(o, { now:
|
|
15
|
+
const p = s + (t - s) * r, o = l ? p : t;
|
|
16
|
+
return this.#t.snap(o, { now: n }), this.#e = o, this.#i = !0, { positionValue: o, textValue: o, opacity: this.#n(r), animating: !0 };
|
|
17
17
|
}
|
|
18
18
|
if (!this.#i)
|
|
19
|
-
return this.#t.snap(t, { now:
|
|
19
|
+
return this.#t.snap(t, { now: n }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
20
20
|
if (!a)
|
|
21
|
-
return this.#t.snap(t, { now:
|
|
22
|
-
const c = i.settleMs ??
|
|
21
|
+
return this.#t.snap(t, { now: n }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
22
|
+
const c = i.settleMs ?? u;
|
|
23
23
|
if (c <= 0)
|
|
24
|
-
return this.#t.snap(t, { now:
|
|
25
|
-
Math.abs(t - this.#e) >
|
|
26
|
-
const
|
|
27
|
-
return { positionValue: this.#t.current, textValue: t, opacity: 1, animating:
|
|
24
|
+
return this.#t.snap(t, { now: n }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
25
|
+
Math.abs(t - this.#e) > y && (this.#t.retarget(t, { now: n, settleMs: c }), this.#e = t);
|
|
26
|
+
const h = this.#t.tick(n);
|
|
27
|
+
return { positionValue: this.#t.current, textValue: t, opacity: 1, animating: h };
|
|
28
28
|
}
|
|
29
|
-
#
|
|
30
|
-
return i >= 1 ? 1 :
|
|
29
|
+
#n(i) {
|
|
30
|
+
return i >= 1 ? 1 : V(i / m);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
function
|
|
33
|
+
const y = 1e-9;
|
|
34
|
+
function V(e) {
|
|
35
35
|
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
36
36
|
}
|
|
37
37
|
function w(e) {
|
|
38
|
-
return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs:
|
|
38
|
+
return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: u } : {
|
|
39
39
|
glide: e.glide ?? !0,
|
|
40
40
|
countUp: e.countUp ?? !0,
|
|
41
|
-
settleMs: e.settleMs ??
|
|
41
|
+
settleMs: e.settleMs ?? u
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
const d = 20;
|
|
45
|
+
function x(e) {
|
|
46
|
+
if (!(e > 0)) return 6;
|
|
47
|
+
if (e >= 1e3) return 0;
|
|
48
|
+
if (e >= 10) return 2;
|
|
49
|
+
if (e >= 0.1) return 4;
|
|
50
|
+
const i = Math.ceil(-Math.log10(e));
|
|
51
|
+
return Math.min(d, Math.max(6, i + 2));
|
|
47
52
|
}
|
|
48
|
-
function S(e, i) {
|
|
53
|
+
function S(e, i, t) {
|
|
54
|
+
const { from: s } = e.getVisibleRange();
|
|
55
|
+
return e.getStackedValueAtTime(i, s) ?? t;
|
|
56
|
+
}
|
|
57
|
+
function v(e, i) {
|
|
49
58
|
if (i !== void 0) return i;
|
|
50
|
-
const t = new Set(e.getSeriesIdsByType("band")),
|
|
59
|
+
const t = new Set(e.getSeriesIdsByType("band")), s = (a) => !t.has(a), r = e.getSeriesIdsByType("time", { visibleOnly: !0, singleLayerOnly: !0 }).filter(s);
|
|
51
60
|
if (r.length > 0) return r[0];
|
|
52
|
-
const
|
|
53
|
-
return
|
|
61
|
+
const n = e.getSeriesIdsByType("time", { visibleOnly: !0 }).filter(s);
|
|
62
|
+
return n.length > 0 ? n[0] : null;
|
|
54
63
|
}
|
|
55
64
|
export {
|
|
56
65
|
b as BadgeAnimator,
|
|
57
|
-
|
|
66
|
+
S as firstVisibleValue,
|
|
58
67
|
w as resolveAnimate,
|
|
59
|
-
|
|
68
|
+
v as resolveYLabelSeriesId,
|
|
69
|
+
x as yLabelFractionDigits
|
|
60
70
|
};
|