@wick-charts/vue 0.6.2 → 0.6.4
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 +2 -2
- package/dist/BandSeries.vue.js +50 -0
- package/dist/BandSeries.vue2.js +4 -0
- package/dist/ChartContainer.vue.js +45 -39
- package/dist/composables.js +39 -26
- package/dist/core/dist/animation/config.js +92 -75
- package/dist/core/dist/axis/dom-labels.js +56 -43
- package/dist/core/dist/chart/badge-animator.js +30 -22
- package/dist/core/dist/chart/edge-indicators.js +22 -21
- package/dist/core/dist/chart/last-value.js +33 -26
- 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 +670 -518
- package/dist/core/dist/components/crosshair.js +8 -8
- package/dist/core/dist/components/grid.js +26 -17
- package/dist/core/dist/components/marker.js +28 -28
- package/dist/core/dist/components/reference-line.js +16 -16
- package/dist/core/dist/data/decimation.js +58 -39
- 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 +47 -44
- 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/y-scale.js +134 -35
- package/dist/core/dist/series/band.js +670 -0
- package/dist/core/dist/series/bar-intro.js +11 -11
- package/dist/core/dist/series/bar.js +301 -251
- package/dist/core/dist/series/base-multi-layer.js +100 -76
- package/dist/core/dist/series/candlestick.js +238 -235
- package/dist/core/dist/series/heatmap.js +5 -5
- package/dist/core/dist/series/line-intro.js +50 -40
- package/dist/core/dist/series/line.js +561 -483
- package/dist/core/dist/series/painters/builtins.js +4 -4
- package/dist/core/dist/series/painters/canvas-path.js +64 -52
- package/dist/core/dist/series/register-builtins.js +9 -8
- package/dist/core/dist/series/scale-stack.js +25 -0
- package/dist/core/dist/snapshots.js +36 -35
- package/dist/core/dist/tooltip-position.js +5 -5
- package/dist/core/dist/utils/point.js +10 -0
- package/dist/index.d.ts +501 -128
- package/dist/index.js +195 -189
- package/dist/ui/Crosshair.vue.js +14 -14
- package/dist/ui/HeatmapTooltip.vue.js +6 -6
- package/dist/ui/InfoBar.vue.js +100 -81
- package/dist/ui/PieTooltip.vue.js +4 -4
- package/dist/ui/TimeAxis.vue.js +23 -22
- package/dist/ui/Tooltip.vue.js +140 -111
- package/dist/ui/YAxis.vue.js +25 -24
- package/dist/ui/YLabel.vue.js +63 -70
- package/package.json +2 -2
- package/src/BandSeries.vue +87 -0
- package/src/ChartContainer.vue +20 -8
- package/src/composables.ts +35 -1
- package/src/index.ts +13 -0
- package/src/ui/Crosshair.vue +2 -2
- package/src/ui/InfoBar.vue +20 -1
- package/src/ui/TimeAxis.vue +7 -4
- package/src/ui/Tooltip.vue +40 -3
- package/src/ui/YAxis.vue +5 -3
- package/src/ui/YLabel.vue +5 -16
|
@@ -1,59 +1,72 @@
|
|
|
1
|
-
import { resolveAxisTextColor as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { resolveAxisTextColor as I, resolveAxisFontSize as C } from "../theme/resolve.js";
|
|
2
|
+
import { clamp as P } from "../utils/math.js";
|
|
3
|
+
const V = 0.01;
|
|
4
|
+
function E(T) {
|
|
5
|
+
const { chart: e, container: w, axis: a } = T, r = /* @__PURE__ */ new Map();
|
|
6
|
+
let p = null, m = null;
|
|
7
|
+
const x = a === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
|
|
8
|
+
function A() {
|
|
9
|
+
return a === "x" ? e.timeScale.niceTickValues(e.getDataInterval()) : { ticks: e.yScale.niceTickValues(), tickInterval: 0 };
|
|
10
|
+
}
|
|
11
|
+
function S(t, o) {
|
|
12
|
+
return a === "x" ? e.timeScale.formatX(t, o) : e.yScale.formatY(t);
|
|
13
|
+
}
|
|
14
|
+
function $(t, o) {
|
|
15
|
+
if (a === "x") {
|
|
15
16
|
t.style.left = `${e.timeScale.timeToSnappedX(o)}px`;
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
19
|
t.style.top = `${e.yScale.valueToSnappedY(o)}px`;
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
t.style.color =
|
|
21
|
+
function h(t, o) {
|
|
22
|
+
t.style.color = I(o, a), t.style.fontSize = `${C(o, a)}px`, t.style.fontFamily = o.typography.fontFamily;
|
|
23
|
+
}
|
|
24
|
+
function v(t, o) {
|
|
25
|
+
const i = o === "left" ? "left" : "right", n = o === "left" ? "right" : "left";
|
|
26
|
+
t.style[i] = "8px", t.style[n] = "";
|
|
27
|
+
}
|
|
28
|
+
function F(t, o) {
|
|
29
|
+
const i = e.headerHeight;
|
|
30
|
+
if (a !== "y" || i <= 0 || e.yAxisPosition !== "left") return 1;
|
|
31
|
+
const n = C(o, a), y = e.yScale.valueToSnappedY(t) - n / 2;
|
|
32
|
+
return P((y - i + n) / n, 0, 1);
|
|
22
33
|
}
|
|
23
|
-
function
|
|
34
|
+
function Y(t, o, i) {
|
|
24
35
|
const n = document.createElement("span");
|
|
25
|
-
return n.textContent =
|
|
26
|
-
}
|
|
27
|
-
function
|
|
28
|
-
const t = e.getTheme(), o = t !==
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
return n.textContent = S(t, o), n.style.position = "absolute", n.style.userSelect = "none", h(n, i), n.style.willChange = "opacity", a === "x" ? (n.style.transform = "translateX(-50%)", n.style.whiteSpace = "nowrap") : (v(n, e.yAxisPosition), n.style.transform = "translateY(-50%)", n.style.fontVariantNumeric = "tabular-nums"), w.appendChild(n), n;
|
|
37
|
+
}
|
|
38
|
+
function c() {
|
|
39
|
+
const t = e.getTheme(), o = t !== p;
|
|
40
|
+
p = t;
|
|
41
|
+
const i = e.yAxisPosition, n = a === "y" && i !== m;
|
|
42
|
+
m = i;
|
|
43
|
+
const { ticks: y, tickInterval: g } = A();
|
|
44
|
+
x.setCurrentTicks(y);
|
|
45
|
+
const { entries: b } = x.snapshot(), k = /* @__PURE__ */ new Set();
|
|
46
|
+
for (const { value: s, opacity: u } of b) {
|
|
47
|
+
if (u <= V) continue;
|
|
48
|
+
k.add(s);
|
|
49
|
+
let l = r.get(s);
|
|
50
|
+
if (l === void 0)
|
|
51
|
+
l = Y(s, g, t), r.set(s, l);
|
|
39
52
|
else {
|
|
40
|
-
const
|
|
41
|
-
|
|
53
|
+
const d = S(s, g);
|
|
54
|
+
l.textContent !== d && (l.textContent = d), o && h(l, t), n && v(l, i);
|
|
42
55
|
}
|
|
43
|
-
|
|
56
|
+
$(l, s), l.style.opacity = String(u * F(s, t));
|
|
44
57
|
}
|
|
45
|
-
for (const [
|
|
46
|
-
|
|
58
|
+
for (const [s, u] of r)
|
|
59
|
+
k.has(s) || (u.remove(), r.delete(s));
|
|
47
60
|
}
|
|
48
|
-
function
|
|
49
|
-
e.getAnimationState().animating ||
|
|
61
|
+
function f() {
|
|
62
|
+
e.getAnimationState().animating || c();
|
|
50
63
|
}
|
|
51
|
-
return
|
|
52
|
-
e.off("tickFrame",
|
|
53
|
-
for (const t of
|
|
54
|
-
|
|
64
|
+
return c(), e.on("tickFrame", c), e.on("viewportChange", f), e.on("overlayChange", f), () => {
|
|
65
|
+
e.off("tickFrame", c), e.off("viewportChange", f), e.off("overlayChange", f);
|
|
66
|
+
for (const t of r.values()) t.remove();
|
|
67
|
+
r.clear();
|
|
55
68
|
};
|
|
56
69
|
}
|
|
57
70
|
export {
|
|
58
|
-
|
|
71
|
+
E as mountAxisLabels
|
|
59
72
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ScalarSpring as g } from "../animation/scalar-spring.js";
|
|
2
|
-
const
|
|
3
|
-
class
|
|
2
|
+
const l = 320, V = 0.15;
|
|
3
|
+
class b {
|
|
4
4
|
#t;
|
|
5
5
|
#e;
|
|
6
6
|
#i = !1;
|
|
@@ -8,45 +8,53 @@ class x {
|
|
|
8
8
|
this.#t = new g(i), this.#e = i;
|
|
9
9
|
}
|
|
10
10
|
frame(i) {
|
|
11
|
-
const { target: t, firstVisible: n, introFront:
|
|
12
|
-
if (p || !
|
|
11
|
+
const { target: t, firstVisible: n, introFront: r, now: s, glide: a = !0, countUp: u = !0, reducedMotion: p = !1 } = i;
|
|
12
|
+
if (p || !a && !u)
|
|
13
13
|
return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
14
|
-
if (
|
|
15
|
-
const
|
|
16
|
-
return this.#t.snap(
|
|
14
|
+
if (r < 1) {
|
|
15
|
+
const h = n + (t - n) * r, o = u ? h : t;
|
|
16
|
+
return this.#t.snap(o, { now: s }), this.#e = o, this.#i = !0, { positionValue: o, textValue: o, opacity: this.#s(r), animating: !0 };
|
|
17
17
|
}
|
|
18
18
|
if (!this.#i)
|
|
19
19
|
return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
20
|
-
if (!
|
|
20
|
+
if (!a)
|
|
21
21
|
return this.#t.snap(t, { now: s }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
22
|
-
const c = i.settleMs ??
|
|
22
|
+
const c = i.settleMs ?? l;
|
|
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) > d && (this.#t.retarget(t, { now: s, settleMs: c }), this.#e = t);
|
|
26
|
+
const f = this.#t.tick(s);
|
|
27
|
+
return { positionValue: this.#t.current, textValue: t, opacity: 1, animating: f };
|
|
28
28
|
}
|
|
29
29
|
#s(i) {
|
|
30
|
-
return i >= 1 ? 1 :
|
|
30
|
+
return i >= 1 ? 1 : y(i / V);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
function
|
|
33
|
+
const d = 1e-9;
|
|
34
|
+
function y(e) {
|
|
35
35
|
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs:
|
|
37
|
+
function w(e) {
|
|
38
|
+
return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: l } : {
|
|
39
39
|
glide: e.glide ?? !0,
|
|
40
40
|
countUp: e.countUp ?? !0,
|
|
41
|
-
settleMs: e.settleMs ??
|
|
41
|
+
settleMs: e.settleMs ?? l
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function M(e, i, t) {
|
|
45
45
|
const { from: n } = e.getVisibleRange();
|
|
46
46
|
return e.getStackedValueAtTime(i, n) ?? t;
|
|
47
47
|
}
|
|
48
|
+
function S(e, i) {
|
|
49
|
+
if (i !== void 0) return i;
|
|
50
|
+
const t = new Set(e.getSeriesIdsByType("band")), n = (a) => !t.has(a), r = e.getSeriesIdsByType("time", { visibleOnly: !0, singleLayerOnly: !0 }).filter(n);
|
|
51
|
+
if (r.length > 0) return r[0];
|
|
52
|
+
const s = e.getSeriesIdsByType("time", { visibleOnly: !0 }).filter(n);
|
|
53
|
+
return s.length > 0 ? s[0] : null;
|
|
54
|
+
}
|
|
48
55
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
b as BadgeAnimator,
|
|
57
|
+
M as firstVisibleValue,
|
|
58
|
+
w as resolveAnimate,
|
|
59
|
+
S as resolveYLabelSeriesId
|
|
52
60
|
};
|
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import { renderEdgeIndicator as s } from "../components/edge-indicator.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { pointValue as c } from "../utils/point.js";
|
|
3
|
+
function h(e) {
|
|
4
|
+
const t = performance.now();
|
|
5
|
+
for (const o of ["left", "right"]) {
|
|
6
|
+
let r = e.edgeStates[o], n = 1;
|
|
6
7
|
if (r === "idle" || r === "has-more") {
|
|
7
|
-
const a = e.edgeExitFades[
|
|
8
|
+
const a = e.edgeExitFades[o];
|
|
8
9
|
if (a === null) continue;
|
|
9
10
|
r = "loading", n = a;
|
|
10
11
|
}
|
|
11
|
-
const l = e.resolveBoundary(
|
|
12
|
+
const l = e.resolveBoundary(o);
|
|
12
13
|
if (l === null) continue;
|
|
13
|
-
const { context:
|
|
14
|
-
n < 1 && (
|
|
14
|
+
const { context: i } = e.scope;
|
|
15
|
+
n < 1 && (i.save(), i.globalAlpha *= n), s({
|
|
15
16
|
scope: e.scope,
|
|
16
17
|
timeScale: e.timeScale,
|
|
17
18
|
theme: e.theme,
|
|
18
19
|
chartMediaWidth: e.chartMediaWidth,
|
|
19
20
|
chartMediaHeight: e.chartMediaHeight,
|
|
20
21
|
boundaryTime: l,
|
|
21
|
-
side:
|
|
22
|
+
side: o,
|
|
22
23
|
state: r,
|
|
23
|
-
now:
|
|
24
|
-
customIndicator: e.edgeIndicatorFns[
|
|
25
|
-
resolveEdgeAnchor: () => e.resolveEdgeAnchor(
|
|
24
|
+
now: t,
|
|
25
|
+
customIndicator: e.edgeIndicatorFns[o],
|
|
26
|
+
resolveEdgeAnchor: () => e.resolveEdgeAnchor(o, l),
|
|
26
27
|
resolveEdgeBarSpacing: () => e.resolveEdgeBarSpacing(),
|
|
27
|
-
reportPlaceholders: (a) => e.reportPlaceholders(
|
|
28
|
-
}), n < 1 &&
|
|
28
|
+
reportPlaceholders: (a) => e.reportPlaceholders(o, a)
|
|
29
|
+
}), n < 1 && i.restore();
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
32
|
+
function u(e, t, o) {
|
|
33
|
+
return t !== null ? t : e === "left" ? o.first ?? null : o.last ?? null;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
return "close" in
|
|
35
|
+
function f(e, t) {
|
|
36
|
+
return "close" in t ? e === "left" ? t.open : t.close : c(t);
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
h as drawEdgeIndicators,
|
|
40
|
+
f as resolveEdgeAnchorValue,
|
|
41
|
+
u as resolveEdgeBoundary
|
|
41
42
|
};
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import { isTimeSeriesRenderer as
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
1
|
+
import { isTimeSeriesRenderer as d } from "../series/types.js";
|
|
2
|
+
import { isBandPoint as g, pointValue as m } from "../utils/point.js";
|
|
3
|
+
function o(n) {
|
|
4
|
+
return g(n) ? null : m(n);
|
|
5
|
+
}
|
|
6
|
+
function L(n, i, u) {
|
|
7
|
+
const t = i.find((l) => l.id === n);
|
|
5
8
|
if (!t) return null;
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
10
|
-
const { from:
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const r = t.renderer;
|
|
10
|
+
if (!d(r)) return null;
|
|
11
|
+
const e = r.getLastDataPoint();
|
|
12
|
+
if (!e) return null;
|
|
13
|
+
const { from: a, to: c } = u;
|
|
14
|
+
if (e.time >= a && e.time <= c) {
|
|
15
|
+
const l = o(e);
|
|
16
|
+
return l === null ? null : { value: l, isLive: !0 };
|
|
17
|
+
}
|
|
18
|
+
const s = r.getVisibleDataPoints(a, c);
|
|
19
|
+
if (s.length === 0) return null;
|
|
20
|
+
const f = o(s[s.length - 1]);
|
|
21
|
+
return f === null ? null : { value: f, isLive: !1 };
|
|
15
22
|
}
|
|
16
|
-
function
|
|
17
|
-
const t =
|
|
18
|
-
return t ? t.renderer.getStackedLastValue?.() ||
|
|
23
|
+
function p(n, i, u) {
|
|
24
|
+
const t = i.find((e) => e.id === n);
|
|
25
|
+
return t ? t.renderer.getStackedLastValue?.() || L(n, i, u) : null;
|
|
19
26
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
23
|
-
const t =
|
|
24
|
-
if (!
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
+
function V(n, i) {
|
|
28
|
+
const u = i.find((e) => e.id === n);
|
|
29
|
+
if (!u) return null;
|
|
30
|
+
const t = u.renderer;
|
|
31
|
+
if (!d(t)) return null;
|
|
32
|
+
const r = t.getSecondLastDataPoint();
|
|
33
|
+
return r ? o(r) : null;
|
|
27
34
|
}
|
|
28
35
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
L as getLastValue,
|
|
37
|
+
V as getPreviousClose,
|
|
38
|
+
p as getStackedLastValue
|
|
32
39
|
};
|
|
@@ -2,14 +2,14 @@ import { DEFAULT_MAX_VISIBLE_BARS as i, MIN_VISIBLE_BARS as r } from "./pan-zoom
|
|
|
2
2
|
function n(t) {
|
|
3
3
|
return t === void 0 || !Number.isFinite(t) || t <= 0 ? 0 : t;
|
|
4
4
|
}
|
|
5
|
-
function
|
|
5
|
+
function l(t) {
|
|
6
6
|
return {
|
|
7
7
|
top: n(t?.top),
|
|
8
8
|
right: t?.right === void 0 ? null : n(t.right),
|
|
9
|
-
left: n(t
|
|
9
|
+
left: t?.left === void 0 ? null : n(t.left)
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function a(t) {
|
|
13
13
|
if (!t) return { monitor: null, ownsMonitor: !1, hud: null };
|
|
14
14
|
if (typeof t != "object" || !("monitor" in t || "recordFrame" in t))
|
|
15
15
|
throw new Error(
|
|
@@ -39,8 +39,8 @@ function m(t) {
|
|
|
39
39
|
}
|
|
40
40
|
export {
|
|
41
41
|
u as isSameHorizontalPadding,
|
|
42
|
-
|
|
42
|
+
l as resolveFade,
|
|
43
43
|
m as resolveMaxVisibleBars,
|
|
44
44
|
f as resolvePadding,
|
|
45
|
-
|
|
45
|
+
a as resolvePerfOptions
|
|
46
46
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function o(a) {
|
|
2
|
+
if (!(a.stacking !== "percent" || a.isPlottable(0)))
|
|
3
|
+
throw new Error(
|
|
4
|
+
`[wick-charts] Series '${a.seriesId}' uses stacking: 'percent', which this Y scale can't show — a 0–100% axis starts at 0, and the scale has no position for 0. Use a linear axis, or stacking: 'normal' / 'off'.`
|
|
5
|
+
);
|
|
6
|
+
}
|
|
7
|
+
function i(a) {
|
|
8
|
+
if (process.env.NODE_ENV === "production") return;
|
|
9
|
+
const { y: n, isPlottable: t } = a;
|
|
10
|
+
for (const e of ["min", "max"]) {
|
|
11
|
+
const s = n?.[e];
|
|
12
|
+
typeof s != "number" || t(s) || console.warn(
|
|
13
|
+
`[wick-charts] axis.y.${e} is ${s}, which the Y scale can't place — falling back to 'auto'. Use a bound inside the scale's domain.`
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function r(a) {
|
|
18
|
+
process.env.NODE_ENV !== "production" && console.warn(
|
|
19
|
+
`[wick-charts] Series '${a.seriesId}' has values in view the Y scale can't place (e.g. ${a.value}; a log axis has no position for values ≤ 0). They are skipped — gaps in a line, no bar or candle. Filter or offset the data, or use a linear axis.`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
o as assertStackingFitsScale,
|
|
24
|
+
i as warnUnplottableBounds,
|
|
25
|
+
r as warnUnplottableValues
|
|
26
|
+
};
|
|
@@ -1,25 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { isPlottableOn as c } from "../scales/y-scale.js";
|
|
2
|
+
import { isTimeSeriesRenderer as d } from "../series/types.js";
|
|
3
|
+
function b(n) {
|
|
4
|
+
const { targetVisible: a, series: t, allValues: o, plottable: r } = n, e = r ? { plottable: r } : void 0;
|
|
5
|
+
let s = 1 / 0, i = -1 / 0;
|
|
6
|
+
for (const l of t) {
|
|
7
|
+
if (!l.visible || !d(l.renderer)) continue;
|
|
8
|
+
const m = l.renderer.getValueRange(a.from, a.to, e);
|
|
9
|
+
m && (r && !r(m.max) || (m.max > i && (i = m.max), m.min < s && (!r || r(m.min)) && (s = m.min), o?.push(m.min, m.max)));
|
|
8
10
|
}
|
|
9
|
-
return
|
|
11
|
+
return i === -1 / 0 ? null : (s === 1 / 0 && (s = i), { min: s, max: i });
|
|
10
12
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
function w(n) {
|
|
14
|
+
const { raw: a, bounds: t, allValues: o, transform: r } = n;
|
|
15
|
+
if (r === null)
|
|
16
|
+
return {
|
|
17
|
+
min: u(t.min, a.min, a.max, o, "min"),
|
|
18
|
+
max: u(t.max, a.max, a.min, o, "max")
|
|
19
|
+
};
|
|
20
|
+
const e = { min: r.forward(a.min), max: r.forward(a.max) };
|
|
21
|
+
return {
|
|
22
|
+
min: f({ bound: t.min, raw: a, scaledRaw: e, allValues: o, side: "min", transform: r }),
|
|
23
|
+
max: f({ bound: t.max, raw: a, scaledRaw: e, allValues: o, side: "max", transform: r })
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function f(n) {
|
|
27
|
+
const { bound: a, raw: t, scaledRaw: o, allValues: r, side: e, transform: s } = n, i = e === "min" ? "max" : "min";
|
|
28
|
+
if (typeof a == "string" && a !== "auto")
|
|
29
|
+
return u(a, o[e], o[i], [], e);
|
|
30
|
+
const l = u(a, t[e], t[i], r, e), m = c(s, l);
|
|
31
|
+
return s.forward(m ? l : t[e]);
|
|
32
|
+
}
|
|
33
|
+
function g(n, a) {
|
|
34
|
+
return a === null ? n : { min: a.inverse(n.min), max: a.inverse(n.max) };
|
|
35
|
+
}
|
|
36
|
+
function u(n, a, t, o, r) {
|
|
37
|
+
if (n === void 0 || n === "auto") return a;
|
|
38
|
+
if (typeof n == "number") return n;
|
|
39
|
+
if (typeof n == "function") return n(o);
|
|
40
|
+
const e = String(n).match(/^([+-]?)\s*(\d+(?:\.\d+)?)\s*%$/);
|
|
41
|
+
if (e) {
|
|
42
|
+
const s = e[1] === "-" ? -1 : 1, i = parseFloat(e[2]) / 100, l = Math.abs(t - a) || Math.abs(a) || 1;
|
|
43
|
+
return a + s * i * l * (r === "max" ? 1 : -1);
|
|
19
44
|
}
|
|
20
|
-
return
|
|
45
|
+
return a;
|
|
21
46
|
}
|
|
22
47
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
48
|
+
b as computeTargetYRange,
|
|
49
|
+
g as fromScaleSpace,
|
|
50
|
+
u as resolveBound,
|
|
51
|
+
w as resolveYTarget
|
|
25
52
|
};
|