@wick-charts/vue 0.6.2 → 0.6.3
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/dist/ChartContainer.vue.js +43 -37
- package/dist/LineSeries.vue.js +2 -2
- package/dist/composables.js +39 -26
- package/dist/core/dist/axis/dom-labels.js +56 -43
- package/dist/core/dist/chart/options.js +5 -5
- package/dist/core/dist/chart/scale-guards.js +26 -0
- package/dist/core/dist/chart/y-target.js +46 -19
- package/dist/core/dist/chart.js +670 -519
- package/dist/core/dist/components/crosshair.js +8 -8
- package/dist/core/dist/components/grid.js +26 -17
- package/dist/core/dist/components/marker.js +28 -28
- package/dist/core/dist/components/reference-line.js +16 -16
- package/dist/core/dist/interactions/handler.js +3 -2
- package/dist/core/dist/interactions/zoom.js +6 -5
- package/dist/core/dist/navigator/controller.js +38 -35
- package/dist/core/dist/perf/perf-hud.js +3 -3
- package/dist/core/dist/scales/log-scale.js +76 -0
- package/dist/core/dist/scales/y-scale.js +134 -35
- package/dist/core/dist/series/bar-intro.js +11 -11
- package/dist/core/dist/series/bar.js +301 -251
- package/dist/core/dist/series/base-multi-layer.js +100 -76
- package/dist/core/dist/series/candlestick.js +244 -241
- package/dist/core/dist/series/line-intro.js +18 -18
- package/dist/core/dist/series/line.js +428 -390
- package/dist/core/dist/series/scale-stack.js +25 -0
- package/dist/core/dist/tooltip-position.js +5 -5
- package/dist/index.d.ts +246 -31
- package/dist/index.js +59 -57
- package/dist/ui/Crosshair.vue.js +14 -14
- package/dist/ui/HeatmapTooltip.vue.js +6 -6
- package/dist/ui/PieTooltip.vue.js +4 -4
- package/dist/ui/TimeAxis.vue.js +23 -22
- package/dist/ui/Tooltip.vue.js +71 -69
- package/dist/ui/YAxis.vue.js +25 -24
- package/dist/ui/YLabel.vue.js +48 -48
- package/package.json +2 -2
- package/src/ChartContainer.vue +20 -8
- package/src/composables.ts +35 -1
- package/src/index.ts +5 -0
- package/src/ui/Crosshair.vue +2 -2
- package/src/ui/TimeAxis.vue +7 -4
- package/src/ui/Tooltip.vue +4 -1
- package/src/ui/YAxis.vue +5 -3
- package/src/ui/YLabel.vue +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as U, ref as
|
|
2
|
-
import { ChartInstance as
|
|
3
|
-
import { deepEqual as
|
|
1
|
+
import { defineComponent as U, ref as d, shallowRef as D, 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";
|
|
2
|
+
import { ChartInstance as F } from "./core/dist/chart.js";
|
|
3
|
+
import { deepEqual as P } from "./core/dist/utils/deep-equal.js";
|
|
4
4
|
import { catppuccin as Q } from "./core/dist/theme/themes/catppuccin.js";
|
|
5
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
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 = {
|
|
@@ -11,7 +11,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
11
11
|
key: 1,
|
|
12
12
|
"data-chart-series-overlay": "",
|
|
13
13
|
style: { position: "absolute", inset: "0", "pointer-events": "none", "z-index": "3" }
|
|
14
|
-
},
|
|
14
|
+
}, z = 24, ce = /* @__PURE__ */ U({
|
|
15
15
|
__name: "ChartContainer",
|
|
16
16
|
props: {
|
|
17
17
|
theme: { default: () => Q.theme },
|
|
@@ -19,7 +19,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
19
19
|
padding: {},
|
|
20
20
|
viewport: {},
|
|
21
21
|
visibleRange: {},
|
|
22
|
-
gradient: { type: Boolean, default: !
|
|
22
|
+
gradient: { type: Boolean, default: !1 },
|
|
23
23
|
interactive: { type: Boolean, default: !0 },
|
|
24
24
|
grid: {},
|
|
25
25
|
fade: { type: [Boolean, Object], default: void 0 },
|
|
@@ -35,24 +35,30 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
35
35
|
onCrosshairMove: {}
|
|
36
36
|
},
|
|
37
37
|
setup(b) {
|
|
38
|
-
const e = b,
|
|
38
|
+
const e = b, u = d(), a = D(null), x = D(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
39
|
l(W, a), l(X, x), l(Y, R), l(Z, k), l(ee, _), l(te, E), l(ie, B);
|
|
40
40
|
let f = null;
|
|
41
|
-
const
|
|
41
|
+
const s = d(0);
|
|
42
|
+
r(
|
|
43
|
+
() => [a.value, e.headerLayout === "overlay" ? s.value : 0],
|
|
44
|
+
([t, i]) => t?.setHeaderHeight(i),
|
|
45
|
+
{ immediate: !0 }
|
|
46
|
+
);
|
|
47
|
+
const 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
48
|
if (!O.value) return 0;
|
|
43
49
|
const t = typeof e.fade == "object" ? e.fade.overlap : void 0;
|
|
44
|
-
return t !== void 0 ? Math.max(0, t) :
|
|
45
|
-
}),
|
|
50
|
+
return t !== void 0 ? Math.max(0, t) : s.value / 2;
|
|
51
|
+
}), L = v(() => {
|
|
46
52
|
if (!O.value) return 0;
|
|
47
53
|
if (typeof e.fade == "object" && e.fade.top !== void 0) return e.fade.top;
|
|
48
|
-
const t = e.headerLayout === "overlay" ?
|
|
49
|
-
return t > 0 ? t +
|
|
50
|
-
}),
|
|
51
|
-
() => e.headerLayout === "overlay" ? Math.max(0,
|
|
54
|
+
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
|
|
52
58
|
);
|
|
53
59
|
function A() {
|
|
54
60
|
if (!a.value) return;
|
|
55
|
-
const i = { top: (e.padding?.top ?? 20) +
|
|
61
|
+
const i = { top: (e.padding?.top ?? 20) + j.value };
|
|
56
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);
|
|
57
63
|
}
|
|
58
64
|
function M(t) {
|
|
@@ -70,84 +76,84 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
70
76
|
a.value.setFade({ top: 0, right: 0, left: 0 });
|
|
71
77
|
return;
|
|
72
78
|
}
|
|
73
|
-
const t = { top:
|
|
79
|
+
const t = { top: L.value };
|
|
74
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);
|
|
75
81
|
}
|
|
76
82
|
function V() {
|
|
77
83
|
f?.disconnect(), f = null;
|
|
78
84
|
const t = e.headerLayout === "overlay" ? C.value : null;
|
|
79
85
|
if (!t) {
|
|
80
|
-
|
|
86
|
+
s.value = 0, A();
|
|
81
87
|
return;
|
|
82
88
|
}
|
|
83
89
|
const i = () => {
|
|
84
|
-
|
|
90
|
+
s.value = t.getBoundingClientRect().height, A();
|
|
85
91
|
};
|
|
86
92
|
i(), f = new ResizeObserver(i), f.observe(t);
|
|
87
93
|
}
|
|
88
|
-
function
|
|
94
|
+
function H(t) {
|
|
89
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));
|
|
90
96
|
const i = () => e.onVisibleRangeChange?.(t.getVisibleRange());
|
|
91
97
|
t.on("viewportChange", i), t.on("dataUpdate", i), t.on("seriesChange", i);
|
|
92
98
|
}
|
|
93
99
|
G(async () => {
|
|
94
|
-
if (!
|
|
100
|
+
if (!u.value) return;
|
|
95
101
|
const t = {};
|
|
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),
|
|
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 F(u.value, t), H(a.value), e.onReady?.(a.value), await g(), V();
|
|
97
103
|
}), I(() => {
|
|
98
104
|
f?.disconnect(), f = null, a.value?.destroy(), a.value = null;
|
|
99
|
-
}),
|
|
105
|
+
}), r(
|
|
100
106
|
() => e.headerLayout,
|
|
101
107
|
async () => {
|
|
102
108
|
a.value && (await g(), V());
|
|
103
109
|
}
|
|
104
|
-
),
|
|
110
|
+
), r(
|
|
105
111
|
() => e.theme,
|
|
106
112
|
(t) => {
|
|
107
113
|
a.value && t && (a.value.setTheme(t), x.value = t);
|
|
108
114
|
}
|
|
109
|
-
),
|
|
115
|
+
), r(
|
|
110
116
|
() => e.axis,
|
|
111
117
|
(t) => {
|
|
112
118
|
a.value && t && a.value.setAxis(t);
|
|
113
119
|
},
|
|
114
120
|
{ deep: !0 }
|
|
115
|
-
),
|
|
121
|
+
), r(
|
|
116
122
|
() => e.grid?.visible,
|
|
117
123
|
() => {
|
|
118
124
|
a.value && e.grid !== void 0 && a.value.setGrid(e.grid);
|
|
119
125
|
}
|
|
120
126
|
);
|
|
121
|
-
let
|
|
122
|
-
|
|
127
|
+
let K = e.animations;
|
|
128
|
+
r(
|
|
123
129
|
() => e.animations,
|
|
124
130
|
async (t) => {
|
|
125
|
-
if (
|
|
131
|
+
if (P(t, K) || (K = t, !a.value || !u.value)) return;
|
|
126
132
|
a.value.destroy(), a.value = null, await g();
|
|
127
133
|
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),
|
|
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 F(u.value, i), H(a.value), e.onReady?.(a.value);
|
|
129
135
|
}
|
|
130
136
|
);
|
|
131
|
-
let
|
|
132
|
-
|
|
137
|
+
let p;
|
|
138
|
+
r(
|
|
133
139
|
() => [a.value, e.visibleRange],
|
|
134
140
|
async ([t, i]) => {
|
|
135
|
-
!t || i === void 0 ||
|
|
141
|
+
!t || i === void 0 || p !== void 0 && p.instance === t && P(p.spec, i) || (p = { instance: t, spec: i }, await g(), t.setVisibleRange(i));
|
|
136
142
|
},
|
|
137
143
|
{ immediate: !0 }
|
|
138
|
-
),
|
|
144
|
+
), r(
|
|
139
145
|
() => [
|
|
140
146
|
e.padding?.top,
|
|
141
147
|
e.padding?.bottom,
|
|
142
148
|
typeof e.padding?.right == "object" ? e.padding.right.intervals : e.padding?.right,
|
|
143
149
|
typeof e.padding?.left == "object" ? e.padding.left.intervals : e.padding?.left,
|
|
144
|
-
|
|
150
|
+
j.value
|
|
145
151
|
],
|
|
146
152
|
A
|
|
147
|
-
),
|
|
153
|
+
), r(() => [a.value, L.value, e.fade], $, { immediate: !0 });
|
|
148
154
|
const N = v(() => {
|
|
149
|
-
const t = x.value, [i, n] = t?.chartGradient ?? ["transparent", "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%, ${
|
|
155
|
+
const t = x.value, [i, n] = t?.chartGradient ?? ["transparent", "transparent"], T = 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%, ${T} 70%, ${n} 100%)` : T}`;
|
|
151
157
|
});
|
|
152
158
|
return (t, i) => (y(), m("div", {
|
|
153
159
|
style: q(N.value)
|
|
@@ -168,7 +174,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
|
|
|
168
174
|
])) : w("", !0),
|
|
169
175
|
o("div", {
|
|
170
176
|
ref_key: "containerRef",
|
|
171
|
-
ref:
|
|
177
|
+
ref: u,
|
|
172
178
|
style: { position: "relative", flex: "1", "min-width": "0", "min-height": "0", overflow: "hidden" }
|
|
173
179
|
}, [
|
|
174
180
|
b.headerLayout === "overlay" ? (y(), m("div", {
|
package/dist/LineSeries.vue.js
CHANGED
|
@@ -2,7 +2,7 @@ import { defineComponent as u, ref as p, onMounted as d, onUnmounted as c, watch
|
|
|
2
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 V = /* @__PURE__ */ u({
|
|
6
6
|
__name: "LineSeries",
|
|
7
7
|
props: {
|
|
8
8
|
data: {},
|
|
@@ -46,5 +46,5 @@ const E = /* @__PURE__ */ u({
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
V as default
|
|
50
50
|
};
|
package/dist/composables.js
CHANGED
|
@@ -1,44 +1,57 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
function
|
|
3
|
-
const o =
|
|
1
|
+
import { ref as u, onMounted as a, onUnmounted as l } from "vue";
|
|
2
|
+
function x(e) {
|
|
3
|
+
const o = u(e.getVisibleRange()), n = () => {
|
|
4
4
|
o.value = e.getVisibleRange();
|
|
5
5
|
};
|
|
6
|
-
return
|
|
6
|
+
return a(() => e.on("viewportChange", n)), l(() => e.off("viewportChange", n)), o;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const o =
|
|
8
|
+
function d(e) {
|
|
9
|
+
const o = u(e.getYRange()), n = () => {
|
|
10
10
|
o.value = e.getYRange();
|
|
11
11
|
};
|
|
12
|
-
return
|
|
12
|
+
return a(() => e.on("viewportChange", n)), l(() => e.off("viewportChange", n)), o;
|
|
13
|
+
}
|
|
14
|
+
function r(e) {
|
|
15
|
+
return { yAxisPosition: e.yAxisPosition, yAxisWidth: e.yAxisWidth, xAxisHeight: e.xAxisHeight };
|
|
16
|
+
}
|
|
17
|
+
function p(e) {
|
|
18
|
+
const o = u(r(e)), n = () => {
|
|
19
|
+
const i = r(e), s = o.value;
|
|
20
|
+
s.yAxisPosition === i.yAxisPosition && s.yAxisWidth === i.yAxisWidth && s.xAxisHeight === i.xAxisHeight || (o.value = i);
|
|
21
|
+
};
|
|
22
|
+
return a(() => {
|
|
23
|
+
n(), e.on("viewportChange", n);
|
|
24
|
+
}), l(() => e.off("viewportChange", n)), o;
|
|
13
25
|
}
|
|
14
|
-
function
|
|
15
|
-
let n = e.getLastValue(o),
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
n?.value ===
|
|
26
|
+
function A(e, o) {
|
|
27
|
+
let n = e.getLastValue(o), i = n ? e.yScale.valueToY(n.value) : null;
|
|
28
|
+
const s = u(n), g = () => {
|
|
29
|
+
const t = e.getLastValue(o), v = t ? e.yScale.valueToY(t.value) : null;
|
|
30
|
+
n?.value === t?.value && n?.isLive === t?.isLive && i === v || (n = t, i = v, s.value = t);
|
|
19
31
|
};
|
|
20
|
-
return
|
|
21
|
-
e.on("dataUpdate",
|
|
22
|
-
}),
|
|
23
|
-
e.off("dataUpdate",
|
|
24
|
-
}),
|
|
32
|
+
return a(() => {
|
|
33
|
+
e.on("dataUpdate", g), e.on("viewportChange", g);
|
|
34
|
+
}), l(() => {
|
|
35
|
+
e.off("dataUpdate", g), e.off("viewportChange", g);
|
|
36
|
+
}), s;
|
|
25
37
|
}
|
|
26
38
|
function C(e, o) {
|
|
27
|
-
const n =
|
|
39
|
+
const n = u(e.getPreviousClose(o)), i = () => {
|
|
28
40
|
n.value = e.getPreviousClose(o);
|
|
29
41
|
};
|
|
30
|
-
return
|
|
42
|
+
return a(() => e.on("dataUpdate", i)), l(() => e.off("dataUpdate", i)), n;
|
|
31
43
|
}
|
|
32
|
-
function
|
|
33
|
-
const o =
|
|
44
|
+
function y(e) {
|
|
45
|
+
const o = u(e.getCrosshairPosition()), n = () => {
|
|
34
46
|
o.value = e.getCrosshairPosition();
|
|
35
47
|
};
|
|
36
|
-
return
|
|
48
|
+
return a(() => e.on("crosshairMove", n)), l(() => e.off("crosshairMove", n)), o;
|
|
37
49
|
}
|
|
38
50
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
p as useAxisLayout,
|
|
52
|
+
y as useCrosshairPosition,
|
|
53
|
+
A as useLastYValue,
|
|
41
54
|
C as usePreviousClose,
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
x as useVisibleRange,
|
|
56
|
+
d as useYRange
|
|
44
57
|
};
|
|
@@ -1,59 +1,72 @@
|
|
|
1
|
-
import { resolveAxisTextColor as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { resolveAxisTextColor as I, resolveAxisFontSize as C } from "../theme/resolve.js";
|
|
2
|
+
import { clamp as P } from "../utils/math.js";
|
|
3
|
+
const V = 0.01;
|
|
4
|
+
function E(T) {
|
|
5
|
+
const { chart: e, container: w, axis: a } = T, r = /* @__PURE__ */ new Map();
|
|
6
|
+
let p = null, m = null;
|
|
7
|
+
const x = a === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
|
|
8
|
+
function A() {
|
|
9
|
+
return a === "x" ? e.timeScale.niceTickValues(e.getDataInterval()) : { ticks: e.yScale.niceTickValues(), tickInterval: 0 };
|
|
10
|
+
}
|
|
11
|
+
function S(t, o) {
|
|
12
|
+
return a === "x" ? e.timeScale.formatX(t, o) : e.yScale.formatY(t);
|
|
13
|
+
}
|
|
14
|
+
function $(t, o) {
|
|
15
|
+
if (a === "x") {
|
|
15
16
|
t.style.left = `${e.timeScale.timeToSnappedX(o)}px`;
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
19
|
t.style.top = `${e.yScale.valueToSnappedY(o)}px`;
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
t.style.color =
|
|
21
|
+
function h(t, o) {
|
|
22
|
+
t.style.color = I(o, a), t.style.fontSize = `${C(o, a)}px`, t.style.fontFamily = o.typography.fontFamily;
|
|
23
|
+
}
|
|
24
|
+
function v(t, o) {
|
|
25
|
+
const i = o === "left" ? "left" : "right", n = o === "left" ? "right" : "left";
|
|
26
|
+
t.style[i] = "8px", t.style[n] = "";
|
|
27
|
+
}
|
|
28
|
+
function F(t, o) {
|
|
29
|
+
const i = e.headerHeight;
|
|
30
|
+
if (a !== "y" || i <= 0 || e.yAxisPosition !== "left") return 1;
|
|
31
|
+
const n = C(o, a), y = e.yScale.valueToSnappedY(t) - n / 2;
|
|
32
|
+
return P((y - i + n) / n, 0, 1);
|
|
22
33
|
}
|
|
23
|
-
function
|
|
34
|
+
function Y(t, o, i) {
|
|
24
35
|
const n = document.createElement("span");
|
|
25
|
-
return n.textContent =
|
|
26
|
-
}
|
|
27
|
-
function
|
|
28
|
-
const t = e.getTheme(), o = t !==
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
return n.textContent = S(t, o), n.style.position = "absolute", n.style.userSelect = "none", h(n, i), n.style.willChange = "opacity", a === "x" ? (n.style.transform = "translateX(-50%)", n.style.whiteSpace = "nowrap") : (v(n, e.yAxisPosition), n.style.transform = "translateY(-50%)", n.style.fontVariantNumeric = "tabular-nums"), w.appendChild(n), n;
|
|
37
|
+
}
|
|
38
|
+
function c() {
|
|
39
|
+
const t = e.getTheme(), o = t !== p;
|
|
40
|
+
p = t;
|
|
41
|
+
const i = e.yAxisPosition, n = a === "y" && i !== m;
|
|
42
|
+
m = i;
|
|
43
|
+
const { ticks: y, tickInterval: g } = A();
|
|
44
|
+
x.setCurrentTicks(y);
|
|
45
|
+
const { entries: b } = x.snapshot(), k = /* @__PURE__ */ new Set();
|
|
46
|
+
for (const { value: s, opacity: u } of b) {
|
|
47
|
+
if (u <= V) continue;
|
|
48
|
+
k.add(s);
|
|
49
|
+
let l = r.get(s);
|
|
50
|
+
if (l === void 0)
|
|
51
|
+
l = Y(s, g, t), r.set(s, l);
|
|
39
52
|
else {
|
|
40
|
-
const
|
|
41
|
-
|
|
53
|
+
const d = S(s, g);
|
|
54
|
+
l.textContent !== d && (l.textContent = d), o && h(l, t), n && v(l, i);
|
|
42
55
|
}
|
|
43
|
-
|
|
56
|
+
$(l, s), l.style.opacity = String(u * F(s, t));
|
|
44
57
|
}
|
|
45
|
-
for (const [
|
|
46
|
-
|
|
58
|
+
for (const [s, u] of r)
|
|
59
|
+
k.has(s) || (u.remove(), r.delete(s));
|
|
47
60
|
}
|
|
48
|
-
function
|
|
49
|
-
e.getAnimationState().animating ||
|
|
61
|
+
function f() {
|
|
62
|
+
e.getAnimationState().animating || c();
|
|
50
63
|
}
|
|
51
|
-
return
|
|
52
|
-
e.off("tickFrame",
|
|
53
|
-
for (const t of
|
|
54
|
-
|
|
64
|
+
return c(), e.on("tickFrame", c), e.on("viewportChange", f), e.on("overlayChange", f), () => {
|
|
65
|
+
e.off("tickFrame", c), e.off("viewportChange", f), e.off("overlayChange", f);
|
|
66
|
+
for (const t of r.values()) t.remove();
|
|
67
|
+
r.clear();
|
|
55
68
|
};
|
|
56
69
|
}
|
|
57
70
|
export {
|
|
58
|
-
|
|
71
|
+
E as mountAxisLabels
|
|
59
72
|
};
|
|
@@ -2,14 +2,14 @@ import { DEFAULT_MAX_VISIBLE_BARS as i, MIN_VISIBLE_BARS as r } from "./pan-zoom
|
|
|
2
2
|
function n(t) {
|
|
3
3
|
return t === void 0 || !Number.isFinite(t) || t <= 0 ? 0 : t;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function l(t) {
|
|
6
6
|
return {
|
|
7
7
|
top: n(t?.top),
|
|
8
8
|
right: t?.right === void 0 ? null : n(t.right),
|
|
9
|
-
left: n(t
|
|
9
|
+
left: t?.left === void 0 ? null : n(t.left)
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function a(t) {
|
|
13
13
|
if (!t) return { monitor: null, ownsMonitor: !1, hud: null };
|
|
14
14
|
if (typeof t != "object" || !("monitor" in t || "recordFrame" in t))
|
|
15
15
|
throw new Error(
|
|
@@ -39,8 +39,8 @@ function m(t) {
|
|
|
39
39
|
}
|
|
40
40
|
export {
|
|
41
41
|
u as isSameHorizontalPadding,
|
|
42
|
-
|
|
42
|
+
l as resolveFade,
|
|
43
43
|
m as resolveMaxVisibleBars,
|
|
44
44
|
f as resolvePadding,
|
|
45
|
-
|
|
45
|
+
a as resolvePerfOptions
|
|
46
46
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function o(a) {
|
|
2
|
+
if (!(a.stacking !== "percent" || a.isPlottable(0)))
|
|
3
|
+
throw new Error(
|
|
4
|
+
`[wick-charts] Series '${a.seriesId}' uses stacking: 'percent', which this Y scale can't show — a 0–100% axis starts at 0, and the scale has no position for 0. Use a linear axis, or stacking: 'normal' / 'off'.`
|
|
5
|
+
);
|
|
6
|
+
}
|
|
7
|
+
function i(a) {
|
|
8
|
+
if (process.env.NODE_ENV === "production") return;
|
|
9
|
+
const { y: n, isPlottable: t } = a;
|
|
10
|
+
for (const e of ["min", "max"]) {
|
|
11
|
+
const s = n?.[e];
|
|
12
|
+
typeof s != "number" || t(s) || console.warn(
|
|
13
|
+
`[wick-charts] axis.y.${e} is ${s}, which the Y scale can't place — falling back to 'auto'. Use a bound inside the scale's domain.`
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function r(a) {
|
|
18
|
+
process.env.NODE_ENV !== "production" && console.warn(
|
|
19
|
+
`[wick-charts] Series '${a.seriesId}' has values in view the Y scale can't place (e.g. ${a.value}; a log axis has no position for values ≤ 0). They are skipped — gaps in a line, no bar or candle. Filter or offset the data, or use a linear axis.`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
o as assertStackingFitsScale,
|
|
24
|
+
i as warnUnplottableBounds,
|
|
25
|
+
r as warnUnplottableValues
|
|
26
|
+
};
|
|
@@ -1,25 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { isPlottableOn as c } from "../scales/y-scale.js";
|
|
2
|
+
import { isTimeSeriesRenderer as d } from "../series/types.js";
|
|
3
|
+
function b(n) {
|
|
4
|
+
const { targetVisible: a, series: t, allValues: o, plottable: r } = n, e = r ? { plottable: r } : void 0;
|
|
5
|
+
let s = 1 / 0, i = -1 / 0;
|
|
6
|
+
for (const l of t) {
|
|
7
|
+
if (!l.visible || !d(l.renderer)) continue;
|
|
8
|
+
const m = l.renderer.getValueRange(a.from, a.to, e);
|
|
9
|
+
m && (r && !r(m.max) || (m.max > i && (i = m.max), m.min < s && (!r || r(m.min)) && (s = m.min), o?.push(m.min, m.max)));
|
|
8
10
|
}
|
|
9
|
-
return
|
|
11
|
+
return i === -1 / 0 ? null : (s === 1 / 0 && (s = i), { min: s, max: i });
|
|
10
12
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
function w(n) {
|
|
14
|
+
const { raw: a, bounds: t, allValues: o, transform: r } = n;
|
|
15
|
+
if (r === null)
|
|
16
|
+
return {
|
|
17
|
+
min: u(t.min, a.min, a.max, o, "min"),
|
|
18
|
+
max: u(t.max, a.max, a.min, o, "max")
|
|
19
|
+
};
|
|
20
|
+
const e = { min: r.forward(a.min), max: r.forward(a.max) };
|
|
21
|
+
return {
|
|
22
|
+
min: f({ bound: t.min, raw: a, scaledRaw: e, allValues: o, side: "min", transform: r }),
|
|
23
|
+
max: f({ bound: t.max, raw: a, scaledRaw: e, allValues: o, side: "max", transform: r })
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function f(n) {
|
|
27
|
+
const { bound: a, raw: t, scaledRaw: o, allValues: r, side: e, transform: s } = n, i = e === "min" ? "max" : "min";
|
|
28
|
+
if (typeof a == "string" && a !== "auto")
|
|
29
|
+
return u(a, o[e], o[i], [], e);
|
|
30
|
+
const l = u(a, t[e], t[i], r, e), m = c(s, l);
|
|
31
|
+
return s.forward(m ? l : t[e]);
|
|
32
|
+
}
|
|
33
|
+
function g(n, a) {
|
|
34
|
+
return a === null ? n : { min: a.inverse(n.min), max: a.inverse(n.max) };
|
|
35
|
+
}
|
|
36
|
+
function u(n, a, t, o, r) {
|
|
37
|
+
if (n === void 0 || n === "auto") return a;
|
|
38
|
+
if (typeof n == "number") return n;
|
|
39
|
+
if (typeof n == "function") return n(o);
|
|
40
|
+
const e = String(n).match(/^([+-]?)\s*(\d+(?:\.\d+)?)\s*%$/);
|
|
41
|
+
if (e) {
|
|
42
|
+
const s = e[1] === "-" ? -1 : 1, i = parseFloat(e[2]) / 100, l = Math.abs(t - a) || Math.abs(a) || 1;
|
|
43
|
+
return a + s * i * l * (r === "max" ? 1 : -1);
|
|
19
44
|
}
|
|
20
|
-
return
|
|
45
|
+
return a;
|
|
21
46
|
}
|
|
22
47
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
48
|
+
b as computeTargetYRange,
|
|
49
|
+
g as fromScaleSpace,
|
|
50
|
+
u as resolveBound,
|
|
51
|
+
w as resolveYTarget
|
|
25
52
|
};
|