@wick-charts/vue 0.1.2 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +198 -0
- package/dist/index.d.ts +1216 -109
- package/dist/index.js +4283 -1897
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -9,59 +9,140 @@ declare const __VLS_component: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, Co
|
|
|
9
9
|
theme: ChartTheme;
|
|
10
10
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
11
11
|
containerRef: HTMLDivElement;
|
|
12
|
+
topOverlayRef: HTMLDivElement;
|
|
13
|
+
titleAnchor: HTMLDivElement;
|
|
14
|
+
infoBarAnchor: HTMLDivElement;
|
|
15
|
+
legendRightAnchor: HTMLDivElement;
|
|
16
|
+
legendAnchor: HTMLDivElement;
|
|
12
17
|
}, HTMLDivElement>;
|
|
13
18
|
|
|
19
|
+
declare const __VLS_component_2: DefineComponent<__VLS_Props_6, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_6> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
|
|
21
|
+
declare const __VLS_component_3: DefineComponent<__VLS_Props_7, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_7> & Readonly<{}>, {
|
|
22
|
+
position: "bottom" | "right";
|
|
23
|
+
mode: LegendMode;
|
|
24
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
|
|
26
|
+
declare const __VLS_component_4: DefineComponent<__VLS_Props_9, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_9> & Readonly<{}>, {
|
|
27
|
+
format: ValueFormatter;
|
|
28
|
+
mode: PieLegendMode;
|
|
29
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
|
|
31
|
+
declare const __VLS_component_5: DefineComponent<__VLS_Props_10, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_10> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
32
|
+
containerRef: HTMLDivElement;
|
|
33
|
+
}, any>;
|
|
34
|
+
|
|
35
|
+
declare const __VLS_component_6: DefineComponent<__VLS_Props_11, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_11> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
|
|
37
|
+
declare const __VLS_component_7: DefineComponent<__VLS_Props_12, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_12> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
38
|
+
containerRef: HTMLDivElement;
|
|
39
|
+
}, any>;
|
|
40
|
+
|
|
41
|
+
declare const __VLS_component_8: DefineComponent<__VLS_Props_14, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_14> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
42
|
+
|
|
14
43
|
declare type __VLS_Props = {
|
|
15
44
|
data: TimePoint[][];
|
|
16
45
|
options?: Partial<BarSeriesOptions>;
|
|
17
|
-
|
|
46
|
+
/** Stable series ID — same value across remounts. */
|
|
47
|
+
id?: string;
|
|
18
48
|
};
|
|
19
49
|
|
|
20
50
|
declare type __VLS_Props_10 = {
|
|
21
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Owning series id. **Optional** — when omitted, the first visible pie
|
|
53
|
+
* series is picked.
|
|
54
|
+
*/
|
|
55
|
+
seriesId?: string;
|
|
56
|
+
/** Custom formatter for the slice value. Default: shared `formatCompact`. */
|
|
57
|
+
format?: ValueFormatter;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
declare type __VLS_Props_11 = {
|
|
61
|
+
sub?: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
declare type __VLS_Props_12 = {
|
|
65
|
+
sort?: SnapshotSort;
|
|
66
|
+
format?: TooltipFormatter;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
declare type __VLS_Props_13 = {
|
|
70
|
+
/** Custom tick-label formatter. Overrides the built-in range-adaptive default. */
|
|
71
|
+
format?: ValueFormatter;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
declare type __VLS_Props_14 = {
|
|
75
|
+
/**
|
|
76
|
+
* Owning series id. **Optional** — when omitted, the first visible
|
|
77
|
+
* single-layer time series is picked, falling back to the first visible
|
|
78
|
+
* multi-layer time series.
|
|
79
|
+
*/
|
|
80
|
+
seriesId?: string;
|
|
22
81
|
color?: string;
|
|
82
|
+
/** Custom formatter; routed through NumberFlow's `formatter` so the digit animation still plays. */
|
|
83
|
+
format?: ValueFormatter;
|
|
23
84
|
};
|
|
24
85
|
|
|
25
86
|
declare type __VLS_Props_2 = {
|
|
26
87
|
data: OHLCInput[];
|
|
27
88
|
options?: Partial<CandlestickSeriesOptions>;
|
|
89
|
+
/** Stable series ID — same value across remounts. */
|
|
90
|
+
id?: string;
|
|
28
91
|
};
|
|
29
92
|
|
|
30
93
|
declare type __VLS_Props_3 = {
|
|
31
94
|
theme?: ChartTheme;
|
|
32
95
|
axis?: AxisConfig;
|
|
96
|
+
/** Background grid configuration. Default: `{ visible: true }`. */
|
|
97
|
+
grid?: {
|
|
98
|
+
visible: boolean;
|
|
99
|
+
};
|
|
33
100
|
};
|
|
34
101
|
|
|
35
102
|
declare type __VLS_Props_4 = {
|
|
36
103
|
data: TimePoint[][];
|
|
37
104
|
options?: Partial<LineSeriesOptions>;
|
|
38
|
-
|
|
105
|
+
/** Stable series ID — same value across remounts. */
|
|
106
|
+
id?: string;
|
|
39
107
|
};
|
|
40
108
|
|
|
41
109
|
declare type __VLS_Props_5 = {
|
|
42
110
|
data: PieSliceData[];
|
|
43
111
|
options?: Partial<PieSeriesOptions>;
|
|
112
|
+
/** Stable series ID — same value across remounts. */
|
|
113
|
+
id?: string;
|
|
44
114
|
};
|
|
45
115
|
|
|
46
116
|
declare type __VLS_Props_6 = {
|
|
47
|
-
|
|
48
|
-
format?:
|
|
49
|
-
locale?: string;
|
|
50
|
-
spinDuration?: number;
|
|
117
|
+
sort?: SnapshotSort;
|
|
118
|
+
format?: TooltipFormatter;
|
|
51
119
|
};
|
|
52
120
|
|
|
53
121
|
declare type __VLS_Props_7 = {
|
|
54
|
-
|
|
55
|
-
|
|
122
|
+
items?: LegendItemOverride[];
|
|
123
|
+
position?: 'bottom' | 'right';
|
|
124
|
+
/** `'isolate'` shows only the clicked item; `'solo'` is a @deprecated alias. */
|
|
125
|
+
mode?: LegendMode;
|
|
56
126
|
};
|
|
57
127
|
|
|
58
128
|
declare type __VLS_Props_8 = {
|
|
59
|
-
|
|
129
|
+
value: number;
|
|
130
|
+
/** Value-to-string formatter. Defaults to the current locale's `Intl.NumberFormat`. */
|
|
131
|
+
format?: (value: number) => string;
|
|
132
|
+
locale?: string;
|
|
133
|
+
spinDuration?: number;
|
|
60
134
|
};
|
|
61
135
|
|
|
62
136
|
declare type __VLS_Props_9 = {
|
|
137
|
+
/**
|
|
138
|
+
* Owning series id. **Optional** — when omitted, the first visible pie
|
|
139
|
+
* series is picked.
|
|
140
|
+
*/
|
|
63
141
|
seriesId?: string;
|
|
64
|
-
|
|
142
|
+
/** 'value' shows only the value, 'percent' only the percent, 'both' shows both. Default: 'both'. */
|
|
143
|
+
mode?: PieLegendMode;
|
|
144
|
+
/** Custom formatter for the absolute slice value. */
|
|
145
|
+
format?: ValueFormatter;
|
|
65
146
|
};
|
|
66
147
|
|
|
67
148
|
declare function __VLS_template(): {
|
|
@@ -71,20 +152,270 @@ declare function __VLS_template(): {
|
|
|
71
152
|
};
|
|
72
153
|
refs: {
|
|
73
154
|
containerRef: HTMLDivElement;
|
|
155
|
+
topOverlayRef: HTMLDivElement;
|
|
156
|
+
titleAnchor: HTMLDivElement;
|
|
157
|
+
infoBarAnchor: HTMLDivElement;
|
|
158
|
+
legendRightAnchor: HTMLDivElement;
|
|
159
|
+
legendAnchor: HTMLDivElement;
|
|
74
160
|
};
|
|
75
161
|
rootEl: HTMLDivElement;
|
|
76
162
|
};
|
|
77
163
|
|
|
164
|
+
declare function __VLS_template_2(): {
|
|
165
|
+
attrs: Partial<{}>;
|
|
166
|
+
slots: Readonly<{
|
|
167
|
+
default?(ctx: {
|
|
168
|
+
snapshots: readonly SeriesSnapshot[];
|
|
169
|
+
time: number;
|
|
170
|
+
isHover: boolean;
|
|
171
|
+
}): unknown;
|
|
172
|
+
}> & {
|
|
173
|
+
default?(ctx: {
|
|
174
|
+
snapshots: readonly SeriesSnapshot[];
|
|
175
|
+
time: number;
|
|
176
|
+
isHover: boolean;
|
|
177
|
+
}): unknown;
|
|
178
|
+
};
|
|
179
|
+
refs: {};
|
|
180
|
+
rootEl: any;
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
declare function __VLS_template_3(): {
|
|
184
|
+
attrs: Partial<{}>;
|
|
185
|
+
slots: Readonly<{
|
|
186
|
+
default?(ctx: {
|
|
187
|
+
items: readonly LegendItem[];
|
|
188
|
+
}): unknown;
|
|
189
|
+
}> & {
|
|
190
|
+
default?(ctx: {
|
|
191
|
+
items: readonly LegendItem[];
|
|
192
|
+
}): unknown;
|
|
193
|
+
};
|
|
194
|
+
refs: {};
|
|
195
|
+
rootEl: any;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
declare function __VLS_template_4(): {
|
|
199
|
+
attrs: Partial<{}>;
|
|
200
|
+
slots: Readonly<{
|
|
201
|
+
default?(ctx: {
|
|
202
|
+
slices: readonly SliceInfo[];
|
|
203
|
+
mode: PieLegendMode;
|
|
204
|
+
format: ValueFormatter;
|
|
205
|
+
}): unknown;
|
|
206
|
+
}> & {
|
|
207
|
+
default?(ctx: {
|
|
208
|
+
slices: readonly SliceInfo[];
|
|
209
|
+
mode: PieLegendMode;
|
|
210
|
+
format: ValueFormatter;
|
|
211
|
+
}): unknown;
|
|
212
|
+
};
|
|
213
|
+
refs: {};
|
|
214
|
+
rootEl: any;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
declare function __VLS_template_5(): {
|
|
218
|
+
attrs: Partial<{}>;
|
|
219
|
+
slots: Readonly<{
|
|
220
|
+
default?(ctx: {
|
|
221
|
+
info: HoverInfo;
|
|
222
|
+
format: ValueFormatter;
|
|
223
|
+
}): unknown;
|
|
224
|
+
}> & {
|
|
225
|
+
default?(ctx: {
|
|
226
|
+
info: HoverInfo;
|
|
227
|
+
format: ValueFormatter;
|
|
228
|
+
}): unknown;
|
|
229
|
+
};
|
|
230
|
+
refs: {
|
|
231
|
+
containerRef: HTMLDivElement;
|
|
232
|
+
};
|
|
233
|
+
rootEl: any;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
declare function __VLS_template_6(): {
|
|
237
|
+
attrs: Partial<{}>;
|
|
238
|
+
slots: {
|
|
239
|
+
default?(_: {}): any;
|
|
240
|
+
};
|
|
241
|
+
refs: {};
|
|
242
|
+
rootEl: any;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
declare function __VLS_template_7(): {
|
|
246
|
+
attrs: Partial<{}>;
|
|
247
|
+
slots: Readonly<{
|
|
248
|
+
default?(ctx: {
|
|
249
|
+
snapshots: readonly SeriesSnapshot[];
|
|
250
|
+
time: number;
|
|
251
|
+
}): unknown;
|
|
252
|
+
}> & {
|
|
253
|
+
default?(ctx: {
|
|
254
|
+
snapshots: readonly SeriesSnapshot[];
|
|
255
|
+
time: number;
|
|
256
|
+
}): unknown;
|
|
257
|
+
};
|
|
258
|
+
refs: {
|
|
259
|
+
containerRef: HTMLDivElement;
|
|
260
|
+
};
|
|
261
|
+
rootEl: any;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
declare function __VLS_template_8(): {
|
|
265
|
+
attrs: Partial<{}>;
|
|
266
|
+
slots: Readonly<{
|
|
267
|
+
default?(ctx: {
|
|
268
|
+
value: number;
|
|
269
|
+
y: number;
|
|
270
|
+
bgColor: string;
|
|
271
|
+
isLive: boolean;
|
|
272
|
+
direction: YLabelDirection;
|
|
273
|
+
format: ValueFormatter;
|
|
274
|
+
}): unknown;
|
|
275
|
+
}> & {
|
|
276
|
+
default?(ctx: {
|
|
277
|
+
value: number;
|
|
278
|
+
y: number;
|
|
279
|
+
bgColor: string;
|
|
280
|
+
isLive: boolean;
|
|
281
|
+
direction: YLabelDirection;
|
|
282
|
+
format: ValueFormatter;
|
|
283
|
+
}): unknown;
|
|
284
|
+
};
|
|
285
|
+
refs: {};
|
|
286
|
+
rootEl: any;
|
|
287
|
+
};
|
|
288
|
+
|
|
78
289
|
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
79
290
|
|
|
291
|
+
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
292
|
+
|
|
293
|
+
declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
|
|
294
|
+
|
|
295
|
+
declare type __VLS_TemplateResult_4 = ReturnType<typeof __VLS_template_4>;
|
|
296
|
+
|
|
297
|
+
declare type __VLS_TemplateResult_5 = ReturnType<typeof __VLS_template_5>;
|
|
298
|
+
|
|
299
|
+
declare type __VLS_TemplateResult_6 = ReturnType<typeof __VLS_template_6>;
|
|
300
|
+
|
|
301
|
+
declare type __VLS_TemplateResult_7 = ReturnType<typeof __VLS_template_7>;
|
|
302
|
+
|
|
303
|
+
declare type __VLS_TemplateResult_8 = ReturnType<typeof __VLS_template_8>;
|
|
304
|
+
|
|
80
305
|
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
81
306
|
new (): {
|
|
82
307
|
$slots: S;
|
|
83
308
|
};
|
|
84
309
|
};
|
|
85
310
|
|
|
311
|
+
declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
312
|
+
new (): {
|
|
313
|
+
$slots: S;
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
declare type __VLS_WithTemplateSlots_3<T, S> = T & {
|
|
318
|
+
new (): {
|
|
319
|
+
$slots: S;
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
declare type __VLS_WithTemplateSlots_4<T, S> = T & {
|
|
324
|
+
new (): {
|
|
325
|
+
$slots: S;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
declare type __VLS_WithTemplateSlots_5<T, S> = T & {
|
|
330
|
+
new (): {
|
|
331
|
+
$slots: S;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
declare type __VLS_WithTemplateSlots_6<T, S> = T & {
|
|
336
|
+
new (): {
|
|
337
|
+
$slots: S;
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
declare type __VLS_WithTemplateSlots_7<T, S> = T & {
|
|
342
|
+
new (): {
|
|
343
|
+
$slots: S;
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
declare type __VLS_WithTemplateSlots_8<T, S> = T & {
|
|
348
|
+
new (): {
|
|
349
|
+
$slots: S;
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
|
|
86
353
|
export declare const andromeda: ThemePreset;
|
|
87
354
|
|
|
355
|
+
/**
|
|
356
|
+
* Chart-level animation configuration. Split into two independent domains so
|
|
357
|
+
* per-series defaults can't bleed into viewport-interaction timings:
|
|
358
|
+
*
|
|
359
|
+
* - `points` — animations applied to data: per-series entrance tween, live-
|
|
360
|
+
* tracking smoothing of the last candle/bar/line value, pulse cadence.
|
|
361
|
+
* These values act as defaults for each series. Per-series options always
|
|
362
|
+
* win unless the chart-level category is explicitly `false`, in which case
|
|
363
|
+
* the whole category is forced off.
|
|
364
|
+
*
|
|
365
|
+
* - `viewport` — animations applied to viewport interactions: post-gesture
|
|
366
|
+
* rebound duration and Y-axis range smoothing.
|
|
367
|
+
*
|
|
368
|
+
* User-initiated pan/zoom (wheel, drag, touch) always applies instantly. The
|
|
369
|
+
* latency of an exponential chase reads as laggy in practice. API-driven
|
|
370
|
+
* transitions (`fitToData`, `scrollToEnd`) and post-gesture rebound still
|
|
371
|
+
* tween via their own fixed-duration ease-out.
|
|
372
|
+
*/
|
|
373
|
+
declare interface AnimationsConfig {
|
|
374
|
+
/**
|
|
375
|
+
* Data-series animations. `false` disables every point animation (entrance,
|
|
376
|
+
* live-smoothing, pulse) across every series. An object overrides individual
|
|
377
|
+
* categories; omitted fields fall back to the built-in defaults.
|
|
378
|
+
*/
|
|
379
|
+
points?: false | {
|
|
380
|
+
/** Per-point entrance duration (ms). `false`/`0` disables. Default: 400. */
|
|
381
|
+
enterMs?: AnimationTime;
|
|
382
|
+
/**
|
|
383
|
+
* Exponential-smoothing time constant (ms) for live last-value chase.
|
|
384
|
+
* `false`/`0` disables smoothing — the last point snaps to the target.
|
|
385
|
+
* Default: 70 ms (equivalent to the legacy `liveSmoothRate = 14`).
|
|
386
|
+
*/
|
|
387
|
+
smoothMs?: AnimationTime;
|
|
388
|
+
/** Pulse cycle period (ms) for the line last-point halo. Default: 600. */
|
|
389
|
+
pulseMs?: AnimationTime;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Viewport interaction animations. `false` disables both rebound and Y-axis
|
|
393
|
+
* smoothing — viewport changes snap instantly.
|
|
394
|
+
*/
|
|
395
|
+
viewport?: false | {
|
|
396
|
+
/** Rebound (snap-back) duration after pan/zoom overshoot (ms). Default: 350. */
|
|
397
|
+
reboundMs?: AnimationTime;
|
|
398
|
+
/**
|
|
399
|
+
* Y-axis range transition scale. **Frame-count-based, calibrated at
|
|
400
|
+
* 60 Hz — not wall-clock ms.** Each render frame closes
|
|
401
|
+
* `min(1, 16 / yAxisMs)` of the remaining gap. Default 80 ≈ the
|
|
402
|
+
* legacy 0.2-per-frame closure. `false` / `0` snaps the Y range
|
|
403
|
+
* instantly. Unlike `smoothMs` / `entryMs` / `reboundMs`, the
|
|
404
|
+
* perceptual duration scales with frame time on refresh rates far
|
|
405
|
+
* from 60 Hz.
|
|
406
|
+
*/
|
|
407
|
+
yAxisMs?: AnimationTime;
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/** Options passed when creating a new {@link ChartInstance}. */
|
|
412
|
+
/**
|
|
413
|
+
* Time-value or boolean used throughout the animation API. `false` disables
|
|
414
|
+
* the category; a number configures its duration/time-constant in milliseconds
|
|
415
|
+
* (`0` also disables, useful when the caller wants a number shape).
|
|
416
|
+
*/
|
|
417
|
+
declare type AnimationTime = number | false;
|
|
418
|
+
|
|
88
419
|
/**
|
|
89
420
|
* Defines a bound for the Y axis.
|
|
90
421
|
*
|
|
@@ -103,11 +434,17 @@ export declare interface AxisConfig {
|
|
|
103
434
|
|
|
104
435
|
export declare const ayuMirage: ThemePreset;
|
|
105
436
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
437
|
+
/**
|
|
438
|
+
* Entrance animation styles for bars.
|
|
439
|
+
* - `'none'` — no animation.
|
|
440
|
+
* - `'fade'` — opacity 0→1.
|
|
441
|
+
* - `'grow'` — height grows from baseline.
|
|
442
|
+
* - `'slide'` — translates in from the right with a fade.
|
|
443
|
+
* - `'fade-grow'` *(default)* — fade + grow combined.
|
|
444
|
+
*/
|
|
445
|
+
declare type BarEntryAnimation = 'none' | 'fade' | 'grow' | 'slide' | 'fade-grow';
|
|
446
|
+
|
|
447
|
+
export declare const BarSeries: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
111
448
|
|
|
112
449
|
/** Visual options for a bar series. */
|
|
113
450
|
export declare interface BarSeriesOptions {
|
|
@@ -118,19 +455,100 @@ export declare interface BarSeriesOptions {
|
|
|
118
455
|
barWidthRatio: number;
|
|
119
456
|
/** Stacking mode. Default: 'off'. */
|
|
120
457
|
stacking: StackingMode;
|
|
458
|
+
/**
|
|
459
|
+
* Entrance animation style for newly appended bars. Style is specific to
|
|
460
|
+
* the bar series; there is no chart-level override for style — only for
|
|
461
|
+
* duration. Default: `'fade-grow'`.
|
|
462
|
+
*
|
|
463
|
+
* @see entryMs — cross-linked duration for this animation.
|
|
464
|
+
*/
|
|
465
|
+
entryAnimation?: BarEntryAnimation;
|
|
466
|
+
/** @deprecated Use {@link entryAnimation} instead. */
|
|
467
|
+
enterAnimation?: BarEntryAnimation;
|
|
468
|
+
/**
|
|
469
|
+
* Entrance animation duration in milliseconds. `false` or `0` disables the
|
|
470
|
+
* per-bar entrance (equivalent to `entryAnimation: 'none'`). Omit to inherit
|
|
471
|
+
* from {@link AnimationsConfig.points}.`entryMs` (default 400).
|
|
472
|
+
*
|
|
473
|
+
* When `animations.points.entryMs` is `false` at the chart level, the
|
|
474
|
+
* entrance is forced off regardless of this field.
|
|
475
|
+
*
|
|
476
|
+
* @see BarSeriesOptions.entryAnimation
|
|
477
|
+
*/
|
|
478
|
+
entryMs?: number | false;
|
|
479
|
+
/** @deprecated Use {@link entryMs} instead. */
|
|
480
|
+
enterMs?: number | false;
|
|
481
|
+
/**
|
|
482
|
+
* Exponential-smoothing time constant (ms) for live-tracking the last
|
|
483
|
+
* bar's value under `updateLastPoint`. `0` or `false` snaps directly to the
|
|
484
|
+
* target (no smoothing). Omit to inherit from
|
|
485
|
+
* {@link AnimationsConfig.points}.`smoothMs` (default 70 ms).
|
|
486
|
+
*
|
|
487
|
+
* When `animations.points.smoothMs` is `false` at the chart level, smoothing
|
|
488
|
+
* is forced off regardless of this field.
|
|
489
|
+
*/
|
|
490
|
+
smoothMs?: number | false;
|
|
121
491
|
}
|
|
122
492
|
|
|
123
493
|
/** @deprecated Use {@link StackingMode} instead. */
|
|
124
494
|
export declare type BarStacking = StackingMode;
|
|
125
495
|
|
|
126
|
-
/**
|
|
127
|
-
|
|
496
|
+
/**
|
|
497
|
+
* Snapshot every visible series / layer at `time`. Used by hover overlays
|
|
498
|
+
* (`InfoBar` in hover mode, `Tooltip`). Hidden series and hidden layers are
|
|
499
|
+
* skipped automatically — the returned array reflects what the chart would
|
|
500
|
+
* actually be drawing.
|
|
501
|
+
*
|
|
502
|
+
* The result is cached per `(chart, cacheKey)` slot; as long as
|
|
503
|
+
* `chart.getOverlayVersion()` hasn't changed and `time`/`sort` match the
|
|
504
|
+
* cached call, the **same reference** is returned. This makes
|
|
505
|
+
* `React.memo((a, b) => a.snapshots === b.snapshots)` skip renders on
|
|
506
|
+
* crosshair moves that stay within one data point.
|
|
507
|
+
*/
|
|
508
|
+
export declare function buildHoverSnapshots(chart: ChartInstance, args: BuildHoverSnapshotsArgs): readonly SeriesSnapshot[];
|
|
509
|
+
|
|
510
|
+
export declare interface BuildHoverSnapshotsArgs {
|
|
511
|
+
/** Timestamp to resolve each series at. Typically `crosshair.time`. */
|
|
512
|
+
time: number;
|
|
513
|
+
/** Sort the output by numeric value. Default: `'none'`. */
|
|
514
|
+
sort?: SnapshotSort;
|
|
515
|
+
/**
|
|
516
|
+
* Cache bucket key. Distinct buckets (e.g. `'tooltip'`, `'infobar-hover'`)
|
|
517
|
+
* let separate overlays cache independently so they don't invalidate each
|
|
518
|
+
* other on every call.
|
|
519
|
+
*/
|
|
520
|
+
cacheKey: string;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Snapshot every visible series / layer at its own last point. For
|
|
525
|
+
* multi-layer renderers each layer contributes its own `time`, so ragged
|
|
526
|
+
* streams (layer 1 newer than layer 0) show correctly instead of stalling
|
|
527
|
+
* at the primary layer's timestamp.
|
|
528
|
+
*
|
|
529
|
+
* Cached by `(chart, cacheKey)` + `sort`, invalidated on
|
|
530
|
+
* `chart.getOverlayVersion()` bump. `time` is not an input, so the slot is
|
|
531
|
+
* stored with `time: null`.
|
|
532
|
+
*/
|
|
533
|
+
export declare function buildLastSnapshots(chart: ChartInstance, args: BuildLastSnapshotsArgs): readonly SeriesSnapshot[];
|
|
534
|
+
|
|
535
|
+
export declare interface BuildLastSnapshotsArgs {
|
|
536
|
+
sort?: SnapshotSort;
|
|
537
|
+
cacheKey: string;
|
|
538
|
+
}
|
|
128
539
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
540
|
+
/**
|
|
541
|
+
* Entrance animation styles for candlesticks (shown when a new candle appears via `appendData`).
|
|
542
|
+
* - `'none'` — no animation.
|
|
543
|
+
* - `'fade'` — opacity 0→1.
|
|
544
|
+
* - `'unfold'` — body scales from the open line outward.
|
|
545
|
+
* - `'slide'` — translates in from the right with a fade.
|
|
546
|
+
* - `'fade-unfold'` *(default)* — fade + unfold combined; the default because a lone fade is
|
|
547
|
+
* hard to notice in streaming demos, while the body-unfold gives a clear visual anchor.
|
|
548
|
+
*/
|
|
549
|
+
declare type CandlestickEntryAnimation = 'none' | 'fade' | 'unfold' | 'slide' | 'fade-unfold';
|
|
550
|
+
|
|
551
|
+
export declare const CandlestickSeries: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
134
552
|
|
|
135
553
|
/** Visual options for a candlestick series. */
|
|
136
554
|
export declare interface CandlestickSeriesOptions {
|
|
@@ -143,7 +561,42 @@ export declare interface CandlestickSeriesOptions {
|
|
|
143
561
|
/** Width of candle body as a fraction of the available bar slot (0-1). */
|
|
144
562
|
bodyWidthRatio: number;
|
|
145
563
|
/** Apply a subtle vertical gradient to candle bodies. Default: true. */
|
|
564
|
+
bodyGradient?: boolean;
|
|
565
|
+
/** @deprecated Use {@link bodyGradient} instead. */
|
|
146
566
|
candleGradient?: boolean;
|
|
567
|
+
/**
|
|
568
|
+
* Entrance animation style for newly appended candles. Style is specific to
|
|
569
|
+
* the candlestick; there is no chart-level override for style — only for
|
|
570
|
+
* duration. Default: `'unfold'`.
|
|
571
|
+
*
|
|
572
|
+
* @see entryMs — cross-linked duration for this animation.
|
|
573
|
+
*/
|
|
574
|
+
entryAnimation?: CandlestickEntryAnimation;
|
|
575
|
+
/** @deprecated Use {@link entryAnimation} instead. */
|
|
576
|
+
enterAnimation?: CandlestickEntryAnimation;
|
|
577
|
+
/**
|
|
578
|
+
* Entrance animation duration in milliseconds. `false` or `0` disables the
|
|
579
|
+
* per-candle entrance (equivalent to `entryAnimation: 'none'`). Omit to
|
|
580
|
+
* inherit from {@link AnimationsConfig.points}.`entryMs` (default 400).
|
|
581
|
+
*
|
|
582
|
+
* When `animations.points.entryMs` is `false` at the chart level, the
|
|
583
|
+
* entrance is forced off regardless of this field.
|
|
584
|
+
*
|
|
585
|
+
* @see CandlestickSeriesOptions.entryAnimation
|
|
586
|
+
*/
|
|
587
|
+
entryMs?: number | false;
|
|
588
|
+
/** @deprecated Use {@link entryMs} instead. */
|
|
589
|
+
enterMs?: number | false;
|
|
590
|
+
/**
|
|
591
|
+
* Exponential-smoothing time constant (ms) for live-tracking the last
|
|
592
|
+
* candle's O/H/L/C under `updateLastPoint`. `0` or `false` snaps directly
|
|
593
|
+
* to the target (no smoothing). Omit to inherit from
|
|
594
|
+
* {@link AnimationsConfig.points}.`smoothMs` (default 70 ms).
|
|
595
|
+
*
|
|
596
|
+
* When `animations.points.smoothMs` is `false` at the chart level, smoothing
|
|
597
|
+
* is forced off regardless of this field.
|
|
598
|
+
*/
|
|
599
|
+
smoothMs?: number | false;
|
|
147
600
|
}
|
|
148
601
|
|
|
149
602
|
export declare const catppuccin: ThemePreset;
|
|
@@ -156,6 +609,14 @@ declare interface ChartEvents {
|
|
|
156
609
|
viewportChange: () => void;
|
|
157
610
|
dataUpdate: () => void;
|
|
158
611
|
seriesChange: () => void;
|
|
612
|
+
/**
|
|
613
|
+
* Fired whenever any state that affects **overlay components** (InfoBar,
|
|
614
|
+
* Tooltip, Legend, YLabel, PieLegend, PieTooltip) changes. Superset of
|
|
615
|
+
* `dataUpdate` and `seriesChange` — also fires on visibility toggles,
|
|
616
|
+
* series option changes, and theme swaps. Overlay components should
|
|
617
|
+
* subscribe to this instead of stacking multiple listeners.
|
|
618
|
+
*/
|
|
619
|
+
overlayChange: () => void;
|
|
159
620
|
}
|
|
160
621
|
|
|
161
622
|
/**
|
|
@@ -180,44 +641,38 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
180
641
|
layers?: number;
|
|
181
642
|
id?: string;
|
|
182
643
|
}>): string;
|
|
183
|
-
/** @deprecated Pass options as first argument: `addLineSeries({ layers: N, ...options })` */
|
|
184
|
-
addLineSeries(layerCount: number, options?: Partial<LineSeriesOptions>): string;
|
|
185
|
-
/** Set data for a specific layer within a line series. */
|
|
186
|
-
setLineLayerData(id: string, layerIndex: number, data: TimePoint[]): void;
|
|
187
644
|
/** Add a bar series and return its unique ID. */
|
|
188
645
|
addBarSeries(options?: Partial<BarSeriesOptions & {
|
|
189
646
|
layers?: number;
|
|
190
647
|
id?: string;
|
|
191
648
|
}>): string;
|
|
192
|
-
/** @deprecated Pass options as first argument: `addBarSeries({ layers: N, ...options })` */
|
|
193
|
-
addBarSeries(layerCount: number, options?: Partial<BarSeriesOptions>): string;
|
|
194
|
-
/** Set data for a specific layer within a bar series. */
|
|
195
|
-
setBarLayerData(id: string, layerIndex: number, data: TimePoint[]): void;
|
|
196
649
|
/** Add a pie/donut series. Set `innerRadiusRatio > 0` for donut. */
|
|
197
650
|
addPieSeries(options?: Partial<PieSeriesOptions & {
|
|
198
651
|
id?: string;
|
|
199
652
|
}>): string;
|
|
200
|
-
/** Set data for a pie/donut series. */
|
|
201
|
-
setPieData(id: string, data: PieSliceData[]): void;
|
|
202
653
|
/** Remove a series by ID and clean up its resources. */
|
|
203
654
|
removeSeries(id: string): void;
|
|
204
|
-
/**
|
|
205
|
-
|
|
655
|
+
/**
|
|
656
|
+
* Replace all data for a series.
|
|
657
|
+
*
|
|
658
|
+
* - Single-layer series (candlestick, single-layer line/bar, pie): pass `data` directly.
|
|
659
|
+
* - Multi-layer series (line/bar with multiple layers): pass `layerIndex` to target a specific layer.
|
|
660
|
+
*
|
|
661
|
+
* For line/bar accepts `TimePointInput[]` (time may be `Date`); for candlestick accepts `OHLCInput[]`;
|
|
662
|
+
* for pie accepts `PieSliceData[]`. Time fields are normalized internally.
|
|
663
|
+
*/
|
|
664
|
+
setSeriesData(id: string, data: unknown, layerIndex?: number): void;
|
|
206
665
|
/** Append a new data point to the end of a series (real-time tick). */
|
|
207
|
-
appendData(id: string, point: OHLCInput | TimePointInput): void;
|
|
666
|
+
appendData(id: string, point: OHLCInput | TimePointInput, layerIndex?: number): void;
|
|
208
667
|
/** Update the last data point of a series in place (e.g. live candle update). */
|
|
209
|
-
updateData(id: string, point: OHLCInput | TimePointInput): void;
|
|
668
|
+
updateData(id: string, point: OHLCInput | TimePointInput, layerIndex?: number): void;
|
|
210
669
|
/** Update visual options (color, width, etc.) for an existing series. */
|
|
211
670
|
updateSeriesOptions(id: string, options: Partial<CandlestickSeriesOptions> | Partial<LineSeriesOptions> | Partial<BarSeriesOptions> | Partial<PieSeriesOptions>): void;
|
|
212
671
|
/**
|
|
213
|
-
* Batch multiple updates: suppress recomputes until `fn` returns.
|
|
214
|
-
*
|
|
672
|
+
* Batch multiple updates: suppress recomputes until `fn` returns. Exceptions
|
|
673
|
+
* inside `fn` still flush the batch so counters don't leak across calls.
|
|
215
674
|
*/
|
|
216
675
|
batch(fn: () => void): void;
|
|
217
|
-
/** @deprecated Use {@link batch} instead. */
|
|
218
|
-
beginUpdate(): void;
|
|
219
|
-
/** @deprecated Use {@link batch} instead. */
|
|
220
|
-
endUpdate(): void;
|
|
221
676
|
/** Show or hide a series. Hidden series are not rendered and excluded from Y-range. */
|
|
222
677
|
setSeriesVisible(seriesId: string, visible: boolean): void;
|
|
223
678
|
isSeriesVisible(seriesId: string): boolean;
|
|
@@ -227,6 +682,22 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
227
682
|
/** Auto-fit the viewport to show all data across every series. */
|
|
228
683
|
fitContent(): void;
|
|
229
684
|
getVisibleRange(): VisibleRange;
|
|
685
|
+
/**
|
|
686
|
+
* Imperatively set the visible time range.
|
|
687
|
+
*
|
|
688
|
+
* Two forms:
|
|
689
|
+
* - `{ from, to }` — explicit millisecond range. Cancels any in-flight
|
|
690
|
+
* animation and applies immediately. Auto-scroll stays on only if the
|
|
691
|
+
* tail is inside the new range (mirrors pan semantics).
|
|
692
|
+
* - `number N` — shorthand for "show the last N bars from the tail".
|
|
693
|
+
* Resolved against the current data bounds and data interval; keeps
|
|
694
|
+
* auto-scroll on so streaming ticks continue to track the tail.
|
|
695
|
+
* No-op if data hasn't loaded yet.
|
|
696
|
+
*
|
|
697
|
+
* Typical use: on mount, zoom to the last N bars while keeping the full
|
|
698
|
+
* buffer available for pan-back history inspection.
|
|
699
|
+
*/
|
|
700
|
+
setVisibleRange(range: VisibleRange | number): void;
|
|
230
701
|
getYRange(): YRange;
|
|
231
702
|
getCrosshairPosition(): CrosshairPosition | null;
|
|
232
703
|
/** Get the last visible value and whether the absolute last point is on screen. */
|
|
@@ -239,57 +710,129 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
239
710
|
getLastData(seriesId: string): OHLCData | TimePoint | null;
|
|
240
711
|
/** Find the data point closest to the given timestamp within one data interval. */
|
|
241
712
|
getDataAtTime(seriesId: string, time: number): OHLCData | TimePoint | null;
|
|
242
|
-
/**
|
|
713
|
+
/**
|
|
714
|
+
* Get all layers' data at a given time for multi-layer series (Bar/Line
|
|
715
|
+
* with stacking). Each entry carries the owning `layerIndex` and the
|
|
716
|
+
* snapped sample time — callers must not derive layer identity from the
|
|
717
|
+
* array index, because hidden layers are filtered out.
|
|
718
|
+
*/
|
|
243
719
|
getLayerSnapshots(seriesId: string, time: number): {
|
|
720
|
+
layerIndex: number;
|
|
721
|
+
time: number;
|
|
244
722
|
value: number;
|
|
245
723
|
color: string;
|
|
246
724
|
}[] | null;
|
|
247
725
|
getSeriesIds(): string[];
|
|
726
|
+
/**
|
|
727
|
+
* Type of a registered series, or `null` for unknown ids. `'pie'` for
|
|
728
|
+
* `PieRenderer`; everything else is a time-series (`'time'`).
|
|
729
|
+
*/
|
|
730
|
+
getSeriesType(seriesId: string): 'pie' | 'time' | null;
|
|
731
|
+
/**
|
|
732
|
+
* Filter `getSeriesIds()` by renderer type. `'pie'` returns pie series,
|
|
733
|
+
* `'time'` returns line/bar/candlestick.
|
|
734
|
+
*
|
|
735
|
+
* - `opts.visibleOnly` — exclude series with `isSeriesVisible=false`; for
|
|
736
|
+
* multi-layer series also exclude when every layer is hidden.
|
|
737
|
+
* - `opts.singleLayerOnly` — exclude series with more than one layer.
|
|
738
|
+
* Useful for YLabel fallback priority (stick to a single line first).
|
|
739
|
+
*/
|
|
740
|
+
getSeriesIdsByType(type: 'pie' | 'time', opts?: {
|
|
741
|
+
visibleOnly?: boolean;
|
|
742
|
+
singleLayerOnly?: boolean;
|
|
743
|
+
}): string[];
|
|
744
|
+
/**
|
|
745
|
+
* Cumulative top last-value for stacked series — the point a YLabel badge
|
|
746
|
+
* anchors to on the rendered stack head. Falls back to `getLastValue` for
|
|
747
|
+
* series without stacked concepts (Candlestick, single-layer Line/Bar).
|
|
748
|
+
* Returns `null` for unknown ids or empty series.
|
|
749
|
+
*/
|
|
750
|
+
getStackedLastValue(seriesId: string): {
|
|
751
|
+
value: number;
|
|
752
|
+
isLive: boolean;
|
|
753
|
+
} | null;
|
|
754
|
+
/**
|
|
755
|
+
* Per-layer last snapshots with each layer's own `time`. Returns `null`
|
|
756
|
+
* for single-layer renderers or when no visible layer has data. Used by
|
|
757
|
+
* overlay components that must display every layer in last-mode even
|
|
758
|
+
* when layers advance at different rates (ragged streams).
|
|
759
|
+
*/
|
|
760
|
+
getLayerLastSnapshots(seriesId: string): {
|
|
761
|
+
layerIndex: number;
|
|
762
|
+
time: number;
|
|
763
|
+
value: number;
|
|
764
|
+
color: string;
|
|
765
|
+
}[] | null;
|
|
248
766
|
/** Get the primary display color for a series. */
|
|
249
767
|
getSeriesColor(seriesId: string): string | null;
|
|
250
768
|
getSeriesLabel(seriesId: string): string | undefined;
|
|
251
|
-
/** Get per-layer colors for a series. Returns null for non-bar/line series
|
|
769
|
+
/** Get per-layer colors for a series. Returns null for single-layer non-bar/line series. */
|
|
252
770
|
getSeriesLayers(seriesId: string): {
|
|
253
771
|
color: string;
|
|
254
772
|
}[] | null;
|
|
255
|
-
/** Get all
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
color: string;
|
|
261
|
-
}[] | null;
|
|
262
|
-
/** Get the hovered pie slice info (label, value, percentage, color). Returns null if no hover. */
|
|
263
|
-
getPieHoverInfo(seriesId: string): {
|
|
264
|
-
label: string;
|
|
265
|
-
value: number;
|
|
266
|
-
percent: number;
|
|
267
|
-
color: string;
|
|
268
|
-
} | null;
|
|
269
|
-
/** Apply a new theme and update candlestick series colors. Line series keep their individual colors. */
|
|
773
|
+
/** Get all slices with computed colors and percentages. Returns null for series without slice data (e.g. candlestick, line, bar). */
|
|
774
|
+
getSliceInfo(seriesId: string): SliceInfo[] | null;
|
|
775
|
+
/** Get hover info (label/value/percent/color) for the currently hovered element, or null. */
|
|
776
|
+
getHoverInfo(seriesId: string): HoverInfo | null;
|
|
777
|
+
/** Apply a new theme and update series colors where appropriate. */
|
|
270
778
|
setTheme(theme: ChartTheme): void;
|
|
271
779
|
getTheme(): ChartTheme;
|
|
272
780
|
/** Update axis configuration and re-render. */
|
|
273
781
|
setAxis(config: AxisConfig): void;
|
|
782
|
+
/**
|
|
783
|
+
* Apply label-density knobs driven by `<YAxis labelCount=… minLabelSpacing=…>`
|
|
784
|
+
* — kept separate from {@link setAxis} so component props don't force a
|
|
785
|
+
* Y-animation reset. Triggers a viewportChange + repaint so static charts
|
|
786
|
+
* react without waiting for pan/zoom.
|
|
787
|
+
*/
|
|
788
|
+
setYAxisLabelDensity(params: {
|
|
789
|
+
labelCount?: number | null;
|
|
790
|
+
minLabelSpacing?: number | null;
|
|
791
|
+
}): void;
|
|
792
|
+
/** Label-density knobs for the time axis — mirror of {@link setYAxisLabelDensity}. */
|
|
793
|
+
setTimeAxisLabelDensity(params: {
|
|
794
|
+
labelCount?: number | null;
|
|
795
|
+
minLabelSpacing?: number | null;
|
|
796
|
+
}): void;
|
|
274
797
|
getMediaSize(): Size;
|
|
275
798
|
/** Returns layout metrics for the chart area, Y axis, and time axis. */
|
|
276
799
|
getLayout(): ChartLayout;
|
|
277
800
|
getDataInterval(): number;
|
|
278
|
-
/**
|
|
801
|
+
/**
|
|
802
|
+
* Update viewport padding at runtime. Refits the visible time range to
|
|
803
|
+
* current data bounds **only when horizontal padding (left/right) changes**
|
|
804
|
+
* — vertical padding only affects the Y-range computation, so touching it
|
|
805
|
+
* shouldn't reset the user's zoom / auto-scroll state. This matters when
|
|
806
|
+
* a wrapper re-applies padding reactively (e.g. in response to a Title /
|
|
807
|
+
* InfoBar ResizeObserver).
|
|
808
|
+
*/
|
|
279
809
|
setPadding(padding: ChartOptions['padding']): void;
|
|
280
810
|
/** Show or hide the background grid. Takes effect on the next render frame. */
|
|
281
|
-
setGrid(grid:
|
|
811
|
+
setGrid(grid: {
|
|
812
|
+
visible: boolean;
|
|
813
|
+
}): void;
|
|
814
|
+
/**
|
|
815
|
+
* Set the visual state for one side of the chart. Typically called in
|
|
816
|
+
* response to the `onEdgeReached` callback:
|
|
817
|
+
* - `loading` while a history fetch is in flight,
|
|
818
|
+
* - `no-data` once the fetch confirmed there's nothing more,
|
|
819
|
+
* - `idle` when the host no longer wants any edge affordance.
|
|
820
|
+
* The state persists until replaced. `has-more` is accepted for API
|
|
821
|
+
* symmetry and currently renders identically to `idle`.
|
|
822
|
+
*/
|
|
823
|
+
setEdgeState(side: EdgeSide, state: EdgeState): void;
|
|
824
|
+
/** Read the current host-declared state for a given edge. */
|
|
825
|
+
getEdgeState(side: EdgeSide): EdgeState;
|
|
282
826
|
/** Notify chart that a YLabel is present (affects right padding). */
|
|
283
827
|
setYLabel(has: boolean): void;
|
|
284
|
-
private updatePieHover;
|
|
285
828
|
private updateViewportPadding;
|
|
286
829
|
/** Tear down the chart: cancel animations, remove listeners, and detach the canvas. */
|
|
287
830
|
destroy(): void;
|
|
831
|
+
/** The attached performance monitor, or `null` when instrumentation is disabled. */
|
|
832
|
+
getPerfMonitor(): PerfMonitor | null;
|
|
288
833
|
/** Compute the earliest and latest timestamps across all series. */
|
|
289
834
|
private getDataBounds;
|
|
290
835
|
private onDataChanged;
|
|
291
|
-
/** Check whether the last data point of any series falls within the visible time range. */
|
|
292
|
-
private isLastPointVisible;
|
|
293
836
|
private updateDataInterval;
|
|
294
837
|
private updateYRange;
|
|
295
838
|
/** Resolve an {@link AxisBound} to a concrete numeric value. */
|
|
@@ -303,8 +846,17 @@ export declare class ChartInstance extends EventEmitter<ChartEvents> {
|
|
|
303
846
|
private updateScales;
|
|
304
847
|
/** Expensive: background, grid, all series. Only on data/viewport/resize change. */
|
|
305
848
|
private renderMain;
|
|
306
|
-
/** Cheap overlay: crosshair, nearest-point dots, pulse animation. */
|
|
849
|
+
/** Cheap overlay: crosshair, nearest-point dots, pulse animation, edge indicator. */
|
|
307
850
|
private renderOverlay;
|
|
851
|
+
private drawEdgeIndicators;
|
|
852
|
+
/**
|
|
853
|
+
* Pick the boundary time to anchor the edge indicator at. Prefer the
|
|
854
|
+
* cached value emitted by the most recent `edgeReached` — that's the
|
|
855
|
+
* *exact* point the user overshot. Fall back to the current data edge
|
|
856
|
+
* when no gesture has fired yet (host might invoke `setEdgeState`
|
|
857
|
+
* directly on mount to show a "no-data" marker from the start).
|
|
858
|
+
*/
|
|
859
|
+
private resolveEdgeBoundary;
|
|
308
860
|
}
|
|
309
861
|
|
|
310
862
|
/** Layout metrics describing the chart area, Y axis, and time axis sizes. */
|
|
@@ -314,7 +866,6 @@ export declare interface ChartLayout {
|
|
|
314
866
|
xAxisHeight: number;
|
|
315
867
|
}
|
|
316
868
|
|
|
317
|
-
/** Options passed when creating a new {@link ChartInstance}. */
|
|
318
869
|
export declare interface ChartOptions {
|
|
319
870
|
theme?: ChartTheme;
|
|
320
871
|
axis?: AxisConfig;
|
|
@@ -334,8 +885,50 @@ export declare interface ChartOptions {
|
|
|
334
885
|
};
|
|
335
886
|
/** Enable zoom, pan, and crosshair interactions. Defaults to true. */
|
|
336
887
|
interactive?: boolean;
|
|
337
|
-
/**
|
|
338
|
-
grid?:
|
|
888
|
+
/** Background grid configuration. Default: `{ visible: true }`. */
|
|
889
|
+
grid?: {
|
|
890
|
+
visible: boolean;
|
|
891
|
+
};
|
|
892
|
+
/**
|
|
893
|
+
* Animation control. Split into `points` (data-series animations) and
|
|
894
|
+
* `viewport` (pan/zoom rebound + Y-axis smoothing). See
|
|
895
|
+
* {@link AnimationsConfig} for the full shape and defaults.
|
|
896
|
+
*
|
|
897
|
+
* Shorthands:
|
|
898
|
+
* - `animations: true` (or omitted) uses built-in defaults.
|
|
899
|
+
* - `animations: false` disables every animation category.
|
|
900
|
+
* - `animations: { points: false }` disables all data-series animations.
|
|
901
|
+
* - `animations: { viewport: false }` disables rebound + Y-axis smoothing.
|
|
902
|
+
*
|
|
903
|
+
* Per-series options (`enterMs`, `smoothMs`, etc.) override chart-level
|
|
904
|
+
* defaults unless the category is explicitly `false` — then the chart-
|
|
905
|
+
* level gate wins.
|
|
906
|
+
*/
|
|
907
|
+
animations?: boolean | AnimationsConfig;
|
|
908
|
+
/**
|
|
909
|
+
* Invoked after the user releases a pan/zoom gesture that pulled the
|
|
910
|
+
* viewport past a data edge by more than 10% of the visible range. Hosts
|
|
911
|
+
* typically respond by prefetching more history and calling
|
|
912
|
+
* {@link ChartInstance.setEdgeState} to show a spinner or "no more data"
|
|
913
|
+
* indicator at the corresponding edge.
|
|
914
|
+
*/
|
|
915
|
+
onEdgeReached?: (info: EdgeReachedInfo) => void;
|
|
916
|
+
/**
|
|
917
|
+
* Runtime performance instrumentation. Opt-in — absent by default so the
|
|
918
|
+
* hot render path stays free of timing/counting overhead.
|
|
919
|
+
*
|
|
920
|
+
* - `false` / omitted — no instrumentation, no HUD, byte-identical to a perf-free build.
|
|
921
|
+
* - `true` — create an internal {@link PerfMonitor} and mount a visible HUD overlay.
|
|
922
|
+
* - `{ hud: true, ...options }` — same, with monitor options forwarded.
|
|
923
|
+
* - `{ hud: false, ...options }` — instrument but do not render a HUD (useful when
|
|
924
|
+
* the host app consumes stats via `monitor.onFrame` and renders its own UI).
|
|
925
|
+
* - `PerfMonitor` instance — attach to a pre-constructed monitor. Useful when several
|
|
926
|
+
* charts share one telemetry sink. HUD defaults to off in this mode.
|
|
927
|
+
*/
|
|
928
|
+
perf?: boolean | PerfMonitor | (PerfMonitorOptions & {
|
|
929
|
+
hud?: boolean;
|
|
930
|
+
monitor?: PerfMonitor;
|
|
931
|
+
});
|
|
339
932
|
}
|
|
340
933
|
|
|
341
934
|
/**
|
|
@@ -399,6 +992,8 @@ export declare interface ChartTheme {
|
|
|
399
992
|
};
|
|
400
993
|
}
|
|
401
994
|
|
|
995
|
+
export declare function computeTooltipPosition(args: TooltipPositionArgs): TooltipPosition;
|
|
996
|
+
|
|
402
997
|
/**
|
|
403
998
|
* Build a complete {@link ThemePreset} from a partial config.
|
|
404
999
|
* Only `background` is required — everything else is derived from it.
|
|
@@ -425,6 +1020,27 @@ export declare function detectInterval(times: number[]): number;
|
|
|
425
1020
|
|
|
426
1021
|
export declare const dracula: ThemePreset;
|
|
427
1022
|
|
|
1023
|
+
/** Payload for {@link ChartOptions.onEdgeReached}. */
|
|
1024
|
+
declare interface EdgeReachedInfo {
|
|
1025
|
+
side: EdgeSide;
|
|
1026
|
+
/** Time units the user pulled past the soft bound. */
|
|
1027
|
+
overshoot: number;
|
|
1028
|
+
/** Soft-bound timestamp that was crossed (dataStart - leftPad or dataEnd + rightPad). */
|
|
1029
|
+
boundaryTime: number;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/** Which data side the user pulled past during a gesture. */
|
|
1033
|
+
declare type EdgeSide = 'left' | 'right';
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Host-controlled visual state for a chart edge:
|
|
1037
|
+
* - `idle`: nothing rendered (default).
|
|
1038
|
+
* - `loading`: a subtle spinner appears in the overshoot area.
|
|
1039
|
+
* - `no-data`: a dashed boundary line + "No more data" label appears at the data edge.
|
|
1040
|
+
* - `has-more`: reserved — currently behaves like `idle`. Use when more data exists but is not being fetched.
|
|
1041
|
+
*/
|
|
1042
|
+
declare type EdgeState = 'idle' | 'loading' | 'no-data' | 'has-more';
|
|
1043
|
+
|
|
428
1044
|
declare class EventEmitter<Events = Record<string, Listener>> {
|
|
429
1045
|
private listeners;
|
|
430
1046
|
on<K extends string & keyof Events>(event: K, listener: Events[K] & Listener): void;
|
|
@@ -433,10 +1049,37 @@ declare class EventEmitter<Events = Record<string, Listener>> {
|
|
|
433
1049
|
removeAllListeners(): void;
|
|
434
1050
|
}
|
|
435
1051
|
|
|
1052
|
+
/**
|
|
1053
|
+
* Compact notation for large magnitudes (K / M / B / T) with adaptive
|
|
1054
|
+
* precision for values below 1. Default decimal count for the compact
|
|
1055
|
+
* suffixes can be overridden via `opts.decimals`.
|
|
1056
|
+
*/
|
|
1057
|
+
export declare function formatCompact(v: number, opts?: {
|
|
1058
|
+
decimals?: number;
|
|
1059
|
+
}): string;
|
|
1060
|
+
|
|
436
1061
|
export declare function formatDate(timestamp: number): string;
|
|
437
1062
|
|
|
1063
|
+
/**
|
|
1064
|
+
* Full-precision display that adapts decimal count to the value's magnitude.
|
|
1065
|
+
* No K/M/B compression — callers wanting a short label should use
|
|
1066
|
+
* `formatCompact` instead.
|
|
1067
|
+
*/
|
|
1068
|
+
export declare function formatPriceAdaptive(v: number): string;
|
|
1069
|
+
|
|
438
1070
|
export declare function formatTime(timestamp: number, interval: number): string;
|
|
439
1071
|
|
|
1072
|
+
declare type FrameKind = 'main' | 'overlay';
|
|
1073
|
+
|
|
1074
|
+
declare interface FrameTimingSample {
|
|
1075
|
+
/** Wall-clock ms for the most recent frame. */
|
|
1076
|
+
last: number;
|
|
1077
|
+
/** Median frame time over the rolling window. */
|
|
1078
|
+
p50: number;
|
|
1079
|
+
/** Tail frame time (worst 5%) — useful for spotting stutter. */
|
|
1080
|
+
p95: number;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
440
1083
|
export declare const githubLight: ThemePreset;
|
|
441
1084
|
|
|
442
1085
|
export declare const gruvbox: ThemePreset;
|
|
@@ -445,8 +1088,65 @@ export declare const handwritten: ThemePreset;
|
|
|
445
1088
|
|
|
446
1089
|
export declare const highContrast: ThemePreset;
|
|
447
1090
|
|
|
1091
|
+
/** Shape returned by {@link SeriesRenderer.getHoverInfo} / per-slice entries of {@link SeriesRenderer.getSliceInfo}. */
|
|
1092
|
+
export declare interface HoverInfo {
|
|
1093
|
+
label: string;
|
|
1094
|
+
value: number;
|
|
1095
|
+
percent: number;
|
|
1096
|
+
color: string;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
export declare const InfoBar: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
1100
|
+
|
|
448
1101
|
export declare const lavenderMist: ThemePreset;
|
|
449
1102
|
|
|
1103
|
+
export declare const Legend: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* Canonical legend item — the unit every framework Legend passes to its
|
|
1107
|
+
* scoped slot (and the shape the built-in default UI consumes).
|
|
1108
|
+
*
|
|
1109
|
+
* Each item is **self-contained**: it carries its own identity and
|
|
1110
|
+
* pre-bound `toggle` / `isolate` closures, so slot code can freely sort,
|
|
1111
|
+
* filter, or remap items without risking a click on one row mutating the
|
|
1112
|
+
* wrong series.
|
|
1113
|
+
*
|
|
1114
|
+
* - `id` — row key for list rendering (React `key`, Vue `:key`,
|
|
1115
|
+
* Svelte `each … (key)`). Guaranteed unique within the array.
|
|
1116
|
+
* - `seriesId` — owning series id, **never includes a layer suffix**.
|
|
1117
|
+
* Use this for filtering/grouping; not unique across multi-layer rows.
|
|
1118
|
+
* - `layerIndex` — layer within a multi-layer series; `undefined` for
|
|
1119
|
+
* single-layer rows.
|
|
1120
|
+
* - `isDisabled` — current toggled-off state, derived from
|
|
1121
|
+
* `isSeriesVisible` / `isLayerVisible` plus local isolate-state in the
|
|
1122
|
+
* Legend component.
|
|
1123
|
+
*/
|
|
1124
|
+
export declare interface LegendItem {
|
|
1125
|
+
readonly id: string;
|
|
1126
|
+
readonly seriesId: string;
|
|
1127
|
+
readonly layerIndex?: number;
|
|
1128
|
+
readonly label: string;
|
|
1129
|
+
readonly color: string;
|
|
1130
|
+
readonly isDisabled: boolean;
|
|
1131
|
+
/** Toggle just this item's visibility. */
|
|
1132
|
+
readonly toggle: () => void;
|
|
1133
|
+
/** Show only this item; calling again reveals everything (isolate/unisolate). */
|
|
1134
|
+
readonly isolate: () => void;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Minimal visual shape the {@link LegendProps.items} override accepts. The
|
|
1139
|
+
* canonical {@link LegendItem} (re-exported from `@wick-charts/core`) carries
|
|
1140
|
+
* the full identity + closures; those aren't meaningful for a pre-baked,
|
|
1141
|
+
* non-interactive legend.
|
|
1142
|
+
*/
|
|
1143
|
+
declare interface LegendItemOverride {
|
|
1144
|
+
label: string;
|
|
1145
|
+
color: string;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
declare type LegendMode = 'toggle' | 'isolate' | 'solo';
|
|
1149
|
+
|
|
450
1150
|
export declare const lightPink: ThemePreset;
|
|
451
1151
|
|
|
452
1152
|
export declare const lightTheme: ChartTheme;
|
|
@@ -454,11 +1154,15 @@ export declare const lightTheme: ChartTheme;
|
|
|
454
1154
|
/** @deprecated Use {@link TimePoint} instead. */
|
|
455
1155
|
export declare type LineData = TimePoint;
|
|
456
1156
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
1157
|
+
/**
|
|
1158
|
+
* Entrance animation styles for new line points.
|
|
1159
|
+
* - `'none'` — new segments appear instantly.
|
|
1160
|
+
* - `'grow'` *(default)* — trailing segment reveals left-to-right.
|
|
1161
|
+
* - `'fade'` — geometry fixed; trailing segment strokes in with alpha 0→1.
|
|
1162
|
+
*/
|
|
1163
|
+
declare type LineEntryAnimation = 'none' | 'grow' | 'fade';
|
|
1164
|
+
|
|
1165
|
+
export declare const LineSeries: DefineComponent<__VLS_Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
462
1166
|
|
|
463
1167
|
/** Visual options for a line series. */
|
|
464
1168
|
export declare interface LineSeriesOptions {
|
|
@@ -466,13 +1170,59 @@ export declare interface LineSeriesOptions {
|
|
|
466
1170
|
label?: string;
|
|
467
1171
|
/** One color per layer. */
|
|
468
1172
|
colors: string[];
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
1173
|
+
/** Stroke width in CSS pixels. Default: 1. `0` hides the line stroke. */
|
|
1174
|
+
strokeWidth: number;
|
|
1175
|
+
/** Area-fill configuration. Default: `{ visible: true }`. */
|
|
1176
|
+
area: {
|
|
1177
|
+
visible: boolean;
|
|
1178
|
+
};
|
|
1179
|
+
/**
|
|
1180
|
+
* Whether to show an animated pulsing dot at the last data point.
|
|
1181
|
+
*/
|
|
473
1182
|
pulse: boolean;
|
|
1183
|
+
/**
|
|
1184
|
+
* Pulse cycle period in milliseconds. `false`/`0` disables the halo (both
|
|
1185
|
+
* the drawing and the associated animation loop). Omit to inherit from
|
|
1186
|
+
* {@link AnimationsConfig.points}.`pulseMs` (default 600 ms). When
|
|
1187
|
+
* `animations.points.pulseMs` is `false` at the chart level the pulse is
|
|
1188
|
+
* forced off regardless of this field.
|
|
1189
|
+
*/
|
|
1190
|
+
pulseMs?: number | false;
|
|
474
1191
|
/** Stacking mode. Default: 'off'. */
|
|
475
1192
|
stacking: StackingMode;
|
|
1193
|
+
/**
|
|
1194
|
+
* Entrance animation style for new points. Style is specific to the line
|
|
1195
|
+
* series; there is no chart-level override for style — only for duration.
|
|
1196
|
+
* Default: `'grow'`.
|
|
1197
|
+
*
|
|
1198
|
+
* @see entryMs — cross-linked duration for this animation.
|
|
1199
|
+
*/
|
|
1200
|
+
entryAnimation?: LineEntryAnimation;
|
|
1201
|
+
/** @deprecated Use {@link entryAnimation} instead. */
|
|
1202
|
+
enterAnimation?: LineEntryAnimation;
|
|
1203
|
+
/**
|
|
1204
|
+
* Entrance animation duration in milliseconds. `false` or `0` disables the
|
|
1205
|
+
* per-point entrance (equivalent to `entryAnimation: 'none'`). Omit to
|
|
1206
|
+
* inherit from {@link AnimationsConfig.points}.`entryMs` (default 400).
|
|
1207
|
+
*
|
|
1208
|
+
* When `animations.points.entryMs` is `false` at the chart level, the
|
|
1209
|
+
* entrance is forced off regardless of this field.
|
|
1210
|
+
*
|
|
1211
|
+
* @see LineSeriesOptions.entryAnimation
|
|
1212
|
+
*/
|
|
1213
|
+
entryMs?: number | false;
|
|
1214
|
+
/** @deprecated Use {@link entryMs} instead. */
|
|
1215
|
+
enterMs?: number | false;
|
|
1216
|
+
/**
|
|
1217
|
+
* Exponential-smoothing time constant (ms) for live-tracking the last
|
|
1218
|
+
* point's value under `updateLastPoint`. `0` or `false` snaps directly to
|
|
1219
|
+
* the target (no smoothing). Omit to inherit from
|
|
1220
|
+
* {@link AnimationsConfig.points}.`smoothMs` (default 70 ms).
|
|
1221
|
+
*
|
|
1222
|
+
* When `animations.points.smoothMs` is `false` at the chart level, smoothing
|
|
1223
|
+
* is forced off regardless of this field.
|
|
1224
|
+
*/
|
|
1225
|
+
smoothMs?: number | false;
|
|
476
1226
|
}
|
|
477
1227
|
|
|
478
1228
|
declare type Listener = (...args: any[]) => void;
|
|
@@ -490,7 +1240,7 @@ export declare const nightOwl: ThemePreset;
|
|
|
490
1240
|
/** Convert a {@link TimeValue} (number ms or Date) to a millisecond timestamp. */
|
|
491
1241
|
export declare function normalizeTime(t: TimeValue): number;
|
|
492
1242
|
|
|
493
|
-
export declare const NumberFlow: DefineComponent<
|
|
1243
|
+
export declare const NumberFlow: DefineComponent<__VLS_Props_8, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_8> & Readonly<{}>, {
|
|
494
1244
|
locale: string;
|
|
495
1245
|
spinDuration: number;
|
|
496
1246
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLSpanElement>;
|
|
@@ -516,30 +1266,216 @@ export declare const panda: ThemePreset;
|
|
|
516
1266
|
|
|
517
1267
|
export declare const peachCream: ThemePreset;
|
|
518
1268
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
1269
|
+
/**
|
|
1270
|
+
* Collects per-frame timing, draw-call counts, per-series render ms, and heap
|
|
1271
|
+
* usage. All collection sites short-circuit to no-ops when no monitor is
|
|
1272
|
+
* attached to the chart, so the zero-perf path remains byte-identical to a
|
|
1273
|
+
* monitorless build.
|
|
1274
|
+
*
|
|
1275
|
+
* Not thread-safe (there are no threads) — a single chart writes to a single
|
|
1276
|
+
* monitor. Multiple charts may share a monitor, but `perSeries` keys must be
|
|
1277
|
+
* unique across charts or samples will collide.
|
|
1278
|
+
*/
|
|
1279
|
+
declare class PerfMonitor {
|
|
1280
|
+
/** Draw-call tally map for the main layer. Mutated in place by the counting context; cleared at the start of each frame. */
|
|
1281
|
+
readonly drawCallsMain: Map<string, number>;
|
|
1282
|
+
/** Draw-call tally map for the overlay layer. Same contract as `drawCallsMain`. */
|
|
1283
|
+
readonly drawCallsOverlay: Map<string, number>;
|
|
1284
|
+
private readonly mainMs;
|
|
1285
|
+
private readonly overlayMs;
|
|
1286
|
+
private readonly mainStamps;
|
|
1287
|
+
private readonly overlayStamps;
|
|
1288
|
+
private readonly perSeriesMs;
|
|
1289
|
+
private readonly perSeriesStamps;
|
|
1290
|
+
private readonly listeners;
|
|
1291
|
+
private readonly windowMs;
|
|
1292
|
+
private readonly maxSamples;
|
|
1293
|
+
private readonly heapInterval;
|
|
1294
|
+
private heapCounter;
|
|
1295
|
+
private heapMb;
|
|
1296
|
+
private mainFrameCount;
|
|
1297
|
+
private overlayFrameCount;
|
|
1298
|
+
/** Most recent frame timestamp across either layer — anchor for age-based trimming. */
|
|
1299
|
+
private lastStamp;
|
|
1300
|
+
constructor(options?: PerfMonitorOptions);
|
|
1301
|
+
/** Clear the draw-call tally for the given layer. Call at the start of each frame. */
|
|
1302
|
+
resetDrawCalls(kind: FrameKind): void;
|
|
1303
|
+
/** Record a completed frame's wall-clock duration and emit stats to subscribers. */
|
|
1304
|
+
recordFrame(kind: FrameKind, ms: number, timestamp: number): void;
|
|
1305
|
+
/** Record one series renderer's time slice inside the main pass. Called from inside `renderMain`, so the enclosing `recordFrame('main', …)` trim takes care of age. */
|
|
1306
|
+
recordSeries(id: string, ms: number, timestamp?: number): void;
|
|
1307
|
+
/** Drop samples older than `windowMs` behind the newest recorded stamp, and enforce the hard per-layer cap. */
|
|
1308
|
+
private trimAll;
|
|
1309
|
+
/** Subscribe to per-frame stat snapshots. Returns an unsubscribe function. */
|
|
1310
|
+
onFrame(cb: (stats: PerfStats) => void): () => void;
|
|
1311
|
+
/** Snapshot current stats. Safe to call outside frames. */
|
|
1312
|
+
getStats(): PerfStats;
|
|
1313
|
+
destroy(): void;
|
|
1314
|
+
private sampleHeap;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
declare interface PerfMonitorOptions {
|
|
1318
|
+
/**
|
|
1319
|
+
* Age of the rolling window in milliseconds. Samples older than this are
|
|
1320
|
+
* dropped from FPS / percentile calculations. Defaults to 5000 (5 seconds).
|
|
1321
|
+
*
|
|
1322
|
+
* Tradeoff: smaller windows react faster to load changes but are noisier;
|
|
1323
|
+
* larger windows smooth spikes but lag. 5 s is a balance — it's long
|
|
1324
|
+
* enough that p95 is meaningful and short enough that numbers visibly
|
|
1325
|
+
* settle when you stop interacting.
|
|
1326
|
+
*/
|
|
1327
|
+
windowMs?: number;
|
|
1328
|
+
/**
|
|
1329
|
+
* Hard cap on retained samples per layer. Belt-and-suspenders against a
|
|
1330
|
+
* runaway high-FPS layer growing the buffer unbounded. Defaults to 2000.
|
|
1331
|
+
*/
|
|
1332
|
+
maxSamples?: number;
|
|
1333
|
+
/** Sample `performance.memory` every Nth main frame. Defaults to 30 (~0.5s at 60fps). */
|
|
1334
|
+
heapSampleEveryNFrames?: number;
|
|
1335
|
+
}
|
|
522
1336
|
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
1337
|
+
declare interface PerfStats {
|
|
1338
|
+
/**
|
|
1339
|
+
* Main-layer renders per second, derived from the interval between recent main
|
|
1340
|
+
* frames. Charts render on demand (data change, pan, zoom, resize, streaming
|
|
1341
|
+
* tick), so `0` during an idle chart is normal — not a stutter. `0` until two
|
|
1342
|
+
* frames have been recorded.
|
|
1343
|
+
*/
|
|
1344
|
+
mainRendersPerSec: number;
|
|
1345
|
+
/** Same as {@link mainRendersPerSec} but for the overlay (crosshair + pulse) layer. */
|
|
1346
|
+
overlayRendersPerSec: number;
|
|
1347
|
+
/** @deprecated Alias for {@link mainRendersPerSec}. Kept for older consumers. */
|
|
1348
|
+
fps: number;
|
|
1349
|
+
mainFrameMs: FrameTimingSample;
|
|
1350
|
+
overlayFrameMs: FrameTimingSample;
|
|
1351
|
+
/** Total frames recorded per layer. Lets consumers distinguish "no data yet" from "drew once and ms is 0". */
|
|
1352
|
+
frameCount: {
|
|
1353
|
+
main: number;
|
|
1354
|
+
overlay: number;
|
|
1355
|
+
};
|
|
1356
|
+
drawCalls: {
|
|
1357
|
+
main: Record<string, number>;
|
|
1358
|
+
overlay: Record<string, number>;
|
|
1359
|
+
};
|
|
1360
|
+
perSeries: Record<string, FrameTimingSample>;
|
|
1361
|
+
/** `null` on browsers without `performance.memory` (Firefox, Safari). */
|
|
1362
|
+
heapMb: number | null;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* How per-slice labels are drawn on a pie/donut.
|
|
1367
|
+
*
|
|
1368
|
+
* - `'outside'` (default) — a short leader line runs from the slice edge to a
|
|
1369
|
+
* text block outside the pie. Reserves horizontal space so the pie shrinks
|
|
1370
|
+
* to fit. Matches the canonical infographic look.
|
|
1371
|
+
* - `'inside'` — text sits on the slice. Auto-skipped when the measured text
|
|
1372
|
+
* won't fit the slice chord at the label radius.
|
|
1373
|
+
* - `'none'` — the renderer draws no labels (PieLegend / PieTooltip still work).
|
|
1374
|
+
*/
|
|
1375
|
+
declare interface PieLabelsOptions {
|
|
1376
|
+
/** Default: `'outside'`. */
|
|
1377
|
+
mode?: 'inside' | 'outside' | 'none';
|
|
1378
|
+
/** What to display per label. Default: `'both'` (e.g. `"BTC 42%"`). */
|
|
1379
|
+
content?: 'percent' | 'label' | 'both';
|
|
1380
|
+
/** Font size in CSS pixels. Default: 11. */
|
|
1381
|
+
fontSize?: number;
|
|
1382
|
+
/**
|
|
1383
|
+
* Slices narrower than this (in degrees) get no on-pie label. Default: 2.5°
|
|
1384
|
+
* (≈ 0.7% of the pie). Raise when many tiny slices would crowd the
|
|
1385
|
+
* de-cluster pass into unreadable overlaps.
|
|
1386
|
+
*/
|
|
1387
|
+
minSliceAngle?: number;
|
|
1388
|
+
/** Leader-line radial segment length in CSS pixels. Default: 12. */
|
|
1389
|
+
elbowLen?: number;
|
|
1390
|
+
/** Gap between leader line and text in CSS pixels. Default: 6. */
|
|
1391
|
+
legPad?: number;
|
|
1392
|
+
/**
|
|
1393
|
+
* Radial distance in CSS pixels from the pie's outer edge to the natural
|
|
1394
|
+
* label anchor point. The label then extends horizontally outward by
|
|
1395
|
+
* {@link railWidth} before the text starts. Clamped internally against
|
|
1396
|
+
* {@link elbowLen}. Default: 14.
|
|
1397
|
+
*/
|
|
1398
|
+
distance?: number;
|
|
1399
|
+
/**
|
|
1400
|
+
* Horizontal length of the final leader-line segment in CSS pixels — the
|
|
1401
|
+
* straight tail that runs from the radial elbow out to the text anchor.
|
|
1402
|
+
* Higher values give a longer visible "rail" before the label. Default: 16.
|
|
1403
|
+
*/
|
|
1404
|
+
railWidth?: number;
|
|
1405
|
+
/**
|
|
1406
|
+
* Minimum vertical gap between adjacent outside labels on the same side,
|
|
1407
|
+
* expressed as a multiplier of {@link fontSize}. Default: 1.8.
|
|
1408
|
+
*/
|
|
1409
|
+
labelGap?: number;
|
|
1410
|
+
/**
|
|
1411
|
+
* @deprecated No effect in the radial per-slice layout. A label's X is
|
|
1412
|
+
* pinned to its slice midangle, so forcing the "other" side would flip
|
|
1413
|
+
* text direction without moving the label and push text across the pie.
|
|
1414
|
+
* Kept in the option surface for backwards compatibility.
|
|
1415
|
+
*/
|
|
1416
|
+
balanceSides?: boolean;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
export declare const PieLegend: __VLS_WithTemplateSlots_4<typeof __VLS_component_4, __VLS_TemplateResult_4["slots"]>;
|
|
1420
|
+
|
|
1421
|
+
declare type PieLegendMode = 'value' | 'percent' | 'both';
|
|
1422
|
+
|
|
1423
|
+
export declare const PieSeries: DefineComponent<__VLS_Props_5, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_5> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
528
1424
|
|
|
529
1425
|
/** Visual options for a pie/donut series. `innerRadiusRatio > 0` makes it a donut. */
|
|
530
1426
|
export declare interface PieSeriesOptions {
|
|
531
1427
|
/** Palette fallback (defaults to theme.seriesColors). */
|
|
532
1428
|
colors?: string[];
|
|
533
|
-
/** 0 = pie, 0.6 = donut. Fraction of outer radius used as inner hole. */
|
|
1429
|
+
/** 0 = pie, 0.6 = donut. Fraction of the outer radius used as an inner hole. */
|
|
534
1430
|
innerRadiusRatio: number;
|
|
535
|
-
/** Gap between slices in
|
|
1431
|
+
/** Gap between slices in degrees. Default: 1.15° (≈ 0.02 rad). */
|
|
536
1432
|
padAngle: number;
|
|
537
|
-
/**
|
|
538
|
-
strokeColor: string;
|
|
539
|
-
/** Slice border width (default 0). */
|
|
540
|
-
strokeWidth: number;
|
|
541
|
-
/** Display label shown in tooltip. */
|
|
1433
|
+
/** Display the label shown in the tooltip. */
|
|
542
1434
|
label?: string;
|
|
1435
|
+
/** Per-slice label rendering on the pie itself. See {@link PieLabelsOptions}. */
|
|
1436
|
+
sliceLabels?: PieLabelsOptions;
|
|
1437
|
+
/**
|
|
1438
|
+
* When `true`, enables pie motion effects: the outside-label entrance
|
|
1439
|
+
* draw-in on mount / data swap, and the hover-explode slice offset.
|
|
1440
|
+
* Default: `false` — labels paint fully on the first frame and hovered
|
|
1441
|
+
* slices stay in place (hover feedback is left to the tooltip / legend /
|
|
1442
|
+
* cursor). Enable for presentations where the motion adds narrative
|
|
1443
|
+
* value.
|
|
1444
|
+
*/
|
|
1445
|
+
animate?: boolean;
|
|
1446
|
+
/**
|
|
1447
|
+
* Ambient *outer* drop-shadow behind each slice. Adds lift for flat
|
|
1448
|
+
* dashboards. Omit / `false` to disable (default). `true` uses soft
|
|
1449
|
+
* defaults; pass an object to tune individually.
|
|
1450
|
+
*/
|
|
1451
|
+
shadow?: boolean | {
|
|
1452
|
+
/** Shadow color. Default: `rgba(0, 0, 0, 0.22)`. */
|
|
1453
|
+
color?: string;
|
|
1454
|
+
/** Blur radius in CSS pixels. Default: 24. */
|
|
1455
|
+
blur?: number;
|
|
1456
|
+
/** Horizontal offset in CSS pixels. Default: 0. */
|
|
1457
|
+
offsetX?: number;
|
|
1458
|
+
/** Vertical offset in CSS pixels. Default: 10. */
|
|
1459
|
+
offsetY?: number;
|
|
1460
|
+
};
|
|
1461
|
+
/**
|
|
1462
|
+
* Inner rim darkening — a dark band near each slice's outer edge that
|
|
1463
|
+
* gives the pie an "inset" / pressed look. Implemented by extending the
|
|
1464
|
+
* per-slice radial gradient with a dark edge stop, so it pairs naturally
|
|
1465
|
+
* with the existing depth gradient. Omit / `false` to disable (default).
|
|
1466
|
+
*/
|
|
1467
|
+
innerShadow?: boolean | {
|
|
1468
|
+
/**
|
|
1469
|
+
* Rim color. Default: `rgba(0, 0, 0, 0.1)` (blended over the slice
|
|
1470
|
+
* color). Accepts any CSS color.
|
|
1471
|
+
*/
|
|
1472
|
+
color?: string;
|
|
1473
|
+
/**
|
|
1474
|
+
* Fraction of the slice's radial span covered by the darkened band
|
|
1475
|
+
* (0..1). Default: 0.3 — darkening starts at 70% of the radius.
|
|
1476
|
+
*/
|
|
1477
|
+
depth?: number;
|
|
1478
|
+
};
|
|
543
1479
|
}
|
|
544
1480
|
|
|
545
1481
|
/** Optional min/max constraints for the Y axis. Omit a side for automatic scaling. */
|
|
@@ -551,7 +1487,7 @@ export declare interface PieSliceData {
|
|
|
551
1487
|
color?: string;
|
|
552
1488
|
}
|
|
553
1489
|
|
|
554
|
-
export declare const PieTooltip:
|
|
1490
|
+
export declare const PieTooltip: __VLS_WithTemplateSlots_5<typeof __VLS_component_5, __VLS_TemplateResult_5["slots"]>;
|
|
555
1491
|
|
|
556
1492
|
export declare const quietLight: ThemePreset;
|
|
557
1493
|
|
|
@@ -567,6 +1503,32 @@ export declare const rosePineDawn: ThemePreset;
|
|
|
567
1503
|
|
|
568
1504
|
export declare const sandDune: ThemePreset;
|
|
569
1505
|
|
|
1506
|
+
/**
|
|
1507
|
+
* Frozen, per-row snapshot of a series at a single point in time. The shape
|
|
1508
|
+
* `buildHoverSnapshots` / `buildLastSnapshots` return to overlay slot
|
|
1509
|
+
* consumers.
|
|
1510
|
+
*
|
|
1511
|
+
* **Two identities, one snapshot:**
|
|
1512
|
+
* - `id` is the **row key** — guaranteed unique within the returned array,
|
|
1513
|
+
* safe for React `key`, Vue `:key`, Svelte `each … (key)`. For single-layer
|
|
1514
|
+
* series this equals the `seriesId`; for multi-layer series it's
|
|
1515
|
+
* `${seriesId}_layer${layerIndex}`.
|
|
1516
|
+
* - `seriesId` is the **owning series identity** — never carries a layer
|
|
1517
|
+
* suffix, not unique across multi-layer rows. Use it for filtering or
|
|
1518
|
+
* grouping (e.g. `snapshots.filter(s => s.seriesId === 'btc')`).
|
|
1519
|
+
*
|
|
1520
|
+
* `data` is a shallow clone, frozen along with the snapshot itself — a slot
|
|
1521
|
+
* consumer cannot accidentally mutate the chart's internal store.
|
|
1522
|
+
*/
|
|
1523
|
+
export declare interface SeriesSnapshot {
|
|
1524
|
+
readonly id: string;
|
|
1525
|
+
readonly seriesId: string;
|
|
1526
|
+
readonly layerIndex?: number;
|
|
1527
|
+
readonly label?: string;
|
|
1528
|
+
readonly data: Readonly<OHLCData> | Readonly<TimePoint>;
|
|
1529
|
+
readonly color: string;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
570
1532
|
/** Supported primary series types. */
|
|
571
1533
|
export declare type SeriesType = 'candlestick' | 'line' | 'bar' | 'pie';
|
|
572
1534
|
|
|
@@ -576,6 +1538,11 @@ declare interface Size {
|
|
|
576
1538
|
height: number;
|
|
577
1539
|
}
|
|
578
1540
|
|
|
1541
|
+
export declare type SliceInfo = HoverInfo;
|
|
1542
|
+
|
|
1543
|
+
/** Sort order applied to a snapshot list by the helper. */
|
|
1544
|
+
export declare type SnapshotSort = 'none' | 'asc' | 'desc';
|
|
1545
|
+
|
|
579
1546
|
export declare const solarizedLight: ThemePreset;
|
|
580
1547
|
|
|
581
1548
|
/** Stacking mode for bar/line series: off (overlap), normal (stacked), percent (100% stacked). */
|
|
@@ -615,9 +1582,6 @@ export declare interface ThemePreset {
|
|
|
615
1582
|
backgroundSize?: string;
|
|
616
1583
|
}
|
|
617
1584
|
|
|
618
|
-
/** All built-in themes keyed by display name */
|
|
619
|
-
export declare const themes: Record<string, ThemePreset>;
|
|
620
|
-
|
|
621
1585
|
export declare const TimeAxis: DefineComponent< {}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
622
1586
|
|
|
623
1587
|
/** A single time-value data point for line and bar series. Time is a timestamp in milliseconds. */
|
|
@@ -636,19 +1600,50 @@ declare class TimeScale {
|
|
|
636
1600
|
private to;
|
|
637
1601
|
private width;
|
|
638
1602
|
private pixelRatio;
|
|
639
|
-
|
|
1603
|
+
private dataInterval;
|
|
1604
|
+
private labelCountHintValue;
|
|
1605
|
+
private minSpacingValue;
|
|
1606
|
+
private resolvedInterval;
|
|
1607
|
+
private lastInterval;
|
|
1608
|
+
/**
|
|
1609
|
+
* "want" (desired interval post-floor) at the time lastInterval was snapped.
|
|
1610
|
+
* Hysteresis band anchors to this so micro range drift back across a tier
|
|
1611
|
+
* boundary doesn't flip the label density — mirrors YScale, see there for
|
|
1612
|
+
* the full reasoning.
|
|
1613
|
+
*/
|
|
1614
|
+
private lastWant;
|
|
1615
|
+
/** Identifies the dataInterval bucket whose tier list drove lastInterval. */
|
|
1616
|
+
private lastBucketKey;
|
|
1617
|
+
private get labelCountHint();
|
|
1618
|
+
private get minLabelSpacing();
|
|
1619
|
+
update(range: VisibleRange, mediaWidth: number, pixelRatio: number, dataInterval?: number): void;
|
|
1620
|
+
setLabelCount(n: number | null | undefined): void;
|
|
1621
|
+
setMinSpacing(px: number | null | undefined): void;
|
|
1622
|
+
private resetHysteresis;
|
|
640
1623
|
timeToX(time: number): number;
|
|
641
1624
|
timeToBitmapX(time: number): number;
|
|
642
1625
|
xToTime(x: number): number;
|
|
643
1626
|
pixelDeltaToTimeDelta(pixelDelta: number): number;
|
|
644
1627
|
barWidthMedia(dataInterval: number): number;
|
|
645
1628
|
barWidthBitmap(dataInterval: number): number;
|
|
1629
|
+
/**
|
|
1630
|
+
* Evenly spaced "nice" tick times. Resolution uses the cached
|
|
1631
|
+
* `dataInterval` set by `update()`; callers that bypass `update()` can
|
|
1632
|
+
* still pass it here for back-compat.
|
|
1633
|
+
*/
|
|
646
1634
|
niceTickValues(dataInterval: number): {
|
|
647
1635
|
ticks: number[];
|
|
648
1636
|
tickInterval: number;
|
|
649
1637
|
};
|
|
650
1638
|
getRange(): VisibleRange;
|
|
651
1639
|
getMediaWidth(): number;
|
|
1640
|
+
/**
|
|
1641
|
+
* Resolve the next tick interval. Walks `niceTimeIntervals(dataInterval)`
|
|
1642
|
+
* looking for the smallest tier ≥ desired spacing; retains the previous
|
|
1643
|
+
* tier inside a ratio band so micro pan/zoom doesn't flip label density.
|
|
1644
|
+
*/
|
|
1645
|
+
private resolveInterval;
|
|
1646
|
+
private countTicks;
|
|
652
1647
|
}
|
|
653
1648
|
|
|
654
1649
|
/**
|
|
@@ -657,11 +1652,49 @@ declare class TimeScale {
|
|
|
657
1652
|
*/
|
|
658
1653
|
export declare type TimeValue = number | Date;
|
|
659
1654
|
|
|
660
|
-
export declare const
|
|
661
|
-
|
|
662
|
-
|
|
1655
|
+
export declare const Title: __VLS_WithTemplateSlots_6<typeof __VLS_component_6, __VLS_TemplateResult_6["slots"]>;
|
|
1656
|
+
|
|
1657
|
+
export declare const Tooltip: __VLS_WithTemplateSlots_7<typeof __VLS_component_7, __VLS_TemplateResult_7["slots"]>;
|
|
1658
|
+
|
|
1659
|
+
/** Fields surfaced to a `Tooltip` / `InfoBar` formatter. */
|
|
1660
|
+
export declare type TooltipField = 'open' | 'high' | 'low' | 'close' | 'volume' | 'value';
|
|
1661
|
+
|
|
1662
|
+
/** Signature for the tooltip formatter — single prop, field hint. */
|
|
1663
|
+
export declare type TooltipFormatter = (value: number, field: TooltipField) => string;
|
|
1664
|
+
|
|
1665
|
+
export declare interface TooltipPosition {
|
|
1666
|
+
left: number;
|
|
1667
|
+
top: number;
|
|
1668
|
+
}
|
|
663
1669
|
|
|
664
|
-
|
|
1670
|
+
/**
|
|
1671
|
+
* Pure positioning for a floating tooltip. Flip the tooltip to the other
|
|
1672
|
+
* side of the cursor when the preferred side would overflow, then clamp
|
|
1673
|
+
* into `[0, chart - size]` so the flipped side can't spill past the
|
|
1674
|
+
* opposite edge either.
|
|
1675
|
+
*
|
|
1676
|
+
* Works for time-series tooltips anchoring to the crosshair and pie
|
|
1677
|
+
* tooltips anchoring to a slice centroid alike — pass the chart bounds
|
|
1678
|
+
* that match the overlay container (media size minus axis gutters for
|
|
1679
|
+
* time-series, full media size for pie).
|
|
1680
|
+
*/
|
|
1681
|
+
export declare interface TooltipPositionArgs {
|
|
1682
|
+
/** Cursor or anchor x in CSS pixels, relative to the chart area origin. */
|
|
1683
|
+
x: number;
|
|
1684
|
+
/** Cursor or anchor y in CSS pixels, relative to the chart area origin. */
|
|
1685
|
+
y: number;
|
|
1686
|
+
/** Plot-area width in CSS pixels. */
|
|
1687
|
+
chartWidth: number;
|
|
1688
|
+
/** Plot-area height in CSS pixels. */
|
|
1689
|
+
chartHeight: number;
|
|
1690
|
+
/** Tooltip box width in CSS pixels. */
|
|
1691
|
+
tooltipWidth: number;
|
|
1692
|
+
/** Tooltip box height in CSS pixels. */
|
|
1693
|
+
tooltipHeight: number;
|
|
1694
|
+
/** Gap between anchor and tooltip. Defaults to 16. */
|
|
1695
|
+
offsetX?: number;
|
|
1696
|
+
offsetY?: number;
|
|
1697
|
+
}
|
|
665
1698
|
|
|
666
1699
|
/** Font family and size tokens used across the chart. */
|
|
667
1700
|
export declare interface Typography {
|
|
@@ -689,6 +1722,28 @@ export declare function useVisibleRange(chart: ChartInstance): Ref<VisibleRange>
|
|
|
689
1722
|
|
|
690
1723
|
export declare function useYRange(chart: ChartInstance): Ref<YRange>;
|
|
691
1724
|
|
|
1725
|
+
/**
|
|
1726
|
+
* Default value formatters used across the chart library.
|
|
1727
|
+
*
|
|
1728
|
+
* Two shapes are exposed:
|
|
1729
|
+
* - `formatCompact` — compact K/M/B/T suffixes for large magnitudes, adaptive
|
|
1730
|
+
* precision for values < 1. Intended for axis labels, legends, pie slices.
|
|
1731
|
+
* - `formatPriceAdaptive` — full-precision display that scales decimal count
|
|
1732
|
+
* to the magnitude. Intended for tooltip rows where users want to read the
|
|
1733
|
+
* exact number.
|
|
1734
|
+
*
|
|
1735
|
+
* Both handle the full range of JS numbers the library is likely to see:
|
|
1736
|
+
* - 0, ±Infinity, NaN
|
|
1737
|
+
* - BTC-style sub-cent prices (0.00001234 → "0.00001234", not "1.234e-5")
|
|
1738
|
+
* - trillion-scale values (5.4e12 → "5.40T")
|
|
1739
|
+
* - Number.MAX_SAFE_INTEGER falls back to scientific notation (>= 1e15)
|
|
1740
|
+
*
|
|
1741
|
+
* Consumers can import these directly, or swap them in per-component via the
|
|
1742
|
+
* `format` prop on Tooltip/InfoBar/YAxis/etc. (see framework wrappers).
|
|
1743
|
+
*/
|
|
1744
|
+
/** Signature for a value-to-string formatter (YAxis, YLabel, Pie, Sparkline, NumberFlow). */
|
|
1745
|
+
export declare type ValueFormatter = (value: number) => string;
|
|
1746
|
+
|
|
692
1747
|
/** Time range (timestamps in milliseconds) of the currently visible portion of the chart. */
|
|
693
1748
|
export declare interface VisibleRange {
|
|
694
1749
|
from: number;
|
|
@@ -697,17 +1752,17 @@ export declare interface VisibleRange {
|
|
|
697
1752
|
|
|
698
1753
|
/** Configuration for the X (time) axis. */
|
|
699
1754
|
export declare interface XAxisConfig {
|
|
700
|
-
/** Height in pixels. Default: 30. */
|
|
1755
|
+
/** Height in CSS pixels. Default: 30. */
|
|
701
1756
|
height?: number;
|
|
702
1757
|
/** Whether the axis is visible. Default: true. When false, height is treated as 0. */
|
|
703
1758
|
visible?: boolean;
|
|
704
1759
|
}
|
|
705
1760
|
|
|
706
|
-
export declare const YAxis: DefineComponent<
|
|
1761
|
+
export declare const YAxis: DefineComponent<__VLS_Props_13, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_13> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
707
1762
|
|
|
708
1763
|
/** Configuration for the Y axis. */
|
|
709
1764
|
export declare interface YAxisConfig {
|
|
710
|
-
/** Width in pixels. Default: 55. */
|
|
1765
|
+
/** Width in CSS pixels. Default: 55. */
|
|
711
1766
|
width?: number;
|
|
712
1767
|
/** Minimum bound. Default: 'auto'. */
|
|
713
1768
|
min?: AxisBound;
|
|
@@ -717,7 +1772,10 @@ export declare interface YAxisConfig {
|
|
|
717
1772
|
visible?: boolean;
|
|
718
1773
|
}
|
|
719
1774
|
|
|
720
|
-
export declare const YLabel:
|
|
1775
|
+
export declare const YLabel: __VLS_WithTemplateSlots_8<typeof __VLS_component_8, __VLS_TemplateResult_8["slots"]>;
|
|
1776
|
+
|
|
1777
|
+
/** Direction of the current value vs. previous close. Drives the badge color in the default UI. */
|
|
1778
|
+
declare type YLabelDirection = 'up' | 'down' | 'neutral';
|
|
721
1779
|
|
|
722
1780
|
/** Min/max value range for the Y axis. */
|
|
723
1781
|
export declare interface YRange {
|
|
@@ -734,20 +1792,69 @@ declare class YScale {
|
|
|
734
1792
|
private max;
|
|
735
1793
|
private height;
|
|
736
1794
|
private pixelRatio;
|
|
1795
|
+
private labelCountHintValue;
|
|
1796
|
+
private minSpacingValue;
|
|
1797
|
+
/** Cached {1,2,5}×10^k interval resolved at update-time; null when degenerate. */
|
|
1798
|
+
private resolvedInterval;
|
|
1799
|
+
/** Previous resolved interval — drives the ratio-band hysteresis. */
|
|
1800
|
+
private lastInterval;
|
|
1801
|
+
/**
|
|
1802
|
+
* rawInterval at the moment `lastInterval` was snapped. Anchoring the
|
|
1803
|
+
* hysteresis band to *raw-at-snap* (not `lastInterval`) is what creates
|
|
1804
|
+
* naturally asymmetric tier hysteresis: after an escalation the band
|
|
1805
|
+
* starts just above the tier boundary, so live range drift back across
|
|
1806
|
+
* the boundary doesn't instantly flip back.
|
|
1807
|
+
*/
|
|
1808
|
+
private lastRawInterval;
|
|
1809
|
+
/** Custom formatter (driven by `<YAxis format=…>`). */
|
|
1810
|
+
private customFormat;
|
|
1811
|
+
private get labelCountHint();
|
|
1812
|
+
private get minLabelSpacing();
|
|
737
1813
|
/** Recalculate the scale with a new Y range, chart height, and device pixel ratio. */
|
|
738
1814
|
update(range: YRange, mediaHeight: number, pixelRatio: number): void;
|
|
1815
|
+
/** Desired label count. Invalid values (NaN, <2, Infinity) clear the hint. */
|
|
1816
|
+
setLabelCount(n: number | null | undefined): void;
|
|
1817
|
+
/** Minimum pixel gap between adjacent labels. */
|
|
1818
|
+
setMinSpacing(px: number | null | undefined): void;
|
|
1819
|
+
private resetHysteresis;
|
|
1820
|
+
/** Install (or clear) a custom formatter. */
|
|
1821
|
+
setFormat(fn: ValueFormatter | null): void;
|
|
1822
|
+
/** Read back the currently installed formatter — null when the built-in is active. */
|
|
1823
|
+
getFormat(): ValueFormatter | null;
|
|
739
1824
|
/** Convert a value to a Y position in CSS (media) pixels. */
|
|
740
1825
|
valueToY(value: number): number;
|
|
741
1826
|
/** Convert a value to a Y position in physical (bitmap) pixels. */
|
|
742
1827
|
valueToBitmapY(value: number): number;
|
|
743
1828
|
/** Convert a Y position in CSS pixels back to a value. */
|
|
744
1829
|
yToValue(y: number): number;
|
|
745
|
-
/**
|
|
1830
|
+
/**
|
|
1831
|
+
* Generate evenly spaced "nice" tick values for the current range and
|
|
1832
|
+
* chart height. Pure read — resolution happens in `update()`.
|
|
1833
|
+
*/
|
|
746
1834
|
niceTickValues(): number[];
|
|
747
1835
|
getRange(): YRange;
|
|
748
1836
|
getMediaHeight(): number;
|
|
749
|
-
/**
|
|
1837
|
+
/**
|
|
1838
|
+
* Format a tick value for display. When a custom formatter is installed
|
|
1839
|
+
* (via {@link setFormat} or the `format` prop on `<YAxis>`), it wins;
|
|
1840
|
+
* otherwise decimals are driven by the resolved tick interval — so
|
|
1841
|
+
* ticks at step 100 never render as "42000.0" just because the visible
|
|
1842
|
+
* range happens to be < 1000.
|
|
1843
|
+
*/
|
|
750
1844
|
formatY(value: number): string;
|
|
1845
|
+
/**
|
|
1846
|
+
* Resolve the interval to a {1,2,5}×10^k tick size that satisfies the pixel
|
|
1847
|
+
* floor and (optionally) targets `labelCountHint` labels.
|
|
1848
|
+
*
|
|
1849
|
+
* Hysteresis: the band [0.8×, 1.25×] is anchored to **rawInterval at last
|
|
1850
|
+
* snap**, not to `lastInterval`. After an escalation (e.g. 100 → 200),
|
|
1851
|
+
* `lastRawInterval` sits just past the tier boundary, so typical live
|
|
1852
|
+
* range drift back across the boundary stays inside the band and does
|
|
1853
|
+
* *not* de-escalate. This prevents the 2-tier flicker users see when new
|
|
1854
|
+
* candles nudge the Y range across a raw-interval threshold.
|
|
1855
|
+
*/
|
|
1856
|
+
private resolveInterval;
|
|
1857
|
+
private countTicks;
|
|
751
1858
|
}
|
|
752
1859
|
|
|
753
1860
|
export { }
|