@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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
class r {
|
|
2
|
+
#i;
|
|
3
|
+
/** Drawn top edge so far — starts at the plot floor when 0 has no place on the axis. */
|
|
4
|
+
#s;
|
|
5
|
+
/** Data value the stack so far stands for; trails `#edge` while a floor stand-in fades out. */
|
|
6
|
+
#t = 0;
|
|
7
|
+
constructor(s) {
|
|
8
|
+
this.#i = s, this.#s = s.baselineValue();
|
|
9
|
+
}
|
|
10
|
+
get edge() {
|
|
11
|
+
return this.#s;
|
|
12
|
+
}
|
|
13
|
+
/** Stacks `weight` of `value` (weight in `[0, 1]`) and returns the new top edge. */
|
|
14
|
+
push(s, i) {
|
|
15
|
+
if (s === 0) return this.#s;
|
|
16
|
+
const t = this.#t + s;
|
|
17
|
+
if (i === 1)
|
|
18
|
+
return this.#s = t, this.#t = t, t;
|
|
19
|
+
const h = this.#i.lerpValue(this.#s, t, i);
|
|
20
|
+
return this.#t = h - (this.#s - this.#t) * (1 - i), this.#s = h, h;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
r as ScaleStack
|
|
25
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
2
|
-
const {
|
|
1
|
+
function c(f) {
|
|
2
|
+
const { y: t, chartLeft: m = 0, chartWidth: n, chartHeight: p, tooltipWidth: o, tooltipHeight: a, offsetX: h = 16, offsetY: i = 16 } = f, e = f.x - m, r = e + h + o > n ? e - h - o : e + h, x = t + i + a > p ? t - i - a : t + i, M = Math.max(0, n - o), s = Math.max(0, p - a);
|
|
3
3
|
return {
|
|
4
|
-
left: Math.max(0, Math.min(
|
|
5
|
-
top: Math.max(0, Math.min(
|
|
4
|
+
left: m + Math.max(0, Math.min(M, r)),
|
|
5
|
+
top: Math.max(0, Math.min(s, x))
|
|
6
6
|
};
|
|
7
7
|
}
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
c as computeTooltipPosition
|
|
10
10
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -268,7 +268,7 @@ declare type __VLS_Props_3 = {
|
|
|
268
268
|
* change, use `viewport.initialRange` instead.
|
|
269
269
|
*/
|
|
270
270
|
visibleRange?: VisibleRangeSpec;
|
|
271
|
-
/** Show the chart background gradient. Live. Defaults to
|
|
271
|
+
/** Show the chart background gradient. Live. Defaults to false. */
|
|
272
272
|
gradient?: boolean;
|
|
273
273
|
/**
|
|
274
274
|
* Enable zoom, pan, and crosshair interactions. Defaults to true.
|
|
@@ -285,16 +285,20 @@ declare type __VLS_Props_3 = {
|
|
|
285
285
|
* Soft fade-out at the top of the plot area, so series content dissolves
|
|
286
286
|
* under a floating `<Title>` / `<InfoBar>` instead of colliding with it.
|
|
287
287
|
* The mask erases canvas alpha rather than painting a cover color, so it
|
|
288
|
-
* stays correct over
|
|
288
|
+
* stays correct over a background gradient. Live.
|
|
289
289
|
*
|
|
290
290
|
* Two directions, independently controlled:
|
|
291
291
|
*
|
|
292
292
|
* **X (under the axis)** — panning content slides under the Y-axis
|
|
293
293
|
* column and dissolves instead of hard-clipping at the pane edge. **On
|
|
294
294
|
* by default** as a 60px ramp that finishes just inside the axis
|
|
295
|
-
* column, before the label glyphs
|
|
296
|
-
*
|
|
297
|
-
*
|
|
295
|
+
* column, before the label glyphs — on whichever side
|
|
296
|
+
* `axis.y.position` puts it (a left-axis ramp ends at the pane edge
|
|
297
|
+
* instead). The axis side's key (`{ right }` by default, `{ left }` for
|
|
298
|
+
* a left axis) overrides the total ramp width in CSS px (`0` disables);
|
|
299
|
+
* the other key adds a plain zone at the opposite pane edge (default
|
|
300
|
+
* off). A chart with only pie / heatmap series has no axis column, so
|
|
301
|
+
* both keys add plain zones there.
|
|
298
302
|
*
|
|
299
303
|
* **Top (under the header)** — opt-in. `true` enables the auto zone
|
|
300
304
|
* (measured header + 24px run-out, half the header fold-in released so
|
|
@@ -760,6 +764,15 @@ export declare interface AnimationsConfig {
|
|
|
760
764
|
* @default {@link DEFAULT_TICKS_MS}
|
|
761
765
|
*/
|
|
762
766
|
ticks?: AnimationTime;
|
|
767
|
+
/**
|
|
768
|
+
* Gridline layer opacity: the opening reveal on first paint and the
|
|
769
|
+
* fade out when `grid.visible` flips off. Independent of
|
|
770
|
+
* {@link ticks}, which owns the per-tick cross-fade on relabel.
|
|
771
|
+
* `false` makes the grid appear and disappear instantly.
|
|
772
|
+
*
|
|
773
|
+
* @default {@link DEFAULT_GRID_MS}
|
|
774
|
+
*/
|
|
775
|
+
grid?: AnimationTime;
|
|
763
776
|
};
|
|
764
777
|
/**
|
|
765
778
|
* Series-visibility toggle duration. Drives BOTH the renderer's alpha
|
|
@@ -1071,8 +1084,9 @@ export declare interface BarIntroDirectives {
|
|
|
1071
1084
|
fromX?: number;
|
|
1072
1085
|
toX?: number;
|
|
1073
1086
|
};
|
|
1074
|
-
/** Per-value transform applied before geometry
|
|
1075
|
-
*
|
|
1087
|
+
/** Per-value transform applied before geometry. Moving the value from
|
|
1088
|
+
* `frame.baseline` grows the bar on every render path. A stack applies it
|
|
1089
|
+
* to each segment before stacking, or to each drawn edge on a non-linear axis. */
|
|
1076
1090
|
value?: (args: BarIntroValueArgs) => number;
|
|
1077
1091
|
/** Per-bar transform applied after the geometry is resolved. */
|
|
1078
1092
|
element?: (el: BarIntroElement) => BarElementTransform;
|
|
@@ -1100,6 +1114,14 @@ export declare type BarIntroFn = (frame: BarIntroFrame) => BarIntroDirectives;
|
|
|
1100
1114
|
export declare interface BarIntroFrame extends WaveIntroFrame {
|
|
1101
1115
|
/** Time → bitmap X through the live time scale. */
|
|
1102
1116
|
timeToX(time: number): number;
|
|
1117
|
+
/** The value bars grow from: `0`, or the plot floor's value on a scale with no place for 0 (log). */
|
|
1118
|
+
baseline: number;
|
|
1119
|
+
/**
|
|
1120
|
+
* The value `t` of the way from `from` to `to` on the Y axis — a plain lerp
|
|
1121
|
+
* on a linear axis, a geometric one on log. Grow bars through this: a bare
|
|
1122
|
+
* `value * t` stays below a log axis's floor for most of the intro.
|
|
1123
|
+
*/
|
|
1124
|
+
lerpValue(from: number, to: number, t: number): number;
|
|
1103
1125
|
}
|
|
1104
1126
|
|
|
1105
1127
|
/** Arguments handed to {@link BarIntroDirectives.value} for every rendered value. */
|
|
@@ -1864,7 +1886,20 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> implements
|
|
|
1864
1886
|
readonly timeScale: XScale;
|
|
1865
1887
|
/** Maps price/value to vertical pixel coordinates. */
|
|
1866
1888
|
readonly yScale: YScale;
|
|
1889
|
+
/** CSS px of the Y-axis column. The default collapses to `0` on a spatial-only chart. */
|
|
1867
1890
|
get yAxisWidth(): number;
|
|
1891
|
+
/** Side of the plot area the Y-axis column sits on. */
|
|
1892
|
+
get yAxisPosition(): YAxisPosition;
|
|
1893
|
+
/**
|
|
1894
|
+
* Left edge of the plot area in container CSS px — the Y-axis width when
|
|
1895
|
+
* the axis sits on the left, `0` otherwise. Scales map into the plot area,
|
|
1896
|
+
* so add this to `timeScale.timeToX()` to get a container coordinate.
|
|
1897
|
+
*/
|
|
1898
|
+
get plotLeft(): number;
|
|
1899
|
+
/** CSS px height of the floating Title / InfoBar header, `0` without one. A left
|
|
1900
|
+
* axis shares its column with it, so tick labels fade out underneath. */
|
|
1901
|
+
get headerHeight(): number;
|
|
1902
|
+
/** CSS px of the time-axis row. The default collapses to `0` on a spatial-only chart. */
|
|
1868
1903
|
get xAxisHeight(): number;
|
|
1869
1904
|
constructor(container: HTMLElement, options?: ChartOptions);
|
|
1870
1905
|
/**
|
|
@@ -2284,6 +2319,9 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> implements
|
|
|
2284
2319
|
* the next render frame.
|
|
2285
2320
|
*/
|
|
2286
2321
|
setFade(fade: ChartOptions['fade']): void;
|
|
2322
|
+
/** Report the floating header's height (see {@link headerHeight}). The
|
|
2323
|
+
* framework wrappers keep it in sync with the measured Title / InfoBar. */
|
|
2324
|
+
setHeaderHeight(height: number): void;
|
|
2287
2325
|
/**
|
|
2288
2326
|
* Set the visual state for one side of the chart. Typically called in
|
|
2289
2327
|
* response to the `onEdgeReached` callback:
|
|
@@ -2359,8 +2397,10 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> implements
|
|
|
2359
2397
|
|
|
2360
2398
|
/** Layout metrics describing the chart area, Y axis, and time axis sizes. */
|
|
2361
2399
|
export declare interface ChartLayout {
|
|
2400
|
+
/** Plot area in container CSS px — `x` is the Y-axis width when the axis sits on the left. */
|
|
2362
2401
|
chartArea: Rect;
|
|
2363
2402
|
yAxisWidth: number;
|
|
2403
|
+
yAxisPosition: YAxisPosition;
|
|
2364
2404
|
xAxisHeight: number;
|
|
2365
2405
|
}
|
|
2366
2406
|
|
|
@@ -2428,11 +2468,11 @@ export declare interface ChartOptions {
|
|
|
2428
2468
|
* Soft alpha fade applied at the edges of the plot area. Anything the main
|
|
2429
2469
|
* layer draws inside a zone (series, grid, time-region bands) dissolves to
|
|
2430
2470
|
* transparent as it approaches the edge: horizontally sliding under the
|
|
2431
|
-
* Y-axis labels
|
|
2432
|
-
*
|
|
2433
|
-
*
|
|
2471
|
+
* Y-axis labels (the axis side, **on by default**), toward a floating
|
|
2472
|
+
* Title / InfoBar at the top (`top`), or out the edge opposite the axis.
|
|
2473
|
+
* The mask *erases* pixels rather than painting a cover color,
|
|
2434
2474
|
* so it stays correct over any container background — including the
|
|
2435
|
-
*
|
|
2475
|
+
* optional CSS gradient. Live — `chart.setFade()` updates it after
|
|
2436
2476
|
* construction.
|
|
2437
2477
|
*/
|
|
2438
2478
|
fade?: FadeConfig;
|
|
@@ -2809,18 +2849,30 @@ declare interface FadeConfig {
|
|
|
2809
2849
|
* area. `0` / omitted disables the mask. */
|
|
2810
2850
|
top?: number;
|
|
2811
2851
|
/**
|
|
2812
|
-
*
|
|
2813
|
-
*
|
|
2814
|
-
*
|
|
2815
|
-
*
|
|
2816
|
-
*
|
|
2817
|
-
*
|
|
2852
|
+
* Width in CSS pixels of the horizontal dissolve at the right edge.
|
|
2853
|
+
*
|
|
2854
|
+
* On the Y-axis side (the default `axis.y.position`) this is the total
|
|
2855
|
+
* width of a ramp that finishes just inside the axis column — 12px past
|
|
2856
|
+
* the pane edge, before the label glyphs start — so content melts on
|
|
2857
|
+
* approach (pan / tail-scroll exit) and is fully gone before it can cross
|
|
2858
|
+
* any axis text; the rest of the width runs backward into the pane as a
|
|
2859
|
+
* soft lead-in. **Defaults to a 60px ramp** there — on out of the box;
|
|
2818
2860
|
* `0` disables. A no-op while the Y axis is hidden.
|
|
2861
|
+
*
|
|
2862
|
+
* On the side opposite the axis it's a plain zone at the pane edge —
|
|
2863
|
+
* content leaving the plot dissolves instead of hard-clipping at the
|
|
2864
|
+
* canvas boundary. Off by default.
|
|
2865
|
+
*
|
|
2866
|
+
* A chart whose series are all spatial (pie, heatmap) has no axis column,
|
|
2867
|
+
* so both sides take the plain zone, off by default.
|
|
2819
2868
|
*/
|
|
2820
2869
|
right?: number;
|
|
2821
|
-
/**
|
|
2822
|
-
*
|
|
2823
|
-
*
|
|
2870
|
+
/**
|
|
2871
|
+
* Width in CSS pixels of the horizontal dissolve at the left edge. Same
|
|
2872
|
+
* rules as {@link right}, except that with `axis.y.position: 'left'` the
|
|
2873
|
+
* ramp (60px by default) finishes at the pane edge rather than under the
|
|
2874
|
+
* column: data scrolls out through the left edge and isn't drawn past it.
|
|
2875
|
+
*/
|
|
2824
2876
|
left?: number;
|
|
2825
2877
|
}
|
|
2826
2878
|
|
|
@@ -3137,11 +3189,20 @@ export declare interface LineIntroFrame {
|
|
|
3137
3189
|
xToTime(x: number): number;
|
|
3138
3190
|
/** Value → bitmap Y through the live Y scale. */
|
|
3139
3191
|
valueToY(value: number): number;
|
|
3192
|
+
/**
|
|
3193
|
+
* The value `t` of the way from `from` to `to` on the Y axis — a plain lerp
|
|
3194
|
+
* on a linear axis, a geometric one on log. Move values through this, or a
|
|
3195
|
+
* log axis bunches the motion at one end and overshoots past 0.
|
|
3196
|
+
*/
|
|
3197
|
+
lerpValue(from: number, to: number, t: number): number;
|
|
3140
3198
|
/** Number of layers in the series. */
|
|
3141
3199
|
layerCount: number;
|
|
3142
3200
|
/** Visible data of one layer (memoized per frame). */
|
|
3143
3201
|
layerData(layerIndex: number): readonly TimePoint[];
|
|
3144
|
-
/**
|
|
3202
|
+
/**
|
|
3203
|
+
* Mean of the layer's visible plottable values, taken on the Y axis (the
|
|
3204
|
+
* geometric mean on log), or `null` for an empty/poisoned layer (memoized per frame).
|
|
3205
|
+
*/
|
|
3145
3206
|
layerMean(layerIndex: number): number | null;
|
|
3146
3207
|
/**
|
|
3147
3208
|
* Bitmap-space polyline of the first visible layer (finite values only,
|
|
@@ -3478,6 +3539,24 @@ export declare interface LoadingIndicatorArgs {
|
|
|
3478
3539
|
/** Pure function contract for a pluggable loading indicator. */
|
|
3479
3540
|
export declare type LoadingIndicatorFn = (args: LoadingIndicatorArgs) => void;
|
|
3480
3541
|
|
|
3542
|
+
/**
|
|
3543
|
+
* Logarithmic Y scale for `axis.y.scale`: each power of the base gets the same
|
|
3544
|
+
* height. Ticks sit on powers of the base, thinned when they crowd and — for
|
|
3545
|
+
* base 10 — with 2× / 5× steps when a decade has room; a range too narrow to
|
|
3546
|
+
* catch a power falls back to linear ticks. Values ≤ 0 have no position.
|
|
3547
|
+
*
|
|
3548
|
+
* Tree-shakeable: charts that never call it don't ship the log code.
|
|
3549
|
+
*/
|
|
3550
|
+
export declare function logScale(options?: LogScaleOptions): YScaleTransform;
|
|
3551
|
+
|
|
3552
|
+
export declare interface LogScaleOptions {
|
|
3553
|
+
/**
|
|
3554
|
+
* Base whose powers carry the ticks. The mapping itself is the same for
|
|
3555
|
+
* every base — only tick placement changes. Default: 10.
|
|
3556
|
+
*/
|
|
3557
|
+
base?: number;
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3481
3560
|
export declare const Marker: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
3482
3561
|
|
|
3483
3562
|
/**
|
|
@@ -3612,8 +3691,9 @@ export declare interface NavigatorCandlePoint {
|
|
|
3612
3691
|
* left handle, right handle. The overlay is purely visual; pointer input is
|
|
3613
3692
|
* captured on the canvas and hit-tested against the current window geometry.
|
|
3614
3693
|
*
|
|
3615
|
-
* Both layers reserve `chart.yAxisWidth` on the
|
|
3616
|
-
* active zone aligns with the main chart's plot area (matches
|
|
3694
|
+
* Both layers reserve `chart.yAxisWidth` on the Y-axis side so the
|
|
3695
|
+
* navigator's active zone aligns with the main chart's plot area (matches
|
|
3696
|
+
* the TimeAxis).
|
|
3617
3697
|
*
|
|
3618
3698
|
* Event topology — navigator is a pure listener on the chart side, never emits:
|
|
3619
3699
|
* chart.viewportChange → reposition window DOM on next frame (canvas untouched)
|
|
@@ -3770,6 +3850,12 @@ declare interface PanZoomTarget {
|
|
|
3770
3850
|
* chart keeps working. Targets that omit the hook are always pan/zoomable.
|
|
3771
3851
|
*/
|
|
3772
3852
|
canPanZoom?(): boolean;
|
|
3853
|
+
/**
|
|
3854
|
+
* Left edge of the plot area in canvas CSS px — nonzero when the Y axis
|
|
3855
|
+
* sits on the left. Pointer offsets subtract it before mapping through the
|
|
3856
|
+
* time scale. Omitted means `0`.
|
|
3857
|
+
*/
|
|
3858
|
+
readonly plotLeft?: number;
|
|
3773
3859
|
}
|
|
3774
3860
|
|
|
3775
3861
|
/**
|
|
@@ -4346,6 +4432,24 @@ export declare function sampleRamp(stops: readonly string[], t: number): string;
|
|
|
4346
4432
|
|
|
4347
4433
|
export declare const sandDune: ThemePreset;
|
|
4348
4434
|
|
|
4435
|
+
/** What a {@link YScaleTransform.ticks} generator is asked to fill. */
|
|
4436
|
+
export declare interface ScaleTickArgs {
|
|
4437
|
+
/** Visible value range. Both bounds are plottable on the scale. */
|
|
4438
|
+
min: number;
|
|
4439
|
+
max: number;
|
|
4440
|
+
/** Plot height in CSS pixels. */
|
|
4441
|
+
height: number;
|
|
4442
|
+
/** Minimum pixel gap between adjacent labels. */
|
|
4443
|
+
minSpacing: number;
|
|
4444
|
+
/** Desired label count from `<YAxis labelCount>`, or `null`. */
|
|
4445
|
+
labelCount: number | null;
|
|
4446
|
+
/**
|
|
4447
|
+
* Linear {1,2,5}×10^k ticks already spaced for this mapping (with the axis's
|
|
4448
|
+
* anti-flicker hold). Return this array itself to keep them.
|
|
4449
|
+
*/
|
|
4450
|
+
linear: readonly number[];
|
|
4451
|
+
}
|
|
4452
|
+
|
|
4349
4453
|
/** Environment the chart hands a {@link SeriesDefinition} when constructing its renderer. */
|
|
4350
4454
|
export declare interface SeriesCreateEnv {
|
|
4351
4455
|
/** Active chart theme — definitions read their default colours from it. */
|
|
@@ -4729,11 +4833,18 @@ export declare interface TimeSeriesRenderer extends BaseSeriesRenderer {
|
|
|
4729
4833
|
sampleTimes(maxCount: number): number[];
|
|
4730
4834
|
/** Visible points in `[from, to]` (layer 0 for multi-layer). */
|
|
4731
4835
|
getVisibleDataPoints(from: number, to: number): readonly (OHLCData | TimePoint)[];
|
|
4732
|
-
/**
|
|
4733
|
-
|
|
4836
|
+
/**
|
|
4837
|
+
* Effective min/max for auto-range (stacked totals for multi-layer; raw
|
|
4838
|
+
* min/max otherwise). With `opts.plottable` (a non-linear Y scale) values
|
|
4839
|
+
* it rejects are left out, so the range covers only what the scale can
|
|
4840
|
+
* place; `null` when nothing plottable is in view.
|
|
4841
|
+
*/
|
|
4842
|
+
getValueRange(from: number, to: number, opts?: ValueRangeOptions): {
|
|
4734
4843
|
min: number;
|
|
4735
4844
|
max: number;
|
|
4736
4845
|
} | null;
|
|
4846
|
+
/** Stacking mode of a multi-layer series — the chart rejects `'percent'` on a Y scale with no 0. */
|
|
4847
|
+
readonly stacking?: StackingMode;
|
|
4737
4848
|
}
|
|
4738
4849
|
|
|
4739
4850
|
/** Custom tick-value generator — replaces the built-in `niceTimeIntervals` tier resolution entirely when installed. */
|
|
@@ -4772,10 +4883,16 @@ export declare interface TooltipPosition {
|
|
|
4772
4883
|
* time-series, full media size for pie).
|
|
4773
4884
|
*/
|
|
4774
4885
|
export declare interface TooltipPositionArgs {
|
|
4775
|
-
/** Cursor or anchor x in CSS pixels, relative to the
|
|
4886
|
+
/** Cursor or anchor x in CSS pixels, relative to the overlay container. */
|
|
4776
4887
|
x: number;
|
|
4777
4888
|
/** Cursor or anchor y in CSS pixels, relative to the chart area origin. */
|
|
4778
4889
|
y: number;
|
|
4890
|
+
/**
|
|
4891
|
+
* Left edge of the plot area in the same space as `x` — `chart.plotLeft`
|
|
4892
|
+
* for a time-series tooltip, so it stays clear of a left-side Y axis.
|
|
4893
|
+
* The result is in that space too. Default `0`.
|
|
4894
|
+
*/
|
|
4895
|
+
chartLeft?: number;
|
|
4779
4896
|
/** Plot-area width in CSS pixels. */
|
|
4780
4897
|
chartWidth: number;
|
|
4781
4898
|
/** Plot-area height in CSS pixels. */
|
|
@@ -4937,6 +5054,12 @@ declare type ValueColor = string | ((value: number) => string);
|
|
|
4937
5054
|
/** Signature for a value-to-string formatter (YAxis, YLabel, Pie, Sparkline, NumberFlow). */
|
|
4938
5055
|
export declare type ValueFormatter = (value: number) => string;
|
|
4939
5056
|
|
|
5057
|
+
/** Options for {@link TimeSeriesRenderer.getValueRange}. */
|
|
5058
|
+
declare interface ValueRangeOptions {
|
|
5059
|
+
/** Whether a value has a position on the Y scale (e.g. `v > 0` on log); others are left out. */
|
|
5060
|
+
plottable?: (value: number) => boolean;
|
|
5061
|
+
}
|
|
5062
|
+
|
|
4940
5063
|
/** Custom tick-value generator — replaces the built-in {1,2,5}×10^k resolution entirely when installed. */
|
|
4941
5064
|
export declare type ValueTickGenerator = (range: YRange) => number[];
|
|
4942
5065
|
|
|
@@ -5027,7 +5150,7 @@ export declare function wipeIntro(): WaveIntroFn;
|
|
|
5027
5150
|
|
|
5028
5151
|
/** Configuration for the X (time) axis. */
|
|
5029
5152
|
export declare interface XAxisConfig {
|
|
5030
|
-
/** Height in CSS pixels. Default: 30. */
|
|
5153
|
+
/** Height in CSS pixels. Default: 30, or 0 when every series is spatial (pie, heatmap). */
|
|
5031
5154
|
height?: number;
|
|
5032
5155
|
/** Whether the axis is visible. Default: true. When false, height is treated as 0. */
|
|
5033
5156
|
visible?: boolean;
|
|
@@ -5099,7 +5222,17 @@ export declare class XScale {
|
|
|
5099
5222
|
formatX(timestamp: number, interval: number): string;
|
|
5100
5223
|
private resetHysteresis;
|
|
5101
5224
|
timeToX(time: number): number;
|
|
5225
|
+
/** X in physical (bitmap) pixels, snapped to the pixel grid — for
|
|
5226
|
+
* axis-aligned edges that have to stay crisp. */
|
|
5102
5227
|
timeToBitmapX(time: number): number;
|
|
5228
|
+
/** Same in physical pixels, off the grid — see {@link YScale.valueToBitmapYExact}. */
|
|
5229
|
+
timeToBitmapXExact(time: number): number;
|
|
5230
|
+
/**
|
|
5231
|
+
* X position in CSS pixels of the *stroke center* the canvas grid draws for
|
|
5232
|
+
* `time`. DOM axis labels position off this instead of raw {@link timeToX}
|
|
5233
|
+
* so text and gridline share one pixel grid.
|
|
5234
|
+
*/
|
|
5235
|
+
timeToSnappedX(time: number): number;
|
|
5103
5236
|
xToTime(x: number): number;
|
|
5104
5237
|
pixelDeltaToTimeDelta(pixelDelta: number): number;
|
|
5105
5238
|
barWidthMedia(dataInterval: number): number;
|
|
@@ -5130,8 +5263,26 @@ containerRef: HTMLDivElement;
|
|
|
5130
5263
|
|
|
5131
5264
|
/** Configuration for the Y axis. */
|
|
5132
5265
|
export declare interface YAxisConfig {
|
|
5133
|
-
/**
|
|
5266
|
+
/**
|
|
5267
|
+
* Side the axis column sits on — the plot area shifts right by the axis
|
|
5268
|
+
* width when it's `'left'`. The default edge fade follows the axis to
|
|
5269
|
+
* whichever side it's on. Default: 'right'.
|
|
5270
|
+
*/
|
|
5271
|
+
position?: YAxisPosition;
|
|
5272
|
+
/** Width in CSS pixels. Default: 55, or 0 when every series is spatial (pie, heatmap). */
|
|
5134
5273
|
width?: number;
|
|
5274
|
+
/**
|
|
5275
|
+
* Value mapping. Omitted: linear. `logScale()` gives each power of ten equal
|
|
5276
|
+
* height — for series spanning orders of magnitude; `logScale({ base: 2 })`
|
|
5277
|
+
* puts the ticks on powers of two. Any {@link YScaleTransform} works.
|
|
5278
|
+
*
|
|
5279
|
+
* Autoscale and Y animations run in the scale's space. Values the scale
|
|
5280
|
+
* can't place (≤ 0 on log) are skipped — a gap in a line, no bar or candle —
|
|
5281
|
+
* a fixed `min` / `max` it can't place falls back to `'auto'`, and area
|
|
5282
|
+
* fills close to the plot floor. Percent stacking is rejected when the
|
|
5283
|
+
* scale has no position for 0. Live — a different scale refits the Y range.
|
|
5284
|
+
*/
|
|
5285
|
+
scale?: YScaleTransform;
|
|
5135
5286
|
/** Minimum bound. Default: 'auto'. */
|
|
5136
5287
|
min?: AxisBound;
|
|
5137
5288
|
/** Maximum bound. Default: 'auto'. */
|
|
@@ -5140,6 +5291,9 @@ export declare interface YAxisConfig {
|
|
|
5140
5291
|
visible?: boolean;
|
|
5141
5292
|
}
|
|
5142
5293
|
|
|
5294
|
+
/** Side of the plot area the Y axis column sits on. */
|
|
5295
|
+
export declare type YAxisPosition = 'left' | 'right';
|
|
5296
|
+
|
|
5143
5297
|
export declare const YLabel: __VLS_WithTemplateSlots_8<typeof __VLS_component_8, __VLS_TemplateResult_8["slots"]>;
|
|
5144
5298
|
|
|
5145
5299
|
/**
|
|
@@ -5178,8 +5332,13 @@ export declare interface YRange {
|
|
|
5178
5332
|
export declare class YScale {
|
|
5179
5333
|
/** Shared fade state for Y ticks; see {@link TimeScale.tickTracker}. */
|
|
5180
5334
|
readonly tickTracker: AxisTickTracker;
|
|
5335
|
+
/** Non-linear value mapping (`axis.y.scale`); `null` is linear. */
|
|
5336
|
+
private transform;
|
|
5181
5337
|
private min;
|
|
5182
5338
|
private max;
|
|
5339
|
+
/** Domain bounds in scale space — `transform.forward` of `min` / `max`. */
|
|
5340
|
+
private lo;
|
|
5341
|
+
private hi;
|
|
5183
5342
|
private height;
|
|
5184
5343
|
private pixelRatio;
|
|
5185
5344
|
private labelCountHintValue;
|
|
@@ -5196,6 +5355,8 @@ export declare class YScale {
|
|
|
5196
5355
|
* the boundary doesn't instantly flip back.
|
|
5197
5356
|
*/
|
|
5198
5357
|
private lastRawInterval;
|
|
5358
|
+
/** The transform's own ticks (e.g. powers of ten); `null` while linear ticks are in use. */
|
|
5359
|
+
private ownTicks;
|
|
5199
5360
|
/** Custom formatter (driven by `<YAxis format=…>`). */
|
|
5200
5361
|
private customFormat;
|
|
5201
5362
|
/** Custom tick generator — bypasses {1,2,5}×10^k resolution in `niceTickValues` when set. */
|
|
@@ -5204,11 +5365,23 @@ export declare class YScale {
|
|
|
5204
5365
|
private get minLabelSpacing();
|
|
5205
5366
|
/** Recalculate the scale with a new Y range, chart height, and device pixel ratio. */
|
|
5206
5367
|
update(range: YRange, mediaHeight: number, pixelRatio: number): void;
|
|
5368
|
+
/** Install a non-linear value mapping, or `null` for linear. The range is kept as-is — the chart refits it. */
|
|
5369
|
+
setTransform(transform: YScaleTransform | null): void;
|
|
5370
|
+
getTransform(): YScaleTransform | null;
|
|
5371
|
+
/**
|
|
5372
|
+
* Whether `value` has a position on this scale: finite, and inside the
|
|
5373
|
+
* transform's domain (positive on log). Renderers skip values that fail —
|
|
5374
|
+
* {@link valueToY} still maps them (to the plot floor) so nothing
|
|
5375
|
+
* downstream sees NaN.
|
|
5376
|
+
*/
|
|
5377
|
+
isPlottable(value: number): boolean;
|
|
5207
5378
|
/** Desired label count. Invalid values (NaN, <2, Infinity) clear the hint. */
|
|
5208
5379
|
setLabelCount(n: number | null | undefined): void;
|
|
5209
5380
|
/** Minimum pixel gap between adjacent labels. */
|
|
5210
5381
|
setMinSpacing(px: number | null | undefined): void;
|
|
5211
5382
|
private resetHysteresis;
|
|
5383
|
+
/** A transformed domain needs both bounds plottable; anything else collapses to a flat one. */
|
|
5384
|
+
private updateDomain;
|
|
5212
5385
|
/** Install (or clear) a custom formatter. */
|
|
5213
5386
|
setFormat(fn: ValueFormatter | null): void;
|
|
5214
5387
|
/** Read back the currently installed formatter — null when the built-in is active. */
|
|
@@ -5219,17 +5392,43 @@ export declare class YScale {
|
|
|
5219
5392
|
* with the current range.
|
|
5220
5393
|
*/
|
|
5221
5394
|
setTickGenerator(fn: ValueTickGenerator | null): void;
|
|
5222
|
-
/**
|
|
5395
|
+
/**
|
|
5396
|
+
* Convert a value to a Y position in CSS (media) pixels. A value the
|
|
5397
|
+
* transform can't place (≤ 0 on log) lands on the plot floor.
|
|
5398
|
+
*/
|
|
5223
5399
|
valueToY(value: number): number;
|
|
5224
|
-
/** Convert a value to a Y position in physical (bitmap) pixels
|
|
5400
|
+
/** Convert a value to a Y position in physical (bitmap) pixels, snapped to
|
|
5401
|
+
* the pixel grid — for axis-aligned edges that have to stay crisp. */
|
|
5225
5402
|
valueToBitmapY(value: number): number;
|
|
5226
|
-
/**
|
|
5403
|
+
/**
|
|
5404
|
+
* Same in physical pixels, off the grid. Anti-aliased geometry reads this
|
|
5405
|
+
* one: snapping buys a diagonal stroke no sharpness, and during a slow
|
|
5406
|
+
* animation it quantises the motion into whole-pixel jumps.
|
|
5407
|
+
*/
|
|
5408
|
+
valueToBitmapYExact(value: number): number;
|
|
5409
|
+
/**
|
|
5410
|
+
* Y position in CSS pixels of the *stroke center* the canvas grid draws for
|
|
5411
|
+
* `value`. DOM axis labels position off this instead of raw {@link valueToY}
|
|
5412
|
+
* so text and gridline share one pixel grid.
|
|
5413
|
+
*/
|
|
5414
|
+
valueToSnappedY(value: number): number;
|
|
5415
|
+
/** Convert a Y position in CSS pixels back to a value — the exact inverse of {@link valueToY}. */
|
|
5227
5416
|
yToValue(y: number): number;
|
|
5417
|
+
/** The value bars and stacks grow from: `0`, or the plot floor's value on a scale with no place for 0 (log). */
|
|
5418
|
+
baselineValue(): number;
|
|
5419
|
+
/**
|
|
5420
|
+
* The value `t` of the way from `from` to `to` in pixels — a plain lerp on a
|
|
5421
|
+
* linear axis, a geometric one on log. `t` past `[0, 1]` overshoots along the
|
|
5422
|
+
* axis. An endpoint the transform can't place returns `to`, so a gap stays a gap.
|
|
5423
|
+
*/
|
|
5424
|
+
lerpValue(from: number, to: number, t: number): number;
|
|
5228
5425
|
/**
|
|
5229
5426
|
* Generate evenly spaced "nice" tick values for the current range and
|
|
5230
5427
|
* chart height. Pure read — resolution happens in `update()`.
|
|
5231
5428
|
*/
|
|
5232
5429
|
niceTickValues(): number[];
|
|
5430
|
+
/** {1,2,5}×10^k ticks at the resolved interval, limited to what the transform can place. */
|
|
5431
|
+
private linearTickValues;
|
|
5233
5432
|
getRange(): YRange;
|
|
5234
5433
|
getMediaHeight(): number;
|
|
5235
5434
|
/**
|
|
@@ -5240,9 +5439,18 @@ export declare class YScale {
|
|
|
5240
5439
|
* range happens to be < 1000.
|
|
5241
5440
|
*/
|
|
5242
5441
|
formatY(value: number): string;
|
|
5442
|
+
private resolveTicks;
|
|
5443
|
+
/**
|
|
5444
|
+
* Smallest linear interval whose ticks stay `minLabelSpacing` apart on the
|
|
5445
|
+
* transformed axis. A monotonic mapping squeezes its gaps hardest at one
|
|
5446
|
+
* end — the top for log (concave), the bottom for a convex one — so
|
|
5447
|
+
* checking both ends covers it.
|
|
5448
|
+
*/
|
|
5449
|
+
private transformedGapFloor;
|
|
5243
5450
|
/**
|
|
5244
5451
|
* Resolve the interval to a {1,2,5}×10^k tick size that satisfies the pixel
|
|
5245
|
-
* floor and (optionally) targets `labelCountHint` labels.
|
|
5452
|
+
* floor and (optionally) targets `labelCountHint` labels. `gapFloorValue` is
|
|
5453
|
+
* the smallest interval that clears `minLabelSpacing` anywhere on the axis.
|
|
5246
5454
|
*
|
|
5247
5455
|
* Hysteresis: the band [0.8×, 1.25×] is anchored to **rawInterval at last
|
|
5248
5456
|
* snap**, not to `lastInterval`. After an escalation (e.g. 100 → 200),
|
|
@@ -5255,4 +5463,43 @@ export declare class YScale {
|
|
|
5255
5463
|
private countTicks;
|
|
5256
5464
|
}
|
|
5257
5465
|
|
|
5466
|
+
/**
|
|
5467
|
+
* A non-linear value mapping for the Y axis — pass one as `axis.y.scale`.
|
|
5468
|
+
* `logScale()` is the built-in one; any monotonic mapping works, e.g. a
|
|
5469
|
+
* square-root axis:
|
|
5470
|
+
*
|
|
5471
|
+
* ```ts
|
|
5472
|
+
* const sqrtScale: YScaleTransform = {
|
|
5473
|
+
* forward: Math.sqrt,
|
|
5474
|
+
* inverse: (s) => s * s,
|
|
5475
|
+
* isPlottable: (v) => v >= 0,
|
|
5476
|
+
* };
|
|
5477
|
+
* ```
|
|
5478
|
+
*
|
|
5479
|
+
* Everything vertical runs in the transformed space: pixel positions,
|
|
5480
|
+
* autoscale padding and the Y animations. Keep the object stable — define it
|
|
5481
|
+
* outside a component, since a new object means a new scale and resets the
|
|
5482
|
+
* Y range.
|
|
5483
|
+
*/
|
|
5484
|
+
export declare interface YScaleTransform {
|
|
5485
|
+
/** Value → scale space. Must be strictly increasing over the plottable values. */
|
|
5486
|
+
forward(value: number): number;
|
|
5487
|
+
/** Scale space → value; the exact inverse of {@link forward}. */
|
|
5488
|
+
inverse(scaled: number): number;
|
|
5489
|
+
/**
|
|
5490
|
+
* Whether a finite value has a position on this scale — one contiguous
|
|
5491
|
+
* interval, e.g. `v > 0` for log. Values that fail are skipped: a gap in a
|
|
5492
|
+
* line, no bar or candle, left out of autoscale. Default: every finite value.
|
|
5493
|
+
*/
|
|
5494
|
+
isPlottable?(value: number): boolean;
|
|
5495
|
+
/**
|
|
5496
|
+
* The scale's own tick values (e.g. powers of ten), or `args.linear` to keep
|
|
5497
|
+
* the linear ticks — say, on a range too narrow for its own. Omitted: linear
|
|
5498
|
+
* ticks, spaced so the tightest gap on this mapping clears `minSpacing`.
|
|
5499
|
+
*/
|
|
5500
|
+
ticks?(args: ScaleTickArgs): readonly number[];
|
|
5501
|
+
/** Label format while the scale's own ticks are in use. Default: the linear formatter. */
|
|
5502
|
+
format?(value: number): string;
|
|
5503
|
+
}
|
|
5504
|
+
|
|
5258
5505
|
export { }
|