@wick-charts/vue 0.6.0 → 0.6.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/README.md +27 -3
- package/dist/ChartContainer.vue.js +99 -69
- package/dist/core/dist/animation/config.js +66 -64
- package/dist/core/dist/animation/intro-wave.js +19 -21
- package/dist/core/dist/animation/reduced-motion.js +6 -0
- package/dist/core/dist/axis/dom-labels.js +14 -14
- package/dist/core/dist/chart/badge-animator.js +15 -19
- package/dist/core/dist/chart/options.js +27 -16
- package/dist/core/dist/chart.js +673 -442
- package/dist/core/dist/components/crosshair.js +8 -6
- package/dist/core/dist/components/grid.js +21 -17
- package/dist/core/dist/interactions/handler.js +36 -20
- package/dist/core/dist/navigator/controller.js +12 -12
- package/dist/core/dist/scales/tick-tracker.js +2 -2
- package/dist/core/dist/scales/x-scale.js +47 -32
- package/dist/core/dist/scales/y-scale.js +39 -21
- package/dist/core/dist/series/bar.js +24 -24
- package/dist/core/dist/series/candlestick.js +20 -20
- package/dist/core/dist/series/heatmap.js +16 -16
- package/dist/core/dist/series/line.js +461 -401
- package/dist/core/dist/utils/pixel-grid.js +10 -0
- package/dist/index.d.ts +123 -1
- package/dist/ui/YLabel.vue.js +19 -18
- package/package.json +2 -2
- package/src/ChartContainer.vue +116 -1
|
@@ -3,47 +3,47 @@ const F = 0.01;
|
|
|
3
3
|
function $(g) {
|
|
4
4
|
const { chart: e, container: h, axis: r } = g, s = /* @__PURE__ */ new Map();
|
|
5
5
|
let y = null;
|
|
6
|
-
const
|
|
6
|
+
const p = r === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
|
|
7
7
|
function k() {
|
|
8
8
|
return r === "x" ? e.timeScale.niceTickValues(e.getDataInterval()) : { ticks: e.yScale.niceTickValues(), tickInterval: 0 };
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function m(t, o) {
|
|
11
11
|
return r === "x" ? e.timeScale.formatX(t, o) : e.yScale.formatY(t);
|
|
12
12
|
}
|
|
13
13
|
function C(t, o) {
|
|
14
14
|
if (r === "x") {
|
|
15
|
-
t.style.left = `${e.timeScale.
|
|
15
|
+
t.style.left = `${e.timeScale.timeToSnappedX(o)}px`;
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
t.style.top = `${e.yScale.
|
|
18
|
+
t.style.top = `${e.yScale.valueToSnappedY(o)}px`;
|
|
19
19
|
}
|
|
20
20
|
function x(t, o) {
|
|
21
21
|
t.style.color = w(o, r), t.style.fontSize = `${A(o, r)}px`, t.style.fontFamily = o.typography.fontFamily;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function d(t, o, u) {
|
|
24
24
|
const n = document.createElement("span");
|
|
25
|
-
return n.textContent =
|
|
25
|
+
return n.textContent = m(t, o), n.style.position = "absolute", n.style.userSelect = "none", x(n, u), n.style.willChange = "opacity", r === "x" ? (n.style.transform = "translateX(-50%)", n.style.whiteSpace = "nowrap") : (n.style.right = "8px", n.style.transform = "translateY(-50%)", n.style.fontVariantNumeric = "tabular-nums"), h.appendChild(n), n;
|
|
26
26
|
}
|
|
27
27
|
function l() {
|
|
28
28
|
const t = e.getTheme(), o = t !== y;
|
|
29
29
|
y = t;
|
|
30
30
|
const { ticks: u, tickInterval: n } = k();
|
|
31
|
-
|
|
32
|
-
const { entries:
|
|
33
|
-
for (const { value: a, opacity: f } of
|
|
31
|
+
p.setCurrentTicks(u);
|
|
32
|
+
const { entries: T } = p.snapshot(), S = /* @__PURE__ */ new Set();
|
|
33
|
+
for (const { value: a, opacity: f } of T) {
|
|
34
34
|
if (f <= F) continue;
|
|
35
|
-
|
|
35
|
+
S.add(a);
|
|
36
36
|
let i = s.get(a);
|
|
37
37
|
if (i === void 0)
|
|
38
|
-
i =
|
|
38
|
+
i = d(a, n, t), s.set(a, i);
|
|
39
39
|
else {
|
|
40
|
-
const
|
|
41
|
-
i.textContent !==
|
|
40
|
+
const v = m(a, n);
|
|
41
|
+
i.textContent !== v && (i.textContent = v), o && x(i, t);
|
|
42
42
|
}
|
|
43
43
|
C(i, a), i.style.opacity = String(f);
|
|
44
44
|
}
|
|
45
45
|
for (const [a, f] of s)
|
|
46
|
-
|
|
46
|
+
S.has(a) || (f.remove(), s.delete(a));
|
|
47
47
|
}
|
|
48
48
|
function c() {
|
|
49
49
|
e.getAnimationState().animating || l();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ScalarSpring as g } from "../animation/scalar-spring.js";
|
|
2
|
-
const r = 320,
|
|
3
|
-
class
|
|
2
|
+
const r = 320, V = 0.15;
|
|
3
|
+
class x {
|
|
4
4
|
#t;
|
|
5
5
|
#e;
|
|
6
6
|
#i = !1;
|
|
@@ -8,11 +8,11 @@ class w {
|
|
|
8
8
|
this.#t = new g(i), this.#e = i;
|
|
9
9
|
}
|
|
10
10
|
frame(i) {
|
|
11
|
-
const { target: t, firstVisible: n, introFront: o, now: s, glide: u = !0, countUp: l = !0, reducedMotion:
|
|
12
|
-
if (
|
|
11
|
+
const { target: t, firstVisible: n, introFront: o, now: s, glide: u = !0, countUp: l = !0, reducedMotion: p = !1 } = i;
|
|
12
|
+
if (p || !u && !l)
|
|
13
13
|
return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
14
14
|
if (o < 1) {
|
|
15
|
-
const
|
|
15
|
+
const f = n + (t - n) * o, a = l ? f : t;
|
|
16
16
|
return this.#t.snap(a, { now: s }), this.#e = a, this.#i = !0, { positionValue: a, textValue: a, opacity: this.#s(o), animating: !0 };
|
|
17
17
|
}
|
|
18
18
|
if (!this.#i)
|
|
@@ -22,35 +22,31 @@ class w {
|
|
|
22
22
|
const c = i.settleMs ?? r;
|
|
23
23
|
if (c <= 0)
|
|
24
24
|
return this.#t.snap(t, { now: s }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
25
|
-
Math.abs(t - this.#e) >
|
|
26
|
-
const
|
|
27
|
-
return { positionValue: this.#t.current, textValue: t, opacity: 1, animating:
|
|
25
|
+
Math.abs(t - this.#e) > m && (this.#t.retarget(t, { now: s, settleMs: c }), this.#e = t);
|
|
26
|
+
const h = this.#t.tick(s);
|
|
27
|
+
return { positionValue: this.#t.current, textValue: t, opacity: 1, animating: h };
|
|
28
28
|
}
|
|
29
29
|
#s(i) {
|
|
30
|
-
return i >= 1 ? 1 : d(i /
|
|
30
|
+
return i >= 1 ? 1 : d(i / V);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const m = 1e-9;
|
|
34
34
|
function d(e) {
|
|
35
35
|
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function M(e) {
|
|
38
38
|
return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: r } : {
|
|
39
39
|
glide: e.glide ?? !0,
|
|
40
40
|
countUp: e.countUp ?? !0,
|
|
41
41
|
settleMs: e.settleMs ?? r
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function y() {
|
|
45
|
-
return typeof matchMedia != "function" ? !1 : matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
46
|
-
}
|
|
47
|
-
function U(e, i, t) {
|
|
44
|
+
function y(e, i, t) {
|
|
48
45
|
const { from: n } = e.getVisibleRange();
|
|
49
46
|
return e.getStackedValueAtTime(i, n) ?? t;
|
|
50
47
|
}
|
|
51
48
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
x as resolveAnimate
|
|
49
|
+
x as BadgeAnimator,
|
|
50
|
+
y as firstVisibleValue,
|
|
51
|
+
M as resolveAnimate
|
|
56
52
|
};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import { DEFAULT_MAX_VISIBLE_BARS as
|
|
2
|
-
function
|
|
1
|
+
import { DEFAULT_MAX_VISIBLE_BARS as i, MIN_VISIBLE_BARS as r } from "./pan-zoom-math.js";
|
|
2
|
+
function n(t) {
|
|
3
|
+
return t === void 0 || !Number.isFinite(t) || t <= 0 ? 0 : t;
|
|
4
|
+
}
|
|
5
|
+
function a(t) {
|
|
6
|
+
return {
|
|
7
|
+
top: n(t?.top),
|
|
8
|
+
right: t?.right === void 0 ? null : n(t.right),
|
|
9
|
+
left: n(t?.left)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function l(t) {
|
|
3
13
|
if (!t) return { monitor: null, ownsMonitor: !1, hud: null };
|
|
4
14
|
if (typeof t != "object" || !("monitor" in t || "recordFrame" in t))
|
|
5
15
|
throw new Error(
|
|
@@ -7,29 +17,30 @@ function s(t) {
|
|
|
7
17
|
);
|
|
8
18
|
return "recordFrame" in t ? { monitor: t, ownsMonitor: !1, hud: null } : { monitor: t.monitor, ownsMonitor: t.ownsMonitor ?? !1, hud: t.hud ?? null };
|
|
9
19
|
}
|
|
10
|
-
const
|
|
20
|
+
const e = {
|
|
11
21
|
top: 20,
|
|
12
22
|
bottom: 20,
|
|
13
23
|
right: { intervals: 3 },
|
|
14
24
|
left: { intervals: 0 }
|
|
15
25
|
};
|
|
16
|
-
function
|
|
26
|
+
function f(t) {
|
|
17
27
|
return {
|
|
18
|
-
top: t?.top ??
|
|
19
|
-
bottom: t?.bottom ??
|
|
20
|
-
right: t?.right ??
|
|
21
|
-
left: t?.left ??
|
|
28
|
+
top: t?.top ?? e.top,
|
|
29
|
+
bottom: t?.bottom ?? e.bottom,
|
|
30
|
+
right: t?.right ?? e.right,
|
|
31
|
+
left: t?.left ?? e.left
|
|
22
32
|
};
|
|
23
33
|
}
|
|
24
|
-
function
|
|
25
|
-
return typeof t == "number" && typeof
|
|
34
|
+
function u(t, o) {
|
|
35
|
+
return typeof t == "number" && typeof o == "number" ? t === o : typeof t == "object" && typeof o == "object" ? t.intervals === o.intervals : !1;
|
|
26
36
|
}
|
|
27
|
-
function
|
|
28
|
-
return t === void 0 ?
|
|
37
|
+
function m(t) {
|
|
38
|
+
return t === void 0 ? i : Number.isFinite(t) ? Math.max(r, Math.floor(t)) : i;
|
|
29
39
|
}
|
|
30
40
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
u as isSameHorizontalPadding,
|
|
42
|
+
a as resolveFade,
|
|
43
|
+
m as resolveMaxVisibleBars,
|
|
44
|
+
f as resolvePadding,
|
|
45
|
+
l as resolvePerfOptions
|
|
35
46
|
};
|