@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DEFAULT_HISTORY_REVEAL as _, DEFAULT_BAR_INTRO as C, DEFAULT_BAR_SMOOTH as F, DEFAULT_BAR_ENTRY as N } from "../animation/config.js";
|
|
2
2
|
import { growIntro as Q } from "./bar-intro.js";
|
|
3
|
-
import { BaseMultiLayerSeries as
|
|
4
|
-
import { resolveBarPainter as
|
|
3
|
+
import { BaseMultiLayerSeries as Z } from "./base-multi-layer.js";
|
|
4
|
+
import { resolveBarPainter as $ } from "./painters/resolve.js";
|
|
5
5
|
import { fadeIntro as q } from "./wave-intro.js";
|
|
6
6
|
const U = 2, G = {
|
|
7
7
|
// Single fallback resolver; the definition's `create` swaps in `theme.bar.color`.
|
|
@@ -15,7 +15,7 @@ const U = 2, G = {
|
|
|
15
15
|
introMs: C,
|
|
16
16
|
historyRevealMs: _
|
|
17
17
|
};
|
|
18
|
-
function
|
|
18
|
+
function O(y) {
|
|
19
19
|
return {
|
|
20
20
|
...y,
|
|
21
21
|
entryMs: y.entryMs === !1 ? 0 : y.entryMs ?? N,
|
|
@@ -29,7 +29,7 @@ const J = Q(), K = q(), tt = {
|
|
|
29
29
|
bottom: { tl: !1, tr: !1, br: !0, bl: !0 },
|
|
30
30
|
none: { tl: !1, tr: !1, br: !1, bl: !1 }
|
|
31
31
|
};
|
|
32
|
-
class et extends
|
|
32
|
+
class et extends Z {
|
|
33
33
|
kind = "bar";
|
|
34
34
|
/** Resolved drawing context for the in-flight render pass. Set at the top of
|
|
35
35
|
* {@link render}, read by {@link drawAnimatedBar}. */
|
|
@@ -43,10 +43,10 @@ class et extends $ {
|
|
|
43
43
|
/** Per-frame history-reveal directives; `null` when no reveal is in flight. */
|
|
44
44
|
#t = null;
|
|
45
45
|
constructor(e, t) {
|
|
46
|
-
super(e), this.options =
|
|
46
|
+
super(e), this.options = O({ ...G, ...t });
|
|
47
47
|
}
|
|
48
48
|
updateOptions(e) {
|
|
49
|
-
this.options =
|
|
49
|
+
this.options = O({ ...this.options, ...e });
|
|
50
50
|
}
|
|
51
51
|
isEntryEnabled() {
|
|
52
52
|
return (this.options.entryAnimation ?? "fade-grow") !== "none";
|
|
@@ -122,7 +122,7 @@ class et extends $ {
|
|
|
122
122
|
this.tickAnimations(performance.now());
|
|
123
123
|
const { scope: t, timeScale: o, yScale: n } = e;
|
|
124
124
|
if (this.#o = {
|
|
125
|
-
painter:
|
|
125
|
+
painter: $(this.options.barPainter),
|
|
126
126
|
env: {
|
|
127
127
|
ctx: t.context,
|
|
128
128
|
theme: e.theme,
|
|
@@ -188,7 +188,7 @@ class et extends $ {
|
|
|
188
188
|
const p = M.getVisibleData(b.from, b.to).length;
|
|
189
189
|
if (p > l && (l = p), l > 2) break;
|
|
190
190
|
}
|
|
191
|
-
const u = o.barWidthBitmap(a), x = Math.round(30 * v), R = l <= 2 ? Math.min(x, u) : u, r = Math.max(1, Math.round(R * this.options.barWidthRatio) - 2), W = Math.floor(r / 2),
|
|
191
|
+
const u = o.barWidthBitmap(a), x = Math.round(30 * v), R = l <= 2 ? Math.min(x, u) : u, r = Math.max(1, Math.round(R * this.options.barWidthRatio) - 2), W = Math.floor(r / 2), k = this.options.anchor === "right" ? r : W, T = n.getRange().min < 0, f = T ? n.valueToBitmapY(0) : t.bitmapSize.height;
|
|
192
192
|
if (this.stores.length === 1) {
|
|
193
193
|
if (!this.stores[0].isVisible()) return;
|
|
194
194
|
const M = this.stores[0].getVisibleData(b.from, b.to);
|
|
@@ -204,7 +204,7 @@ class et extends $ {
|
|
|
204
204
|
baselineY: f,
|
|
205
205
|
topY: g,
|
|
206
206
|
barHeight: c,
|
|
207
|
-
x: h -
|
|
207
|
+
x: h - k,
|
|
208
208
|
barWidth: r,
|
|
209
209
|
color: s,
|
|
210
210
|
roundEdge: "top",
|
|
@@ -219,7 +219,7 @@ class et extends $ {
|
|
|
219
219
|
baselineY: f,
|
|
220
220
|
topY: f,
|
|
221
221
|
barHeight: c,
|
|
222
|
-
x: h -
|
|
222
|
+
x: h - k,
|
|
223
223
|
barWidth: r,
|
|
224
224
|
color: s,
|
|
225
225
|
roundEdge: "bottom",
|
|
@@ -256,22 +256,22 @@ class et extends $ {
|
|
|
256
256
|
for (let h = 0; h < P.length; h++) {
|
|
257
257
|
const { layer: s, value: g, colorValue: c } = P[h], S = this.resolveLayerColor(s, c), E = this.entranceProgress(s, d);
|
|
258
258
|
if (g >= 0) {
|
|
259
|
-
const
|
|
259
|
+
const H = n.valueToBitmapY(g), V = Math.max(1, f - H);
|
|
260
260
|
this.drawAnimatedBar({
|
|
261
261
|
context: m,
|
|
262
262
|
time: d,
|
|
263
263
|
progress: E,
|
|
264
264
|
baselineY: f,
|
|
265
|
-
topY:
|
|
265
|
+
topY: H,
|
|
266
266
|
barHeight: V,
|
|
267
|
-
x: B -
|
|
267
|
+
x: B - k,
|
|
268
268
|
barWidth: r,
|
|
269
269
|
color: S,
|
|
270
270
|
roundEdge: "top",
|
|
271
271
|
isProjected: i
|
|
272
272
|
});
|
|
273
273
|
} else {
|
|
274
|
-
const
|
|
274
|
+
const H = n.valueToBitmapY(g), V = Math.max(1, H - f);
|
|
275
275
|
this.drawAnimatedBar({
|
|
276
276
|
context: m,
|
|
277
277
|
time: d,
|
|
@@ -279,7 +279,7 @@ class et extends $ {
|
|
|
279
279
|
baselineY: f,
|
|
280
280
|
topY: f,
|
|
281
281
|
barHeight: V,
|
|
282
|
-
x: B -
|
|
282
|
+
x: B - k,
|
|
283
283
|
barWidth: r,
|
|
284
284
|
color: S,
|
|
285
285
|
roundEdge: "bottom",
|
|
@@ -304,7 +304,7 @@ class et extends $ {
|
|
|
304
304
|
const h = i.getVisibleData(l.from, l.to).length;
|
|
305
305
|
if (h > u && (u = h), u > 2) break;
|
|
306
306
|
}
|
|
307
|
-
const x = n.barWidthBitmap(m), R = Math.round(30 * b), r = u <= 2 ? Math.min(R, x) : x, W = Math.max(1, Math.round(r * this.options.barWidthRatio) - 2),
|
|
307
|
+
const x = n.barWidthBitmap(m), R = Math.round(30 * b), r = u <= 2 ? Math.min(R, x) : x, W = Math.max(1, Math.round(r * this.options.barWidthRatio) - 2), k = Math.floor(W / 2), T = this.options.anchor === "right" ? W : k, f = this.stores.map(
|
|
308
308
|
(i, h) => this.getLayerAlpha(h) > 0 ? i.getVisibleData(l.from, l.to) : []
|
|
309
309
|
);
|
|
310
310
|
if (f.every((i) => i.length === 0)) return;
|
|
@@ -332,10 +332,10 @@ class et extends $ {
|
|
|
332
332
|
const c = g[i];
|
|
333
333
|
if (c === 0) continue;
|
|
334
334
|
const S = n.timeToBitmapX(s);
|
|
335
|
-
let E = 0,
|
|
335
|
+
let E = 0, H = 0;
|
|
336
336
|
for (let Y = 0; Y < i; Y++) {
|
|
337
337
|
const w = g[Y];
|
|
338
|
-
w > 0 ? E += w :
|
|
338
|
+
w > 0 ? E += w : H += w;
|
|
339
339
|
}
|
|
340
340
|
const V = this.entranceProgress(i, s), X = this.isProjectedTime(s), z = c > 0 ? P.get(s) === i ? "top" : "none" : B.get(s) === i ? "bottom" : "none";
|
|
341
341
|
if (t) {
|
|
@@ -343,14 +343,14 @@ class et extends $ {
|
|
|
343
343
|
for (const A of g)
|
|
344
344
|
A > 0 ? Y += A : w += A;
|
|
345
345
|
if (c > 0 && Y > 0) {
|
|
346
|
-
const A = E / Y * 100, D = (E + c) / Y * 100, j = a.valueToBitmapY(D), L = a.valueToBitmapY(A),
|
|
346
|
+
const A = E / Y * 100, D = (E + c) / Y * 100, j = a.valueToBitmapY(D), L = a.valueToBitmapY(A), I = Math.max(1, L - j);
|
|
347
347
|
this.drawAnimatedBar({
|
|
348
348
|
context: v,
|
|
349
349
|
time: s,
|
|
350
350
|
progress: V,
|
|
351
351
|
baselineY: L,
|
|
352
352
|
topY: j,
|
|
353
|
-
barHeight:
|
|
353
|
+
barHeight: I,
|
|
354
354
|
x: S - T,
|
|
355
355
|
barWidth: W,
|
|
356
356
|
color: h,
|
|
@@ -359,14 +359,14 @@ class et extends $ {
|
|
|
359
359
|
growBaked: !0
|
|
360
360
|
});
|
|
361
361
|
} else if (c < 0 && w < 0) {
|
|
362
|
-
const A =
|
|
362
|
+
const A = H / w * -100, D = (H + c) / w * -100, j = a.valueToBitmapY(A), L = a.valueToBitmapY(D), I = Math.max(1, L - j);
|
|
363
363
|
this.drawAnimatedBar({
|
|
364
364
|
context: v,
|
|
365
365
|
time: s,
|
|
366
366
|
progress: V,
|
|
367
367
|
baselineY: j,
|
|
368
368
|
topY: j,
|
|
369
|
-
barHeight:
|
|
369
|
+
barHeight: I,
|
|
370
370
|
x: S - T,
|
|
371
371
|
barWidth: W,
|
|
372
372
|
color: h,
|
|
@@ -392,7 +392,7 @@ class et extends $ {
|
|
|
392
392
|
growBaked: !0
|
|
393
393
|
});
|
|
394
394
|
} else {
|
|
395
|
-
const Y = a.valueToBitmapY(
|
|
395
|
+
const Y = a.valueToBitmapY(H), w = a.valueToBitmapY(H + c), A = Math.max(1, w - Y);
|
|
396
396
|
this.drawAnimatedBar({
|
|
397
397
|
context: v,
|
|
398
398
|
time: s,
|
|
@@ -423,7 +423,7 @@ class et extends $ {
|
|
|
423
423
|
const { context: o, baselineY: n, topY: a, barHeight: m, x: v, barWidth: b, color: l, roundEdge: u } = e, x = e.isProjected ? 1 : e.progress, R = this.options.entryAnimation ?? "fade-grow";
|
|
424
424
|
let r = x >= 1 || R === "none" ? { x: v, topY: a, barWidth: b, barHeight: m, alpha: 1 } : this.applyBarTransform(e, x);
|
|
425
425
|
if (!e.isProjected) {
|
|
426
|
-
const
|
|
426
|
+
const k = this.#t?.element, T = k !== void 0 ? this.#r(e.time) : null, f = T !== null ? k : this.#e?.element, M = T ?? (f !== void 0 ? this.#a(e.time) : null);
|
|
427
427
|
if (f !== void 0 && M !== null) {
|
|
428
428
|
const p = f({
|
|
429
429
|
...M,
|
|
@@ -6,10 +6,10 @@ import { ScalarSpring as V } from "../animation/scalar-spring.js";
|
|
|
6
6
|
import { decimateOHLCData as at } from "../data/decimation.js";
|
|
7
7
|
import { TimeSeriesStore as rt } from "../data/store.js";
|
|
8
8
|
import { resolveCandlestickBodyColor as I } from "../theme/resolve.js";
|
|
9
|
-
import { hexToRgba as K, mixColors as
|
|
10
|
-
import { clamp as _, lerp as
|
|
9
|
+
import { hexToRgba as K, mixColors as G } from "../utils/color.js";
|
|
10
|
+
import { clamp as _, lerp as z } from "../utils/math.js";
|
|
11
11
|
import { isPoisonedNumber as N, reportPoisonedData as ht } from "../utils/poisoned-data-reporter.js";
|
|
12
|
-
import { normalizeOHLCArray as
|
|
12
|
+
import { normalizeOHLCArray as J, normalizeTime as Q } from "../utils/time.js";
|
|
13
13
|
import { candleUnfoldIntro as lt } from "./candlestick-intro.js";
|
|
14
14
|
import { fillRoundedRect as Z } from "./painters/canvas-path.js";
|
|
15
15
|
import { resolveCandlePainter as mt } from "./painters/resolve.js";
|
|
@@ -137,19 +137,19 @@ class xt {
|
|
|
137
137
|
// --- SeriesRenderer interface implementation ------------------------------
|
|
138
138
|
setData(t) {
|
|
139
139
|
const i = this.store.length > 0;
|
|
140
|
-
this.store.setData(
|
|
140
|
+
this.store.setData(J(t ?? [])), !i && this.store.length > 0 && this.introWave.arm(this.options.introMs);
|
|
141
141
|
const e = this.store.last();
|
|
142
142
|
this.displayedLast = e ?? null, this.#t = null, this.entries.clear(), this.#i = null, this.#o.finish(), this.#a = null, this.#m = null;
|
|
143
143
|
}
|
|
144
144
|
appendPoint(t) {
|
|
145
|
-
const i = t, e =
|
|
145
|
+
const i = t, e = Q(i.time), o = { ...i, time: e };
|
|
146
146
|
this.store.append(o), this.displayedLast = o, this.#t = null;
|
|
147
147
|
const a = this.options.entryMs;
|
|
148
148
|
this.isEntryEnabled() && a > 0 && this.entries.set(e, { startTime: performance.now() });
|
|
149
149
|
}
|
|
150
150
|
prependPoints(t) {
|
|
151
151
|
if (t.length === 0) return;
|
|
152
|
-
const i =
|
|
152
|
+
const i = J(t), e = this.store.first()?.time;
|
|
153
153
|
this.store.prepend(i), this.#u(i[0].time, e);
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
@@ -172,7 +172,7 @@ class xt {
|
|
|
172
172
|
i !== void 0 && (this.#m = { bars: t, anchorTime: i });
|
|
173
173
|
}
|
|
174
174
|
updateLastPoint(t) {
|
|
175
|
-
const i = t, e =
|
|
175
|
+
const i = t, e = Q(i.time), o = { ...i, time: e };
|
|
176
176
|
this.store.updateLast(o);
|
|
177
177
|
const a = this.options.smoothMs;
|
|
178
178
|
if (a <= 0) {
|
|
@@ -342,8 +342,8 @@ class xt {
|
|
|
342
342
|
for (const x of m) {
|
|
343
343
|
const P = this.entries.get(x.time);
|
|
344
344
|
if (P === void 0 || r <= 0) continue;
|
|
345
|
-
const k = l - P.startTime,
|
|
346
|
-
|
|
345
|
+
const k = l - P.startTime, $ = Math.min(1, Math.max(0, k / r));
|
|
346
|
+
$ >= 1 || (W === null && (W = /* @__PURE__ */ new Map()), W.set(x.time, nt($)));
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
const X = e.barWidthBitmap(a), f = Math.round(30 * u), M = m.length <= 2 ? Math.min(f, X) : X, d = Math.max(1, Math.round(u));
|
|
@@ -440,8 +440,8 @@ class xt {
|
|
|
440
440
|
const e = t.unfold ?? 1, o = t.offsetY ?? 0;
|
|
441
441
|
return {
|
|
442
442
|
x: i.x + (t.offsetX ?? 0),
|
|
443
|
-
topY: (t.topY ??
|
|
444
|
-
bottomY: (t.bottomY ??
|
|
443
|
+
topY: (t.topY ?? z(i.anchorY, i.topY, e)) + o,
|
|
444
|
+
bottomY: (t.bottomY ?? z(i.anchorY, i.bottomY, e)) + o,
|
|
445
445
|
alpha: t.alpha ?? 1,
|
|
446
446
|
tint: t.tint
|
|
447
447
|
};
|
|
@@ -558,7 +558,7 @@ class xt {
|
|
|
558
558
|
t.fillRect(T, R, u, v - R);
|
|
559
559
|
continue;
|
|
560
560
|
}
|
|
561
|
-
t.save(), t.globalAlpha = n.alpha, g > 0 && (t.fillStyle =
|
|
561
|
+
t.save(), t.globalAlpha = n.alpha, g > 0 && (t.fillStyle = G(m, W, g)), t.fillRect(n.x, n.topY, u, Math.max(1, n.bottomY - n.topY)), t.restore();
|
|
562
562
|
}
|
|
563
563
|
const X = Array.isArray(y);
|
|
564
564
|
for (const f of i) {
|
|
@@ -587,15 +587,15 @@ class xt {
|
|
|
587
587
|
C !== null && (n = C.x, p = C.topY, g = C.bottomY, L *= C.alpha, E = C.tint ?? 0, B = !0);
|
|
588
588
|
const D = B ? Math.max(1, g - p) : A;
|
|
589
589
|
B && t.save();
|
|
590
|
-
const r = Array.isArray(y) ? y[0] : y, l = E > 0 ?
|
|
590
|
+
const r = Array.isArray(y) ? y[0] : y, l = E > 0 ? G(r, W, E) : r, x = X && D > 2 && E <= 0, P = x ? this.#d(t, y, D) : l;
|
|
591
591
|
t.fillStyle = P, B && (t.globalAlpha = L), x && t.translate(0, p);
|
|
592
|
-
const k = x ? 0 : p,
|
|
593
|
-
|
|
592
|
+
const k = x ? 0 : p, $ = _(w.radius, 0, Math.min(s, D) / 2);
|
|
593
|
+
$ < 1 && !this.options.candlePainter ? t.fillRect(n, k, s, D) : w.painter(w.env, {
|
|
594
594
|
geom: { x: n, y: k, width: s, height: D },
|
|
595
595
|
fillStyle: P,
|
|
596
596
|
color: l,
|
|
597
597
|
corners: ft,
|
|
598
|
-
radius:
|
|
598
|
+
radius: $,
|
|
599
599
|
progress: M,
|
|
600
600
|
isBullish: f.close >= f.open
|
|
601
601
|
}), x && t.translate(0, -p), B && t.restore();
|
|
@@ -625,8 +625,8 @@ function F(h, t, i) {
|
|
|
625
625
|
case "unfold":
|
|
626
626
|
return {
|
|
627
627
|
x: i.x,
|
|
628
|
-
topY:
|
|
629
|
-
bottomY:
|
|
628
|
+
topY: z(i.anchorY, i.topY, h),
|
|
629
|
+
bottomY: z(i.anchorY, i.bottomY, h),
|
|
630
630
|
alpha: 1
|
|
631
631
|
};
|
|
632
632
|
case "slide":
|
|
@@ -639,8 +639,8 @@ function F(h, t, i) {
|
|
|
639
639
|
case "fade-unfold":
|
|
640
640
|
return {
|
|
641
641
|
x: i.x,
|
|
642
|
-
topY:
|
|
643
|
-
bottomY:
|
|
642
|
+
topY: z(i.anchorY, i.topY, h),
|
|
643
|
+
bottomY: z(i.anchorY, i.bottomY, h),
|
|
644
644
|
alpha: h
|
|
645
645
|
};
|
|
646
646
|
}
|
|
@@ -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
|