@wick-charts/vue 0.8.1 → 0.8.2
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/BandSeries.vue.js +25 -24
- package/dist/BarSeries.vue.js +27 -26
- package/dist/CandlestickSeries.vue.js +25 -24
- package/dist/HeatmapSeries.vue.js +21 -20
- package/dist/LineSeries.vue.js +24 -23
- package/dist/PieSeries.vue.js +25 -24
- package/dist/composables.js +63 -36
- package/dist/core/dist/axis/dom-labels.js +64 -53
- package/dist/core/dist/chart/options.js +1 -1
- package/dist/core/dist/chart/y-target.js +38 -32
- package/dist/core/dist/chart.js +475 -439
- package/dist/core/dist/data/decimation.js +52 -51
- package/dist/core/dist/data/store.js +38 -20
- package/dist/core/dist/data/sync.js +80 -69
- package/dist/core/dist/perf/perf-hud.js +3 -3
- package/dist/core/dist/scales/tick-tracker.js +2 -1
- package/dist/core/dist/series/band.js +1 -1
- package/dist/core/dist/series/bar.js +240 -211
- package/dist/core/dist/series/base-multi-layer.js +267 -249
- package/dist/core/dist/series/candlestick.js +116 -116
- package/dist/core/dist/series/line.js +540 -455
- package/dist/core/dist/snapshots.js +96 -77
- package/dist/index.d.ts +22 -4
- package/dist/ui/InfoBar.vue.js +68 -68
- package/dist/ui/NumberFlow.vue.js +36 -27
- package/dist/ui/Tooltip.vue.js +127 -130
- package/package.json +2 -2
- package/src/BandSeries.vue +5 -3
- package/src/BarSeries.vue +5 -3
- package/src/CandlestickSeries.vue +5 -4
- package/src/ChartContainer.vue +1 -1
- package/src/HeatmapSeries.vue +5 -4
- package/src/LineSeries.vue +5 -3
- package/src/PieSeries.vue +6 -5
- package/src/composables.ts +64 -1
- package/src/ui/InfoBar.vue +11 -3
- package/src/ui/NumberFlow.vue +17 -3
- package/src/ui/Tooltip.vue +23 -12
|
@@ -1,77 +1,88 @@
|
|
|
1
|
-
import { resolveAxisTextColor as
|
|
2
|
-
import { clamp as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const { chart:
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
return
|
|
1
|
+
import { resolveAxisTextColor as P, resolveAxisFontSize as $ } from "../theme/resolve.js";
|
|
2
|
+
import { clamp as A } from "../utils/math.js";
|
|
3
|
+
const D = 0.01;
|
|
4
|
+
function N(F) {
|
|
5
|
+
const { chart: o, container: M, axis: a, scale: g } = F, c = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
let S = null, v = null;
|
|
7
|
+
function f() {
|
|
8
|
+
return o.getYScale(g);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function h() {
|
|
11
|
+
return o.getYScaleColumn(g)?.position ?? o.yAxisPosition;
|
|
12
12
|
}
|
|
13
13
|
function Y() {
|
|
14
|
-
return a === "x" ?
|
|
14
|
+
return a === "x" ? o.timeScale.niceTickValues(o.getDataInterval()) : { ticks: f().niceTickValues(), tickInterval: 0 };
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return a === "x" ?
|
|
16
|
+
function k(t, n) {
|
|
17
|
+
return a === "x" ? o.timeScale.formatX(t, n) : f().formatY(t);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function b(t, n) {
|
|
20
20
|
if (a === "x") {
|
|
21
|
-
|
|
21
|
+
o.timeScale.getType() === "category" && (t.style.maxWidth = `${o.timeScale.barWidthMedia(1)}px`), t.style.left = `${z(t, o.timeScale.timeToSnappedX(n))}px`;
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
t.style.top = `${
|
|
24
|
+
t.style.top = `${f().valueToSnappedY(n)}px`;
|
|
25
|
+
}
|
|
26
|
+
function z(t, n) {
|
|
27
|
+
if (!(n >= 0 && n <= o.timeScale.getMediaWidth())) return n;
|
|
28
|
+
const i = I(t) / 2, e = i - o.getAxisColumnWidth("left"), r = o.timeScale.getMediaWidth() + o.getAxisColumnWidth("right") - i;
|
|
29
|
+
return e > r ? n : A(n, e, r);
|
|
25
30
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
31
|
+
function I(t) {
|
|
32
|
+
const { fontSize: n, fontFamily: i, maxWidth: e } = t.style, r = `${t.textContent ?? ""}|${n}|${i}|${e}`, u = x.get(t);
|
|
33
|
+
if (u !== void 0 && u.key === r) return u.width;
|
|
34
|
+
const m = t.offsetWidth;
|
|
35
|
+
return x.set(t, { key: r, width: m }), m;
|
|
28
36
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
37
|
+
function C(t, n) {
|
|
38
|
+
t.style.color = P(n, a), t.style.fontSize = `${$(n, a)}px`, t.style.fontFamily = n.typography.fontFamily;
|
|
39
|
+
}
|
|
40
|
+
function w(t, n) {
|
|
41
|
+
const i = n === "left" ? "left" : "right", e = n === "left" ? "right" : "left";
|
|
31
42
|
t.style[i] = "8px", t.style[e] = "";
|
|
32
43
|
}
|
|
33
|
-
function
|
|
34
|
-
const i =
|
|
35
|
-
if (a !== "y" || i <= 0 ||
|
|
36
|
-
const e =
|
|
37
|
-
return
|
|
44
|
+
function V(t, n) {
|
|
45
|
+
const i = o.headerHeight;
|
|
46
|
+
if (a !== "y" || i <= 0 || h() !== "left") return 1;
|
|
47
|
+
const e = $(n, a), r = f().valueToSnappedY(t) - e / 2;
|
|
48
|
+
return A((r - i + e) / e, 0, 1);
|
|
38
49
|
}
|
|
39
|
-
function
|
|
50
|
+
function X(t, n, i) {
|
|
40
51
|
const e = document.createElement("span");
|
|
41
|
-
return e.textContent =
|
|
52
|
+
return e.textContent = k(t, n), e.style.position = "absolute", e.style.userSelect = "none", C(e, i), e.style.willChange = "opacity", a === "x" ? (e.style.transform = "translateX(-50%)", e.style.whiteSpace = "nowrap", o.timeScale.getType() === "category" && (e.style.overflow = "hidden", e.style.textOverflow = "ellipsis")) : (w(e, h()), e.style.transform = "translateY(-50%)", e.style.fontVariantNumeric = "tabular-nums"), M.appendChild(e), e;
|
|
42
53
|
}
|
|
43
|
-
function
|
|
44
|
-
const t =
|
|
45
|
-
|
|
46
|
-
const i =
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const { entries:
|
|
51
|
-
for (const { value: l, opacity:
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
let
|
|
55
|
-
if (
|
|
56
|
-
|
|
54
|
+
function y() {
|
|
55
|
+
const t = o.getTheme(), n = t !== S;
|
|
56
|
+
S = t;
|
|
57
|
+
const i = h(), e = a === "y" && i !== v;
|
|
58
|
+
v = i;
|
|
59
|
+
const r = a === "x" ? o.timeScale.tickTracker : f().tickTracker, { ticks: u, tickInterval: m } = Y();
|
|
60
|
+
r.setCurrentTicks(u);
|
|
61
|
+
const { entries: E } = r.snapshot(), T = /* @__PURE__ */ new Set();
|
|
62
|
+
for (const { value: l, opacity: d } of E) {
|
|
63
|
+
if (d <= D) continue;
|
|
64
|
+
T.add(l);
|
|
65
|
+
let s = c.get(l);
|
|
66
|
+
if (s === void 0)
|
|
67
|
+
s = X(l, m, t), c.set(l, s);
|
|
57
68
|
else {
|
|
58
|
-
const
|
|
59
|
-
|
|
69
|
+
const W = k(l, m);
|
|
70
|
+
s.textContent !== W && (s.textContent = W), n && C(s, t), e && w(s, i);
|
|
60
71
|
}
|
|
61
|
-
|
|
72
|
+
b(s, l), s.style.opacity = String(d * V(l, t));
|
|
62
73
|
}
|
|
63
|
-
for (const [l,
|
|
64
|
-
|
|
74
|
+
for (const [l, d] of c)
|
|
75
|
+
T.has(l) || (d.remove(), c.delete(l));
|
|
65
76
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
77
|
+
function p() {
|
|
78
|
+
o.getAnimationState().animating || y();
|
|
68
79
|
}
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
for (const t of
|
|
72
|
-
|
|
80
|
+
return y(), o.on("tickFrame", y), o.on("viewportChange", p), o.on("overlayChange", p), () => {
|
|
81
|
+
o.off("tickFrame", y), o.off("viewportChange", p), o.off("overlayChange", p);
|
|
82
|
+
for (const t of c.values()) t.remove();
|
|
83
|
+
c.clear();
|
|
73
84
|
};
|
|
74
85
|
}
|
|
75
86
|
export {
|
|
76
|
-
|
|
87
|
+
N as mountAxisLabels
|
|
77
88
|
};
|
|
@@ -1,52 +1,58 @@
|
|
|
1
1
|
import { isPlottableOn as c } from "../scales/y-scale.js";
|
|
2
|
-
import { isTimeSeriesRenderer as
|
|
3
|
-
function
|
|
4
|
-
const { targetVisible:
|
|
2
|
+
import { isTimeSeriesRenderer as x } from "../series/types.js";
|
|
3
|
+
function p(a) {
|
|
4
|
+
const { targetVisible: n, series: t, allValues: m, plottable: r } = a, e = r ? { plottable: r } : void 0;
|
|
5
5
|
let s = 1 / 0, i = -1 / 0;
|
|
6
6
|
for (const l of t) {
|
|
7
|
-
if (!l.visible || !
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
if (!l.visible || !x(l.renderer)) continue;
|
|
8
|
+
const o = l.renderer.getValueRange(n.from, n.to, e);
|
|
9
|
+
o && (r && !r(o.max) || (o.max > i && (i = o.max), o.min < s && (!r || r(o.min)) && (s = o.min), m?.push(o.min, o.max)));
|
|
10
10
|
}
|
|
11
11
|
return i === -1 / 0 ? null : (s === 1 / 0 && (s = i), { min: s, max: i });
|
|
12
12
|
}
|
|
13
|
-
function w(
|
|
14
|
-
|
|
13
|
+
function w(a) {
|
|
14
|
+
if (a.max !== a.min) return a;
|
|
15
|
+
const n = a.min === 0 ? 1 : Math.abs(a.min) * 0.05;
|
|
16
|
+
return { min: a.min - n, max: a.max + n };
|
|
17
|
+
}
|
|
18
|
+
function g(a) {
|
|
19
|
+
const { raw: n, bounds: t, allValues: m, transform: r } = a;
|
|
15
20
|
if (r === null)
|
|
16
21
|
return {
|
|
17
|
-
min: u(t.min,
|
|
18
|
-
max: u(t.max,
|
|
22
|
+
min: u(t.min, n.min, n.max, m, "min"),
|
|
23
|
+
max: u(t.max, n.max, n.min, m, "max")
|
|
19
24
|
};
|
|
20
|
-
const e = { min: r.forward(
|
|
25
|
+
const e = { min: r.forward(n.min), max: r.forward(n.max) };
|
|
21
26
|
return {
|
|
22
|
-
min: f({ bound: t.min, raw:
|
|
23
|
-
max: f({ bound: t.max, raw:
|
|
27
|
+
min: f({ bound: t.min, raw: n, scaledRaw: e, allValues: m, side: "min", transform: r }),
|
|
28
|
+
max: f({ bound: t.max, raw: n, scaledRaw: e, allValues: m, side: "max", transform: r })
|
|
24
29
|
};
|
|
25
30
|
}
|
|
26
|
-
function f(
|
|
27
|
-
const { bound:
|
|
28
|
-
if (typeof
|
|
29
|
-
return u(
|
|
30
|
-
const l = u(
|
|
31
|
-
return s.forward(
|
|
31
|
+
function f(a) {
|
|
32
|
+
const { bound: n, raw: t, scaledRaw: m, allValues: r, side: e, transform: s } = a, i = e === "min" ? "max" : "min";
|
|
33
|
+
if (typeof n == "string" && n !== "auto")
|
|
34
|
+
return u(n, m[e], m[i], [], e);
|
|
35
|
+
const l = u(n, t[e], t[i], r, e), o = c(s, l);
|
|
36
|
+
return s.forward(o ? l : t[e]);
|
|
32
37
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
38
|
+
function v(a, n) {
|
|
39
|
+
return n === null ? a : { min: n.inverse(a.min), max: n.inverse(a.max) };
|
|
35
40
|
}
|
|
36
|
-
function u(
|
|
37
|
-
if (
|
|
38
|
-
if (typeof
|
|
39
|
-
if (typeof
|
|
40
|
-
const e = String(
|
|
41
|
+
function u(a, n, t, m, r) {
|
|
42
|
+
if (a === void 0 || a === "auto") return n;
|
|
43
|
+
if (typeof a == "number") return a;
|
|
44
|
+
if (typeof a == "function") return a(m);
|
|
45
|
+
const e = String(a).match(/^([+-]?)\s*(\d+(?:\.\d+)?)\s*%$/);
|
|
41
46
|
if (e) {
|
|
42
|
-
const s = e[1] === "-" ? -1 : 1, i = parseFloat(e[2]) / 100, l = Math.abs(t -
|
|
43
|
-
return
|
|
47
|
+
const s = e[1] === "-" ? -1 : 1, i = parseFloat(e[2]) / 100, l = Math.abs(t - n) || Math.abs(n) || 1;
|
|
48
|
+
return n + s * i * l * (r === "max" ? 1 : -1);
|
|
44
49
|
}
|
|
45
|
-
return
|
|
50
|
+
return n;
|
|
46
51
|
}
|
|
47
52
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
p as computeTargetYRange,
|
|
54
|
+
v as fromScaleSpace,
|
|
50
55
|
u as resolveBound,
|
|
51
|
-
|
|
56
|
+
g as resolveYTarget,
|
|
57
|
+
w as widenFlatRange
|
|
52
58
|
};
|