@wick-charts/vue 0.3.5 → 0.4.0
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 +6 -6
- package/dist/index.d.ts +726 -315
- package/dist/index.js +4658 -3907
- package/package.json +3 -3
- package/src/BarSeries.vue +20 -13
- package/src/CandlestickSeries.vue +9 -24
- package/src/ChartContainer.vue +72 -19
- package/src/LineSeries.vue +20 -13
- package/src/PieSeries.vue +1 -1
- package/src/index.ts +0 -4
- package/src/ui/TimeAxis.vue +13 -70
- package/src/ui/Title.vue +1 -1
- package/src/ui/YAxis.vue +13 -70
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,28 @@ declare type __VLS_Props_3 = {
|
|
|
151
151
|
intervals: number;
|
|
152
152
|
};
|
|
153
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* Viewport-level streaming behavior. Captured at mount only — changing
|
|
156
|
+
* this prop after the chart is created is ignored.
|
|
157
|
+
*/
|
|
158
|
+
viewport?: {
|
|
159
|
+
/**
|
|
160
|
+
* Width of the visible window in data bars, set on the first data load
|
|
161
|
+
* to `maxVisibleBars * dataInterval`. While the dataset is smaller than
|
|
162
|
+
* this width, streaming ticks render into the empty right-side gap and
|
|
163
|
+
* the viewport stays put; once the data reaches the right edge, the
|
|
164
|
+
* viewport pans forward to keep the latest bar pinned (tail-scroll).
|
|
165
|
+
* Default: 200.
|
|
166
|
+
*/
|
|
167
|
+
maxVisibleBars?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Initial visible range applied before the first paint with data. Same
|
|
170
|
+
* shape as the imperative `chart.setVisibleRange` — pass a bar count
|
|
171
|
+
* (e.g. `35`), an explicit `{from, to}` window, or `{from, bars}` for
|
|
172
|
+
* a warm-up pair. Captured at mount.
|
|
173
|
+
*/
|
|
174
|
+
initialRange?: VisibleRangeSpec;
|
|
175
|
+
};
|
|
154
176
|
/** Show the chart background gradient. Defaults to true. */
|
|
155
177
|
gradient?: boolean;
|
|
156
178
|
/** Enable zoom, pan, and crosshair interactions. Defaults to true. */
|
|
@@ -166,16 +188,15 @@ declare type __VLS_Props_3 = {
|
|
|
166
188
|
*/
|
|
167
189
|
headerLayout?: 'overlay' | 'inline';
|
|
168
190
|
/**
|
|
169
|
-
*
|
|
191
|
+
* Animation control. `true` / omitted uses built-in defaults; `false`
|
|
192
|
+
* disables every category. Per-series options on `<LineSeries>` /
|
|
193
|
+
* `<CandlestickSeries>` / `<BarSeries>` override these chart-level
|
|
194
|
+
* defaults unless the category here is explicitly `false`.
|
|
170
195
|
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* Shorthands: `true` / omitted — built-in defaults; `false` — disables every
|
|
176
|
-
* animation category; `{ points: false }` / `{ viewport: false }` disables a
|
|
177
|
-
* category. Updating this prop calls `chart.setAnimations(...)` so the new
|
|
178
|
-
* durations take effect on the next animation / render.
|
|
196
|
+
* **Init-only by reference identity.** A new `animations` reference
|
|
197
|
+
* recreates the underlying `ChartInstance`. Hoist the object outside
|
|
198
|
+
* the render scope — an inline literal tears the chart down on every
|
|
199
|
+
* re-render.
|
|
179
200
|
*/
|
|
180
201
|
animations?: boolean | AnimationsConfig;
|
|
181
202
|
/**
|
|
@@ -183,6 +204,13 @@ declare type __VLS_Props_3 = {
|
|
|
183
204
|
* later changes are ignored.
|
|
184
205
|
*/
|
|
185
206
|
perf?: PerfOption;
|
|
207
|
+
/**
|
|
208
|
+
* Fired after the user releases a pan/zoom gesture that pulled the viewport
|
|
209
|
+
* past a data edge by more than ~10% of the visible range. Hosts typically
|
|
210
|
+
* respond by prefetching more history. Captured at mount only; changing
|
|
211
|
+
* the prop identity later is ignored.
|
|
212
|
+
*/
|
|
213
|
+
onEdgeReached?: (info: EdgeReachedInfo) => void;
|
|
186
214
|
};
|
|
187
215
|
|
|
188
216
|
declare type __VLS_Props_4 = {
|
|
@@ -458,114 +486,230 @@ declare type __VLS_WithTemplateSlots_8<T, S> = T & {
|
|
|
458
486
|
export declare const andromeda: ThemePreset;
|
|
459
487
|
|
|
460
488
|
/**
|
|
461
|
-
*
|
|
462
|
-
* defaults can't bleed into viewport-interaction timings.
|
|
463
|
-
*
|
|
464
|
-
* **Two layers — chart-level vs per-series.** The same data-animation knobs
|
|
465
|
-
* live on both layers; remember which is which:
|
|
489
|
+
* Animation behavior knobs grouped by surface:
|
|
466
490
|
*
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
*
|
|
491
|
+
* - `axis.y` — Y bound chase: pluggable curve, expand/contract/gesture
|
|
492
|
+
* settle times.
|
|
493
|
+
* - `axis.x` — X viewport: streaming settle + gesture override.
|
|
494
|
+
* - `axis.ticks` — axis tick label cross-fade.
|
|
495
|
+
* - `toggle` — series visibility (alpha fade + Y re-fit, locked to one
|
|
496
|
+
* duration so they finish on the same frame).
|
|
497
|
+
* - `series.{line,candlestick,bar,pie}` — per-series-type data tweens.
|
|
472
498
|
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
499
|
+
* Top-level `false` disables every animation category. `axis: false`
|
|
500
|
+
* disables both axes and ticks. `axis.y: false` / `axis.x: false` disables
|
|
501
|
+
* that axis only. Series-type-level `false` (`series: { line: false }`)
|
|
502
|
+
* disables that type only.
|
|
477
503
|
*
|
|
478
|
-
* - `
|
|
479
|
-
*
|
|
480
|
-
* -
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
* All settling animations share a 250 ms default so the X re-fit, Y range
|
|
485
|
-
* update, and last-bar live-track all settle on the same frame on a
|
|
486
|
-
* streaming tick. Pulse cycle period (600 ms) and `inputResponseMs` (0,
|
|
487
|
-
* opt-in) keep their own values.
|
|
504
|
+
* The per-series numeric fields (`entry` / `smooth` / `pulse`) also exist
|
|
505
|
+
* on individual series options (`<XSeries options={{ entryMs }}>`). The
|
|
506
|
+
* chart-level field acts as the default for any series that hasn't set its
|
|
507
|
+
* own override; an explicit `series.<type>: false` (or top-level `false`)
|
|
508
|
+
* is a hard disable that overrides per-series.
|
|
488
509
|
*/
|
|
489
510
|
declare interface AnimationsConfig {
|
|
490
511
|
/**
|
|
491
|
-
*
|
|
492
|
-
* live-smoothing, pulse) across every series — overrides any per-series
|
|
493
|
-
* option set on the same fields. An object overrides individual categories;
|
|
494
|
-
* omitted fields fall back to the built-in defaults.
|
|
495
|
-
*
|
|
496
|
-
* Per-series options (`<LineSeries options={{ entryMs, smoothMs, pulseMs }}>`)
|
|
497
|
-
* win over chart-level numeric values. The chart-level field becomes the
|
|
498
|
-
* default for series that don't set their own.
|
|
512
|
+
* Axis-level animation. `false` collapses both axes and ticks to instant.
|
|
499
513
|
*/
|
|
500
|
-
|
|
514
|
+
axis?: false | {
|
|
501
515
|
/**
|
|
502
|
-
*
|
|
503
|
-
* Per-series equivalent: `<XSeries options={{ entryMs }}>` (note the
|
|
504
|
-
* `y` — chart-level uses `enterMs`, per-series uses `entryMs` for
|
|
505
|
-
* historical reasons; both refer to the same animation). `false` /
|
|
506
|
-
* `0` disables.
|
|
516
|
+
* Y bound chase. `false` snaps Y instantly.
|
|
507
517
|
*/
|
|
508
|
-
|
|
518
|
+
y?: false | {
|
|
519
|
+
/** Y curve. See {@link hermite}, {@link spring}, {@link snap}. */
|
|
520
|
+
curve?: TransitionFactory<YRange>;
|
|
521
|
+
/**
|
|
522
|
+
* Outward settle time — bound expanding to a new extreme.
|
|
523
|
+
*
|
|
524
|
+
* @default {@link DEFAULT_Y_SETTLE_MS}
|
|
525
|
+
*/
|
|
526
|
+
settle?: AnimationTime;
|
|
527
|
+
/**
|
|
528
|
+
* Inward (contraction) settle — applied when a bound recedes
|
|
529
|
+
* after an extreme leaves the window (the "sticky-Y" hold).
|
|
530
|
+
*
|
|
531
|
+
* - `{ min, max }` — **dynamic**: the contract duration scales
|
|
532
|
+
* with the contraction magnitude, from `min` (a tiny recede)
|
|
533
|
+
* up to `max` (a full-range contraction). Big outliers ease
|
|
534
|
+
* off slowly while small receders finish quickly, so the axis
|
|
535
|
+
* doesn't crawl for seconds over a few pixels. Either side
|
|
536
|
+
* falls back to its default when omitted.
|
|
537
|
+
* - a scalar `AnimationTime` — **fixed**: `min === max`, every
|
|
538
|
+
* contraction takes the same time regardless of size (the
|
|
539
|
+
* legacy sticky feel). `false` snaps contractions instantly.
|
|
540
|
+
*
|
|
541
|
+
* @default `{ min:` {@link DEFAULT_Y_STICKY_MIN_MS}`, max:` {@link DEFAULT_Y_STICKY_MAX_MS}` }`
|
|
542
|
+
*/
|
|
543
|
+
sticky?: AnimationTime | {
|
|
544
|
+
min?: AnimationTime;
|
|
545
|
+
max?: AnimationTime;
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* One-shot override during a user gesture (pan/zoom). Shorter
|
|
549
|
+
* than `sticky` so contractions during interaction converge in
|
|
550
|
+
* ~one frame per wheel tick.
|
|
551
|
+
*
|
|
552
|
+
* @default {@link DEFAULT_Y_GESTURE_MS}
|
|
553
|
+
*/
|
|
554
|
+
gesture?: AnimationTime;
|
|
555
|
+
};
|
|
509
556
|
/**
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
* `options={{ smoothMs }}`. `false` / `0` snaps.
|
|
557
|
+
* X viewport. `false` snaps X instantly. The default critically-
|
|
558
|
+
* damped spring carries velocity across retargets so wheel-zoom
|
|
559
|
+
* sequences feel continuous and stream ticks blend smoothly into
|
|
560
|
+
* gesture motion.
|
|
515
561
|
*/
|
|
516
|
-
|
|
562
|
+
x?: false | {
|
|
563
|
+
/** X curve. See {@link spring}, {@link snap}. */
|
|
564
|
+
curve?: TransitionFactory<VisibleRange>;
|
|
565
|
+
/**
|
|
566
|
+
* Streaming settle time. Spring reaches ~99% of the target
|
|
567
|
+
* after this many ms. Used for streaming retargets; the
|
|
568
|
+
* streaming-cadence EMA tunes the effective value upward when
|
|
569
|
+
* data arrives slower than the baseline.
|
|
570
|
+
*
|
|
571
|
+
* @default {@link DEFAULT_X_SETTLE_MS}
|
|
572
|
+
*/
|
|
573
|
+
settle?: AnimationTime;
|
|
574
|
+
/**
|
|
575
|
+
* One-shot override applied to user pan/zoom commits and to
|
|
576
|
+
* programmatic `fitContent`.
|
|
577
|
+
*
|
|
578
|
+
* @default {@link DEFAULT_X_GESTURE_MS}
|
|
579
|
+
*/
|
|
580
|
+
gesture?: AnimationTime;
|
|
581
|
+
};
|
|
517
582
|
/**
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
583
|
+
* Axis tick label cross-fade. `false` makes tick relabel instant.
|
|
584
|
+
*
|
|
585
|
+
* @default {@link DEFAULT_TICKS_MS}
|
|
521
586
|
*/
|
|
522
|
-
|
|
587
|
+
ticks?: AnimationTime;
|
|
523
588
|
};
|
|
524
589
|
/**
|
|
525
|
-
*
|
|
526
|
-
*
|
|
590
|
+
* Series-visibility toggle duration. Drives BOTH the renderer's alpha
|
|
591
|
+
* cross-fade and the engine's Y re-fit ease, so the two animations land
|
|
592
|
+
* on the same frame. `false` makes `setSeriesVisible` instant.
|
|
593
|
+
*
|
|
594
|
+
* @default {@link DEFAULT_TOGGLE_MS}
|
|
595
|
+
*/
|
|
596
|
+
toggle?: AnimationTime;
|
|
597
|
+
/**
|
|
598
|
+
* Per-series-type data animations. `false` disables every per-point
|
|
599
|
+
* animation across every series. Setting a single type to `false`
|
|
600
|
+
* (`series: { line: false }`) disables that type only.
|
|
601
|
+
*
|
|
602
|
+
* Per-series options (`<LineSeries options={{ entryMs, smoothMs, pulseMs }}>`)
|
|
603
|
+
* win over chart-level numeric values. The chart-level field becomes the
|
|
604
|
+
* default for series that don't set their own.
|
|
527
605
|
*/
|
|
528
|
-
|
|
529
|
-
/** Rebound (snap-back) duration after pan/zoom overshoot (ms). Default: 350. */
|
|
530
|
-
reboundMs?: AnimationTime;
|
|
606
|
+
series?: false | {
|
|
531
607
|
/**
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
* data updates and eases toward the new bound over this many ms.
|
|
535
|
-
* Default `250` (shares the lockstep-arrival budget with viewport and
|
|
536
|
-
* live-track). Inward contraction always eases. Outward expansion
|
|
537
|
-
* eases when the per-point entrance is enabled (the entering candle's
|
|
538
|
-
* fade masks the brief overshoot); when entrance is hard-disabled
|
|
539
|
-
* (`points.enterMs === 0`), Y bounds snap outward to keep new
|
|
540
|
-
* highs/lows from clipping at the canvas edge. `false` / `0` snaps
|
|
541
|
-
* the Y range instantly on every update.
|
|
608
|
+
* Line-series tweens. `false` disables all line animations
|
|
609
|
+
* (entrance, live-smoothing, pulse).
|
|
542
610
|
*/
|
|
543
|
-
|
|
611
|
+
line?: false | {
|
|
612
|
+
/**
|
|
613
|
+
* Per-point entrance duration. `false` disables the entrance
|
|
614
|
+
* (equivalent to `entryAnimation: 'none'`).
|
|
615
|
+
*
|
|
616
|
+
* @default {@link DEFAULT_LINE_ENTRY}
|
|
617
|
+
*/
|
|
618
|
+
entry?: AnimationTime;
|
|
619
|
+
/**
|
|
620
|
+
* Last-value chase duration on `updateLastPoint`. `false` /
|
|
621
|
+
* `0` snaps to the target instantly.
|
|
622
|
+
*
|
|
623
|
+
* @default {@link DEFAULT_LINE_SMOOTH}
|
|
624
|
+
*/
|
|
625
|
+
smooth?: AnimationTime;
|
|
626
|
+
/**
|
|
627
|
+
* Halo cycle period at the line tail. Periodic loop, not a
|
|
628
|
+
* one-shot. `false` / `0` turns the halo off entirely (drawing
|
|
629
|
+
* and animation loop).
|
|
630
|
+
*
|
|
631
|
+
* @default {@link DEFAULT_LINE_PULSE}
|
|
632
|
+
*/
|
|
633
|
+
pulse?: AnimationTime;
|
|
634
|
+
};
|
|
544
635
|
/**
|
|
545
|
-
*
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
636
|
+
* Candlestick tweens. `false` disables candle entrance + OHLC chase.
|
|
637
|
+
*/
|
|
638
|
+
candlestick?: false | {
|
|
639
|
+
/**
|
|
640
|
+
* Per-candle entrance duration. `false` disables the entrance
|
|
641
|
+
* (equivalent to `entryAnimation: 'none'`).
|
|
642
|
+
*
|
|
643
|
+
* @default {@link DEFAULT_CANDLESTICK_ENTRY}
|
|
644
|
+
*/
|
|
645
|
+
entry?: AnimationTime;
|
|
646
|
+
/**
|
|
647
|
+
* Live OHLC chase duration on `updateLastPoint`. `false` / `0`
|
|
648
|
+
* snaps to the target instantly.
|
|
649
|
+
*
|
|
650
|
+
* @default {@link DEFAULT_CANDLESTICK_SMOOTH}
|
|
651
|
+
*/
|
|
652
|
+
smooth?: AnimationTime;
|
|
653
|
+
};
|
|
654
|
+
/**
|
|
655
|
+
* Bar-series tweens. `false` disables bar entrance + value chase.
|
|
656
|
+
*/
|
|
657
|
+
bar?: false | {
|
|
658
|
+
/**
|
|
659
|
+
* Per-bar entrance duration. `false` disables the entrance
|
|
660
|
+
* (equivalent to `entryAnimation: 'none'`).
|
|
661
|
+
*
|
|
662
|
+
* @default {@link DEFAULT_BAR_ENTRY}
|
|
663
|
+
*/
|
|
664
|
+
entry?: AnimationTime;
|
|
665
|
+
/**
|
|
666
|
+
* Live value chase duration on `updateLastPoint`. `false` /
|
|
667
|
+
* `0` snaps to the target instantly.
|
|
668
|
+
*
|
|
669
|
+
* @default {@link DEFAULT_BAR_SMOOTH}
|
|
670
|
+
*/
|
|
671
|
+
smooth?: AnimationTime;
|
|
672
|
+
};
|
|
673
|
+
/**
|
|
674
|
+
* Pie segment entry/update tweens. Parsed at config-time; the actual
|
|
675
|
+
* wiring lands in a later phase — providing a value here today is a
|
|
676
|
+
* no-op but the shape is stable.
|
|
557
677
|
*/
|
|
558
|
-
|
|
678
|
+
pie?: false | {
|
|
679
|
+
/**
|
|
680
|
+
* Slice grow-in duration on first paint.
|
|
681
|
+
*
|
|
682
|
+
* @default {@link DEFAULT_PIE_ENTRY}
|
|
683
|
+
*/
|
|
684
|
+
entry?: AnimationTime;
|
|
685
|
+
/**
|
|
686
|
+
* Slice resize duration when data changes.
|
|
687
|
+
*
|
|
688
|
+
* @default {@link DEFAULT_PIE_UPDATE}
|
|
689
|
+
*/
|
|
690
|
+
update?: AnimationTime;
|
|
691
|
+
};
|
|
559
692
|
};
|
|
560
693
|
}
|
|
561
694
|
|
|
562
|
-
/** Options passed when creating a new {@link ChartInstance}. */
|
|
563
695
|
/**
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
* (`
|
|
696
|
+
* Per-frame engine snapshot — same shape returned by the legacy
|
|
697
|
+
* `AnimationEngine.tick()` so existing consumers (chart render loop,
|
|
698
|
+
* `chart.getAnimationState()` public API, series overlay hooks) keep working.
|
|
699
|
+
*/
|
|
700
|
+
declare interface AnimationState {
|
|
701
|
+
readonly xRange: XRange;
|
|
702
|
+
readonly yRange: YRange;
|
|
703
|
+
readonly animating: boolean;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Public animation-time input. Accepts:
|
|
708
|
+
* - `number` — already milliseconds (`250`)
|
|
709
|
+
* - `string` in `<n>ms` or `<n>s` form (`"250ms"`, `"1s"`, `"2.5s"`)
|
|
710
|
+
* - `false` — disable (equivalent to `0`)
|
|
567
711
|
*/
|
|
568
|
-
declare type AnimationTime =
|
|
712
|
+
declare type AnimationTime = Milliseconds | string | false;
|
|
569
713
|
|
|
570
714
|
/**
|
|
571
715
|
* Build a 2-stop candle-body gradient around a single hex color — a lightened
|
|
@@ -614,6 +758,51 @@ export declare interface AxisConfig {
|
|
|
614
758
|
x?: XAxisConfig;
|
|
615
759
|
}
|
|
616
760
|
|
|
761
|
+
declare class AxisTickTracker {
|
|
762
|
+
#private;
|
|
763
|
+
constructor(opts?: AxisTickTrackerOptions);
|
|
764
|
+
/**
|
|
765
|
+
* Record the latest tick set. Diffs against the current set and either
|
|
766
|
+
* starts a `0 → 1` fade-in for new values or a `1 → 0` fade-out for
|
|
767
|
+
* dropped ones. Idempotent on element-wise equal arrays.
|
|
768
|
+
*
|
|
769
|
+
* Callers must invoke {@link tick} every frame to advance the animators —
|
|
770
|
+
* `snapshot()` reads the current state but does not advance time.
|
|
771
|
+
*/
|
|
772
|
+
setCurrentTicks(next: readonly number[]): void;
|
|
773
|
+
/**
|
|
774
|
+
* Advance each tracked animator against `now`. Animators that settle
|
|
775
|
+
* at zero are dropped from the map; non-zero settled animators stay so
|
|
776
|
+
* a subsequent re-entering tick can pick them up without a flicker.
|
|
777
|
+
* Returns `true` while any animator is still in flight.
|
|
778
|
+
*/
|
|
779
|
+
tick(now: number): boolean;
|
|
780
|
+
/**
|
|
781
|
+
* Build a renderer-ready snapshot from the tracker's own animator state.
|
|
782
|
+
* No external opacity map is consulted — `setCurrentTicks` + `tick(now)`
|
|
783
|
+
* are the only inputs.
|
|
784
|
+
*/
|
|
785
|
+
snapshot(): TickTrackerSnapshot;
|
|
786
|
+
getCurrentTicks(): readonly number[];
|
|
787
|
+
getPreviousTicks(): readonly number[];
|
|
788
|
+
/**
|
|
789
|
+
* Reconfigure the cross-fade duration. Chart calls this after resolving
|
|
790
|
+
* `animations.axis.ticks` so the tracker honors the user's config
|
|
791
|
+
* without plumbing options through the scale constructors.
|
|
792
|
+
*/
|
|
793
|
+
setFadeMs(ms: number): void;
|
|
794
|
+
/** Whether subsequent tick-set changes should fade-in or snap. */
|
|
795
|
+
markArmed(): void;
|
|
796
|
+
get isArmed(): boolean;
|
|
797
|
+
/** Drop all tracked ticks. Use after dataset swap so stale values don't linger. */
|
|
798
|
+
reset(): void;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
declare interface AxisTickTrackerOptions {
|
|
802
|
+
/** Cross-fade duration in ms once {@link markArmed} has flipped. Defaults to {@link DEFAULT_TICKS_MS}. */
|
|
803
|
+
fadeMs?: number;
|
|
804
|
+
}
|
|
805
|
+
|
|
617
806
|
export declare const ayuMirage: ThemePreset;
|
|
618
807
|
|
|
619
808
|
/**
|
|
@@ -646,8 +835,6 @@ export declare interface BarSeriesOptions {
|
|
|
646
835
|
* @see entryMs — cross-linked duration for this animation.
|
|
647
836
|
*/
|
|
648
837
|
entryAnimation?: BarEntryAnimation;
|
|
649
|
-
/** @deprecated Use {@link entryAnimation} instead. */
|
|
650
|
-
enterAnimation?: BarEntryAnimation;
|
|
651
838
|
/**
|
|
652
839
|
* Per-bar entrance duration in milliseconds. Default: `250`.
|
|
653
840
|
*
|
|
@@ -655,24 +842,19 @@ export declare interface BarSeriesOptions {
|
|
|
655
842
|
* // Override for one series:
|
|
656
843
|
* <BarSeries options={{ entryMs: 600 }} data={data} />
|
|
657
844
|
*
|
|
658
|
-
* // Or set the default for every series at once:
|
|
659
|
-
* <ChartContainer animations={{
|
|
845
|
+
* // Or set the default for every bar series at once:
|
|
846
|
+
* <ChartContainer animations={{ series: { bar: { entry: 600 } } }}>
|
|
660
847
|
* <BarSeries data={data} />
|
|
661
848
|
* </ChartContainer>
|
|
662
849
|
* ```
|
|
663
850
|
*
|
|
664
|
-
* Note: chart-level uses `enterMs`, per-series uses `entryMs` — same
|
|
665
|
-
* animation, two names for historical reasons.
|
|
666
|
-
*
|
|
667
851
|
* `false` or `0` disables the entrance (equivalent to
|
|
668
|
-
* `entryAnimation: 'none'`). A chart-level `animations.
|
|
669
|
-
* hard disable that wins over this field.
|
|
852
|
+
* `entryAnimation: 'none'`). A chart-level `animations.series.bar: false`
|
|
853
|
+
* is a hard disable that wins over this field.
|
|
670
854
|
*
|
|
671
855
|
* @see BarSeriesOptions.entryAnimation
|
|
672
856
|
*/
|
|
673
857
|
entryMs?: number | false;
|
|
674
|
-
/** @deprecated Use {@link entryMs} instead. */
|
|
675
|
-
enterMs?: number | false;
|
|
676
858
|
/**
|
|
677
859
|
* How long the displayed bar value takes to catch up to the actual one
|
|
678
860
|
* on every `updateLastPoint`. Default: `250` ms.
|
|
@@ -682,21 +864,18 @@ export declare interface BarSeriesOptions {
|
|
|
682
864
|
* <BarSeries options={{ smoothMs: 100 }} data={data} />
|
|
683
865
|
*
|
|
684
866
|
* // Chart-level default:
|
|
685
|
-
* <ChartContainer animations={{
|
|
867
|
+
* <ChartContainer animations={{ series: { bar: { smooth: 100 } } }}>
|
|
686
868
|
* <BarSeries data={data} />
|
|
687
869
|
* </ChartContainer>
|
|
688
870
|
* ```
|
|
689
871
|
*
|
|
690
872
|
* `0` or `false` snaps the displayed value to the target on every tick
|
|
691
|
-
* (no smoothing). A chart-level `animations.
|
|
873
|
+
* (no smoothing). A chart-level `animations.series.bar: false` is a hard
|
|
692
874
|
* disable that wins over this field.
|
|
693
875
|
*/
|
|
694
876
|
smoothMs?: number | false;
|
|
695
877
|
}
|
|
696
878
|
|
|
697
|
-
/** @deprecated Use {@link StackingMode} instead. */
|
|
698
|
-
export declare type BarStacking = StackingMode;
|
|
699
|
-
|
|
700
879
|
/**
|
|
701
880
|
* Snapshot every visible series / layer at `time`. Used by hover overlays
|
|
702
881
|
* (`InfoBar` in hover mode, `Tooltip`). Hidden series and hidden layers are
|
|
@@ -784,8 +963,6 @@ export declare interface CandlestickSeriesOptions {
|
|
|
784
963
|
* @see entryMs — cross-linked duration for this animation.
|
|
785
964
|
*/
|
|
786
965
|
entryAnimation?: CandlestickEntryAnimation;
|
|
787
|
-
/** @deprecated Use {@link entryAnimation} instead. */
|
|
788
|
-
enterAnimation?: CandlestickEntryAnimation;
|
|
789
966
|
/**
|
|
790
967
|
* Per-candle entrance duration in milliseconds. Default: `250`.
|
|
791
968
|
*
|
|
@@ -793,24 +970,20 @@ export declare interface CandlestickSeriesOptions {
|
|
|
793
970
|
* // Override for one series:
|
|
794
971
|
* <CandlestickSeries options={{ entryMs: 600 }} data={data} />
|
|
795
972
|
*
|
|
796
|
-
* // Or set the default for every series at once:
|
|
797
|
-
* <ChartContainer animations={{
|
|
973
|
+
* // Or set the default for every candlestick series at once:
|
|
974
|
+
* <ChartContainer animations={{ series: { candlestick: { entry: 600 } } }}>
|
|
798
975
|
* <CandlestickSeries data={data} />
|
|
799
976
|
* </ChartContainer>
|
|
800
977
|
* ```
|
|
801
978
|
*
|
|
802
|
-
* Note: chart-level uses `enterMs`, per-series uses `entryMs` — same
|
|
803
|
-
* animation, two names for historical reasons.
|
|
804
|
-
*
|
|
805
979
|
* `false` or `0` disables the entrance (equivalent to
|
|
806
|
-
* `entryAnimation: 'none'`). A chart-level
|
|
807
|
-
* hard disable that wins over
|
|
980
|
+
* `entryAnimation: 'none'`). A chart-level
|
|
981
|
+
* `animations.series.candlestick: false` is a hard disable that wins over
|
|
982
|
+
* this field.
|
|
808
983
|
*
|
|
809
984
|
* @see CandlestickSeriesOptions.entryAnimation
|
|
810
985
|
*/
|
|
811
986
|
entryMs?: number | false;
|
|
812
|
-
/** @deprecated Use {@link entryMs} instead. */
|
|
813
|
-
enterMs?: number | false;
|
|
814
987
|
/**
|
|
815
988
|
* How long the displayed OHLC takes to catch up to the actual last value
|
|
816
989
|
* on every `updateLastPoint`. Default: `250` ms.
|
|
@@ -820,14 +993,14 @@ export declare interface CandlestickSeriesOptions {
|
|
|
820
993
|
* <CandlestickSeries options={{ smoothMs: 100 }} data={data} />
|
|
821
994
|
*
|
|
822
995
|
* // Chart-level default:
|
|
823
|
-
* <ChartContainer animations={{
|
|
996
|
+
* <ChartContainer animations={{ series: { candlestick: { smooth: 100 } } }}>
|
|
824
997
|
* <CandlestickSeries data={data} />
|
|
825
998
|
* </ChartContainer>
|
|
826
999
|
* ```
|
|
827
1000
|
*
|
|
828
1001
|
* `0` or `false` snaps the displayed value to the target on every tick
|
|
829
|
-
* (no smoothing). A chart-level `animations.
|
|
830
|
-
* disable that wins over this field.
|
|
1002
|
+
* (no smoothing). A chart-level `animations.series.candlestick: false` is
|
|
1003
|
+
* a hard disable that wins over this field.
|
|
831
1004
|
*/
|
|
832
1005
|
smoothMs?: number | false;
|
|
833
1006
|
}
|
|
@@ -850,41 +1023,58 @@ declare interface ChartEvents {
|
|
|
850
1023
|
* subscribe to this instead of stacking multiple listeners.
|
|
851
1024
|
*/
|
|
852
1025
|
overlayChange: () => void;
|
|
1026
|
+
/**
|
|
1027
|
+
* Fired once per main-layer frame *while* an axis tick is still in the
|
|
1028
|
+
* middle of its fade-in/out animation. DOM axis components (`<TimeAxis>`,
|
|
1029
|
+
* `<YAxis>`) listen to this to re-read the per-tick opacity from
|
|
1030
|
+
* `timeScale.tickTracker` / `yScale.tickTracker` so the DOM labels and
|
|
1031
|
+
* canvas grid lines fade in lockstep. Stops firing as soon as every
|
|
1032
|
+
* tracked tick has reached its target opacity.
|
|
1033
|
+
*/
|
|
1034
|
+
tickFrame: () => void;
|
|
853
1035
|
}
|
|
854
1036
|
|
|
855
1037
|
/**
|
|
856
1038
|
* Core chart controller. Manages series, viewport, scales, and rendering.
|
|
857
1039
|
* Create one per chart container and call {@link destroy} on unmount.
|
|
858
1040
|
*/
|
|
859
|
-
export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
1041
|
+
export declare class ChartInstance extends EventEmitter<ChartEvents> implements PanZoomTarget {
|
|
860
1042
|
#private;
|
|
861
1043
|
/** Maps time values to horizontal pixel coordinates. */
|
|
862
|
-
readonly timeScale:
|
|
1044
|
+
readonly timeScale: XScale;
|
|
863
1045
|
/** Maps price/value to vertical pixel coordinates. */
|
|
864
1046
|
readonly yScale: YScale;
|
|
865
1047
|
get yAxisWidth(): number;
|
|
866
1048
|
get xAxisHeight(): number;
|
|
867
1049
|
constructor(container: HTMLElement, options?: ChartOptions);
|
|
868
|
-
/**
|
|
869
|
-
|
|
1050
|
+
/**
|
|
1051
|
+
* Add a series of the given `type` and return its unique ID. `options` is
|
|
1052
|
+
* typed per `type` via the overloads. `layers` (line/bar) and `id` are
|
|
1053
|
+
* consumed here; everything else is forwarded to the renderer.
|
|
1054
|
+
*/
|
|
1055
|
+
addSeries(type: 'candlestick', options?: Partial<CandlestickSeriesOptions & {
|
|
870
1056
|
id?: string;
|
|
871
1057
|
}>): string;
|
|
872
|
-
|
|
873
|
-
addLineSeries(options?: Partial<LineSeriesOptions & {
|
|
1058
|
+
addSeries(type: 'line', options?: Partial<LineSeriesOptions & {
|
|
874
1059
|
layers?: number;
|
|
875
1060
|
id?: string;
|
|
876
1061
|
}>): string;
|
|
877
|
-
|
|
878
|
-
addBarSeries(options?: Partial<BarSeriesOptions & {
|
|
1062
|
+
addSeries(type: 'bar', options?: Partial<BarSeriesOptions & {
|
|
879
1063
|
layers?: number;
|
|
880
1064
|
id?: string;
|
|
881
1065
|
}>): string;
|
|
882
|
-
|
|
883
|
-
addPieSeries(options?: Partial<PieSeriesOptions & {
|
|
1066
|
+
addSeries(type: 'pie', options?: Partial<PieSeriesOptions & {
|
|
884
1067
|
id?: string;
|
|
885
1068
|
}>): string;
|
|
886
1069
|
/** Remove a series by ID and clean up its resources. */
|
|
887
1070
|
removeSeries(id: string): void;
|
|
1071
|
+
/**
|
|
1072
|
+
* Read-only snapshot of the chart's X / Y viewport animation. The same
|
|
1073
|
+
* shape (`xRange`, `yRange`, `animating`) every frame — call this inside
|
|
1074
|
+
* the current render pass rather than caching the reference, as the
|
|
1075
|
+
* underlying animator mutates between frames.
|
|
1076
|
+
*/
|
|
1077
|
+
getAnimationState(): AnimationState;
|
|
888
1078
|
/**
|
|
889
1079
|
* Replace all data for a series.
|
|
890
1080
|
*
|
|
@@ -899,6 +1089,20 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
899
1089
|
appendData(id: string, point: OHLCInput | TimePointInput, layerIndex?: number): void;
|
|
900
1090
|
/** Update the last data point of a series in place (e.g. live candle update). */
|
|
901
1091
|
updateData(id: string, point: OHLCInput | TimePointInput, layerIndex?: number): void;
|
|
1092
|
+
/**
|
|
1093
|
+
* Keep only the most recent `count` points of a series — drop the oldest
|
|
1094
|
+
* tail when the series exceeds the cap. Smooth Y-range chase (no snap):
|
|
1095
|
+
* unlike {@link setSeriesData}, this does NOT set the bulk-replace snap
|
|
1096
|
+
* flag, so streaming windows can roll without per-tick Y jitter.
|
|
1097
|
+
*
|
|
1098
|
+
* Idempotent: a no-op when the series is already at or below `count`.
|
|
1099
|
+
* Use after {@link appendData} in a rolling-window stream:
|
|
1100
|
+
* ```ts
|
|
1101
|
+
* chart.appendData('feed', point);
|
|
1102
|
+
* chart.keepLast('feed', 100);
|
|
1103
|
+
* ```
|
|
1104
|
+
*/
|
|
1105
|
+
keepLast(id: string, count: number, layerIndex?: number): void;
|
|
902
1106
|
/** Update visual options (color, width, etc.) for an existing series. */
|
|
903
1107
|
updateSeriesOptions(id: string, options: Partial<CandlestickSeriesOptions> | Partial<LineSeriesOptions> | Partial<BarSeriesOptions> | Partial<PieSeriesOptions>): void;
|
|
904
1108
|
/**
|
|
@@ -906,39 +1110,103 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
906
1110
|
* inside `fn` still flush the batch so counters don't leak across calls.
|
|
907
1111
|
*/
|
|
908
1112
|
batch(fn: () => void): void;
|
|
909
|
-
/** Show or hide a series.
|
|
1113
|
+
/** Show or hide a series. The series cross-fades over
|
|
1114
|
+
* `animations.toggle`; the Y range re-fits on the same schedule
|
|
1115
|
+
* (one-shot duration override) so the fade and the axis adjustment
|
|
1116
|
+
* finish on the same frame. Hidden series are excluded from Y-range
|
|
1117
|
+
* computation immediately so the axis can start moving while the line
|
|
1118
|
+
* fades out in parallel.
|
|
1119
|
+
*/
|
|
910
1120
|
setSeriesVisible(seriesId: string, visible: boolean): void;
|
|
1121
|
+
/**
|
|
1122
|
+
* Whether streaming ticks slide the visible range to track the data tail.
|
|
1123
|
+
* Flipped off by a pan that pushes the tail off screen; re-engaged when
|
|
1124
|
+
* a follow-up pan brings the tail back into the destination window or
|
|
1125
|
+
* when {@link fitContent} / {@link setVisibleRange} commits a range
|
|
1126
|
+
* containing the tail.
|
|
1127
|
+
*/
|
|
1128
|
+
getAutoScroll(): boolean;
|
|
911
1129
|
isSeriesVisible(seriesId: string): boolean;
|
|
912
|
-
/**
|
|
1130
|
+
/**
|
|
1131
|
+
* Show or hide a specific layer within a multi-layer series.
|
|
1132
|
+
*
|
|
1133
|
+
* Symmetric with {@link setSeriesVisible}: drives both the renderer's
|
|
1134
|
+
* per-layer alpha fade and the engine's Y re-fit through `toggleMs` so the
|
|
1135
|
+
* line fade and the axis adjustment finish on the same frame. Hidden layers
|
|
1136
|
+
* are excluded from Y-range computation immediately (via the renderer's
|
|
1137
|
+
* `getValueRange` reading `store.isVisible()`); the alpha fade keeps the
|
|
1138
|
+
* layer's geometry on screen until the engine's Y ease settles.
|
|
1139
|
+
*/
|
|
913
1140
|
setLayerVisible(seriesId: string, layerIndex: number, visible: boolean): void;
|
|
914
1141
|
isLayerVisible(seriesId: string, layerIndex: number): boolean;
|
|
915
1142
|
/** Auto-fit the viewport to show all data across every series. */
|
|
916
1143
|
fitContent(): void;
|
|
917
|
-
getVisibleRange():
|
|
1144
|
+
getVisibleRange(): XRange;
|
|
918
1145
|
/**
|
|
919
1146
|
* Return the full span of registered data, or `null` before any data has
|
|
920
|
-
* arrived. `{ from: dataStart, to: dataEnd }` mirrors the
|
|
1147
|
+
* arrived. `{ from: dataStart, to: dataEnd }` mirrors the chart's own
|
|
921
1148
|
* tracking and is cheaper than recomputing from series stores.
|
|
922
1149
|
*/
|
|
923
|
-
getDataRange():
|
|
1150
|
+
getDataRange(): XRange | null;
|
|
924
1151
|
/**
|
|
925
|
-
* Imperatively set the visible time range.
|
|
1152
|
+
* Imperatively set the visible time range. Three forms:
|
|
926
1153
|
*
|
|
927
|
-
*
|
|
928
|
-
*
|
|
929
|
-
*
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
*
|
|
933
|
-
*
|
|
934
|
-
*
|
|
1154
|
+
* - `number N` — show the last N bars from the data tail (anchor right).
|
|
1155
|
+
* Resolved against current data bounds and data interval; keeps
|
|
1156
|
+
* auto-scroll on. No-op if data hasn't loaded yet.
|
|
1157
|
+
* - `{ from, to }` — explicit time range. `from`/`to` accept either
|
|
1158
|
+
* epoch milliseconds or `Date`. Cancels any in-flight animation and
|
|
1159
|
+
* applies immediately. Auto-scroll stays on only if the tail is
|
|
1160
|
+
* inside the new range (mirrors pan semantics).
|
|
1161
|
+
* - `{ from, bars }` — anchor the visible window at `from` and extend
|
|
1162
|
+
* right by `bars` data intervals. Useful for warm-up windows where
|
|
1163
|
+
* seed points sit on the left and a stream fills the gap on the
|
|
1164
|
+
* right. `from` accepts a `Date` too.
|
|
935
1165
|
*
|
|
936
1166
|
* Typical use: on mount, zoom to the last N bars while keeping the full
|
|
937
1167
|
* buffer available for pan-back history inspection.
|
|
938
|
-
|
|
939
|
-
|
|
1168
|
+
*
|
|
1169
|
+
* `opts.gesture` (explicit `{ from, to }` form only) eases X and Y on the
|
|
1170
|
+
* same fast, velocity-matched profile a user pan/zoom uses instead of the
|
|
1171
|
+
* default programmatic settle (snap X, sticky-Y ease). Use it for
|
|
1172
|
+
* multi-chart sync so a synced pane tracks the originating gesture in
|
|
1173
|
+
* lockstep rather than lagging behind on the long sticky contract.
|
|
1174
|
+
*/
|
|
1175
|
+
setVisibleRange(spec: VisibleRangeSpec, opts?: {
|
|
1176
|
+
gesture?: boolean;
|
|
1177
|
+
}): void;
|
|
940
1178
|
getYRange(): YRange;
|
|
941
1179
|
getCrosshairPosition(): CrosshairPosition | null;
|
|
1180
|
+
/**
|
|
1181
|
+
* Programmatically set or clear the crosshair. Same effect as the user
|
|
1182
|
+
* hovering over `(timeToX(time), valueToY(y))` — emits `crosshairMove`,
|
|
1183
|
+
* marks the overlay layer dirty, and lets `<Crosshair>` / `<Tooltip>`
|
|
1184
|
+
* react via their normal store subscriptions.
|
|
1185
|
+
*
|
|
1186
|
+
* Pass `null` to clear (mirrors the pointer-leave path).
|
|
1187
|
+
*
|
|
1188
|
+
* `y` is optional. Resolution order when omitted:
|
|
1189
|
+
* 1. **current crosshair's y** — preserves whatever the chart already
|
|
1190
|
+
* has (real cursor y, or a previously-synthesised value). This is
|
|
1191
|
+
* what makes the cross-chart broadcast pattern work: when an echo
|
|
1192
|
+
* arrives at the chart that originated the hover, the existing y
|
|
1193
|
+
* stays in place and the idempotency check below short-circuits the
|
|
1194
|
+
* loop. Without preservation, the echo would overwrite the source's
|
|
1195
|
+
* real cursor y with the midpoint default and the tooltip would
|
|
1196
|
+
* jitter between cursor and midpoint every mouse-move.
|
|
1197
|
+
* 2. **midpoint of the current Y range** — fallback when there is no
|
|
1198
|
+
* current crosshair (first programmatic set on a chart that hasn't
|
|
1199
|
+
* been hovered yet).
|
|
1200
|
+
*
|
|
1201
|
+
* Idempotent: a call that produces the same `(time, y)` pair as the
|
|
1202
|
+
* current crosshair is a no-op (no emit). Combined with the y-preservation
|
|
1203
|
+
* above, this lets N charts broadcast their hover to each other without
|
|
1204
|
+
* a feedback-loop guard.
|
|
1205
|
+
*/
|
|
1206
|
+
setCrosshair(pos: {
|
|
1207
|
+
time: number;
|
|
1208
|
+
y?: number;
|
|
1209
|
+
} | null): void;
|
|
942
1210
|
/** Get the last visible value and whether the absolute last point is on screen. */
|
|
943
1211
|
getLastValue(seriesId: string): {
|
|
944
1212
|
value: number;
|
|
@@ -962,11 +1230,6 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
962
1230
|
color: string;
|
|
963
1231
|
}[] | null;
|
|
964
1232
|
getSeriesIds(): string[];
|
|
965
|
-
/**
|
|
966
|
-
* Type of a registered series, or `null` for unknown ids. `'pie'` for
|
|
967
|
-
* `PieRenderer`; everything else is a time-series (`'time'`).
|
|
968
|
-
*/
|
|
969
|
-
getSeriesType(seriesId: string): 'pie' | 'time' | null;
|
|
970
1233
|
/**
|
|
971
1234
|
* Filter `getSeriesIds()` by renderer type. `'pie'` returns pie series,
|
|
972
1235
|
* `'time'` returns line/bar/candlestick.
|
|
@@ -1045,25 +1308,6 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
1045
1308
|
* a wrapper re-applies padding reactively (e.g. in response to a Title /
|
|
1046
1309
|
* InfoBar ResizeObserver).
|
|
1047
1310
|
*/
|
|
1048
|
-
/**
|
|
1049
|
-
* Replace the chart-level animation configuration at runtime. Updates the
|
|
1050
|
-
* resolved durations and propagates them to every dependent subsystem:
|
|
1051
|
-
*
|
|
1052
|
-
* - viewport: reboundMs (next rebound), inputResponseMs (next pan/zoom).
|
|
1053
|
-
* - per-frame: yAxisMs (next render).
|
|
1054
|
-
* - existing series: only the **hard-disable** signal (0 / false) is pushed
|
|
1055
|
-
* into renderers — that's the documented contract on
|
|
1056
|
-
* {@link AnimationsConfig.points}, "chart-level `false` wins over per-
|
|
1057
|
-
* series". Numeric chart-level changes update the default for *new*
|
|
1058
|
-
* series but leave existing per-series overrides intact, which avoids
|
|
1059
|
-
* silently clobbering custom values on every prop update from a React
|
|
1060
|
-
* wrapper.
|
|
1061
|
-
*
|
|
1062
|
-
* In-flight animations are NOT cancelled — the new durations apply to the
|
|
1063
|
-
* next animation that fires. To force-snap the current animation, call
|
|
1064
|
-
* the relevant API explicitly (e.g. `setRange`) afterwards.
|
|
1065
|
-
*/
|
|
1066
|
-
setAnimations(animations: ChartOptions['animations']): void;
|
|
1067
1311
|
setPadding(padding: ChartOptions['padding']): void;
|
|
1068
1312
|
/** Show or hide the background grid. Takes effect on the next render frame. */
|
|
1069
1313
|
setGrid(grid: {
|
|
@@ -1081,9 +1325,13 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
1081
1325
|
setEdgeState(side: EdgeSide, state: EdgeState): void;
|
|
1082
1326
|
/** Read the current host-declared state for a given edge. */
|
|
1083
1327
|
getEdgeState(side: EdgeSide): EdgeState;
|
|
1084
|
-
/**
|
|
1085
|
-
|
|
1086
|
-
|
|
1328
|
+
/**
|
|
1329
|
+
* Notify chart that a YLabel overlay is mounted / unmounted. Currently a
|
|
1330
|
+
* no-op — placeholder for the right-padding reflow that will adjust the
|
|
1331
|
+
* chart area to make room for the badge.
|
|
1332
|
+
* TODO: implement reflow.
|
|
1333
|
+
*/
|
|
1334
|
+
setYLabel(_has: boolean): void;
|
|
1087
1335
|
/** Tear down the chart: cancel animations, remove listeners, and detach the canvas. */
|
|
1088
1336
|
destroy(): void;
|
|
1089
1337
|
/** The attached performance monitor, or `null` when instrumentation is disabled. */
|
|
@@ -1093,39 +1341,42 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
1093
1341
|
private onDataChanged;
|
|
1094
1342
|
private updateDataInterval;
|
|
1095
1343
|
/**
|
|
1096
|
-
*
|
|
1097
|
-
*
|
|
1098
|
-
*
|
|
1344
|
+
* Shift the visible time range by `timeDelta` ms. Hard-clamped so at
|
|
1345
|
+
* least one data point stays on screen — no rubber-band, no overshoot.
|
|
1346
|
+
* A pan that moves the viewport off the live-tail position flips
|
|
1347
|
+
* autoscroll off. Fires `edgeReached` whenever the clamp trims the
|
|
1348
|
+
* gesture (i.e., the user pushed past the boundary), so consumers can
|
|
1349
|
+
* trigger history loads. Forwards the committed target to the engine
|
|
1350
|
+
* as a gesture for visual easing. Public so consumers can drive pan
|
|
1351
|
+
* programmatically.
|
|
1352
|
+
*/
|
|
1353
|
+
pan(timeDelta: number, chartWidth?: number): void;
|
|
1354
|
+
/**
|
|
1355
|
+
* Zoom around a time anchor. `factor < 1` zooms in, `> 1` zooms out.
|
|
1356
|
+
* In historical mode the window anchors to `centerTime` (cursor-driven).
|
|
1357
|
+
* Zoom-out is hard-capped at the padded data span. Forwards the committed
|
|
1358
|
+
* target to the engine as a gesture for visual easing. Public so consumers
|
|
1359
|
+
* can drive zoom programmatically.
|
|
1099
1360
|
*
|
|
1100
|
-
* `
|
|
1101
|
-
*
|
|
1102
|
-
*
|
|
1103
|
-
*
|
|
1361
|
+
* Sticky-follow: while `#autoScroll` is on, the new window is repositioned
|
|
1362
|
+
* so its right edge sits at `dataEnd + paddingRight` (follow position).
|
|
1363
|
+
* Span (zoom level) from `computeZoom` is preserved; only the position
|
|
1364
|
+
* is locked to the tail. This avoids the next-tick `computeStreamingTarget`
|
|
1365
|
+
* offset clamp (which would otherwise slide X left to the follow position
|
|
1366
|
+
* and produce a visible jump). Cursor-anchored zoom is intentionally
|
|
1367
|
+
* sacrificed in follow-live mode — pan first to inspect history.
|
|
1104
1368
|
*/
|
|
1105
|
-
|
|
1106
|
-
private updateYRange;
|
|
1107
|
-
/** Resolve an {@link AxisBound} to a concrete numeric value. */
|
|
1108
|
-
private resolveBound;
|
|
1369
|
+
zoomAt(centerTime: number, factor: number, chartWidth?: number): void;
|
|
1109
1370
|
/**
|
|
1110
1371
|
* Lightweight scale sync: updates timeScale/yScale from current viewport state
|
|
1111
1372
|
* without advancing the Y smoothing animation. Called from the viewport 'change'
|
|
1112
|
-
* handler so DOM axis components always read fresh coordinates on re-render.
|
|
1373
|
+
* handler, so DOM axis components always read fresh coordinates on re-render.
|
|
1113
1374
|
*/
|
|
1114
1375
|
private syncScales;
|
|
1115
|
-
private updateScales;
|
|
1116
1376
|
/** Expensive: background, grid, all series. Only on data/viewport/resize change. */
|
|
1117
1377
|
private renderMain;
|
|
1118
1378
|
/** Cheap overlay: crosshair, nearest-point dots, pulse animation, edge indicator. */
|
|
1119
1379
|
private renderOverlay;
|
|
1120
|
-
private drawEdgeIndicators;
|
|
1121
|
-
/**
|
|
1122
|
-
* Pick the boundary time to anchor the edge indicator at. Prefer the
|
|
1123
|
-
* cached value emitted by the most recent `edgeReached` — that's the
|
|
1124
|
-
* *exact* point the user overshot. Fall back to the current data edge
|
|
1125
|
-
* when no gesture has fired yet (host might invoke `setEdgeState`
|
|
1126
|
-
* directly on mount to show a "no-data" marker from the start).
|
|
1127
|
-
*/
|
|
1128
|
-
private resolveEdgeBoundary;
|
|
1129
1380
|
}
|
|
1130
1381
|
|
|
1131
1382
|
/** Layout metrics describing the chart area, Y axis, and time axis sizes. */
|
|
@@ -1135,6 +1386,7 @@ export declare interface ChartLayout {
|
|
|
1135
1386
|
xAxisHeight: number;
|
|
1136
1387
|
}
|
|
1137
1388
|
|
|
1389
|
+
/** Options passed when creating a new ChartInstance. */
|
|
1138
1390
|
export declare interface ChartOptions {
|
|
1139
1391
|
theme?: ChartTheme;
|
|
1140
1392
|
axis?: AxisConfig;
|
|
@@ -1145,12 +1397,35 @@ export declare interface ChartOptions {
|
|
|
1145
1397
|
padding?: {
|
|
1146
1398
|
top?: number;
|
|
1147
1399
|
bottom?: number;
|
|
1148
|
-
right?:
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1400
|
+
right?: HorizontalPadding;
|
|
1401
|
+
left?: HorizontalPadding;
|
|
1402
|
+
};
|
|
1403
|
+
/**
|
|
1404
|
+
* Viewport-level streaming behavior.
|
|
1405
|
+
*/
|
|
1406
|
+
viewport?: {
|
|
1407
|
+
/**
|
|
1408
|
+
* Maximum number of data bars (candles/points) the viewport will fit
|
|
1409
|
+
* before it stops growing and switches to tail-scroll. While the data
|
|
1410
|
+
* span is below this threshold, streaming ticks expand the right edge
|
|
1411
|
+
* to absorb new points; once the span exceeds it, the visible window
|
|
1412
|
+
* holds at this width and slides forward as new data arrives.
|
|
1413
|
+
* Default: 200. Values below 2 are clamped.
|
|
1414
|
+
*/
|
|
1415
|
+
maxVisibleBars?: number;
|
|
1416
|
+
/**
|
|
1417
|
+
* Initial visible range applied **before** the first paint after data
|
|
1418
|
+
* arrives. Same shape as `ChartInstance.setVisibleRange` (a bar count,
|
|
1419
|
+
* an explicit `{from, to}` window, or a `{from, bars}` warm-up pair).
|
|
1420
|
+
* Calling `setVisibleRange` after mount via `useEffect` runs post-paint
|
|
1421
|
+
* and visually re-zooms the chart on the next frame; this option folds
|
|
1422
|
+
* the same intent into the first render so the very first paint
|
|
1423
|
+
* already shows the requested window.
|
|
1424
|
+
*
|
|
1425
|
+
* One-shot — consumed by the first `onDataChanged` call that has data,
|
|
1426
|
+
* then cleared. Subsequent `setSeriesData` calls don't re-apply it.
|
|
1427
|
+
*/
|
|
1428
|
+
initialRange?: VisibleRangeSpec;
|
|
1154
1429
|
};
|
|
1155
1430
|
/** Enable zoom, pan, and crosshair interactions. Defaults to true. */
|
|
1156
1431
|
interactive?: boolean;
|
|
@@ -1159,17 +1434,16 @@ export declare interface ChartOptions {
|
|
|
1159
1434
|
visible: boolean;
|
|
1160
1435
|
};
|
|
1161
1436
|
/**
|
|
1162
|
-
* Animation control.
|
|
1163
|
-
* `
|
|
1164
|
-
* {
|
|
1437
|
+
* Animation control. Grouped as `axis: { y, x, ticks }` (axis-side
|
|
1438
|
+
* behaviour), `toggle` (series visibility — alpha + Y refit), and
|
|
1439
|
+
* `series.{line,candlestick,bar,pie}` (per-series-type data tweens).
|
|
1440
|
+
* See {@link AnimationsConfig} for the full shape and defaults.
|
|
1165
1441
|
*
|
|
1166
1442
|
* Shorthands:
|
|
1167
1443
|
* - `animations: true` (or omitted) uses built-in defaults.
|
|
1168
1444
|
* - `animations: false` disables every animation category.
|
|
1169
|
-
* - `animations: { points: false }` disables all data-series animations.
|
|
1170
|
-
* - `animations: { viewport: false }` disables rebound + Y-axis smoothing.
|
|
1171
1445
|
*
|
|
1172
|
-
* Per-series options (`
|
|
1446
|
+
* Per-series options (`entryMs`, `smoothMs`, etc.) override chart-level
|
|
1173
1447
|
* defaults unless the category is explicitly `false` — then the chart-
|
|
1174
1448
|
* level gate wins.
|
|
1175
1449
|
*/
|
|
@@ -1178,7 +1452,7 @@ export declare interface ChartOptions {
|
|
|
1178
1452
|
* Invoked after the user releases a pan/zoom gesture that pulled the
|
|
1179
1453
|
* viewport past a data edge by more than 10% of the visible range. Hosts
|
|
1180
1454
|
* typically respond by prefetching more history and calling
|
|
1181
|
-
*
|
|
1455
|
+
* `ChartInstance.setEdgeState` to show a spinner or "no more data"
|
|
1182
1456
|
* indicator at the corresponding edge.
|
|
1183
1457
|
*/
|
|
1184
1458
|
onEdgeReached?: (info: EdgeReachedInfo) => void;
|
|
@@ -1410,15 +1684,6 @@ export declare interface CrosshairPosition {
|
|
|
1410
1684
|
y: number;
|
|
1411
1685
|
}
|
|
1412
1686
|
|
|
1413
|
-
/**
|
|
1414
|
-
* @deprecated Use a named preset instead — `catppuccin.theme` is the new
|
|
1415
|
-
* default dark palette, and `dracula`, `nightOwl`, `oneDarkPro`, `gruvbox`,
|
|
1416
|
-
* `monokaiPro`, `materialPalenight`, or `panda` cover the rest of the
|
|
1417
|
-
* dark spectrum. `darkTheme` is kept as an alias for the previous default
|
|
1418
|
-
* and will be removed in a future major release.
|
|
1419
|
-
*/
|
|
1420
|
-
export declare const darkTheme: ChartTheme;
|
|
1421
|
-
|
|
1422
1687
|
export declare function detectInterval(times: number[]): number;
|
|
1423
1688
|
|
|
1424
1689
|
export declare const dracula: ThemePreset;
|
|
@@ -1491,6 +1756,11 @@ export declare const handwritten: ThemePreset;
|
|
|
1491
1756
|
|
|
1492
1757
|
export declare const highContrast: ThemePreset;
|
|
1493
1758
|
|
|
1759
|
+
/** Horizontal padding expressed as a fixed pixel offset or a number of data intervals. */
|
|
1760
|
+
declare type HorizontalPadding = number | {
|
|
1761
|
+
intervals: number;
|
|
1762
|
+
};
|
|
1763
|
+
|
|
1494
1764
|
/** Shape returned by {@link SeriesRenderer.getHoverInfo} / per-slice entries of {@link SeriesRenderer.getSliceInfo}. */
|
|
1495
1765
|
export declare interface HoverInfo {
|
|
1496
1766
|
label: string;
|
|
@@ -1552,18 +1822,6 @@ declare type LegendMode = 'toggle' | 'isolate' | 'solo';
|
|
|
1552
1822
|
|
|
1553
1823
|
export declare const lightPink: ThemePreset;
|
|
1554
1824
|
|
|
1555
|
-
/**
|
|
1556
|
-
* @deprecated Use a named light preset instead — `quietLight`, `githubLight`,
|
|
1557
|
-
* `solarizedLight`, `minimalLight`, `peachCream`, `sandDune`, `lightPink`,
|
|
1558
|
-
* `lavenderMist`, `mintBreeze`, `rosePineDawn`, or `handwritten`. `lightTheme`
|
|
1559
|
-
* is kept as an alias for the previous default and will be removed in a
|
|
1560
|
-
* future major release.
|
|
1561
|
-
*/
|
|
1562
|
-
export declare const lightTheme: ChartTheme;
|
|
1563
|
-
|
|
1564
|
-
/** @deprecated Use {@link TimePoint} instead. */
|
|
1565
|
-
export declare type LineData = TimePoint;
|
|
1566
|
-
|
|
1567
1825
|
/**
|
|
1568
1826
|
* Entrance animation styles for new line points.
|
|
1569
1827
|
* - `'none'` — new segments appear instantly.
|
|
@@ -1601,14 +1859,14 @@ export declare interface LineSeriesOptions {
|
|
|
1601
1859
|
* <LineSeries options={{ pulseMs: 1200 }} data={data} />
|
|
1602
1860
|
*
|
|
1603
1861
|
* // Chart-level default:
|
|
1604
|
-
* <ChartContainer animations={{
|
|
1862
|
+
* <ChartContainer animations={{ series: { line: { pulse: 1200 } } }}>
|
|
1605
1863
|
* <LineSeries data={data} />
|
|
1606
1864
|
* </ChartContainer>
|
|
1607
1865
|
* ```
|
|
1608
1866
|
*
|
|
1609
1867
|
* `false` or `0` turns the halo off entirely (drawing and animation loop).
|
|
1610
|
-
* A chart-level `animations.
|
|
1611
|
-
* over this field.
|
|
1868
|
+
* A chart-level `animations.series.line: false` is a hard disable that
|
|
1869
|
+
* wins over this field.
|
|
1612
1870
|
*/
|
|
1613
1871
|
pulseMs?: number | false;
|
|
1614
1872
|
/** Stacking mode. Default: 'off'. */
|
|
@@ -1621,8 +1879,6 @@ export declare interface LineSeriesOptions {
|
|
|
1621
1879
|
* @see entryMs — cross-linked duration for this animation.
|
|
1622
1880
|
*/
|
|
1623
1881
|
entryAnimation?: LineEntryAnimation;
|
|
1624
|
-
/** @deprecated Use {@link entryAnimation} instead. */
|
|
1625
|
-
enterAnimation?: LineEntryAnimation;
|
|
1626
1882
|
/**
|
|
1627
1883
|
* Per-point entrance duration in milliseconds. Default: `250`.
|
|
1628
1884
|
*
|
|
@@ -1630,24 +1886,19 @@ export declare interface LineSeriesOptions {
|
|
|
1630
1886
|
* // Override for one series:
|
|
1631
1887
|
* <LineSeries options={{ entryMs: 600 }} data={data} />
|
|
1632
1888
|
*
|
|
1633
|
-
* // Or set the default for every series at once:
|
|
1634
|
-
* <ChartContainer animations={{
|
|
1889
|
+
* // Or set the default for every line series at once:
|
|
1890
|
+
* <ChartContainer animations={{ series: { line: { entry: 600 } } }}>
|
|
1635
1891
|
* <LineSeries data={data} />
|
|
1636
1892
|
* </ChartContainer>
|
|
1637
1893
|
* ```
|
|
1638
1894
|
*
|
|
1639
|
-
* Note: chart-level uses `enterMs`, per-series uses `entryMs` — same
|
|
1640
|
-
* animation, two names for historical reasons.
|
|
1641
|
-
*
|
|
1642
1895
|
* `false` or `0` disables the entrance (equivalent to
|
|
1643
|
-
* `entryAnimation: 'none'`). A chart-level `animations.
|
|
1644
|
-
* hard disable that wins over this field.
|
|
1896
|
+
* `entryAnimation: 'none'`). A chart-level `animations.series.line: false`
|
|
1897
|
+
* is a hard disable that wins over this field.
|
|
1645
1898
|
*
|
|
1646
1899
|
* @see LineSeriesOptions.entryAnimation
|
|
1647
1900
|
*/
|
|
1648
1901
|
entryMs?: number | false;
|
|
1649
|
-
/** @deprecated Use {@link entryMs} instead. */
|
|
1650
|
-
enterMs?: number | false;
|
|
1651
1902
|
/**
|
|
1652
1903
|
* How long the displayed last value takes to catch up to the actual one
|
|
1653
1904
|
* on every `updateLastPoint`. Default: `250` ms.
|
|
@@ -1657,13 +1908,13 @@ export declare interface LineSeriesOptions {
|
|
|
1657
1908
|
* <LineSeries options={{ smoothMs: 100 }} data={data} />
|
|
1658
1909
|
*
|
|
1659
1910
|
* // Chart-level default:
|
|
1660
|
-
* <ChartContainer animations={{
|
|
1911
|
+
* <ChartContainer animations={{ series: { line: { smooth: 100 } } }}>
|
|
1661
1912
|
* <LineSeries data={data} />
|
|
1662
1913
|
* </ChartContainer>
|
|
1663
1914
|
* ```
|
|
1664
1915
|
*
|
|
1665
1916
|
* `0` or `false` snaps the displayed value to the target on every tick
|
|
1666
|
-
* (no smoothing). A chart-level `animations.
|
|
1917
|
+
* (no smoothing). A chart-level `animations.series.line: false` is a hard
|
|
1667
1918
|
* disable that wins over this field.
|
|
1668
1919
|
*/
|
|
1669
1920
|
smoothMs?: number | false;
|
|
@@ -1673,6 +1924,15 @@ declare type Listener = (...args: any[]) => void;
|
|
|
1673
1924
|
|
|
1674
1925
|
export declare const materialPalenight: ThemePreset;
|
|
1675
1926
|
|
|
1927
|
+
/**
|
|
1928
|
+
* Time helpers for the animation config surface. The public config accepts
|
|
1929
|
+
* three shapes: a number (already milliseconds), a string with an explicit
|
|
1930
|
+
* unit (`"250ms"`, `"1s"`, `"2.5s"`), or `false` to disable. The resolver
|
|
1931
|
+
* parses each input once at chart construction; the hot render path then
|
|
1932
|
+
* only ever sees numbers.
|
|
1933
|
+
*/
|
|
1934
|
+
declare type Milliseconds = number;
|
|
1935
|
+
|
|
1676
1936
|
export declare const minimalLight: ThemePreset;
|
|
1677
1937
|
|
|
1678
1938
|
export declare const mintBreeze: ThemePreset;
|
|
@@ -1790,6 +2050,25 @@ export declare const oneDarkPro: ThemePreset;
|
|
|
1790
2050
|
|
|
1791
2051
|
export declare const panda: ThemePreset;
|
|
1792
2052
|
|
|
2053
|
+
/**
|
|
2054
|
+
* Narrow interface the interaction handlers expect from their host. Lets
|
|
2055
|
+
* `InteractionHandler` / `PanHandler` / `ZoomHandler` drive pan / zoom
|
|
2056
|
+
* without depending on the full ChartInstance surface.
|
|
2057
|
+
*/
|
|
2058
|
+
declare interface PanZoomTarget {
|
|
2059
|
+
/**
|
|
2060
|
+
* Shift the visible time range by `timeDelta` ms. `chartWidth` is used
|
|
2061
|
+
* by pixel-padding resolution; passing the current canvas width yields
|
|
2062
|
+
* correct rubber-band clamps.
|
|
2063
|
+
*/
|
|
2064
|
+
pan(timeDelta: number, chartWidth?: number): void;
|
|
2065
|
+
/**
|
|
2066
|
+
* Zoom around a time anchor. `factor < 1` zooms in, `> 1` zooms out.
|
|
2067
|
+
* `chartWidth` participates in soft-bound math the same way as in `pan`.
|
|
2068
|
+
*/
|
|
2069
|
+
zoomAt(centerTime: number, factor: number, chartWidth?: number): void;
|
|
2070
|
+
}
|
|
2071
|
+
|
|
1793
2072
|
export declare const peachCream: ThemePreset;
|
|
1794
2073
|
|
|
1795
2074
|
/**
|
|
@@ -1872,8 +2151,6 @@ declare interface PerfStats {
|
|
|
1872
2151
|
mainRendersPerSec: number;
|
|
1873
2152
|
/** Same as {@link mainRendersPerSec} but for the overlay (crosshair + pulse) layer. */
|
|
1874
2153
|
overlayRendersPerSec: number;
|
|
1875
|
-
/** @deprecated Alias for {@link mainRendersPerSec}. Kept for older consumers. */
|
|
1876
|
-
fps: number;
|
|
1877
2154
|
mainFrameMs: FrameTimingSample;
|
|
1878
2155
|
overlayFrameMs: FrameTimingSample;
|
|
1879
2156
|
/** Total frames recorded per layer. Lets consumers distinguish "no data yet" from "drew once and ms is 0". */
|
|
@@ -1935,13 +2212,6 @@ declare interface PieLabelsOptions {
|
|
|
1935
2212
|
* expressed as a multiplier of {@link fontSize}. Default: 1.8.
|
|
1936
2213
|
*/
|
|
1937
2214
|
labelGap?: number;
|
|
1938
|
-
/**
|
|
1939
|
-
* @deprecated No effect in the radial per-slice layout. A label's X is
|
|
1940
|
-
* pinned to its slice midangle, so forcing the "other" side would flip
|
|
1941
|
-
* text direction without moving the label and push text across the pie.
|
|
1942
|
-
* Kept in the option surface for backwards compatibility.
|
|
1943
|
-
*/
|
|
1944
|
-
balanceSides?: boolean;
|
|
1945
2215
|
}
|
|
1946
2216
|
|
|
1947
2217
|
export declare const PieLegend: __VLS_WithTemplateSlots_4<typeof __VLS_component_4, __VLS_TemplateResult_4["slots"]>;
|
|
@@ -2059,6 +2329,30 @@ export declare function resolveAxisTextColor(theme: ChartTheme, axis?: 'x' | 'y'
|
|
|
2059
2329
|
*/
|
|
2060
2330
|
export declare function resolveCandlestickBodyColor(body: string | [string, string]): string;
|
|
2061
2331
|
|
|
2332
|
+
/**
|
|
2333
|
+
* Per-call settle times supplied by the engine to {@link Transition.retarget}.
|
|
2334
|
+
* The engine owns all durations and pushes them per call; the curves carry
|
|
2335
|
+
* no baseline of their own.
|
|
2336
|
+
*
|
|
2337
|
+
* X transitions use only `expandMs` (single direction). Y transitions use
|
|
2338
|
+
* both `expandMs` (outward — new extreme enters window) and `contractMs`
|
|
2339
|
+
* (inward — extreme leaves; the sticky-Y mechanism).
|
|
2340
|
+
*/
|
|
2341
|
+
declare interface RetargetOptions {
|
|
2342
|
+
/** Optional wall clock. Defaults to `performance.now()`. */
|
|
2343
|
+
now?: number;
|
|
2344
|
+
/**
|
|
2345
|
+
* Settle time (ms) for *outward* motion — bound reaching a new extreme.
|
|
2346
|
+
* Also used by X (single-direction) as the spring's settle time.
|
|
2347
|
+
*/
|
|
2348
|
+
expandMs?: number;
|
|
2349
|
+
/**
|
|
2350
|
+
* Settle time (ms) for *inward* motion — bound contracting after an
|
|
2351
|
+
* extreme leaves the window. Y-only; X transitions ignore this field.
|
|
2352
|
+
*/
|
|
2353
|
+
contractMs?: number;
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2062
2356
|
export declare const rosePineDawn: ThemePreset;
|
|
2063
2357
|
|
|
2064
2358
|
export declare const sandDune: ThemePreset;
|
|
@@ -2158,7 +2452,39 @@ export declare interface ThemePreset {
|
|
|
2158
2452
|
backgroundSize?: string;
|
|
2159
2453
|
}
|
|
2160
2454
|
|
|
2161
|
-
|
|
2455
|
+
/**
|
|
2456
|
+
* Per-axis tick-set holder with self-managed fade.
|
|
2457
|
+
*
|
|
2458
|
+
* Each tick value gets its own {@link Animator}: entering ticks ramp `0 → 1`,
|
|
2459
|
+
* exiting ticks ramp `1 → 0` and are removed once they settle at zero.
|
|
2460
|
+
* Callers drive the clock with {@link tick} once per frame, then read the
|
|
2461
|
+
* current opacity table via {@link snapshot}.
|
|
2462
|
+
*
|
|
2463
|
+
* Pre-arming (initial mount, dataset swap) the tracker uses duration `0` so
|
|
2464
|
+
* the very first nice-tick sets snap into place without an opening fade —
|
|
2465
|
+
* transient tick churn during layout settling should not look animated.
|
|
2466
|
+
*/
|
|
2467
|
+
declare interface TickEntry {
|
|
2468
|
+
/** Tick value (time or price). */
|
|
2469
|
+
readonly value: number;
|
|
2470
|
+
/** Current opacity in [0, 1]. */
|
|
2471
|
+
readonly opacity: number;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
declare interface TickTrackerSnapshot {
|
|
2475
|
+
/**
|
|
2476
|
+
* Every tick the tracker still considers alive — current ones at their
|
|
2477
|
+
* resolved opacity (1.0 once any pending fade-in settles) and fading-out
|
|
2478
|
+
* ones above 0.
|
|
2479
|
+
*/
|
|
2480
|
+
readonly entries: readonly TickEntry[];
|
|
2481
|
+
/** True while at least one entry hasn't reached its target opacity. */
|
|
2482
|
+
readonly isAnimating: boolean;
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
export declare const TimeAxis: DefineComponent<__VLS_Props_12, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_12> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
2486
|
+
containerRef: HTMLDivElement;
|
|
2487
|
+
}, HTMLDivElement>;
|
|
2162
2488
|
|
|
2163
2489
|
/** A single time-value data point for line and bar series. Time is a timestamp in milliseconds. */
|
|
2164
2490
|
export declare interface TimePoint {
|
|
@@ -2171,57 +2497,6 @@ export declare type TimePointInput = Omit<TimePoint, 'time'> & {
|
|
|
2171
2497
|
time: TimeValue;
|
|
2172
2498
|
};
|
|
2173
2499
|
|
|
2174
|
-
declare class TimeScale {
|
|
2175
|
-
private from;
|
|
2176
|
-
private to;
|
|
2177
|
-
private width;
|
|
2178
|
-
private pixelRatio;
|
|
2179
|
-
private dataInterval;
|
|
2180
|
-
private labelCountHintValue;
|
|
2181
|
-
private minSpacingValue;
|
|
2182
|
-
private resolvedInterval;
|
|
2183
|
-
private lastInterval;
|
|
2184
|
-
/**
|
|
2185
|
-
* "want" (desired interval post-floor) at the time lastInterval was snapped.
|
|
2186
|
-
* Hysteresis band anchors to this so micro range drift back across a tier
|
|
2187
|
-
* boundary doesn't flip the label density — mirrors YScale, see there for
|
|
2188
|
-
* the full reasoning.
|
|
2189
|
-
*/
|
|
2190
|
-
private lastWant;
|
|
2191
|
-
/** Identifies the dataInterval bucket whose tier list drove lastInterval. */
|
|
2192
|
-
private lastBucketKey;
|
|
2193
|
-
private get labelCountHint();
|
|
2194
|
-
private get minLabelSpacing();
|
|
2195
|
-
update(range: VisibleRange, mediaWidth: number, pixelRatio: number, dataInterval?: number): void;
|
|
2196
|
-
setLabelCount(n: number | null | undefined): void;
|
|
2197
|
-
setMinSpacing(px: number | null | undefined): void;
|
|
2198
|
-
private resetHysteresis;
|
|
2199
|
-
timeToX(time: number): number;
|
|
2200
|
-
timeToBitmapX(time: number): number;
|
|
2201
|
-
xToTime(x: number): number;
|
|
2202
|
-
pixelDeltaToTimeDelta(pixelDelta: number): number;
|
|
2203
|
-
barWidthMedia(dataInterval: number): number;
|
|
2204
|
-
barWidthBitmap(dataInterval: number): number;
|
|
2205
|
-
/**
|
|
2206
|
-
* Evenly spaced "nice" tick times. Resolution uses the cached
|
|
2207
|
-
* `dataInterval` set by `update()`; callers that bypass `update()` can
|
|
2208
|
-
* still pass it here for back-compat.
|
|
2209
|
-
*/
|
|
2210
|
-
niceTickValues(dataInterval: number): {
|
|
2211
|
-
ticks: number[];
|
|
2212
|
-
tickInterval: number;
|
|
2213
|
-
};
|
|
2214
|
-
getRange(): VisibleRange;
|
|
2215
|
-
getMediaWidth(): number;
|
|
2216
|
-
/**
|
|
2217
|
-
* Resolve the next tick interval. Walks `niceTimeIntervals(dataInterval)`
|
|
2218
|
-
* looking for the smallest tier ≥ desired spacing; retains the previous
|
|
2219
|
-
* tier inside a ratio band so micro pan/zoom doesn't flip label density.
|
|
2220
|
-
*/
|
|
2221
|
-
private resolveInterval;
|
|
2222
|
-
private countTicks;
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
2500
|
/**
|
|
2226
2501
|
* Accepted time input: a timestamp in **milliseconds** (like `Date.now()`) or a `Date` object.
|
|
2227
2502
|
* `Date` values are converted to milliseconds internally via `Date.getTime()`.
|
|
@@ -2272,6 +2547,57 @@ export declare interface TooltipPositionArgs {
|
|
|
2272
2547
|
offsetY?: number;
|
|
2273
2548
|
}
|
|
2274
2549
|
|
|
2550
|
+
/**
|
|
2551
|
+
* Smoothing-curve contract. Implementations (`YRangeHermite`, `YRangeSpring`,
|
|
2552
|
+
* `RangeSnap` for Y; `VisibleRangeSpring`, `RangeSnap` for X) drive a value
|
|
2553
|
+
* of type `T` from one snapshot to the next while maintaining `current` /
|
|
2554
|
+
* `target` / velocity continuity.
|
|
2555
|
+
*
|
|
2556
|
+
* Parametric over `T` so X and Y share the same interface — Y uses
|
|
2557
|
+
* `Transition<YRange>` (default), X uses `Transition<VisibleRange>`.
|
|
2558
|
+
*
|
|
2559
|
+
* This is the single public customization point for the chart's curves.
|
|
2560
|
+
* Other animation math (entry tweens, pulse, axis tick fade) stays
|
|
2561
|
+
* engine-fixed.
|
|
2562
|
+
*/
|
|
2563
|
+
declare interface Transition<T> {
|
|
2564
|
+
/** Current sampled position. Read by renderers on every frame. */
|
|
2565
|
+
readonly current: T;
|
|
2566
|
+
/** Active retarget destination. May equal `current` after settle. */
|
|
2567
|
+
readonly target: T;
|
|
2568
|
+
/** True while position has not yet converged to `target`. */
|
|
2569
|
+
readonly animating: boolean;
|
|
2570
|
+
/**
|
|
2571
|
+
* Begin a new transition toward `value`. Existing velocity is carried
|
|
2572
|
+
* over (no reset twitch). The engine supplies the active settle times
|
|
2573
|
+
* via `opts.expandMs` (and `opts.contractMs` for Y).
|
|
2574
|
+
*/
|
|
2575
|
+
retarget(value: T, opts?: RetargetOptions): void;
|
|
2576
|
+
/** Land at `value` instantly. Velocity resets to zero. */
|
|
2577
|
+
snap(value: T, opts?: {
|
|
2578
|
+
now?: number;
|
|
2579
|
+
}): void;
|
|
2580
|
+
/** Advance to `now`. Returns `true` while still perceptibly moving. */
|
|
2581
|
+
tick(now: number): boolean;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
/**
|
|
2585
|
+
* Context handed to a {@link TransitionFactory} at chart construction.
|
|
2586
|
+
* Holds the initial value so the produced transition starts pinned to
|
|
2587
|
+
* the same value the chart will render on its first frame.
|
|
2588
|
+
*/
|
|
2589
|
+
declare interface TransitionContext<T> {
|
|
2590
|
+
initial: T;
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
/**
|
|
2594
|
+
* Factory function returning a fresh {@link Transition}. Pass one as
|
|
2595
|
+
* `animations.axis.y.curve` (or `animations.axis.x.curve`) to plug a custom
|
|
2596
|
+
* smoothing strategy. Built-in factories: {@link hermite} (Y default),
|
|
2597
|
+
* {@link spring} (X default, also valid for Y), {@link snap} (no animation).
|
|
2598
|
+
*/
|
|
2599
|
+
declare type TransitionFactory<T> = (ctx: TransitionContext<T>) => Transition<T>;
|
|
2600
|
+
|
|
2275
2601
|
/** Font family and base font size used across the chart. */
|
|
2276
2602
|
export declare interface Typography {
|
|
2277
2603
|
/** CSS `font-family` stack applied to all text rendered by the chart. */
|
|
@@ -2319,11 +2645,26 @@ export declare function useYRange(chart: ChartInstance): Ref<YRange>;
|
|
|
2319
2645
|
/** Signature for a value-to-string formatter (YAxis, YLabel, Pie, Sparkline, NumberFlow). */
|
|
2320
2646
|
export declare type ValueFormatter = (value: number) => string;
|
|
2321
2647
|
|
|
2322
|
-
/**
|
|
2323
|
-
export declare
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
}
|
|
2648
|
+
/** @deprecated Use {@link XRange} instead. Visible time range of the chart. */
|
|
2649
|
+
export declare type VisibleRange = XRange;
|
|
2650
|
+
|
|
2651
|
+
/**
|
|
2652
|
+
* Argument accepted by {@link Chart.setVisibleRange}. Three forms:
|
|
2653
|
+
*
|
|
2654
|
+
* - `number N` — show the last N bars from the data tail (anchor right).
|
|
2655
|
+
* - `{ from, to }` — explicit time range; `from`/`to` accept either epoch
|
|
2656
|
+
* milliseconds or `Date`, normalised to ms internally.
|
|
2657
|
+
* - `{ from, bars }` — anchor the visible window at `from` and extend
|
|
2658
|
+
* right by `bars` data intervals. Useful for "show N bars starting
|
|
2659
|
+
* here" patterns (warm-up windows for streaming charts, etc.).
|
|
2660
|
+
*/
|
|
2661
|
+
declare type VisibleRangeSpec = number | {
|
|
2662
|
+
from: TimeValue;
|
|
2663
|
+
to: TimeValue;
|
|
2664
|
+
} | {
|
|
2665
|
+
from: TimeValue;
|
|
2666
|
+
bars: number;
|
|
2667
|
+
};
|
|
2327
2668
|
|
|
2328
2669
|
/** Configuration for the X (time) axis. */
|
|
2329
2670
|
export declare interface XAxisConfig {
|
|
@@ -2333,7 +2674,72 @@ export declare interface XAxisConfig {
|
|
|
2333
2674
|
visible?: boolean;
|
|
2334
2675
|
}
|
|
2335
2676
|
|
|
2336
|
-
|
|
2677
|
+
/** Time range (timestamps in milliseconds) of the currently visible portion of the chart. */
|
|
2678
|
+
declare interface XRange {
|
|
2679
|
+
from: number;
|
|
2680
|
+
to: number;
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
declare class XScale {
|
|
2684
|
+
/**
|
|
2685
|
+
* Shared fade state for time ticks. Grid lines (canvas) and DOM tick labels
|
|
2686
|
+
* read opacity from the same tracker, so a tick fading in/out looks
|
|
2687
|
+
* identical on both surfaces.
|
|
2688
|
+
*/
|
|
2689
|
+
readonly tickTracker: AxisTickTracker;
|
|
2690
|
+
private from;
|
|
2691
|
+
private to;
|
|
2692
|
+
private width;
|
|
2693
|
+
private pixelRatio;
|
|
2694
|
+
private dataInterval;
|
|
2695
|
+
private labelCountHintValue;
|
|
2696
|
+
private minSpacingValue;
|
|
2697
|
+
private resolvedInterval;
|
|
2698
|
+
private lastInterval;
|
|
2699
|
+
/**
|
|
2700
|
+
* "want" (desired interval post-floor) at the time lastInterval was snapped.
|
|
2701
|
+
* Hysteresis band anchors to this so micro range drift back across a tier
|
|
2702
|
+
* boundary doesn't flip the label density — mirrors YScale, see there for
|
|
2703
|
+
* the full reasoning.
|
|
2704
|
+
*/
|
|
2705
|
+
private lastWant;
|
|
2706
|
+
/** Identifies the dataInterval bucket whose tier list drove lastInterval. */
|
|
2707
|
+
private lastBucketKey;
|
|
2708
|
+
private get labelCountHint();
|
|
2709
|
+
private get minLabelSpacing();
|
|
2710
|
+
update(range: XRange, mediaWidth: number, pixelRatio: number, dataInterval?: number): void;
|
|
2711
|
+
setLabelCount(n: number | null | undefined): void;
|
|
2712
|
+
setMinSpacing(px: number | null | undefined): void;
|
|
2713
|
+
private resetHysteresis;
|
|
2714
|
+
timeToX(time: number): number;
|
|
2715
|
+
timeToBitmapX(time: number): number;
|
|
2716
|
+
xToTime(x: number): number;
|
|
2717
|
+
pixelDeltaToTimeDelta(pixelDelta: number): number;
|
|
2718
|
+
barWidthMedia(dataInterval: number): number;
|
|
2719
|
+
barWidthBitmap(dataInterval: number): number;
|
|
2720
|
+
/**
|
|
2721
|
+
* Evenly spaced "nice" tick times. Resolution uses the cached
|
|
2722
|
+
* `dataInterval` set by `update()`; callers that bypass `update()` can
|
|
2723
|
+
* still pass it here for back-compat.
|
|
2724
|
+
*/
|
|
2725
|
+
niceTickValues(dataInterval: number): {
|
|
2726
|
+
ticks: number[];
|
|
2727
|
+
tickInterval: number;
|
|
2728
|
+
};
|
|
2729
|
+
getRange(): XRange;
|
|
2730
|
+
getMediaWidth(): number;
|
|
2731
|
+
/**
|
|
2732
|
+
* Resolve the next tick interval. Walks `niceTimeIntervals(dataInterval)`
|
|
2733
|
+
* looking for the smallest tier ≥ desired spacing; retains the previous
|
|
2734
|
+
* tier inside a ratio band so micro pan/zoom doesn't flip label density.
|
|
2735
|
+
*/
|
|
2736
|
+
private resolveInterval;
|
|
2737
|
+
private countTicks;
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
export declare const YAxis: DefineComponent<__VLS_Props_15, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_15> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
2741
|
+
containerRef: HTMLDivElement;
|
|
2742
|
+
}, HTMLDivElement>;
|
|
2337
2743
|
|
|
2338
2744
|
/** Configuration for the Y axis. */
|
|
2339
2745
|
export declare interface YAxisConfig {
|
|
@@ -2352,7 +2758,10 @@ export declare const YLabel: __VLS_WithTemplateSlots_8<typeof __VLS_component_8,
|
|
|
2352
2758
|
/** Direction of the current value vs. previous close. Drives the badge color in the default UI. */
|
|
2353
2759
|
declare type YLabelDirection = 'up' | 'down' | 'neutral';
|
|
2354
2760
|
|
|
2355
|
-
/**
|
|
2761
|
+
/** Value range covered by the chart's Y axis at a given frame. Animated as a
|
|
2762
|
+
* single struct so the upper and lower bounds always move in lockstep — no
|
|
2763
|
+
* half-tween states where the visible domain is wider on one side than the
|
|
2764
|
+
* other for a frame. */
|
|
2356
2765
|
export declare interface YRange {
|
|
2357
2766
|
min: number;
|
|
2358
2767
|
max: number;
|
|
@@ -2363,6 +2772,8 @@ export declare interface YRange {
|
|
|
2363
2772
|
* Also provides tick generation and value formatting for the Y axis.
|
|
2364
2773
|
*/
|
|
2365
2774
|
declare class YScale {
|
|
2775
|
+
/** Shared fade state for Y ticks; see {@link TimeScale.tickTracker}. */
|
|
2776
|
+
readonly tickTracker: AxisTickTracker;
|
|
2366
2777
|
private min;
|
|
2367
2778
|
private max;
|
|
2368
2779
|
private height;
|