@wick-charts/vue 0.6.1 → 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/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.js +448 -417
- package/dist/core/dist/components/grid.js +21 -17
- 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 +33 -1
- package/dist/ui/YLabel.vue.js +19 -18
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -760,6 +760,15 @@ export declare interface AnimationsConfig {
|
|
|
760
760
|
* @default {@link DEFAULT_TICKS_MS}
|
|
761
761
|
*/
|
|
762
762
|
ticks?: AnimationTime;
|
|
763
|
+
/**
|
|
764
|
+
* Gridline layer opacity: the opening reveal on first paint and the
|
|
765
|
+
* fade out when `grid.visible` flips off. Independent of
|
|
766
|
+
* {@link ticks}, which owns the per-tick cross-fade on relabel.
|
|
767
|
+
* `false` makes the grid appear and disappear instantly.
|
|
768
|
+
*
|
|
769
|
+
* @default {@link DEFAULT_GRID_MS}
|
|
770
|
+
*/
|
|
771
|
+
grid?: AnimationTime;
|
|
763
772
|
};
|
|
764
773
|
/**
|
|
765
774
|
* Series-visibility toggle duration. Drives BOTH the renderer's alpha
|
|
@@ -5099,7 +5108,17 @@ export declare class XScale {
|
|
|
5099
5108
|
formatX(timestamp: number, interval: number): string;
|
|
5100
5109
|
private resetHysteresis;
|
|
5101
5110
|
timeToX(time: number): number;
|
|
5111
|
+
/** X in physical (bitmap) pixels, snapped to the pixel grid — for
|
|
5112
|
+
* axis-aligned edges that have to stay crisp. */
|
|
5102
5113
|
timeToBitmapX(time: number): number;
|
|
5114
|
+
/** Same in physical pixels, off the grid — see {@link YScale.valueToBitmapYExact}. */
|
|
5115
|
+
timeToBitmapXExact(time: number): number;
|
|
5116
|
+
/**
|
|
5117
|
+
* X position in CSS pixels of the *stroke center* the canvas grid draws for
|
|
5118
|
+
* `time`. DOM axis labels position off this instead of raw {@link timeToX}
|
|
5119
|
+
* so text and gridline share one pixel grid.
|
|
5120
|
+
*/
|
|
5121
|
+
timeToSnappedX(time: number): number;
|
|
5103
5122
|
xToTime(x: number): number;
|
|
5104
5123
|
pixelDeltaToTimeDelta(pixelDelta: number): number;
|
|
5105
5124
|
barWidthMedia(dataInterval: number): number;
|
|
@@ -5221,8 +5240,21 @@ export declare class YScale {
|
|
|
5221
5240
|
setTickGenerator(fn: ValueTickGenerator | null): void;
|
|
5222
5241
|
/** Convert a value to a Y position in CSS (media) pixels. */
|
|
5223
5242
|
valueToY(value: number): number;
|
|
5224
|
-
/** Convert a value to a Y position in physical (bitmap) pixels
|
|
5243
|
+
/** Convert a value to a Y position in physical (bitmap) pixels, snapped to
|
|
5244
|
+
* the pixel grid — for axis-aligned edges that have to stay crisp. */
|
|
5225
5245
|
valueToBitmapY(value: number): number;
|
|
5246
|
+
/**
|
|
5247
|
+
* Same in physical pixels, off the grid. Anti-aliased geometry reads this
|
|
5248
|
+
* one: snapping buys a diagonal stroke no sharpness, and during a slow
|
|
5249
|
+
* animation it quantises the motion into whole-pixel jumps.
|
|
5250
|
+
*/
|
|
5251
|
+
valueToBitmapYExact(value: number): number;
|
|
5252
|
+
/**
|
|
5253
|
+
* Y position in CSS pixels of the *stroke center* the canvas grid draws for
|
|
5254
|
+
* `value`. DOM axis labels position off this instead of raw {@link valueToY}
|
|
5255
|
+
* so text and gridline share one pixel grid.
|
|
5256
|
+
*/
|
|
5257
|
+
valueToSnappedY(value: number): number;
|
|
5226
5258
|
/** Convert a Y position in CSS pixels back to a value. */
|
|
5227
5259
|
yToValue(y: number): number;
|
|
5228
5260
|
/**
|
package/dist/ui/YLabel.vue.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { defineComponent as q, useSlots as j, computed as n, ref as I, onMounted as G, onUnmounted as P, openBlock as w, createElementBlock as B, Fragment as A, renderSlot as W, createElementVNode as _, normalizeStyle as T, unref as H, createVNode as J, createCommentVNode as K } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { prefersReducedMotion as Q } from "../core/dist/animation/reduced-motion.js";
|
|
3
|
+
import { resolveAnimate as X, firstVisibleValue as Z, BadgeAnimator as ee } from "../core/dist/chart/badge-animator.js";
|
|
3
4
|
import { useChartInstance as te } from "../context.js";
|
|
4
5
|
import ne from "./NumberFlow.vue.js";
|
|
5
|
-
const
|
|
6
|
+
const ie = /* @__PURE__ */ q({
|
|
6
7
|
__name: "YLabel",
|
|
7
8
|
props: {
|
|
8
9
|
seriesId: {},
|
|
@@ -12,18 +13,18 @@ const re = /* @__PURE__ */ q({
|
|
|
12
13
|
},
|
|
13
14
|
setup(z) {
|
|
14
15
|
const f = z, e = te(), Y = j(), E = n(() => typeof Y.default == "function"), i = I(0), u = I(null);
|
|
15
|
-
let
|
|
16
|
-
const M = n(() =>
|
|
17
|
-
function
|
|
16
|
+
let p = null, g = null, o = null;
|
|
17
|
+
const M = n(() => X(f.animate));
|
|
18
|
+
function L() {
|
|
18
19
|
o = null;
|
|
19
20
|
const t = s.value, l = t !== null ? e.getStackedLastValue(t) : null;
|
|
20
21
|
if (t === null || !l) {
|
|
21
|
-
|
|
22
|
+
p = null, g = null;
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
25
|
const v = l.value;
|
|
25
|
-
(
|
|
26
|
-
const { glide: d, countUp: U, settleMs: $ } = M.value, F = e.getIntroFront(t), c =
|
|
26
|
+
(p === null || g !== t) && (p = new ee(v), g = t);
|
|
27
|
+
const { glide: d, countUp: U, settleMs: $ } = M.value, F = e.getIntroFront(t), c = p.frame({
|
|
27
28
|
target: v,
|
|
28
29
|
// Only needed for the intro count-up; skip the visible-range binary search
|
|
29
30
|
// entirely once the reveal has settled (the hot streaming path).
|
|
@@ -33,20 +34,20 @@ const re = /* @__PURE__ */ q({
|
|
|
33
34
|
glide: d,
|
|
34
35
|
countUp: U,
|
|
35
36
|
settleMs: $,
|
|
36
|
-
reducedMotion:
|
|
37
|
+
reducedMotion: Q()
|
|
37
38
|
}), y = u.value;
|
|
38
|
-
(y === null || y.positionValue !== c.positionValue || y.textValue !== c.textValue || y.opacity !== c.opacity) && (u.value = { positionValue: c.positionValue, textValue: c.textValue, opacity: c.opacity }), c.animating && o === null && (o = requestAnimationFrame(
|
|
39
|
+
(y === null || y.positionValue !== c.positionValue || y.textValue !== c.textValue || y.opacity !== c.opacity) && (u.value = { positionValue: c.positionValue, textValue: c.textValue, opacity: c.opacity }), c.animating && o === null && (o = requestAnimationFrame(L));
|
|
39
40
|
}
|
|
40
41
|
function N() {
|
|
41
|
-
o === null && (o = requestAnimationFrame(
|
|
42
|
+
o === null && (o = requestAnimationFrame(L));
|
|
42
43
|
}
|
|
43
|
-
const
|
|
44
|
+
const m = () => {
|
|
44
45
|
i.value++, N();
|
|
45
46
|
};
|
|
46
47
|
G(() => {
|
|
47
|
-
e.setYLabel(!0), e.on("overlayChange",
|
|
48
|
+
e.setYLabel(!0), e.on("overlayChange", m), e.on("viewportChange", m), e.getSeriesIds().length > 0 && m();
|
|
48
49
|
}), P(() => {
|
|
49
|
-
e.setYLabel(!1), e.off("overlayChange",
|
|
50
|
+
e.setYLabel(!1), e.off("overlayChange", m), e.off("viewportChange", m), o !== null && cancelAnimationFrame(o), o = null;
|
|
50
51
|
});
|
|
51
52
|
function O(t, l) {
|
|
52
53
|
if (l !== void 0) return l;
|
|
@@ -55,11 +56,11 @@ const re = /* @__PURE__ */ q({
|
|
|
55
56
|
const d = t.getSeriesIdsByType("time", { visibleOnly: !0 });
|
|
56
57
|
return d.length > 0 ? d[0] : null;
|
|
57
58
|
}
|
|
58
|
-
const s = n(() => (i.value, O(e, f.seriesId))), a = n(() => (i.value, s.value !== null ? e.getStackedLastValue(s.value) : null)), b = n(() => (i.value, s.value !== null ? e.getPreviousClose(s.value) : null)), r = n(() => (i.value, e.getTheme())), R = n(() => u.value !== null ? u.value.positionValue : a.value?.value ?? 0), D = n(() => u.value !== null ? u.value.textValue : a.value?.value ?? 0), h = n(() => u.value !== null ? u.value.opacity : s.value === null ? 1 : e.getIntroFront(s.value) < 1 ? 0 : 1), x = n(() => (i.value, a.value === null ? 0 : e.yScale.valueToY(R.value))),
|
|
59
|
+
const s = n(() => (i.value, O(e, f.seriesId))), a = n(() => (i.value, s.value !== null ? e.getStackedLastValue(s.value) : null)), b = n(() => (i.value, s.value !== null ? e.getPreviousClose(s.value) : null)), r = n(() => (i.value, e.getTheme())), R = n(() => u.value !== null ? u.value.positionValue : a.value?.value ?? 0), D = n(() => u.value !== null ? u.value.textValue : a.value?.value ?? 0), h = n(() => u.value !== null ? u.value.opacity : s.value === null ? 1 : e.getIntroFront(s.value) < 1 ? 0 : 1), x = n(() => (i.value, a.value === null ? 0 : e.yScale.valueToY(R.value))), S = n(() => a.value === null || b.value === null ? "neutral" : a.value.value > b.value ? "up" : a.value.value < b.value ? "down" : "neutral"), V = n(() => {
|
|
59
60
|
if (a.value === null) return r.value.yLabel.neutralBackground;
|
|
60
61
|
if (!a.value.isLive) return r.value.axis.textColor;
|
|
61
62
|
if (f.color) return f.color;
|
|
62
|
-
switch (
|
|
63
|
+
switch (S.value) {
|
|
63
64
|
case "up":
|
|
64
65
|
return r.value.yLabel.upBackground;
|
|
65
66
|
case "down":
|
|
@@ -87,7 +88,7 @@ const re = /* @__PURE__ */ q({
|
|
|
87
88
|
y: x.value,
|
|
88
89
|
bgColor: V.value,
|
|
89
90
|
isLive: a.value.isLive,
|
|
90
|
-
direction:
|
|
91
|
+
direction: S.value,
|
|
91
92
|
format: C.value,
|
|
92
93
|
opacity: h.value
|
|
93
94
|
}) : (w(), B(A, { key: 1 }, [
|
|
@@ -134,5 +135,5 @@ const re = /* @__PURE__ */ q({
|
|
|
134
135
|
}
|
|
135
136
|
});
|
|
136
137
|
export {
|
|
137
|
-
|
|
138
|
+
ie as default
|
|
138
139
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wick-charts/vue",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "High-performance canvas timeseries charts for Vue — candlestick, line, bar, pie. Tree-shakeable, zero runtime deps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"vue": ">=3.3.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@wick-charts/core": "^0.6.
|
|
48
|
+
"@wick-charts/core": "^0.6.2"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "vite build"
|