@wick-charts/vue 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -145
- package/dist/index.d.ts +229 -65
- package/dist/index.js +3060 -2754
- package/package.json +2 -2
- package/src/ChartContainer.vue +26 -0
- package/src/ui/TimeAxis.vue +1 -1
- package/src/ui/YAxis.vue +1 -1
package/README.md
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- Generated from README.tmpl.md — edit the template, not this file. -->
|
|
4
4
|
|
|
5
|
-
High-performance timeseries charts for **React**, **Vue**, and **Svelte**. Canvas-rendered, tree-shakeable,
|
|
5
|
+
High-performance timeseries charts for **React**, **Vue**, and **Svelte**. Canvas-rendered, tree-shakeable, zero runtime dependencies.
|
|
6
6
|
|
|
7
|
-
[Live Demo](https://mo4islona.github.io/wick-charts/)
|
|
7
|
+
[Live Demo](https://mo4islona.github.io/wick-charts/) · [Docs](https://mo4islona.github.io/wick-charts/#/api/chart-container)
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
- **Candlestick, Line, Bar, Pie** — all from one package
|
|
12
|
-
- **Real-time streaming** — append/update
|
|
13
|
-
- **22 built-in themes**
|
|
11
|
+
- **Candlestick, Line, Bar, Pie, Sparkline** — all from one package
|
|
12
|
+
- **Real-time streaming** — append/update at 60fps with coordinated animations
|
|
13
|
+
- **22 built-in themes** plus `createTheme()` for custom palettes
|
|
14
14
|
- **Interactive** — zoom, pan, crosshair, tooltips
|
|
15
15
|
- **Stacking** — normal and percent modes for line/bar
|
|
16
|
-
- **Custom-render
|
|
16
|
+
- **Custom-render slots** — keep the built-in positioning, replace the contents
|
|
17
17
|
- **Tree-shakeable** — import only what you use
|
|
18
|
-
- **Zero dependencies** — just your framework
|
|
18
|
+
- **Zero runtime dependencies** — just your framework
|
|
19
19
|
|
|
20
20
|
## Install
|
|
21
21
|
|
|
@@ -46,150 +46,23 @@ const props = defineProps(['data']);
|
|
|
46
46
|
</template>
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
##
|
|
49
|
+
## API
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|---|---|---|
|
|
53
|
-
| `CandlestickSeries` | `{ time, open, high, low, close, volume? }[]` | OHLC candlesticks with volume bars |
|
|
54
|
-
| `LineSeries` | `{ time, value }[][]` | Line/area charts, multi-layer, stacking |
|
|
55
|
-
| `BarSeries` | `{ time, value }[][]` | Histogram/bar charts, stacking |
|
|
56
|
-
| `PieSeries` | `{ label, value, color? }[]` | Pie and donut charts |
|
|
51
|
+
Every component, prop, type, and slot context lives in the docs site:
|
|
57
52
|
|
|
58
|
-
|
|
53
|
+
[mo4islona.github.io/wick-charts/#/api/chart-container](https://mo4islona.github.io/wick-charts/#/api/chart-container)
|
|
59
54
|
|
|
60
|
-
|
|
55
|
+
Start there for [ChartContainer](https://mo4islona.github.io/wick-charts/#/api/chart-container), then drill into the series ([Candlestick](https://mo4islona.github.io/wick-charts/#/api/candlestick-series), [Line](https://mo4islona.github.io/wick-charts/#/api/line-series), [Bar](https://mo4islona.github.io/wick-charts/#/api/bar-series), [Pie](https://mo4islona.github.io/wick-charts/#/api/pie-series), [Sparkline](https://mo4islona.github.io/wick-charts/#/api/sparkline)) and overlays ([Tooltip](https://mo4islona.github.io/wick-charts/#/api/tooltip), [InfoBar](https://mo4islona.github.io/wick-charts/#/api/info-bar), [Crosshair](https://mo4islona.github.io/wick-charts/#/api/crosshair), [Legend](https://mo4islona.github.io/wick-charts/#/api/legend), [YAxis](https://mo4islona.github.io/wick-charts/#/api/y-axis), [XAxis](https://mo4islona.github.io/wick-charts/#/api/x-axis), [Navigator](https://mo4islona.github.io/wick-charts/#/api/navigator), …).
|
|
61
56
|
|
|
62
|
-
|
|
63
|
-
|---|---|---|
|
|
64
|
-
| `Tooltip` | Floating glass tooltip near cursor on hover | `{ snapshots, time }` |
|
|
65
|
-
| `InfoBar` | Compact OHLC / values info bar hoisted above the canvas | `{ snapshots, time, isHover }` |
|
|
66
|
-
| `Title` | Chart title / subtitle bar hoisted above the canvas | — |
|
|
67
|
-
| `Crosshair` | Axis labels at cursor position | — |
|
|
68
|
-
| `YAxis` | Vertical price/value axis with animated ticks | — |
|
|
69
|
-
| `TimeAxis` | Horizontal time axis with animated ticks | — |
|
|
70
|
-
| `YLabel` | Floating price badge with dashed line | `{ value, y, bgColor, isLive, direction, format }` |
|
|
71
|
-
| `Legend` | Clickable legend with toggle/isolate modes | `{ items: LegendItem[] }` |
|
|
72
|
-
| `PieTooltip` | Tooltip for pie/donut hover | `{ info, format }` |
|
|
73
|
-
| `PieLegend` | Slice labels with values or percentages | `{ slices, mode, format }` |
|
|
57
|
+
## Bundle size
|
|
74
58
|
|
|
75
|
-
|
|
59
|
+
Tree-shaken React scenarios via `pnpm size` (esbuild, minified, browser target, React/ReactDOM external):
|
|
76
60
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
:key="s.id"
|
|
83
|
-
:style="{ color: s.color }"
|
|
84
|
-
>
|
|
85
|
-
{{ s.label }}: {{ s.data.close ?? s.data.value }}
|
|
86
|
-
</div>
|
|
87
|
-
</Tooltip>
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Each overlay has its own slot context (see the Slot ctx column above); the shape is consistent across frameworks for the same overlay.
|
|
91
|
-
|
|
92
|
-
### Public helpers (re-exported from each framework package)
|
|
93
|
-
|
|
94
|
-
- `buildHoverSnapshots(chart, { time, sort?, cacheKey })` / `buildLastSnapshots(chart, { sort?, cacheKey })` — structural-equality-cached snapshot arrays for building your own floating widgets. Calls with the same args return the **same reference** while the chart's overlay version is unchanged, so `React.memo` / Vue `computed` / Svelte `$:` skip renders on no-op mousemoves.
|
|
95
|
-
- `computeTooltipPosition({ x, y, chartWidth, chartHeight, tooltipWidth, tooltipHeight, offsetX?, offsetY? })` — flip + clamp positioning for a tooltip container you own.
|
|
96
|
-
- Types: `SeriesSnapshot`, `LegendItem`, `SliceInfo`, `HoverInfo`.
|
|
97
|
-
|
|
98
|
-
## Custom number formatting
|
|
99
|
-
|
|
100
|
-
Every numeric overlay accepts a `format` prop so you can override the default label rendering. Two shared helpers ship in each framework package (`@wick-charts/react`, `@wick-charts/vue`, `@wick-charts/svelte`):
|
|
101
|
-
|
|
102
|
-
- `formatCompact(v)` — K/M/B/T suffixes with adaptive precision. Default for `YAxis` (at ranges ≥ 1e6), `PieLegend`, `PieTooltip`, `Sparkline`.
|
|
103
|
-
- `formatPriceAdaptive(v)` — full-precision display that scales decimals to the value's magnitude. Default for `Tooltip` / `InfoBar` OHLC and line-value cells. Handles sub-cent prices (`0.00001234` → `"0.00001234"`, not `"0.00"`).
|
|
104
|
-
|
|
105
|
-
```vue
|
|
106
|
-
<script setup>
|
|
107
|
-
import { Tooltip, YAxis, formatCompact } from '@wick-charts/vue';
|
|
108
|
-
|
|
109
|
-
const yFormat = (v) => `$${formatCompact(v)}`;
|
|
110
|
-
const tipFormat = (v, field) => (field === 'volume' ? formatCompact(v) : v.toFixed(4));
|
|
111
|
-
</script>
|
|
112
|
-
|
|
113
|
-
<template>
|
|
114
|
-
<YAxis :format="yFormat" />
|
|
115
|
-
<Tooltip :format="tipFormat" />
|
|
116
|
-
</template>
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Tooltip / InfoBar pass a `field` arg (`'open' | 'high' | 'low' | 'close' | 'volume' | 'value'`) so you can branch on which cell you're formatting. All other overlays receive a single `value: number`.
|
|
120
|
-
|
|
121
|
-
## Themes
|
|
122
|
-
|
|
123
|
-
22 built-in themes. Import only the ones you need (tree-shakable) and pass them to `ChartContainer` or `ThemeProvider` for global theming.
|
|
124
|
-
|
|
125
|
-
```vue
|
|
126
|
-
<script setup>
|
|
127
|
-
import { catppuccin } from '@wick-charts/vue';
|
|
128
|
-
// Dark: andromeda, ayuMirage, catppuccin, dracula, gruvbox, highContrast,
|
|
129
|
-
// materialPalenight, monokaiPro, nightOwl, oneDarkPro, panda
|
|
130
|
-
// Light: githubLight, handwritten, lavenderMist, lightPink, minimalLight, mintBreeze,
|
|
131
|
-
// peachCream, quietLight, rosePineDawn, sandDune, solarizedLight
|
|
132
|
-
</script>
|
|
133
|
-
|
|
134
|
-
<template>
|
|
135
|
-
<ChartContainer :theme="catppuccin.theme" />
|
|
136
|
-
</template>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Create custom themes with `createTheme()`:
|
|
140
|
-
|
|
141
|
-
```ts
|
|
142
|
-
import { createTheme } from '@wick-charts/vue';
|
|
143
|
-
|
|
144
|
-
const myTheme = createTheme({
|
|
145
|
-
background: '#1a1b2e',
|
|
146
|
-
candlestick: {
|
|
147
|
-
up: { body: '#00d4aa' },
|
|
148
|
-
down: { body: '#ff5577' },
|
|
149
|
-
},
|
|
150
|
-
axis: { textColor: '#8888aa' },
|
|
151
|
-
});
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Real-Time Data
|
|
155
|
-
|
|
156
|
-
```vue
|
|
157
|
-
<template>
|
|
158
|
-
<!-- Full replace (initial load) -->
|
|
159
|
-
<CandlestickSeries :data="allCandles" />
|
|
160
|
-
</template>
|
|
161
|
-
|
|
162
|
-
<!--
|
|
163
|
-
The component auto-detects changes:
|
|
164
|
-
- data.length grew by 1-5 → append
|
|
165
|
-
- data.length same → update last point
|
|
166
|
-
- data.length shrunk or grew by >5 → full replace
|
|
167
|
-
-->
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
## Configuration
|
|
171
|
-
|
|
172
|
-
```vue
|
|
173
|
-
<template>
|
|
174
|
-
<ChartContainer
|
|
175
|
-
:theme="theme"
|
|
176
|
-
:axis="{
|
|
177
|
-
y: { visible: true, width: 55, min: 0, max: 'auto' },
|
|
178
|
-
x: { visible: true, height: 30 },
|
|
179
|
-
}"
|
|
180
|
-
/>
|
|
181
|
-
</template>
|
|
182
|
-
|
|
183
|
-
<!-- Vue ChartContainer currently accepts theme + axis; padding/gradient/grid/interactive are React-only. -->
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## Bundle Size
|
|
187
|
-
|
|
188
|
-
Full `dist/index.js` (minified + gzipped):
|
|
189
|
-
|
|
190
|
-
| Package | Raw | Gzip |
|
|
191
|
-
|---|---|---|
|
|
192
|
-
| `@wick-charts/vue` | 219 KB | 57.3 KB |
|
|
61
|
+
| Scenario | Raw | Gzip | Brotli |
|
|
62
|
+
|---|---:|---:|---:|
|
|
63
|
+
| Candlestick only | 147 KB | 44 KB | 38 KB |
|
|
64
|
+
| Line only | 147 KB | 44 KB | 38 KB |
|
|
65
|
+
| Full React | 164 KB | 49 KB | 41 KB |
|
|
193
66
|
|
|
194
67
|
## Migration
|
|
195
68
|
|
package/dist/index.d.ts
CHANGED
|
@@ -165,6 +165,19 @@ declare type __VLS_Props_3 = {
|
|
|
165
165
|
* - `'inline'`: flex siblings above the canvas — the canvas (and grid) shift down.
|
|
166
166
|
*/
|
|
167
167
|
headerLayout?: 'overlay' | 'inline';
|
|
168
|
+
/**
|
|
169
|
+
* Chart-level animation configuration. See `AnimationsConfig` for the full shape.
|
|
170
|
+
*
|
|
171
|
+
* Two layers — chart-level (this prop) sets defaults for every series; per-series
|
|
172
|
+
* options on `<LineSeries>`/`<CandlestickSeries>`/`<BarSeries>` override that
|
|
173
|
+
* default for that one series.
|
|
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.
|
|
179
|
+
*/
|
|
180
|
+
animations?: boolean | AnimationsConfig;
|
|
168
181
|
/**
|
|
169
182
|
* Enable runtime performance instrumentation. Off by default. Read at mount only;
|
|
170
183
|
* later changes are ignored.
|
|
@@ -445,39 +458,67 @@ declare type __VLS_WithTemplateSlots_8<T, S> = T & {
|
|
|
445
458
|
export declare const andromeda: ThemePreset;
|
|
446
459
|
|
|
447
460
|
/**
|
|
448
|
-
* Chart-level animation configuration.
|
|
449
|
-
*
|
|
461
|
+
* Chart-level animation configuration. Two independent domains so per-series
|
|
462
|
+
* defaults can't bleed into viewport-interaction timings.
|
|
450
463
|
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
* These values act as defaults for each series. Per-series options always
|
|
454
|
-
* win unless the chart-level category is explicitly `false`, in which case
|
|
455
|
-
* the whole category is forced off.
|
|
464
|
+
* **Two layers — chart-level vs per-series.** The same data-animation knobs
|
|
465
|
+
* live on both layers; remember which is which:
|
|
456
466
|
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
467
|
+
* | Field | Chart-level (here) | Per-series option |
|
|
468
|
+
* | ----- | ------------------ | ----------------- |
|
|
469
|
+
* | Entry duration | {@link AnimationsConfig.points}`.enterMs` | `<XSeries options={{ entryMs }}>` (canonical name; `enterMs` is a `@deprecated` alias) |
|
|
470
|
+
* | Live smoothing | `points.smoothMs` | `options={{ smoothMs }}` |
|
|
471
|
+
* | Line pulse period | `points.pulseMs` | `<LineSeries options={{ pulseMs }}>` |
|
|
459
472
|
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
463
|
-
*
|
|
473
|
+
* Resolution: per-series option **wins** (it's the override). The chart-
|
|
474
|
+
* level field acts as the default for every series that didn't set its own
|
|
475
|
+
* override — *except* when the chart-level category is explicitly `false`,
|
|
476
|
+
* which is a hard disable that overrides per-series too.
|
|
477
|
+
*
|
|
478
|
+
* - `points` — applied to data: entrance tween, live-tracking smoothing of
|
|
479
|
+
* the last candle/bar/line value, line pulse cadence.
|
|
480
|
+
* - `viewport` — applied to viewport interactions: post-gesture rebound,
|
|
481
|
+
* Y-axis range chase, optional per-event ease for pan/zoom. Has no
|
|
482
|
+
* per-series equivalent — these are chart-level only.
|
|
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.
|
|
464
488
|
*/
|
|
465
489
|
declare interface AnimationsConfig {
|
|
466
490
|
/**
|
|
467
491
|
* Data-series animations. `false` disables every point animation (entrance,
|
|
468
|
-
* live-smoothing, pulse) across every series
|
|
469
|
-
*
|
|
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.
|
|
470
499
|
*/
|
|
471
500
|
points?: false | {
|
|
472
|
-
/**
|
|
501
|
+
/**
|
|
502
|
+
* Per-point entrance duration (ms). Default: 250.
|
|
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.
|
|
507
|
+
*/
|
|
473
508
|
enterMs?: AnimationTime;
|
|
474
509
|
/**
|
|
475
|
-
*
|
|
476
|
-
* `
|
|
477
|
-
*
|
|
510
|
+
* Live-value chase duration (ms) for the displayed last point on
|
|
511
|
+
* `updateData` ticks. Animator-driven cubic ease — after this many ms
|
|
512
|
+
* with no new updates, the displayed value reaches exactly the
|
|
513
|
+
* actual last value. Default: 250. Per-series equivalent:
|
|
514
|
+
* `options={{ smoothMs }}`. `false` / `0` snaps.
|
|
478
515
|
*/
|
|
479
516
|
smoothMs?: AnimationTime;
|
|
480
|
-
/**
|
|
517
|
+
/**
|
|
518
|
+
* Pulse cycle period (ms) for the line last-point halo — periodic,
|
|
519
|
+
* not a one-shot transition. Default: 600. Per-series equivalent:
|
|
520
|
+
* `<LineSeries options={{ pulseMs }}>`. `false` / `0` disables.
|
|
521
|
+
*/
|
|
481
522
|
pulseMs?: AnimationTime;
|
|
482
523
|
};
|
|
483
524
|
/**
|
|
@@ -488,15 +529,33 @@ declare interface AnimationsConfig {
|
|
|
488
529
|
/** Rebound (snap-back) duration after pan/zoom overshoot (ms). Default: 350. */
|
|
489
530
|
reboundMs?: AnimationTime;
|
|
490
531
|
/**
|
|
491
|
-
* Y-axis range transition
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
532
|
+
* Y-axis range transition duration in wall-clock milliseconds. The Y
|
|
533
|
+
* min and max each ride their own {@link Animator} that retargets on
|
|
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.
|
|
498
542
|
*/
|
|
499
543
|
yAxisMs?: AnimationTime;
|
|
544
|
+
/**
|
|
545
|
+
* Per-event ease applied to user pan/zoom commits. Logical state
|
|
546
|
+
* advances synchronously (gesture math, edge detection, autoscroll
|
|
547
|
+
* all read the committed target); the visual range eases over this
|
|
548
|
+
* duration so back-to-back wheel/trackpad events interpolate
|
|
549
|
+
* smoothly through the same animator.
|
|
550
|
+
*
|
|
551
|
+
* Default `0` (instant-apply, matches the long-standing pre-Phase-5
|
|
552
|
+
* behaviour). Opt in via `inputResponseMs: 60` for an eased pan/zoom
|
|
553
|
+
* feel — the default is conservative because the animated visual
|
|
554
|
+
* range diverges from the committed target until the ease completes,
|
|
555
|
+
* and existing consumers reading `chart.getVisibleRange()`
|
|
556
|
+
* synchronously after a wheel/pan expect the new value.
|
|
557
|
+
*/
|
|
558
|
+
inputResponseMs?: AnimationTime;
|
|
500
559
|
};
|
|
501
560
|
}
|
|
502
561
|
|
|
@@ -590,12 +649,24 @@ export declare interface BarSeriesOptions {
|
|
|
590
649
|
/** @deprecated Use {@link entryAnimation} instead. */
|
|
591
650
|
enterAnimation?: BarEntryAnimation;
|
|
592
651
|
/**
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
*
|
|
652
|
+
* Per-bar entrance duration in milliseconds. Default: `250`.
|
|
653
|
+
*
|
|
654
|
+
* ```
|
|
655
|
+
* // Override for one series:
|
|
656
|
+
* <BarSeries options={{ entryMs: 600 }} data={data} />
|
|
596
657
|
*
|
|
597
|
-
*
|
|
598
|
-
*
|
|
658
|
+
* // Or set the default for every series at once:
|
|
659
|
+
* <ChartContainer animations={{ points: { enterMs: 600 } }}>
|
|
660
|
+
* <BarSeries data={data} />
|
|
661
|
+
* </ChartContainer>
|
|
662
|
+
* ```
|
|
663
|
+
*
|
|
664
|
+
* Note: chart-level uses `enterMs`, per-series uses `entryMs` — same
|
|
665
|
+
* animation, two names for historical reasons.
|
|
666
|
+
*
|
|
667
|
+
* `false` or `0` disables the entrance (equivalent to
|
|
668
|
+
* `entryAnimation: 'none'`). A chart-level `animations.points: false` is a
|
|
669
|
+
* hard disable that wins over this field.
|
|
599
670
|
*
|
|
600
671
|
* @see BarSeriesOptions.entryAnimation
|
|
601
672
|
*/
|
|
@@ -603,13 +674,22 @@ export declare interface BarSeriesOptions {
|
|
|
603
674
|
/** @deprecated Use {@link entryMs} instead. */
|
|
604
675
|
enterMs?: number | false;
|
|
605
676
|
/**
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
677
|
+
* How long the displayed bar value takes to catch up to the actual one
|
|
678
|
+
* on every `updateLastPoint`. Default: `250` ms.
|
|
679
|
+
*
|
|
680
|
+
* ```
|
|
681
|
+
* // Per-series override:
|
|
682
|
+
* <BarSeries options={{ smoothMs: 100 }} data={data} />
|
|
610
683
|
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
684
|
+
* // Chart-level default:
|
|
685
|
+
* <ChartContainer animations={{ points: { smoothMs: 100 } }}>
|
|
686
|
+
* <BarSeries data={data} />
|
|
687
|
+
* </ChartContainer>
|
|
688
|
+
* ```
|
|
689
|
+
*
|
|
690
|
+
* `0` or `false` snaps the displayed value to the target on every tick
|
|
691
|
+
* (no smoothing). A chart-level `animations.points: false` is a hard
|
|
692
|
+
* disable that wins over this field.
|
|
613
693
|
*/
|
|
614
694
|
smoothMs?: number | false;
|
|
615
695
|
}
|
|
@@ -707,12 +787,24 @@ export declare interface CandlestickSeriesOptions {
|
|
|
707
787
|
/** @deprecated Use {@link entryAnimation} instead. */
|
|
708
788
|
enterAnimation?: CandlestickEntryAnimation;
|
|
709
789
|
/**
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
*
|
|
790
|
+
* Per-candle entrance duration in milliseconds. Default: `250`.
|
|
791
|
+
*
|
|
792
|
+
* ```
|
|
793
|
+
* // Override for one series:
|
|
794
|
+
* <CandlestickSeries options={{ entryMs: 600 }} data={data} />
|
|
713
795
|
*
|
|
714
|
-
*
|
|
715
|
-
*
|
|
796
|
+
* // Or set the default for every series at once:
|
|
797
|
+
* <ChartContainer animations={{ points: { enterMs: 600 } }}>
|
|
798
|
+
* <CandlestickSeries data={data} />
|
|
799
|
+
* </ChartContainer>
|
|
800
|
+
* ```
|
|
801
|
+
*
|
|
802
|
+
* Note: chart-level uses `enterMs`, per-series uses `entryMs` — same
|
|
803
|
+
* animation, two names for historical reasons.
|
|
804
|
+
*
|
|
805
|
+
* `false` or `0` disables the entrance (equivalent to
|
|
806
|
+
* `entryAnimation: 'none'`). A chart-level `animations.points: false` is a
|
|
807
|
+
* hard disable that wins over this field.
|
|
716
808
|
*
|
|
717
809
|
* @see CandlestickSeriesOptions.entryAnimation
|
|
718
810
|
*/
|
|
@@ -720,13 +812,22 @@ export declare interface CandlestickSeriesOptions {
|
|
|
720
812
|
/** @deprecated Use {@link entryMs} instead. */
|
|
721
813
|
enterMs?: number | false;
|
|
722
814
|
/**
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*
|
|
815
|
+
* How long the displayed OHLC takes to catch up to the actual last value
|
|
816
|
+
* on every `updateLastPoint`. Default: `250` ms.
|
|
817
|
+
*
|
|
818
|
+
* ```
|
|
819
|
+
* // Per-series override:
|
|
820
|
+
* <CandlestickSeries options={{ smoothMs: 100 }} data={data} />
|
|
727
821
|
*
|
|
728
|
-
*
|
|
729
|
-
*
|
|
822
|
+
* // Chart-level default:
|
|
823
|
+
* <ChartContainer animations={{ points: { smoothMs: 100 } }}>
|
|
824
|
+
* <CandlestickSeries data={data} />
|
|
825
|
+
* </ChartContainer>
|
|
826
|
+
* ```
|
|
827
|
+
*
|
|
828
|
+
* `0` or `false` snaps the displayed value to the target on every tick
|
|
829
|
+
* (no smoothing). A chart-level `animations.points: false` is a hard
|
|
830
|
+
* disable that wins over this field.
|
|
730
831
|
*/
|
|
731
832
|
smoothMs?: number | false;
|
|
732
833
|
}
|
|
@@ -944,6 +1045,25 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
944
1045
|
* a wrapper re-applies padding reactively (e.g. in response to a Title /
|
|
945
1046
|
* InfoBar ResizeObserver).
|
|
946
1047
|
*/
|
|
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;
|
|
947
1067
|
setPadding(padding: ChartOptions['padding']): void;
|
|
948
1068
|
/** Show or hide the background grid. Takes effect on the next render frame. */
|
|
949
1069
|
setGrid(grid: {
|
|
@@ -972,6 +1092,17 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
972
1092
|
private getDataBounds;
|
|
973
1093
|
private onDataChanged;
|
|
974
1094
|
private updateDataInterval;
|
|
1095
|
+
/**
|
|
1096
|
+
* Sample data inside `targetVisible` and return the unbounded [min, max] of
|
|
1097
|
+
* the visible series, or `null` when nothing is in view. Bounds are NOT
|
|
1098
|
+
* applied here — the caller composes them via {@link resolveBound}.
|
|
1099
|
+
*
|
|
1100
|
+
* `targetVisible` is the X *destination* (logicalRange), not the animating
|
|
1101
|
+
* current. Sampling against a moving X would make Y chase a definition of
|
|
1102
|
+
* "in view" that shifts every frame; passing the destination explicitly
|
|
1103
|
+
* keeps Y on a stable target so X and Y converge together.
|
|
1104
|
+
*/
|
|
1105
|
+
private computeTargetYRange;
|
|
975
1106
|
private updateYRange;
|
|
976
1107
|
/** Resolve an {@link AxisBound} to a concrete numeric value. */
|
|
977
1108
|
private resolveBound;
|
|
@@ -1447,11 +1578,23 @@ export declare interface LineSeriesOptions {
|
|
|
1447
1578
|
*/
|
|
1448
1579
|
pulse: boolean;
|
|
1449
1580
|
/**
|
|
1450
|
-
*
|
|
1451
|
-
*
|
|
1452
|
-
*
|
|
1453
|
-
*
|
|
1454
|
-
*
|
|
1581
|
+
* Period of one halo pulse cycle in milliseconds. Continuous loop, not a
|
|
1582
|
+
* one-shot — short values pulse fast, long values pulse slowly. Default:
|
|
1583
|
+
* `600` (≈ 1.7 Hz, a calm "breathing" rhythm).
|
|
1584
|
+
*
|
|
1585
|
+
* ```
|
|
1586
|
+
* // Per-series override:
|
|
1587
|
+
* <LineSeries options={{ pulseMs: 1200 }} data={data} />
|
|
1588
|
+
*
|
|
1589
|
+
* // Chart-level default:
|
|
1590
|
+
* <ChartContainer animations={{ points: { pulseMs: 1200 } }}>
|
|
1591
|
+
* <LineSeries data={data} />
|
|
1592
|
+
* </ChartContainer>
|
|
1593
|
+
* ```
|
|
1594
|
+
*
|
|
1595
|
+
* `false` or `0` turns the halo off entirely (drawing and animation loop).
|
|
1596
|
+
* A chart-level `animations.points: false` is a hard disable that wins
|
|
1597
|
+
* over this field.
|
|
1455
1598
|
*/
|
|
1456
1599
|
pulseMs?: number | false;
|
|
1457
1600
|
/** Stacking mode. Default: 'off'. */
|
|
@@ -1467,12 +1610,24 @@ export declare interface LineSeriesOptions {
|
|
|
1467
1610
|
/** @deprecated Use {@link entryAnimation} instead. */
|
|
1468
1611
|
enterAnimation?: LineEntryAnimation;
|
|
1469
1612
|
/**
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1613
|
+
* Per-point entrance duration in milliseconds. Default: `250`.
|
|
1614
|
+
*
|
|
1615
|
+
* ```
|
|
1616
|
+
* // Override for one series:
|
|
1617
|
+
* <LineSeries options={{ entryMs: 600 }} data={data} />
|
|
1473
1618
|
*
|
|
1474
|
-
*
|
|
1475
|
-
*
|
|
1619
|
+
* // Or set the default for every series at once:
|
|
1620
|
+
* <ChartContainer animations={{ points: { enterMs: 600 } }}>
|
|
1621
|
+
* <LineSeries data={data} />
|
|
1622
|
+
* </ChartContainer>
|
|
1623
|
+
* ```
|
|
1624
|
+
*
|
|
1625
|
+
* Note: chart-level uses `enterMs`, per-series uses `entryMs` — same
|
|
1626
|
+
* animation, two names for historical reasons.
|
|
1627
|
+
*
|
|
1628
|
+
* `false` or `0` disables the entrance (equivalent to
|
|
1629
|
+
* `entryAnimation: 'none'`). A chart-level `animations.points: false` is a
|
|
1630
|
+
* hard disable that wins over this field.
|
|
1476
1631
|
*
|
|
1477
1632
|
* @see LineSeriesOptions.entryAnimation
|
|
1478
1633
|
*/
|
|
@@ -1480,13 +1635,22 @@ export declare interface LineSeriesOptions {
|
|
|
1480
1635
|
/** @deprecated Use {@link entryMs} instead. */
|
|
1481
1636
|
enterMs?: number | false;
|
|
1482
1637
|
/**
|
|
1483
|
-
*
|
|
1484
|
-
*
|
|
1485
|
-
*
|
|
1486
|
-
*
|
|
1638
|
+
* How long the displayed last value takes to catch up to the actual one
|
|
1639
|
+
* on every `updateLastPoint`. Default: `250` ms.
|
|
1640
|
+
*
|
|
1641
|
+
* ```
|
|
1642
|
+
* // Per-series override:
|
|
1643
|
+
* <LineSeries options={{ smoothMs: 100 }} data={data} />
|
|
1644
|
+
*
|
|
1645
|
+
* // Chart-level default:
|
|
1646
|
+
* <ChartContainer animations={{ points: { smoothMs: 100 } }}>
|
|
1647
|
+
* <LineSeries data={data} />
|
|
1648
|
+
* </ChartContainer>
|
|
1649
|
+
* ```
|
|
1487
1650
|
*
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1651
|
+
* `0` or `false` snaps the displayed value to the target on every tick
|
|
1652
|
+
* (no smoothing). A chart-level `animations.points: false` is a hard
|
|
1653
|
+
* disable that wins over this field.
|
|
1490
1654
|
*/
|
|
1491
1655
|
smoothMs?: number | false;
|
|
1492
1656
|
}
|