@wick-charts/vue 0.6.1 → 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/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 +58 -45
- package/dist/core/dist/chart/badge-animator.js +15 -19
- 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 +752 -570
- package/dist/core/dist/components/crosshair.js +8 -8
- package/dist/core/dist/components/grid.js +28 -15
- 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 +43 -40
- 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/tick-tracker.js +2 -2
- package/dist/core/dist/scales/x-scale.js +47 -32
- package/dist/core/dist/scales/y-scale.js +155 -38
- package/dist/core/dist/series/bar-intro.js +11 -11
- package/dist/core/dist/series/bar.js +299 -249
- package/dist/core/dist/series/base-multi-layer.js +100 -76
- package/dist/core/dist/series/candlestick.js +252 -249
- package/dist/core/dist/series/heatmap.js +16 -16
- package/dist/core/dist/series/line-intro.js +18 -18
- package/dist/core/dist/series/line.js +522 -424
- package/dist/core/dist/series/scale-stack.js +25 -0
- package/dist/core/dist/tooltip-position.js +5 -5
- package/dist/core/dist/utils/pixel-grid.js +10 -0
- package/dist/index.d.ts +279 -32
- 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 +50 -49
- 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
|
@@ -5,7 +5,7 @@ import { sampleRamp as Y, deriveHeatmapRamp as st, mixColors as et, isLightColor
|
|
|
5
5
|
import { formatCompact as ot } from "../utils/format.js";
|
|
6
6
|
import { clamp as v, smoothToward as z } from "../utils/math.js";
|
|
7
7
|
import { fillRoundedRect as nt } from "./painters/canvas-path.js";
|
|
8
|
-
const
|
|
8
|
+
const P = {
|
|
9
9
|
fontSize: 10
|
|
10
10
|
};
|
|
11
11
|
function ht(r, s) {
|
|
@@ -20,9 +20,9 @@ const lt = {
|
|
|
20
20
|
updateMs: Q
|
|
21
21
|
};
|
|
22
22
|
function rt(r) {
|
|
23
|
-
return r === void 0 || r === !1 ? !1 : r === !0 ?
|
|
23
|
+
return r === void 0 || r === !1 ? !1 : r === !0 ? P : { ...P, ...r };
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function E(r, s) {
|
|
26
26
|
const t = {
|
|
27
27
|
...r,
|
|
28
28
|
...s,
|
|
@@ -90,14 +90,14 @@ class ct {
|
|
|
90
90
|
*/
|
|
91
91
|
#g;
|
|
92
92
|
/** Data extent cached by {@link #rebuildGrid} — see {@link #domain}. */
|
|
93
|
-
#
|
|
93
|
+
#M = { min: 0, max: 1 };
|
|
94
94
|
constructor(s, t) {
|
|
95
|
-
this.#t =
|
|
95
|
+
this.#t = E(lt, s ?? {}), this.#r = this.#t.entryMs === 0, this.#g = t ?? null;
|
|
96
96
|
}
|
|
97
97
|
// --- Data ingest -----------------------------------------------------------
|
|
98
98
|
setData(s) {
|
|
99
99
|
const t = this.#x(), e = this.#s.length > 0;
|
|
100
|
-
if (this.#c = s ?? [], this.#
|
|
100
|
+
if (this.#c = s ?? [], this.#b(), e && this.#x() === t) {
|
|
101
101
|
for (const o of this.#s)
|
|
102
102
|
this.#n.has(o.key) || this.#n.set(o.key, o.value);
|
|
103
103
|
this.#u = this.#t.updateMs > 0;
|
|
@@ -118,7 +118,7 @@ class ct {
|
|
|
118
118
|
}
|
|
119
119
|
updateOptions(s) {
|
|
120
120
|
const t = this.#t.columns, e = this.#t.rows;
|
|
121
|
-
this.#t =
|
|
121
|
+
this.#t = E(this.#t, s ?? {}), (this.#t.columns !== t || this.#t.rows !== e) && this.#b(), this.#t.entryMs === 0 && (this.#r = !0), this.#t.updateMs === 0 && (this.#u = !1), this.#o = null;
|
|
122
122
|
}
|
|
123
123
|
// --- Layer model (single-layer no-ops, mirroring pie) ----------------------
|
|
124
124
|
getLayerCount() {
|
|
@@ -210,7 +210,7 @@ class ct {
|
|
|
210
210
|
* and place every datum. On duplicate (x, y) coordinates the last datum
|
|
211
211
|
* wins — matching "latest sample replaces" streaming intuition.
|
|
212
212
|
*/
|
|
213
|
-
#
|
|
213
|
+
#b() {
|
|
214
214
|
const s = this.#x(), t = this.#t.columns ? [...this.#t.columns] : [], e = this.#t.rows ? [...this.#t.rows] : [], o = new Map(t.map((i, n) => [i, n])), h = new Map(e.map((i, n) => [i, n]));
|
|
215
215
|
for (const i of this.#c)
|
|
216
216
|
!this.#t.columns && !o.has(i.x) && (o.set(i.x, t.length), t.push(i.x)), !this.#t.rows && !h.has(i.y) && (h.set(i.y, e.length), e.push(i.y));
|
|
@@ -229,7 +229,7 @@ class ct {
|
|
|
229
229
|
};
|
|
230
230
|
u >= 0 ? this.#s[u] = c : (this.#h[a] = this.#s.length, this.#s.push(c));
|
|
231
231
|
}
|
|
232
|
-
this.#x() !== s && (this.#l = new Array(this.#h.length).fill(0), this.#a = -1), this.#
|
|
232
|
+
this.#x() !== s && (this.#l = new Array(this.#h.length).fill(0), this.#a = -1), this.#M = this.#w();
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* Scan the placed cells for the finite-value extent. Called once per
|
|
@@ -249,7 +249,7 @@ class ct {
|
|
|
249
249
|
}
|
|
250
250
|
/** Value domain: explicit option bounds win, else the cached data extent. */
|
|
251
251
|
#d() {
|
|
252
|
-
const { min: s, max: t } = this.#
|
|
252
|
+
const { min: s, max: t } = this.#M;
|
|
253
253
|
return {
|
|
254
254
|
min: this.#t.min ?? s,
|
|
255
255
|
max: this.#t.max ?? Math.max(t, this.#t.min ?? s)
|
|
@@ -264,7 +264,7 @@ class ct {
|
|
|
264
264
|
if (this.#s.length === 0) return;
|
|
265
265
|
const { scope: t, theme: e, padding: o } = s, { context: h, bitmapSize: i, horizontalPixelRatio: n, verticalPixelRatio: l } = t, a = performance.now(), u = this.#p ? Math.min(0.05, (a - this.#p) / 1e3) : 0;
|
|
266
266
|
this.#p = a, this.#m === 0 && (this.#m = a), this.#H(u), this.#L(u);
|
|
267
|
-
const { min: c, max: f } = this.#d(),
|
|
267
|
+
const { min: c, max: f } = this.#d(), b = f - c, X = this.#y(e), H = Z(e), L = `${H * n}px ${e.typography.fontFamily}`, T = this.#t.axisLabels ? this.#T({ context: h, font: L, fontSize: H, hpr: n, vpr: l }) : { left: 0, bottom: 0 }, m = O({
|
|
268
268
|
bitmapWidth: i.width,
|
|
269
269
|
bitmapHeight: i.height,
|
|
270
270
|
padTop: o.top * l,
|
|
@@ -287,12 +287,12 @@ class ct {
|
|
|
287
287
|
const K = (p.col + p.row) / U * x, D = v((a - this.#m - K) / x, 0, 1);
|
|
288
288
|
if (D < 1 && ($ = !1), y = J(D), y <= 0) continue;
|
|
289
289
|
}
|
|
290
|
-
const w = this.#n.get(p.key) ?? p.value, j = Number.isFinite(w) &&
|
|
291
|
-
let
|
|
290
|
+
const w = this.#n.get(p.key) ?? p.value, j = Number.isFinite(w) && b > 0 ? v((w - c) / b, 0, 1) : 0;
|
|
291
|
+
let M = p.color ?? Y(X, j);
|
|
292
292
|
const G = p.row * this.#e.length + p.col, g = this.#l[G] ?? 0;
|
|
293
|
-
g > 0.01 && (
|
|
293
|
+
g > 0.01 && (M = et(M, e.tooltip.textColor, 0.1 * g), h.shadowColor = "rgba(0, 0, 0, 0.3)", h.shadowBlur = 12 * n * g, h.shadowOffsetY = 3 * l * g);
|
|
294
294
|
const S = Math.max(0, m.slotW - N), W = Math.max(0, m.slotH - _), F = (0.82 + 0.18 * y) * (1 + 0.04 * g), R = S * F, B = W * F, C = m.originX + p.col * m.slotW + m.slotW / 2, k = m.originY + p.row * m.slotH + m.slotH / 2;
|
|
295
|
-
h.globalAlpha = A * y, h.fillStyle =
|
|
295
|
+
h.globalAlpha = A * y, h.fillStyle = M, nt(h, {
|
|
296
296
|
x: C - R / 2,
|
|
297
297
|
y: k - B / 2,
|
|
298
298
|
width: R,
|
|
@@ -301,7 +301,7 @@ class ct {
|
|
|
301
301
|
corners: { tl: !0, tr: !0, br: !0, bl: !0 }
|
|
302
302
|
}), g > 0.01 && (h.shadowColor = "transparent", h.shadowBlur = 0, h.shadowOffsetY = 0), d && this.#A({
|
|
303
303
|
context: h,
|
|
304
|
-
cell: { fill:
|
|
304
|
+
cell: { fill: M, displayed: w, cx: C, cy: k, innerW: S, innerH: W, span: b },
|
|
305
305
|
labels: d,
|
|
306
306
|
font: V,
|
|
307
307
|
hpr: n
|
|
@@ -6,7 +6,7 @@ function g(e) {
|
|
|
6
6
|
const o = f(e.progress), t = e.range.from + o * (e.range.to - e.range.from);
|
|
7
7
|
return { x: e.timeToX(t), time: t };
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function I(e = {}) {
|
|
10
10
|
const o = e.head ?? !0;
|
|
11
11
|
return (t) => {
|
|
12
12
|
const r = g(t);
|
|
@@ -16,39 +16,39 @@ function X(e = {}) {
|
|
|
16
16
|
function y(e = {}) {
|
|
17
17
|
const o = Math.min(l(e.stagger ?? 0.35), 0.9);
|
|
18
18
|
return (t) => ({
|
|
19
|
-
value: ({ layerIndex: r, value:
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
const n = l((t.progress - o *
|
|
23
|
-
return
|
|
19
|
+
value: ({ layerIndex: r, value: i, position: c }) => {
|
|
20
|
+
const u = t.layerMean(r);
|
|
21
|
+
if (u === null || !Number.isFinite(i)) return i;
|
|
22
|
+
const n = l((t.progress - o * c) / (1 - o));
|
|
23
|
+
return t.lerpValue(u, i, d(n));
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
function T() {
|
|
28
|
-
const e =
|
|
28
|
+
const e = I();
|
|
29
29
|
return (o) => {
|
|
30
30
|
if (o.stacking !== "off") return e(o);
|
|
31
31
|
const t = o.primaryPath();
|
|
32
32
|
if (t === null || t.length < 2) return e(o);
|
|
33
33
|
let r = 0;
|
|
34
|
-
const
|
|
34
|
+
const i = [];
|
|
35
35
|
for (let n = 1; n < t.length; n++) {
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const s = Math.hypot(t[n].x - t[n - 1].x, t[n].y - t[n - 1].y);
|
|
37
|
+
i.push(s), r += s;
|
|
38
38
|
}
|
|
39
39
|
if (r <= 0) return e(o);
|
|
40
|
-
let
|
|
40
|
+
let c = o.progress * r;
|
|
41
41
|
for (let n = 1; n < t.length; n++) {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
|
|
42
|
+
const s = i[n - 1];
|
|
43
|
+
if (c > s) {
|
|
44
|
+
c -= s;
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const p = s > 0 ? c / s : 1, a = t[n - 1], h = t[n], m = a.x + (h.x - a.x) * p, x = a.time + (h.time - a.time) * p;
|
|
48
48
|
return { clip: { toX: m }, heads: [{ x: m, time: x }] };
|
|
49
49
|
}
|
|
50
|
-
const
|
|
51
|
-
return { clip: { toX:
|
|
50
|
+
const u = t[t.length - 1];
|
|
51
|
+
return { clip: { toX: u.x }, heads: [{ x: u.x, time: u.time }] };
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
function w(e = {}) {
|
|
@@ -79,7 +79,7 @@ export {
|
|
|
79
79
|
b as backfillSweepIntro,
|
|
80
80
|
k as centerOutIntro,
|
|
81
81
|
T as plotterIntro,
|
|
82
|
-
|
|
82
|
+
I as sweepIntro,
|
|
83
83
|
w as traceIntro,
|
|
84
84
|
y as unfoldIntro
|
|
85
85
|
};
|