@photonviz/core 0.3.0 → 0.3.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 +14 -5
- package/dist/index.d.ts +1361 -6
- package/dist/index.js +3774 -746
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,13 @@ type Dim = "x" | "y";
|
|
|
68
68
|
* - `box-y` drag selects a y-range only (full width band) — Y-only zoom
|
|
69
69
|
*/
|
|
70
70
|
type InteractionMode = "pan" | "box" | "box-x" | "box-y";
|
|
71
|
+
/**
|
|
72
|
+
* How a layer expects its data to change, mapped to a WebGL buffer-usage hint:
|
|
73
|
+
* `"static"` → `STATIC_DRAW` (upload once), `"dynamic"` → `DYNAMIC_DRAW` (stream
|
|
74
|
+
* via `setData`). Purely a performance hint — `setData` works either way. Default
|
|
75
|
+
* `"static"`. Set `"dynamic"` on layers you update every frame.
|
|
76
|
+
*/
|
|
77
|
+
type RenderType = "static" | "dynamic";
|
|
71
78
|
type Range = readonly [number, number];
|
|
72
79
|
interface Bounds {
|
|
73
80
|
x: Range;
|
|
@@ -131,6 +138,8 @@ interface AreaOptions {
|
|
|
131
138
|
/** Lower edge(s). Number or per-point array — pass cumulative to stack. */
|
|
132
139
|
base?: number | ArrayLike<number>;
|
|
133
140
|
color?: string | Color;
|
|
141
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
142
|
+
renderType?: RenderType;
|
|
134
143
|
name?: string;
|
|
135
144
|
yAxis?: string;
|
|
136
145
|
}
|
|
@@ -146,6 +155,7 @@ declare class AreaLayer implements Layer {
|
|
|
146
155
|
private uniforms;
|
|
147
156
|
private vertexCount;
|
|
148
157
|
private color;
|
|
158
|
+
private usage;
|
|
149
159
|
private xRef;
|
|
150
160
|
private yRef;
|
|
151
161
|
private xBounds;
|
|
@@ -179,6 +189,13 @@ interface BarOptions {
|
|
|
179
189
|
*/
|
|
180
190
|
orientation?: "v" | "h";
|
|
181
191
|
color?: string | Color;
|
|
192
|
+
/**
|
|
193
|
+
* Per-bar colors (overrides {@link color}). Handy for tinting each bar — e.g.
|
|
194
|
+
* volume bars green/red by the candle's direction. Length should match `x`.
|
|
195
|
+
*/
|
|
196
|
+
colors?: Array<string | Color>;
|
|
197
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
198
|
+
renderType?: RenderType;
|
|
182
199
|
name?: string;
|
|
183
200
|
yAxis?: string;
|
|
184
201
|
}
|
|
@@ -194,6 +211,8 @@ declare class BarLayer implements Layer {
|
|
|
194
211
|
private uniforms;
|
|
195
212
|
private count;
|
|
196
213
|
private color;
|
|
214
|
+
private colorsInput?;
|
|
215
|
+
private usage;
|
|
197
216
|
private barWidth;
|
|
198
217
|
private offset;
|
|
199
218
|
private orientation;
|
|
@@ -202,9 +221,11 @@ declare class BarLayer implements Layer {
|
|
|
202
221
|
private xBounds;
|
|
203
222
|
private yBounds;
|
|
204
223
|
constructor(gl: WebGL2RenderingContext, opts: BarOptions);
|
|
224
|
+
/** Per-bar color array (each bar uses its `colors[i]` or falls back to `color`). */
|
|
225
|
+
private buildColors;
|
|
205
226
|
private buildRects;
|
|
206
|
-
/** Replace bar values and re-upload
|
|
207
|
-
setData(x: ArrayLike<number>, y: ArrayLike<number>, base?: number | ArrayLike<number>): void;
|
|
227
|
+
/** Replace bar values (and optionally per-bar colors) and re-upload for streaming. */
|
|
228
|
+
setData(x: ArrayLike<number>, y: ArrayLike<number>, base?: number | ArrayLike<number>, colors?: Array<string | Color>): void;
|
|
208
229
|
bounds(): {
|
|
209
230
|
x: Range;
|
|
210
231
|
y: Range;
|
|
@@ -228,6 +249,8 @@ interface BoxOptions {
|
|
|
228
249
|
box?: boolean;
|
|
229
250
|
/** Draw a violin (KDE) shape behind/instead of the box (default false). */
|
|
230
251
|
violin?: boolean;
|
|
252
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
253
|
+
renderType?: RenderType;
|
|
231
254
|
yAxis?: string;
|
|
232
255
|
}
|
|
233
256
|
declare class BoxLayer implements Layer {
|
|
@@ -247,7 +270,15 @@ declare class BoxLayer implements Layer {
|
|
|
247
270
|
private lineCount;
|
|
248
271
|
private pointStart;
|
|
249
272
|
private pointCount;
|
|
273
|
+
private width;
|
|
274
|
+
private showBox;
|
|
275
|
+
private showViolin;
|
|
276
|
+
private usage;
|
|
250
277
|
constructor(gl: WebGL2RenderingContext, opts: BoxOptions);
|
|
278
|
+
/** Build box/whisker/violin geometry from the groups; sets refs, bounds and draw ranges. */
|
|
279
|
+
private build;
|
|
280
|
+
/** Replace the box groups and rebuild the geometry (for streaming). */
|
|
281
|
+
setData(groups: BoxGroup[], width?: number): void;
|
|
251
282
|
bounds(): {
|
|
252
283
|
x: Range;
|
|
253
284
|
y: Range;
|
|
@@ -271,9 +302,29 @@ interface CandlestickOptions {
|
|
|
271
302
|
downColor?: string | Color;
|
|
272
303
|
/** Wick thickness in CSS px. Default 1.5. */
|
|
273
304
|
wickWidth?: number;
|
|
305
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
306
|
+
renderType?: RenderType;
|
|
274
307
|
name?: string;
|
|
275
308
|
yAxis?: string;
|
|
276
309
|
}
|
|
310
|
+
/** The OHLC of a single candle — used by {@link CandlestickLayer.updateLast}/`appendCandle`. */
|
|
311
|
+
interface Candle {
|
|
312
|
+
x: number;
|
|
313
|
+
open: number;
|
|
314
|
+
high: number;
|
|
315
|
+
low: number;
|
|
316
|
+
close: number;
|
|
317
|
+
}
|
|
318
|
+
/** New OHLC arrays for {@link CandlestickLayer.setData} (colors/width stay fixed). */
|
|
319
|
+
interface CandlestickData {
|
|
320
|
+
x: ArrayLike<number>;
|
|
321
|
+
open: ArrayLike<number>;
|
|
322
|
+
high: ArrayLike<number>;
|
|
323
|
+
low: ArrayLike<number>;
|
|
324
|
+
close: ArrayLike<number>;
|
|
325
|
+
/** Optional new body width; keeps the previous width if omitted. */
|
|
326
|
+
width?: number;
|
|
327
|
+
}
|
|
277
328
|
declare class CandlestickLayer implements Layer {
|
|
278
329
|
readonly id: string;
|
|
279
330
|
readonly name: string;
|
|
@@ -287,12 +338,120 @@ declare class CandlestickLayer implements Layer {
|
|
|
287
338
|
private uBody;
|
|
288
339
|
private uWick;
|
|
289
340
|
private wickWidth;
|
|
341
|
+
private usage;
|
|
342
|
+
private up;
|
|
343
|
+
private down;
|
|
344
|
+
/** Body width in data units (median-derived unless the user fixed it). */
|
|
345
|
+
private bodyWidth;
|
|
346
|
+
private explicitWidth;
|
|
347
|
+
private xs;
|
|
348
|
+
private os;
|
|
349
|
+
private hs;
|
|
350
|
+
private ls;
|
|
351
|
+
private cs;
|
|
352
|
+
private rects;
|
|
353
|
+
private wicks;
|
|
354
|
+
private colors;
|
|
290
355
|
private count;
|
|
291
356
|
private xRef;
|
|
292
357
|
private yRef;
|
|
293
358
|
private xBounds;
|
|
294
359
|
private yBounds;
|
|
295
360
|
constructor(gl: WebGL2RenderingContext, opts: CandlestickOptions);
|
|
361
|
+
/** Copy the incoming OHLC arrays into the retained plain arrays. */
|
|
362
|
+
private ingest;
|
|
363
|
+
/** Write candle `i`'s body rect, wick segment and up/down color into the arrays. */
|
|
364
|
+
private emitCandle;
|
|
365
|
+
/** Recompute width/refs/bounds and refill the vertex arrays from the retained OHLC. */
|
|
366
|
+
private rebuild;
|
|
367
|
+
/** Re-upload all three per-candle buffers (after a full rebuild). */
|
|
368
|
+
private upload;
|
|
369
|
+
/** Replace every candle and re-upload (for streaming a whole new window). */
|
|
370
|
+
setData(data: CandlestickData): void;
|
|
371
|
+
/**
|
|
372
|
+
* Append one new candle (grows the series). Prefer {@link updateLast} for the
|
|
373
|
+
* in-progress candle and `appendCandle` only when a bar closes and a new one opens.
|
|
374
|
+
*/
|
|
375
|
+
appendCandle(c: Candle): void;
|
|
376
|
+
/**
|
|
377
|
+
* Update the most recent candle in place — the cheap hot path for a live
|
|
378
|
+
* (forming) bar. Only that candle's 12 floats are re-uploaded; bounds are
|
|
379
|
+
* extended (never shrunk) to include it. No-op when the series is empty.
|
|
380
|
+
*/
|
|
381
|
+
updateLast(c: Candle): void;
|
|
382
|
+
bounds(): {
|
|
383
|
+
x: Range;
|
|
384
|
+
y: Range;
|
|
385
|
+
} | null;
|
|
386
|
+
draw(state: DrawState): void;
|
|
387
|
+
dispose(): void;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* An OHLC bar chart — the western cousin of the candlestick. Each period is a
|
|
392
|
+
* vertical low→high line with a left tick at the open and a right tick at the
|
|
393
|
+
* close, colored up/down by direction. Streams like {@link CandlestickLayer}.
|
|
394
|
+
*/
|
|
395
|
+
interface OhlcOptions {
|
|
396
|
+
/** Bar positions (data space — e.g. epoch ms on a time axis). */
|
|
397
|
+
x: ArrayLike<number>;
|
|
398
|
+
open: ArrayLike<number>;
|
|
399
|
+
high: ArrayLike<number>;
|
|
400
|
+
low: ArrayLike<number>;
|
|
401
|
+
close: ArrayLike<number>;
|
|
402
|
+
/** Total tick span in data units (each open/close tick is half of this). Default 70% of median spacing. */
|
|
403
|
+
width?: number;
|
|
404
|
+
/** Close ≥ open color. Default green. */
|
|
405
|
+
upColor?: string | Color;
|
|
406
|
+
/** Close < open color. Default red. */
|
|
407
|
+
downColor?: string | Color;
|
|
408
|
+
/** Line thickness in CSS px. Default 1.5. */
|
|
409
|
+
lineWidth?: number;
|
|
410
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
411
|
+
renderType?: RenderType;
|
|
412
|
+
name?: string;
|
|
413
|
+
yAxis?: string;
|
|
414
|
+
}
|
|
415
|
+
declare class OhlcLayer implements Layer {
|
|
416
|
+
readonly id: string;
|
|
417
|
+
readonly name: string;
|
|
418
|
+
readonly colorCss: string;
|
|
419
|
+
readonly yAxis: string;
|
|
420
|
+
private gl;
|
|
421
|
+
private program;
|
|
422
|
+
private vao;
|
|
423
|
+
private buffers;
|
|
424
|
+
private uniforms;
|
|
425
|
+
private lineWidth;
|
|
426
|
+
private usage;
|
|
427
|
+
private up;
|
|
428
|
+
private down;
|
|
429
|
+
private barWidth;
|
|
430
|
+
private explicitWidth;
|
|
431
|
+
private xs;
|
|
432
|
+
private os;
|
|
433
|
+
private hs;
|
|
434
|
+
private ls;
|
|
435
|
+
private cs;
|
|
436
|
+
private segs;
|
|
437
|
+
private colors;
|
|
438
|
+
private count;
|
|
439
|
+
private xRef;
|
|
440
|
+
private yRef;
|
|
441
|
+
private xBounds;
|
|
442
|
+
private yBounds;
|
|
443
|
+
constructor(gl: WebGL2RenderingContext, opts: OhlcOptions);
|
|
444
|
+
private ingest;
|
|
445
|
+
/** Write bar `i`'s three segments (+ colors) at instance base `i * SEGS_PER_BAR`. */
|
|
446
|
+
private emitBar;
|
|
447
|
+
private rebuild;
|
|
448
|
+
private upload;
|
|
449
|
+
/** Replace every bar and re-upload (for streaming a whole new window). */
|
|
450
|
+
setData(data: CandlestickData): void;
|
|
451
|
+
/** Append one new bar (grows the series). */
|
|
452
|
+
appendCandle(c: Candle): void;
|
|
453
|
+
/** Update the most recent bar in place — the cheap hot path for a live bar. */
|
|
454
|
+
updateLast(c: Candle): void;
|
|
296
455
|
bounds(): {
|
|
297
456
|
x: Range;
|
|
298
457
|
y: Range;
|
|
@@ -326,6 +485,8 @@ interface ContourOptions {
|
|
|
326
485
|
/** Single line color; if omitted, levels are colored by a colormap. */
|
|
327
486
|
color?: string | Color;
|
|
328
487
|
colormap?: ColormapName;
|
|
488
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
489
|
+
renderType?: RenderType;
|
|
329
490
|
yAxis?: string;
|
|
330
491
|
}
|
|
331
492
|
declare class ContourLayer implements Layer {
|
|
@@ -340,7 +501,17 @@ declare class ContourLayer implements Layer {
|
|
|
340
501
|
private xRef;
|
|
341
502
|
private yRef;
|
|
342
503
|
private ext;
|
|
504
|
+
private cols;
|
|
505
|
+
private rows;
|
|
506
|
+
private levelsOpt;
|
|
507
|
+
private cmap;
|
|
508
|
+
private fixedColor;
|
|
509
|
+
private usage;
|
|
343
510
|
constructor(gl: WebGL2RenderingContext, opts: ContourOptions);
|
|
511
|
+
/** Marching-squares the scalar field into iso-line segments; sets vertexCount. */
|
|
512
|
+
private build;
|
|
513
|
+
/** Replace the scalar field and recompute the iso lines (for streaming). */
|
|
514
|
+
setData(values: ArrayLike<number>, cols?: number, rows?: number): void;
|
|
344
515
|
bounds(): {
|
|
345
516
|
x: Range;
|
|
346
517
|
y: Range;
|
|
@@ -372,9 +543,20 @@ interface ErrorBarOptions {
|
|
|
372
543
|
band?: boolean;
|
|
373
544
|
/** Band fill opacity. Default 0.2. */
|
|
374
545
|
bandOpacity?: number;
|
|
546
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
547
|
+
renderType?: RenderType;
|
|
375
548
|
name?: string;
|
|
376
549
|
yAxis?: string;
|
|
377
550
|
}
|
|
551
|
+
/** New positions/errors for {@link ErrorBarLayer.setData} (styling stays fixed). */
|
|
552
|
+
interface ErrorBarData {
|
|
553
|
+
x: ArrayLike<number>;
|
|
554
|
+
y: ArrayLike<number>;
|
|
555
|
+
yerr?: ErrInput;
|
|
556
|
+
yerrLow?: ErrInput;
|
|
557
|
+
yerrHigh?: ErrInput;
|
|
558
|
+
xerr?: ErrInput;
|
|
559
|
+
}
|
|
378
560
|
declare class ErrorBarLayer implements Layer {
|
|
379
561
|
readonly id: string;
|
|
380
562
|
readonly name: string;
|
|
@@ -395,6 +577,7 @@ declare class ErrorBarLayer implements Layer {
|
|
|
395
577
|
private bandOpacity;
|
|
396
578
|
private showWhiskers;
|
|
397
579
|
private showBand;
|
|
580
|
+
private usage;
|
|
398
581
|
private segCount;
|
|
399
582
|
private capCount;
|
|
400
583
|
private bandVerts;
|
|
@@ -403,6 +586,10 @@ declare class ErrorBarLayer implements Layer {
|
|
|
403
586
|
private xBounds;
|
|
404
587
|
private yBounds;
|
|
405
588
|
constructor(gl: WebGL2RenderingContext, opts: ErrorBarOptions);
|
|
589
|
+
/** Recompute refs/bounds/counts and the whisker/cap/band vertex arrays from new data. */
|
|
590
|
+
private build;
|
|
591
|
+
/** Replace the data and re-upload (for streaming). */
|
|
592
|
+
setData(data: ErrorBarData): void;
|
|
406
593
|
bounds(): {
|
|
407
594
|
x: Range;
|
|
408
595
|
y: Range;
|
|
@@ -421,9 +608,20 @@ interface GraphOptions {
|
|
|
421
608
|
/** Node diameter in CSS pixels. Default 10. */
|
|
422
609
|
nodeSize?: number;
|
|
423
610
|
edgeColor?: string | Color;
|
|
611
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
612
|
+
renderType?: RenderType;
|
|
424
613
|
name?: string;
|
|
425
614
|
yAxis?: string;
|
|
426
615
|
}
|
|
616
|
+
/** New nodes/edges for {@link GraphLayer.setData} (colors/size stay fixed). */
|
|
617
|
+
interface GraphData {
|
|
618
|
+
/** Node positions. Omit both to run a force layout from `edges`. */
|
|
619
|
+
x?: ArrayLike<number>;
|
|
620
|
+
y?: ArrayLike<number>;
|
|
621
|
+
edges: ReadonlyArray<readonly [number, number]>;
|
|
622
|
+
/** Node count for the force layout when `x`/`y` are omitted. Defaults to max edge index + 1. */
|
|
623
|
+
nodeCount?: number;
|
|
624
|
+
}
|
|
427
625
|
/** A node-link graph: edges as line segments, nodes as round points. */
|
|
428
626
|
declare class GraphLayer implements Layer {
|
|
429
627
|
readonly id: string;
|
|
@@ -446,7 +644,15 @@ declare class GraphLayer implements Layer {
|
|
|
446
644
|
private yRef;
|
|
447
645
|
private xBounds;
|
|
448
646
|
private yBounds;
|
|
647
|
+
private usage;
|
|
449
648
|
constructor(gl: WebGL2RenderingContext, opts: GraphOptions);
|
|
649
|
+
/** Build node/edge vertex arrays from positions + edges; sets counts, refs and bounds. */
|
|
650
|
+
private build;
|
|
651
|
+
/**
|
|
652
|
+
* Replace nodes and edges (for streaming). When `x`/`y` are omitted, node
|
|
653
|
+
* positions are recomputed with the package's force layout from the edges.
|
|
654
|
+
*/
|
|
655
|
+
setData(data: GraphData): void;
|
|
450
656
|
bounds(): {
|
|
451
657
|
x: Range;
|
|
452
658
|
y: Range;
|
|
@@ -470,6 +676,8 @@ interface HeatmapOptions {
|
|
|
470
676
|
domain?: Range;
|
|
471
677
|
/** Bilinear filtering (default true) vs. hard cells. */
|
|
472
678
|
smooth?: boolean;
|
|
679
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
680
|
+
renderType?: RenderType;
|
|
473
681
|
yAxis?: string;
|
|
474
682
|
}
|
|
475
683
|
declare class HeatmapLayer implements Layer {
|
|
@@ -484,7 +692,15 @@ declare class HeatmapLayer implements Layer {
|
|
|
484
692
|
private xRef;
|
|
485
693
|
private yRef;
|
|
486
694
|
private ext;
|
|
695
|
+
private lut;
|
|
696
|
+
private fixedDomain;
|
|
697
|
+
private cols;
|
|
698
|
+
private rows;
|
|
487
699
|
constructor(gl: WebGL2RenderingContext, opts: HeatmapOptions);
|
|
700
|
+
/** Bake a `cols*rows` value grid into the RGBA data texture via the colormap. */
|
|
701
|
+
private uploadValues;
|
|
702
|
+
/** Replace the value grid and re-bake the data texture (for streaming). */
|
|
703
|
+
setData(values: ArrayLike<number>, cols?: number, rows?: number): void;
|
|
488
704
|
bounds(): {
|
|
489
705
|
x: Range;
|
|
490
706
|
y: Range;
|
|
@@ -501,6 +717,8 @@ interface HexbinOptions {
|
|
|
501
717
|
colormap?: ColormapName;
|
|
502
718
|
/** Count range mapped to the colormap. Defaults to [1, maxCount]. */
|
|
503
719
|
domain?: Range;
|
|
720
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
721
|
+
renderType?: RenderType;
|
|
504
722
|
yAxis?: string;
|
|
505
723
|
}
|
|
506
724
|
declare class HexbinLayer implements Layer {
|
|
@@ -517,7 +735,15 @@ declare class HexbinLayer implements Layer {
|
|
|
517
735
|
private yRef;
|
|
518
736
|
private xBounds;
|
|
519
737
|
private yBounds;
|
|
738
|
+
private cmap;
|
|
739
|
+
private explicitRadius;
|
|
740
|
+
private domain;
|
|
741
|
+
private usage;
|
|
520
742
|
constructor(gl: WebGL2RenderingContext, opts: HexbinOptions);
|
|
743
|
+
/** Bin the points into hex cells; sets radius, refs, bounds and cell count. */
|
|
744
|
+
private build;
|
|
745
|
+
/** Replace the point arrays, re-bin and re-upload the cells (for streaming). */
|
|
746
|
+
setData(x: ArrayLike<number>, y: ArrayLike<number>): void;
|
|
521
747
|
bounds(): {
|
|
522
748
|
x: Range;
|
|
523
749
|
y: Range;
|
|
@@ -542,6 +768,8 @@ interface ImageOptions {
|
|
|
542
768
|
opacity?: number;
|
|
543
769
|
/** Called after an async (URL) image finishes loading — wire to `plot.requestRender`. */
|
|
544
770
|
onLoad?: () => void;
|
|
771
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
772
|
+
renderType?: RenderType;
|
|
545
773
|
name?: string;
|
|
546
774
|
yAxis?: string;
|
|
547
775
|
}
|
|
@@ -570,6 +798,10 @@ declare class ImageLayer implements Layer {
|
|
|
570
798
|
private ready;
|
|
571
799
|
private img;
|
|
572
800
|
constructor(gl: WebGL2RenderingContext, opts: ImageOptions);
|
|
801
|
+
/** Point the texture at a new source: load a URL async, or upload a bitmap now. */
|
|
802
|
+
private setSource;
|
|
803
|
+
/** Replace the image source and re-upload the texture (for streaming). */
|
|
804
|
+
setData(source: ImageSource, onLoad?: () => void): void;
|
|
573
805
|
private upload;
|
|
574
806
|
bounds(): {
|
|
575
807
|
x: Range;
|
|
@@ -629,6 +861,8 @@ interface LineOptions {
|
|
|
629
861
|
* zoomed out (preserves peaks). Requires monotonic x; auto-detected. Default true.
|
|
630
862
|
*/
|
|
631
863
|
decimate?: boolean;
|
|
864
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
865
|
+
renderType?: RenderType;
|
|
632
866
|
}
|
|
633
867
|
declare class LineLayer implements Layer {
|
|
634
868
|
readonly id: string;
|
|
@@ -657,6 +891,7 @@ declare class LineLayer implements Layer {
|
|
|
657
891
|
private monotonic;
|
|
658
892
|
private gpuDec;
|
|
659
893
|
private step?;
|
|
894
|
+
private usage;
|
|
660
895
|
private xRef;
|
|
661
896
|
private yRef;
|
|
662
897
|
private xs;
|
|
@@ -707,6 +942,8 @@ interface PatchesOptions {
|
|
|
707
942
|
domain?: Range;
|
|
708
943
|
/** Fill opacity, 0..1. Default 1. */
|
|
709
944
|
opacity?: number;
|
|
945
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
946
|
+
renderType?: RenderType;
|
|
710
947
|
name?: string;
|
|
711
948
|
yAxis?: string;
|
|
712
949
|
}
|
|
@@ -730,7 +967,16 @@ declare class PatchesLayer implements Layer {
|
|
|
730
967
|
private yRef;
|
|
731
968
|
private xBounds;
|
|
732
969
|
private yBounds;
|
|
970
|
+
private defRgba;
|
|
971
|
+
private opacity;
|
|
972
|
+
private cmap;
|
|
973
|
+
private domainOpt;
|
|
974
|
+
private usage;
|
|
733
975
|
constructor(gl: WebGL2RenderingContext, opts: PatchesOptions);
|
|
976
|
+
/** Triangulate the patches and recompute refs/bounds/vertexCount into position/color arrays. */
|
|
977
|
+
private build;
|
|
978
|
+
/** Replace the patches and re-upload (for streaming). */
|
|
979
|
+
setData(patches: Patch[]): void;
|
|
734
980
|
bounds(): {
|
|
735
981
|
x: Range;
|
|
736
982
|
y: Range;
|
|
@@ -754,6 +1000,8 @@ interface PieOptions {
|
|
|
754
1000
|
innerRadius?: number;
|
|
755
1001
|
/** Angle of the first slice edge, radians. Default `Math.PI / 2` (12 o'clock). */
|
|
756
1002
|
startAngle?: number;
|
|
1003
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
1004
|
+
renderType?: RenderType;
|
|
757
1005
|
name?: string;
|
|
758
1006
|
yAxis?: string;
|
|
759
1007
|
}
|
|
@@ -777,7 +1025,19 @@ declare class PieLayer implements Layer {
|
|
|
777
1025
|
private yRef;
|
|
778
1026
|
private xBounds;
|
|
779
1027
|
private yBounds;
|
|
1028
|
+
private cx;
|
|
1029
|
+
private cy;
|
|
1030
|
+
private R;
|
|
1031
|
+
private rIn;
|
|
1032
|
+
private start;
|
|
1033
|
+
private colorsOpt;
|
|
1034
|
+
private cmap;
|
|
1035
|
+
private usage;
|
|
780
1036
|
constructor(gl: WebGL2RenderingContext, opts: PieOptions);
|
|
1037
|
+
/** Recompute vertexCount and the position/color triangle soup from new slice values. */
|
|
1038
|
+
private build;
|
|
1039
|
+
/** Replace the slice values and re-upload (for streaming). */
|
|
1040
|
+
setData(values: ArrayLike<number>): void;
|
|
781
1041
|
bounds(): {
|
|
782
1042
|
x: Range;
|
|
783
1043
|
y: Range;
|
|
@@ -806,6 +1066,8 @@ interface QuiverOptions {
|
|
|
806
1066
|
colormap?: ColormapName;
|
|
807
1067
|
domain?: Range;
|
|
808
1068
|
};
|
|
1069
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
1070
|
+
renderType?: RenderType;
|
|
809
1071
|
name?: string;
|
|
810
1072
|
yAxis?: string;
|
|
811
1073
|
}
|
|
@@ -825,6 +1087,9 @@ declare class QuiverLayer implements Layer {
|
|
|
825
1087
|
private width;
|
|
826
1088
|
private headSize;
|
|
827
1089
|
private useVertexColor;
|
|
1090
|
+
private explicitScale;
|
|
1091
|
+
private colorBy;
|
|
1092
|
+
private usage;
|
|
828
1093
|
private count;
|
|
829
1094
|
private xRef;
|
|
830
1095
|
private yRef;
|
|
@@ -832,6 +1097,10 @@ declare class QuiverLayer implements Layer {
|
|
|
832
1097
|
private yBounds;
|
|
833
1098
|
constructor(gl: WebGL2RenderingContext, opts: QuiverOptions);
|
|
834
1099
|
private bindInstanceAttribs;
|
|
1100
|
+
/** Recompute count/refs/bounds and the arrow+color arrays from new x/y/u/v. */
|
|
1101
|
+
private build;
|
|
1102
|
+
/** Replace the data and re-upload (for streaming). */
|
|
1103
|
+
setData(x: ArrayLike<number>, y: ArrayLike<number>, u: ArrayLike<number>, v: ArrayLike<number>): void;
|
|
835
1104
|
bounds(): {
|
|
836
1105
|
x: Range;
|
|
837
1106
|
y: Range;
|
|
@@ -865,6 +1134,8 @@ interface ScatterOptions {
|
|
|
865
1134
|
/** Value range mapped to [0,1]. Defaults to the data min/max. */
|
|
866
1135
|
domain?: Range;
|
|
867
1136
|
};
|
|
1137
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
1138
|
+
renderType?: RenderType;
|
|
868
1139
|
}
|
|
869
1140
|
declare class ScatterLayer implements Layer {
|
|
870
1141
|
readonly id: string;
|
|
@@ -879,6 +1150,7 @@ declare class ScatterLayer implements Layer {
|
|
|
879
1150
|
private count;
|
|
880
1151
|
private size;
|
|
881
1152
|
private marker;
|
|
1153
|
+
private usage;
|
|
882
1154
|
private color;
|
|
883
1155
|
private useVertexColor;
|
|
884
1156
|
private labels?;
|
|
@@ -912,6 +1184,8 @@ interface StemOptions {
|
|
|
912
1184
|
width?: number;
|
|
913
1185
|
/** Tip marker diameter in CSS px (0 hides). Default 6. */
|
|
914
1186
|
markerSize?: number;
|
|
1187
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
1188
|
+
renderType?: RenderType;
|
|
915
1189
|
name?: string;
|
|
916
1190
|
yAxis?: string;
|
|
917
1191
|
}
|
|
@@ -931,6 +1205,7 @@ declare class StemLayer implements Layer {
|
|
|
931
1205
|
private width;
|
|
932
1206
|
private markerSize;
|
|
933
1207
|
private count;
|
|
1208
|
+
private usage;
|
|
934
1209
|
private baseline;
|
|
935
1210
|
private xRef;
|
|
936
1211
|
private yRef;
|
|
@@ -939,6 +1214,10 @@ declare class StemLayer implements Layer {
|
|
|
939
1214
|
private xBounds;
|
|
940
1215
|
private yBounds;
|
|
941
1216
|
constructor(gl: WebGL2RenderingContext, opts: StemOptions);
|
|
1217
|
+
/** Recompute count/refs/bounds and the stem+tip vertex arrays from new x/y. */
|
|
1218
|
+
private build;
|
|
1219
|
+
/** Replace the data and re-upload (for streaming). */
|
|
1220
|
+
setData(x: ArrayLike<number>, y: ArrayLike<number>): void;
|
|
942
1221
|
bounds(): {
|
|
943
1222
|
x: Range;
|
|
944
1223
|
y: Range;
|
|
@@ -1017,8 +1296,32 @@ declare class CategoricalScale implements Scale {
|
|
|
1017
1296
|
ticks(): Tick[];
|
|
1018
1297
|
formatTick(value: number): string;
|
|
1019
1298
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1299
|
+
/**
|
|
1300
|
+
* An **ordinal time** axis — the standard financial x-axis. Bars are plotted at
|
|
1301
|
+
* evenly-spaced integer indices `0..n-1` (like {@link CategoricalScale}, so the
|
|
1302
|
+
* domain is the band `[-0.5, n-1+0.5]`), which **collapses market gaps**
|
|
1303
|
+
* (weekends, overnight, holidays) instead of leaving blank space the way a real
|
|
1304
|
+
* {@link TimeScale} would. Each index carries a timestamp; ticks are placed at
|
|
1305
|
+
* natural calendar boundaries (day / month / year, or hour / minute when zoomed
|
|
1306
|
+
* in) and subsampled toward the target count, so labels stay readable at any zoom.
|
|
1307
|
+
*
|
|
1308
|
+
* Plot your candles/bars at `x = 0,1,2,…` and pass the per-bar epoch-ms `times`.
|
|
1309
|
+
*/
|
|
1310
|
+
declare class OrdinalTimeScale implements Scale {
|
|
1311
|
+
readonly type = "ordinal-time";
|
|
1312
|
+
readonly log = false;
|
|
1313
|
+
times: number[];
|
|
1314
|
+
domain: Range;
|
|
1315
|
+
constructor(times?: ArrayLike<number>);
|
|
1316
|
+
norm(value: number): number;
|
|
1317
|
+
invert(t: number): number;
|
|
1318
|
+
/** Timestamp at a (rounded, clamped) index. */
|
|
1319
|
+
private timeAt;
|
|
1320
|
+
ticks(target?: number): Tick[];
|
|
1321
|
+
formatTick(value: number): string;
|
|
1322
|
+
}
|
|
1323
|
+
type ScaleType = "linear" | "log" | "time" | "categorical" | "ordinal-time";
|
|
1324
|
+
declare function makeScale(type: ScaleType, domain?: Range, factors?: string[], times?: ArrayLike<number>): Scale;
|
|
1022
1325
|
|
|
1023
1326
|
/** Pixel geometry of the plot, in CSS pixels. The plot region excludes margins. */
|
|
1024
1327
|
interface Layout {
|
|
@@ -1077,12 +1380,37 @@ interface PlotTitleOptions {
|
|
|
1077
1380
|
align?: "left" | "center" | "right";
|
|
1078
1381
|
}
|
|
1079
1382
|
|
|
1383
|
+
/**
|
|
1384
|
+
* Shared image-export helpers used by Plot / Plot3D / PolarPlot. Each plot
|
|
1385
|
+
* composites its layers into a single 2D canvas, then these turn that canvas into
|
|
1386
|
+
* a data URL / Blob / download / clipboard image.
|
|
1387
|
+
*/
|
|
1388
|
+
/** Options accepted by the export methods. */
|
|
1389
|
+
interface ExportOptions {
|
|
1390
|
+
/** Fill color behind the plot (default the theme page color; `"transparent"` keeps alpha). */
|
|
1391
|
+
background?: string;
|
|
1392
|
+
/** Encoder quality 0..1 for lossy types (`image/jpeg`, `image/webp`). */
|
|
1393
|
+
quality?: number;
|
|
1394
|
+
}
|
|
1395
|
+
/** Turn a canvas into a `Blob` (default PNG). */
|
|
1396
|
+
declare function canvasToBlob(canvas: HTMLCanvasElement, type?: string, quality?: number): Promise<Blob | null>;
|
|
1397
|
+
/** Download a canvas as an image file (PNG by default). */
|
|
1398
|
+
declare function downloadCanvas(canvas: HTMLCanvasElement, filename?: string, type?: string, quality?: number): Promise<void>;
|
|
1399
|
+
/** Copy a canvas to the clipboard as a PNG. Throws where the browser can't. */
|
|
1400
|
+
declare function copyCanvasToClipboard(canvas: HTMLCanvasElement): Promise<void>;
|
|
1401
|
+
|
|
1080
1402
|
interface AxisScaleOptions {
|
|
1081
1403
|
type?: ScaleType;
|
|
1082
1404
|
/** Fixed domain. If omitted, the axis autoscales to the data. */
|
|
1083
1405
|
domain?: Range;
|
|
1084
1406
|
/** Factor labels for a `"categorical"` axis (fixes the domain to the bands). */
|
|
1085
1407
|
factors?: string[];
|
|
1408
|
+
/**
|
|
1409
|
+
* Per-index epoch-ms timestamps for an `"ordinal-time"` axis (finance/session
|
|
1410
|
+
* axis). Plot bars at integer indices `0..times.length-1`; gaps collapse and
|
|
1411
|
+
* ticks show calendar dates.
|
|
1412
|
+
*/
|
|
1413
|
+
times?: ArrayLike<number>;
|
|
1086
1414
|
}
|
|
1087
1415
|
/** Legend placement + styling. `legend: true` uses all defaults. */
|
|
1088
1416
|
interface LegendOptions {
|
|
@@ -1100,6 +1428,8 @@ interface YAxisOptions extends AxisConfig {
|
|
|
1100
1428
|
domain?: Range;
|
|
1101
1429
|
/** Factor labels for a `"categorical"` axis. */
|
|
1102
1430
|
factors?: string[];
|
|
1431
|
+
/** Per-index epoch-ms timestamps for an `"ordinal-time"` axis. */
|
|
1432
|
+
times?: ArrayLike<number>;
|
|
1103
1433
|
/** Which side to draw the axis on. Default `"right"` for secondary axes. */
|
|
1104
1434
|
side?: "left" | "right";
|
|
1105
1435
|
/** Axis + label color (secondary axes often match their series). */
|
|
@@ -1158,7 +1488,10 @@ interface GraphInput extends Omit<GraphOptions, "x" | "y"> {
|
|
|
1158
1488
|
/**
|
|
1159
1489
|
* A Canvas2D overlay marker drawn above the data, projected through the scales:
|
|
1160
1490
|
* a full-width/height guide line (`span`), a shaded range (`band`), a rectangle
|
|
1161
|
-
* (`box`),
|
|
1491
|
+
* (`box`), text (`label`), an arbitrary segment (`line` — trendlines), a segment
|
|
1492
|
+
* extended past its end (`ray`), or Fibonacci retracement levels (`fib`). `yAxis`
|
|
1493
|
+
* targets a secondary axis where relevant. All coordinates are in data space, so
|
|
1494
|
+
* annotations pan and zoom with the chart.
|
|
1162
1495
|
*/
|
|
1163
1496
|
type Annotation = {
|
|
1164
1497
|
type: "span";
|
|
@@ -1181,6 +1514,7 @@ type Annotation = {
|
|
|
1181
1514
|
y: Range;
|
|
1182
1515
|
color?: string;
|
|
1183
1516
|
border?: string;
|
|
1517
|
+
label?: string;
|
|
1184
1518
|
yAxis?: string;
|
|
1185
1519
|
} | {
|
|
1186
1520
|
type: "label";
|
|
@@ -1191,7 +1525,42 @@ type Annotation = {
|
|
|
1191
1525
|
font?: string;
|
|
1192
1526
|
align?: "left" | "center" | "right";
|
|
1193
1527
|
yAxis?: string;
|
|
1528
|
+
} | {
|
|
1529
|
+
type: "line";
|
|
1530
|
+
x0: number;
|
|
1531
|
+
y0: number;
|
|
1532
|
+
x1: number;
|
|
1533
|
+
y1: number;
|
|
1534
|
+
color?: string;
|
|
1535
|
+
width?: number;
|
|
1536
|
+
dash?: number[];
|
|
1537
|
+
label?: string;
|
|
1538
|
+
yAxis?: string;
|
|
1539
|
+
} | {
|
|
1540
|
+
type: "ray";
|
|
1541
|
+
x0: number;
|
|
1542
|
+
y0: number;
|
|
1543
|
+
x1: number;
|
|
1544
|
+
y1: number;
|
|
1545
|
+
color?: string;
|
|
1546
|
+
width?: number;
|
|
1547
|
+
dash?: number[];
|
|
1548
|
+
label?: string;
|
|
1549
|
+
yAxis?: string;
|
|
1550
|
+
} | {
|
|
1551
|
+
type: "fib";
|
|
1552
|
+
x0: number;
|
|
1553
|
+
x1: number;
|
|
1554
|
+
high: number;
|
|
1555
|
+
low: number;
|
|
1556
|
+
ratios?: number[];
|
|
1557
|
+
color?: string;
|
|
1558
|
+
fill?: boolean;
|
|
1559
|
+
label?: string;
|
|
1560
|
+
yAxis?: string;
|
|
1194
1561
|
};
|
|
1562
|
+
/** An interactive drawing tool: click-drag on the plot to place the shape. */
|
|
1563
|
+
type DrawTool = "trendline" | "hline" | "ray" | "fib" | "rect";
|
|
1195
1564
|
/** One line of the hover tooltip header, produced by {@link PlotOptions.hoverReadout}. */
|
|
1196
1565
|
interface HoverReadoutRow {
|
|
1197
1566
|
label: string;
|
|
@@ -1220,6 +1589,10 @@ interface PlotOptions {
|
|
|
1220
1589
|
interactive?: boolean;
|
|
1221
1590
|
/** Show the built-in toolbar (home + pan/box/X/Y zoom modes). Default true. */
|
|
1222
1591
|
showToolbar?: boolean;
|
|
1592
|
+
/** Add drawing tools (trendline / horizontal / ray / Fibonacci / rectangle) to the toolbar. Default false. */
|
|
1593
|
+
drawingTools?: boolean;
|
|
1594
|
+
/** Accessible label for the chart (sets `role="img"` + `aria-label`). Auto-summarized if omitted. */
|
|
1595
|
+
ariaLabel?: string;
|
|
1223
1596
|
/** Initial interaction mode. Default `"pan"`. */
|
|
1224
1597
|
mode?: InteractionMode;
|
|
1225
1598
|
/** Enable hover crosshair + tooltip. Default true. */
|
|
@@ -1267,6 +1640,7 @@ interface PlotOptions {
|
|
|
1267
1640
|
*/
|
|
1268
1641
|
declare class Plot {
|
|
1269
1642
|
private container;
|
|
1643
|
+
private ariaLabel?;
|
|
1270
1644
|
private gridCanvas;
|
|
1271
1645
|
private dataCanvas;
|
|
1272
1646
|
private axisCanvas;
|
|
@@ -1303,6 +1677,18 @@ declare class Plot {
|
|
|
1303
1677
|
private hoverReadout?;
|
|
1304
1678
|
/** Cursor position while the pointer is pressed, when `crosshair`. */
|
|
1305
1679
|
private pressPx;
|
|
1680
|
+
private viewListeners;
|
|
1681
|
+
private cursorListeners;
|
|
1682
|
+
private lastEmittedX;
|
|
1683
|
+
private lastEmittedCursor;
|
|
1684
|
+
private linkedCursorX;
|
|
1685
|
+
private drawTool;
|
|
1686
|
+
private drawings;
|
|
1687
|
+
private pendingDrawing;
|
|
1688
|
+
private drawToolCbs;
|
|
1689
|
+
private hoverDrawing;
|
|
1690
|
+
private selectedDrawing;
|
|
1691
|
+
private drawMenu;
|
|
1306
1692
|
private tooltip;
|
|
1307
1693
|
/** A point clicked to pin its details, until another click clears it. */
|
|
1308
1694
|
private selected;
|
|
@@ -1321,6 +1707,11 @@ declare class Plot {
|
|
|
1321
1707
|
/** Pixel x-position (and title x) for each y axis, by draw order per side. */
|
|
1322
1708
|
private yAxisPositions;
|
|
1323
1709
|
private register;
|
|
1710
|
+
/** Set the chart's accessible label (`aria-label`). Pass `undefined` to auto-summarize. */
|
|
1711
|
+
setAriaLabel(text: string | undefined): void;
|
|
1712
|
+
/** A one-line text summary of the chart (title + series), for a11y / tooltips. */
|
|
1713
|
+
describe(): string;
|
|
1714
|
+
private updateAria;
|
|
1324
1715
|
/**
|
|
1325
1716
|
* Register a layer built outside core (e.g. `@photonviz/map`). Use with
|
|
1326
1717
|
* {@link context} to construct the layer against this plot's WebGL2 context.
|
|
@@ -1359,6 +1750,8 @@ declare class Plot {
|
|
|
1359
1750
|
addStem(opts: StemOptions): StemLayer;
|
|
1360
1751
|
addQuiver(opts: QuiverOptions): QuiverLayer;
|
|
1361
1752
|
addCandlestick(opts: CandlestickOptions): CandlestickLayer;
|
|
1753
|
+
/** An OHLC bar chart (low→high line with open/close ticks). Streams like candlesticks. */
|
|
1754
|
+
addOhlc(opts: OhlcOptions): OhlcLayer;
|
|
1362
1755
|
/** Filled polygons (choropleth-capable). Rings are triangulated with earcut. */
|
|
1363
1756
|
addPatches(opts: PatchesOptions): PatchesLayer;
|
|
1364
1757
|
/** A pie / donut chart. Set `equalAspect: true` on the plot so it stays circular. */
|
|
@@ -1382,6 +1775,41 @@ declare class Plot {
|
|
|
1382
1775
|
addAnnotation(a: Annotation): () => void;
|
|
1383
1776
|
/** Remove all annotations. */
|
|
1384
1777
|
clearAnnotations(): void;
|
|
1778
|
+
/** Activate a drawing tool (click-drag on the plot to place), or `null` to stop drawing. */
|
|
1779
|
+
setDrawTool(tool: DrawTool | null): void;
|
|
1780
|
+
/** The active drawing tool, or `null`. */
|
|
1781
|
+
getDrawTool(): DrawTool | null;
|
|
1782
|
+
/** Subscribe to draw-tool changes (used by the toolbar). Returns an unsubscribe fn. */
|
|
1783
|
+
onDrawToolChange(cb: (t: DrawTool | null) => void): () => void;
|
|
1784
|
+
/** Add a drawing programmatically (same shapes the tools produce). */
|
|
1785
|
+
addDrawing(a: Annotation): void;
|
|
1786
|
+
/** All user drawings (trendlines, fib levels, …). */
|
|
1787
|
+
getDrawings(): Annotation[];
|
|
1788
|
+
/** Remove every user drawing. */
|
|
1789
|
+
clearDrawings(): void;
|
|
1790
|
+
/** Canvas-space pixel → data coordinates on the x + primary y scale. */
|
|
1791
|
+
private dataAtPx;
|
|
1792
|
+
/** Build the annotation for a draw tool from its start + current data points. */
|
|
1793
|
+
private buildDrawing;
|
|
1794
|
+
private drawingYScale;
|
|
1795
|
+
/** Editable handle points (data space) for a drawing; `[]` if it has none. */
|
|
1796
|
+
private drawingHandlePts;
|
|
1797
|
+
/** Move handle `i` of a drawing to a new data-space point (all editable types). */
|
|
1798
|
+
private setDrawingHandle;
|
|
1799
|
+
/** Translate a whole drawing by a data-space delta (drag the body). */
|
|
1800
|
+
private translateDrawing;
|
|
1801
|
+
/** Cursor→drawing distance in px (segment for line/ray, edges for box/fib, the line for span). */
|
|
1802
|
+
private drawingBodyDist;
|
|
1803
|
+
/** Topmost drawing under the cursor and its handle (handle −1 = body, index −1 = none). */
|
|
1804
|
+
private hitDrawing;
|
|
1805
|
+
private removeDrawing;
|
|
1806
|
+
private hideDrawMenu;
|
|
1807
|
+
/** Right-click context menu for a drawing: rename, recolor, delete. */
|
|
1808
|
+
private showDrawMenu;
|
|
1809
|
+
/** Recolor a drawing: a box keeps its translucent fill + opaque border; others take the color directly. */
|
|
1810
|
+
private recolorDrawing;
|
|
1811
|
+
/** Prompt for a label on a drawing (double-click / context menu). */
|
|
1812
|
+
private renameDrawing;
|
|
1385
1813
|
/** Compute an STFT of `signal` and render it as a heatmap (time × frequency). */
|
|
1386
1814
|
addHeatmapSpectrogram(signal: ArrayLike<number>, opts?: {
|
|
1387
1815
|
fftSize?: number;
|
|
@@ -1399,6 +1827,10 @@ declare class Plot {
|
|
|
1399
1827
|
}): BarLayer;
|
|
1400
1828
|
/** Register an additional named y axis. Series opt in via `addLine({ yAxis })`. */
|
|
1401
1829
|
addYAxis(id: string, opts?: YAxisOptions): void;
|
|
1830
|
+
/** Whether a y axis with this id exists (the primary is always `"y"`). */
|
|
1831
|
+
hasYAxis(id: string): boolean;
|
|
1832
|
+
/** Remove a secondary y axis. No-op for the primary `"y"` or an unknown id. */
|
|
1833
|
+
removeYAxis(id: string): void;
|
|
1402
1834
|
removeLayer(layer: Layer): void;
|
|
1403
1835
|
/** Configure ticks/format/title for the x axis or a y axis (default primary "y"). */
|
|
1404
1836
|
setAxis(dim: Dim | string, config: Partial<AxisConfig>): void;
|
|
@@ -1408,18 +1840,46 @@ declare class Plot {
|
|
|
1408
1840
|
y?: Range;
|
|
1409
1841
|
yAxes?: Record<string, Range>;
|
|
1410
1842
|
}): void;
|
|
1843
|
+
/**
|
|
1844
|
+
* Subscribe to x-domain changes (pan / zoom / home / setView). Fires once per
|
|
1845
|
+
* frame after the domain settles. Returns an unsubscribe function. See {@link linkX}.
|
|
1846
|
+
*/
|
|
1847
|
+
onViewChange(cb: (x: Range) => void): () => void;
|
|
1848
|
+
/**
|
|
1849
|
+
* Subscribe to the hover cursor's data-space x (or `null` when it leaves the
|
|
1850
|
+
* plot). Returns an unsubscribe function. Used to share a crosshair across panes.
|
|
1851
|
+
*/
|
|
1852
|
+
onCursorMove(cb: (dataX: number | null) => void): () => void;
|
|
1853
|
+
/** Draw a linked crosshair at this data-space x (pushed from another pane), or clear it with `null`. */
|
|
1854
|
+
setLinkedCursor(dataX: number | null): void;
|
|
1411
1855
|
private setYDomain;
|
|
1412
1856
|
setMode(mode: InteractionMode): void;
|
|
1413
1857
|
getMode(): InteractionMode;
|
|
1414
1858
|
onModeChange(cb: (mode: InteractionMode) => void): void;
|
|
1415
1859
|
/** Reset to the home view: explicit domains restored, auto axes re-fit to data. */
|
|
1416
1860
|
home(): void;
|
|
1861
|
+
/**
|
|
1862
|
+
* Composite this plot's layers (grid → data → axes/labels) into a single 2D
|
|
1863
|
+
* canvas at device resolution. `background` fills behind the plot (default the
|
|
1864
|
+
* theme's page color; pass `"transparent"` to keep alpha).
|
|
1865
|
+
*/
|
|
1866
|
+
private compositeCanvas;
|
|
1867
|
+
/** Export the current view as a data URL (default PNG). */
|
|
1868
|
+
toDataURL(type?: string, opts?: ExportOptions): string;
|
|
1869
|
+
/** Export the current view as a `Blob` (default PNG). */
|
|
1870
|
+
toBlob(type?: string, opts?: ExportOptions): Promise<Blob | null>;
|
|
1871
|
+
/** Download the current view as an image (PNG by default). */
|
|
1872
|
+
downloadImage(filename?: string, type?: string, opts?: ExportOptions): Promise<void>;
|
|
1873
|
+
/** Copy the current view to the clipboard as a PNG. Throws if the browser can't. */
|
|
1874
|
+
copyToClipboard(opts?: ExportOptions): Promise<void>;
|
|
1417
1875
|
/** Re-fit auto axes to the data: x over all series, each y axis over its own series. */
|
|
1418
1876
|
autoscale(): void;
|
|
1419
1877
|
destroy(): void;
|
|
1420
1878
|
private resize;
|
|
1421
1879
|
requestRender(): void;
|
|
1422
1880
|
private primaryY;
|
|
1881
|
+
/** Fire view/cursor listeners once the frame's x-domain + cursor are settled. */
|
|
1882
|
+
private emitLinks;
|
|
1423
1883
|
render(): void;
|
|
1424
1884
|
/** Named series that can appear in the legend: any layer exposing name + colorCss. */
|
|
1425
1885
|
private legendEntries;
|
|
@@ -1466,12 +1926,36 @@ declare class Plot {
|
|
|
1466
1926
|
private zoomAround;
|
|
1467
1927
|
}
|
|
1468
1928
|
|
|
1929
|
+
/**
|
|
1930
|
+
* Link the x-axis (pan / zoom) and hover crosshair of several plots so they move
|
|
1931
|
+
* together — the standard multi-pane financial layout (price on top, volume /
|
|
1932
|
+
* RSI / MACD below, all sharing one time axis). The plots should share the same
|
|
1933
|
+
* x-scale semantics (e.g. all `ordinal-time` over the same bars).
|
|
1934
|
+
*
|
|
1935
|
+
* ```ts
|
|
1936
|
+
* const detach = linkX([pricePlot, volumePlot, rsiPlot]);
|
|
1937
|
+
* // …later: detach();
|
|
1938
|
+
* ```
|
|
1939
|
+
*
|
|
1940
|
+
* @returns a function that unlinks them again.
|
|
1941
|
+
*/
|
|
1942
|
+
declare function linkX(plots: Plot[]): () => void;
|
|
1943
|
+
|
|
1469
1944
|
/** The subset of Plot the toolbar drives. Kept minimal to avoid an import cycle. */
|
|
1470
1945
|
interface ToolbarHost {
|
|
1471
1946
|
setMode(mode: InteractionMode): void;
|
|
1472
1947
|
getMode(): InteractionMode;
|
|
1473
1948
|
home(): void;
|
|
1474
1949
|
onModeChange(cb: (mode: InteractionMode) => void): void;
|
|
1950
|
+
/** Optional: download the current view as a PNG. Adds a toolbar button when present. */
|
|
1951
|
+
download?(): void;
|
|
1952
|
+
/** Optional: interactive drawing tools. Adds a tool group (trendline / hline / ray / fib / rect / clear) when present. */
|
|
1953
|
+
drawTools?: {
|
|
1954
|
+
set(tool: string | null): void;
|
|
1955
|
+
get(): string | null;
|
|
1956
|
+
clear(): void;
|
|
1957
|
+
onChange(cb: (tool: string | null) => void): void;
|
|
1958
|
+
};
|
|
1475
1959
|
}
|
|
1476
1960
|
interface ToolbarTheme {
|
|
1477
1961
|
bg: string;
|
|
@@ -1533,6 +2017,8 @@ interface PolarLineOptions {
|
|
|
1533
2017
|
width?: number;
|
|
1534
2018
|
/** Connect the last point back to the first. */
|
|
1535
2019
|
closed?: boolean;
|
|
2020
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2021
|
+
renderType?: RenderType;
|
|
1536
2022
|
}
|
|
1537
2023
|
interface PolarScatterOptions {
|
|
1538
2024
|
theta: ArrayLike<number>;
|
|
@@ -1541,6 +2027,8 @@ interface PolarScatterOptions {
|
|
|
1541
2027
|
size?: number;
|
|
1542
2028
|
/** Optional per-point labels (one per point), shown as the title of the click-pinned info box. */
|
|
1543
2029
|
labels?: ArrayLike<string>;
|
|
2030
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2031
|
+
renderType?: RenderType;
|
|
1544
2032
|
}
|
|
1545
2033
|
/** A live handle to update a polar series with new (theta, r) data. */
|
|
1546
2034
|
interface PolarSeries {
|
|
@@ -1597,6 +2085,16 @@ declare class PolarPlot {
|
|
|
1597
2085
|
getRotation(): number;
|
|
1598
2086
|
/** Set the rotation offset (radians, CCW) and redraw. */
|
|
1599
2087
|
setRotation(rad: number): void;
|
|
2088
|
+
/** Composite grid → data → overlay into one canvas at device resolution. */
|
|
2089
|
+
private compositeCanvas;
|
|
2090
|
+
/** Export the current view as a data URL (default PNG). */
|
|
2091
|
+
toDataURL(type?: string, opts?: ExportOptions): string;
|
|
2092
|
+
/** Export the current view as a `Blob` (default PNG). */
|
|
2093
|
+
toBlob(type?: string, opts?: ExportOptions): Promise<Blob | null>;
|
|
2094
|
+
/** Download the current view as an image (PNG by default). */
|
|
2095
|
+
downloadImage(filename?: string, type?: string, opts?: ExportOptions): Promise<void>;
|
|
2096
|
+
/** Copy the current view to the clipboard as a PNG. */
|
|
2097
|
+
copyToClipboard(opts?: ExportOptions): Promise<void>;
|
|
1600
2098
|
destroy(): void;
|
|
1601
2099
|
private resize;
|
|
1602
2100
|
requestRender(): void;
|
|
@@ -1672,6 +2170,8 @@ interface Bar3DOptions {
|
|
|
1672
2170
|
domain?: Range;
|
|
1673
2171
|
};
|
|
1674
2172
|
name?: string;
|
|
2173
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2174
|
+
renderType?: RenderType;
|
|
1675
2175
|
}
|
|
1676
2176
|
/** 3D bars (columns) on an x/z grid, lit like the surface and optionally colormapped. */
|
|
1677
2177
|
declare class Bar3DLayer implements Layer3D {
|
|
@@ -1682,15 +2182,24 @@ declare class Bar3DLayer implements Layer3D {
|
|
|
1682
2182
|
private program;
|
|
1683
2183
|
private vao;
|
|
1684
2184
|
private buffers;
|
|
2185
|
+
private instBuf;
|
|
1685
2186
|
private uniforms;
|
|
1686
2187
|
private count;
|
|
1687
2188
|
private width;
|
|
1688
2189
|
private b3;
|
|
1689
2190
|
private cInfo;
|
|
1690
2191
|
private positions;
|
|
2192
|
+
private base;
|
|
2193
|
+
private optWidth?;
|
|
2194
|
+
private colorByOpt?;
|
|
2195
|
+
private usage;
|
|
1691
2196
|
private lightDir;
|
|
1692
2197
|
private ambient;
|
|
1693
2198
|
constructor(gl: WebGL2RenderingContext, opts: Bar3DOptions);
|
|
2199
|
+
/** Build the per-bar instances (base/height/color) and (re)upload the instance buffer. */
|
|
2200
|
+
private build;
|
|
2201
|
+
/** Stream new bar positions/heights (instances rebuilt). Call `plot.refresh()` after. */
|
|
2202
|
+
setData(x: ArrayLike<number>, z: ArrayLike<number>, y: ArrayLike<number>): void;
|
|
1694
2203
|
bounds3(): Bounds3 | null;
|
|
1695
2204
|
colorInfo(): ColorInfo | null;
|
|
1696
2205
|
pickData(): {
|
|
@@ -1716,6 +2225,8 @@ interface Contour3DOptions {
|
|
|
1716
2225
|
color?: string | Color;
|
|
1717
2226
|
colormap?: ColormapName;
|
|
1718
2227
|
name?: string;
|
|
2228
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2229
|
+
renderType?: RenderType;
|
|
1719
2230
|
}
|
|
1720
2231
|
/**
|
|
1721
2232
|
* 3D contour: iso-height lines of a grid, each drawn at its own level height
|
|
@@ -1733,7 +2244,24 @@ declare class Contour3DLayer implements Layer3D {
|
|
|
1733
2244
|
private vertCount;
|
|
1734
2245
|
private b3;
|
|
1735
2246
|
private cInfo;
|
|
2247
|
+
private cmapName;
|
|
2248
|
+
private fixed;
|
|
2249
|
+
private levelsOpt?;
|
|
2250
|
+
private cols;
|
|
2251
|
+
private rows;
|
|
2252
|
+
private extentX;
|
|
2253
|
+
private extentZ;
|
|
2254
|
+
private usage;
|
|
1736
2255
|
constructor(gl: WebGL2RenderingContext, opts: Contour3DOptions);
|
|
2256
|
+
/** Marching-squares the grid at each iso level and (re)upload the line buffer. */
|
|
2257
|
+
private build;
|
|
2258
|
+
/** Stream a new scalar field (contours recomputed). Call `plot.refresh()` after. */
|
|
2259
|
+
setData(values: ArrayLike<number>, opts?: {
|
|
2260
|
+
cols?: number;
|
|
2261
|
+
rows?: number;
|
|
2262
|
+
extentX?: Range;
|
|
2263
|
+
extentZ?: Range;
|
|
2264
|
+
}): void;
|
|
1737
2265
|
bounds3(): Bounds3 | null;
|
|
1738
2266
|
colorInfo(): ColorInfo | null;
|
|
1739
2267
|
draw(gl: WebGL2RenderingContext, mvp: Mat4): void;
|
|
@@ -1756,6 +2284,8 @@ interface IsosurfaceOptions {
|
|
|
1756
2284
|
/** Fill opacity 0..1. Default 1. */
|
|
1757
2285
|
opacity?: number;
|
|
1758
2286
|
name?: string;
|
|
2287
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2288
|
+
renderType?: RenderType;
|
|
1759
2289
|
}
|
|
1760
2290
|
/** A marching-cubes isosurface of a 3D scalar volume, lit and solid-colored. */
|
|
1761
2291
|
declare class IsosurfaceLayer implements Layer3D {
|
|
@@ -1771,9 +2301,18 @@ declare class IsosurfaceLayer implements Layer3D {
|
|
|
1771
2301
|
private color;
|
|
1772
2302
|
private opacity;
|
|
1773
2303
|
private b3;
|
|
2304
|
+
private usage;
|
|
1774
2305
|
private lightDir;
|
|
1775
2306
|
private ambient;
|
|
1776
2307
|
constructor(gl: WebGL2RenderingContext, opts: IsosurfaceOptions);
|
|
2308
|
+
/** Run marching cubes and (re)upload the interleaved pos/normal vertex buffer. */
|
|
2309
|
+
private build;
|
|
2310
|
+
/** Stream a new volume + iso level (marching-cubes mesh recomputed). Call `plot.refresh()` after. */
|
|
2311
|
+
setData(values: ArrayLike<number>, dims: [number, number, number], isoLevel: number, extent?: {
|
|
2312
|
+
x: Range;
|
|
2313
|
+
y: Range;
|
|
2314
|
+
z: Range;
|
|
2315
|
+
}): void;
|
|
1777
2316
|
bounds3(): Bounds3 | null;
|
|
1778
2317
|
/** Set the light direction (world space) and ambient term (0..1). */
|
|
1779
2318
|
setLight(dir: [number, number, number], ambient: number): void;
|
|
@@ -1787,6 +2326,8 @@ interface Line3DOptions {
|
|
|
1787
2326
|
z: ArrayLike<number>;
|
|
1788
2327
|
color?: string | Color;
|
|
1789
2328
|
name?: string;
|
|
2329
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2330
|
+
renderType?: RenderType;
|
|
1790
2331
|
}
|
|
1791
2332
|
/** A 3D polyline / path (`GL_LINE_STRIP`). */
|
|
1792
2333
|
declare class Line3DLayer implements Layer3D {
|
|
@@ -1802,6 +2343,7 @@ declare class Line3DLayer implements Layer3D {
|
|
|
1802
2343
|
private color;
|
|
1803
2344
|
private b3;
|
|
1804
2345
|
private positions;
|
|
2346
|
+
private usage;
|
|
1805
2347
|
constructor(gl: WebGL2RenderingContext, opts: Line3DOptions);
|
|
1806
2348
|
bounds3(): Bounds3 | null;
|
|
1807
2349
|
pickData(): {
|
|
@@ -1831,6 +2373,8 @@ interface PointCloudOptions {
|
|
|
1831
2373
|
labels?: ArrayLike<string>;
|
|
1832
2374
|
/** Series name (legend / colorbar label). */
|
|
1833
2375
|
name?: string;
|
|
2376
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2377
|
+
renderType?: RenderType;
|
|
1834
2378
|
}
|
|
1835
2379
|
declare class PointCloudLayer implements Layer3D {
|
|
1836
2380
|
readonly id: string;
|
|
@@ -1849,6 +2393,7 @@ declare class PointCloudLayer implements Layer3D {
|
|
|
1849
2393
|
private labels?;
|
|
1850
2394
|
/** Interleaved pos(3)+color(3)+size(1); positions are streamed in place. */
|
|
1851
2395
|
private data;
|
|
2396
|
+
private usage;
|
|
1852
2397
|
constructor(gl: WebGL2RenderingContext, opts: PointCloudOptions);
|
|
1853
2398
|
private updateBounds;
|
|
1854
2399
|
/** Stream new point positions (same count keeps colors/sizes). Call `plot.refresh()` after. */
|
|
@@ -1883,6 +2428,8 @@ interface Quiver3DOptions {
|
|
|
1883
2428
|
/** Arrowhead length as a fraction of the arrow. Default 0.28. */
|
|
1884
2429
|
headSize?: number;
|
|
1885
2430
|
name?: string;
|
|
2431
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2432
|
+
renderType?: RenderType;
|
|
1886
2433
|
}
|
|
1887
2434
|
/** A 3D vector field: each arrow is a shaft + a 4-wing arrowhead, drawn as lines. */
|
|
1888
2435
|
declare class Quiver3DLayer implements Layer3D {
|
|
@@ -1898,7 +2445,16 @@ declare class Quiver3DLayer implements Layer3D {
|
|
|
1898
2445
|
private b3;
|
|
1899
2446
|
private cInfo;
|
|
1900
2447
|
private positions;
|
|
2448
|
+
private base;
|
|
2449
|
+
private scale;
|
|
2450
|
+
private headSize;
|
|
2451
|
+
private colorByOpt?;
|
|
2452
|
+
private usage;
|
|
1901
2453
|
constructor(gl: WebGL2RenderingContext, opts: Quiver3DOptions);
|
|
2454
|
+
/** Build the arrow line geometry (shaft + 4-wing head) and (re)upload the vertex buffer. */
|
|
2455
|
+
private build;
|
|
2456
|
+
/** Stream a new vector field (arrows rebuilt). Call `plot.refresh()` after. */
|
|
2457
|
+
setData(x: ArrayLike<number>, y: ArrayLike<number>, z: ArrayLike<number>, u: ArrayLike<number>, v: ArrayLike<number>, w: ArrayLike<number>): void;
|
|
1902
2458
|
bounds3(): Bounds3 | null;
|
|
1903
2459
|
colorInfo(): ColorInfo | null;
|
|
1904
2460
|
pickData(): {
|
|
@@ -1921,6 +2477,8 @@ interface SurfaceOptions {
|
|
|
1921
2477
|
name?: string;
|
|
1922
2478
|
/** Render the grid as a wireframe (lines) instead of a lit filled surface. */
|
|
1923
2479
|
wireframe?: boolean;
|
|
2480
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2481
|
+
renderType?: RenderType;
|
|
1924
2482
|
}
|
|
1925
2483
|
declare class SurfaceLayer implements Layer3D {
|
|
1926
2484
|
readonly id: string;
|
|
@@ -1935,9 +2493,23 @@ declare class SurfaceLayer implements Layer3D {
|
|
|
1935
2493
|
private cmapName;
|
|
1936
2494
|
private vDomain;
|
|
1937
2495
|
private wireframe;
|
|
2496
|
+
private cols;
|
|
2497
|
+
private rows;
|
|
2498
|
+
private extentX;
|
|
2499
|
+
private extentZ;
|
|
2500
|
+
private usage;
|
|
1938
2501
|
private lightDir;
|
|
1939
2502
|
private ambient;
|
|
1940
2503
|
constructor(gl: WebGL2RenderingContext, opts: SurfaceOptions);
|
|
2504
|
+
/** Build the mesh (positions/normals/colors or wireframe) and (re)upload the vertex buffer. */
|
|
2505
|
+
private build;
|
|
2506
|
+
/** Stream a new height grid (mesh/normals/wireframe rebuilt). Call `plot.refresh()` after. */
|
|
2507
|
+
setData(values: ArrayLike<number>, opts?: {
|
|
2508
|
+
cols?: number;
|
|
2509
|
+
rows?: number;
|
|
2510
|
+
extentX?: Range;
|
|
2511
|
+
extentZ?: Range;
|
|
2512
|
+
}): void;
|
|
1941
2513
|
bounds3(): Bounds3;
|
|
1942
2514
|
colorInfo(): ColorInfo;
|
|
1943
2515
|
/** Set the light direction (world space) and ambient term (0..1). */
|
|
@@ -1962,6 +2534,8 @@ interface VolumeOptions {
|
|
|
1962
2534
|
/** Overall opacity multiplier. Default 1. */
|
|
1963
2535
|
density?: number;
|
|
1964
2536
|
name?: string;
|
|
2537
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming via setData. Default `"static"`. */
|
|
2538
|
+
renderType?: RenderType;
|
|
1965
2539
|
}
|
|
1966
2540
|
/**
|
|
1967
2541
|
* Direct volume rendering: GPU raymarching through a 3D texture with front-to-back
|
|
@@ -1983,8 +2557,15 @@ declare class VolumeLayer implements Layer3D {
|
|
|
1983
2557
|
private density;
|
|
1984
2558
|
private cmapName;
|
|
1985
2559
|
private vDomain;
|
|
2560
|
+
private dims;
|
|
2561
|
+
private domainOpt?;
|
|
2562
|
+
private usage;
|
|
1986
2563
|
private camLocal;
|
|
1987
2564
|
constructor(gl: WebGL2RenderingContext, opts: VolumeOptions);
|
|
2565
|
+
/** Normalize the scalar field and (re)upload it into the R8 3D texture. */
|
|
2566
|
+
private uploadVolume;
|
|
2567
|
+
/** Stream a new scalar volume (same dims); re-uploads the 3D texture. Call `plot.refresh()` after. */
|
|
2568
|
+
setData(values: ArrayLike<number>): void;
|
|
1988
2569
|
bounds3(): Bounds3;
|
|
1989
2570
|
colorInfo(): ColorInfo;
|
|
1990
2571
|
/** Set the camera position in world space; converted to the volume's [0,1] local space. */
|
|
@@ -2018,6 +2599,8 @@ interface Plot3DOptions {
|
|
|
2018
2599
|
hover?: boolean;
|
|
2019
2600
|
/** Show a reset-view (home) button. Default true. */
|
|
2020
2601
|
resetButton?: boolean;
|
|
2602
|
+
/** Show a download-PNG button. Default true. */
|
|
2603
|
+
downloadButton?: boolean;
|
|
2021
2604
|
/** Draw grid lines on the back walls of the cube. Default true. */
|
|
2022
2605
|
gridPlanes?: boolean;
|
|
2023
2606
|
/** Auto-orbit the camera: `true` for a default speed, or radians/frame. Default off. */
|
|
@@ -2071,6 +2654,7 @@ declare class Plot3D {
|
|
|
2071
2654
|
private colorbarDiv;
|
|
2072
2655
|
private tooltip;
|
|
2073
2656
|
private resetBtn;
|
|
2657
|
+
private downloadBtn;
|
|
2074
2658
|
private hoverEnabled;
|
|
2075
2659
|
/** Screen position (device px) of the picked point, for the highlight ring. */
|
|
2076
2660
|
private hoverHit;
|
|
@@ -2113,6 +2697,16 @@ declare class Plot3D {
|
|
|
2113
2697
|
removeLayer(layer: Layer3D): void;
|
|
2114
2698
|
/** Re-fit the axes to the data and redraw — call after a layer's `setData(...)`. */
|
|
2115
2699
|
refresh(): void;
|
|
2700
|
+
/** Copy the current 3D frame (already composited on one canvas) into a fresh canvas. */
|
|
2701
|
+
private compositeCanvas;
|
|
2702
|
+
/** Export the current view as a data URL (default PNG). */
|
|
2703
|
+
toDataURL(type?: string, opts?: ExportOptions): string;
|
|
2704
|
+
/** Export the current view as a `Blob` (default PNG). */
|
|
2705
|
+
toBlob(type?: string, opts?: ExportOptions): Promise<Blob | null>;
|
|
2706
|
+
/** Download the current view as an image (PNG by default). */
|
|
2707
|
+
downloadImage(filename?: string, type?: string, opts?: ExportOptions): Promise<void>;
|
|
2708
|
+
/** Copy the current view to the clipboard as a PNG. */
|
|
2709
|
+
copyToClipboard(opts?: ExportOptions): Promise<void>;
|
|
2116
2710
|
destroy(): void;
|
|
2117
2711
|
private recompute;
|
|
2118
2712
|
/** Build tick-mark line geometry + tick/title labels from the data bounds. */
|
|
@@ -2241,6 +2835,8 @@ interface Density {
|
|
|
2241
2835
|
*/
|
|
2242
2836
|
declare function kde(values: ArrayLike<number>, lo: number, hi: number, points?: number, bandwidth?: number): Density;
|
|
2243
2837
|
|
|
2838
|
+
/** Map a layer's {@link RenderType} to a WebGL buffer-usage hint (default STATIC_DRAW). */
|
|
2839
|
+
declare function bufferUsage(gl: WebGL2RenderingContext, renderType?: RenderType): number;
|
|
2244
2840
|
/** Compile + link a vertex/fragment program. */
|
|
2245
2841
|
declare function createProgram(gl: WebGL2RenderingContext, vert: string, frag: string): WebGLProgram;
|
|
2246
2842
|
/** Cache uniform locations for a program by name. */
|
|
@@ -2268,9 +2864,768 @@ declare function uniformLocations(gl: WebGL2RenderingContext, program: WebGLProg
|
|
|
2268
2864
|
*/
|
|
2269
2865
|
declare function earcut(data: number[], holeIndices?: number[], dim?: number): number[];
|
|
2270
2866
|
|
|
2867
|
+
/** Simple moving average over `period` samples. */
|
|
2868
|
+
declare function sma(values: ArrayLike<number>, period: number): Float64Array;
|
|
2869
|
+
/** Weighted moving average (linear weights 1..period, newest heaviest). */
|
|
2870
|
+
declare function wma(values: ArrayLike<number>, period: number): Float64Array;
|
|
2871
|
+
/**
|
|
2872
|
+
* Exponential moving average, α = 2/(period+1). Seeded with the SMA of the first
|
|
2873
|
+
* `period` samples at index `period-1` (the standard convention).
|
|
2874
|
+
*/
|
|
2875
|
+
declare function ema(values: ArrayLike<number>, period: number): Float64Array;
|
|
2876
|
+
/** Rolling population standard deviation over `period` samples. */
|
|
2877
|
+
declare function rollingStd(values: ArrayLike<number>, period: number): Float64Array;
|
|
2878
|
+
interface BollingerBands {
|
|
2879
|
+
middle: Float64Array;
|
|
2880
|
+
upper: Float64Array;
|
|
2881
|
+
lower: Float64Array;
|
|
2882
|
+
}
|
|
2883
|
+
/** Bollinger Bands: SMA(period) ± `k`·rollingStd(period). Defaults 20, 2. */
|
|
2884
|
+
declare function bollinger(close: ArrayLike<number>, period?: number, k?: number): BollingerBands;
|
|
2885
|
+
/** Wilder's RSI over `period` (default 14). Values in 0..100; warm-up is NaN. */
|
|
2886
|
+
declare function rsi(close: ArrayLike<number>, period?: number): Float64Array;
|
|
2887
|
+
interface Macd {
|
|
2888
|
+
macd: Float64Array;
|
|
2889
|
+
signal: Float64Array;
|
|
2890
|
+
histogram: Float64Array;
|
|
2891
|
+
}
|
|
2892
|
+
/** MACD: EMA(fast) − EMA(slow), its EMA(signal) line, and the histogram. Defaults 12/26/9. */
|
|
2893
|
+
declare function macd(close: ArrayLike<number>, fast?: number, slow?: number, signalPeriod?: number): Macd;
|
|
2894
|
+
/**
|
|
2895
|
+
* Volume-weighted average price, cumulative from the first sample: running
|
|
2896
|
+
* Σ(typical·volume) / Σ(volume), where typical = (high+low+close)/3.
|
|
2897
|
+
*/
|
|
2898
|
+
declare function vwap(high: ArrayLike<number>, low: ArrayLike<number>, close: ArrayLike<number>, volume: ArrayLike<number>): Float64Array;
|
|
2899
|
+
/** True range per bar: max(H−L, |H−prevC|, |L−prevC|). First bar is H−L. */
|
|
2900
|
+
declare function trueRange(high: ArrayLike<number>, low: ArrayLike<number>, close: ArrayLike<number>): Float64Array;
|
|
2901
|
+
/** Wilder's Average True Range over `period` (default 14). */
|
|
2902
|
+
declare function atr(high: ArrayLike<number>, low: ArrayLike<number>, close: ArrayLike<number>, period?: number): Float64Array;
|
|
2903
|
+
/** Index of the first non-NaN value (−1 if all NaN). Handy for trimming warm-up. */
|
|
2904
|
+
declare function firstFinite(values: ArrayLike<number>): number;
|
|
2905
|
+
interface Stochastic {
|
|
2906
|
+
k: Float64Array;
|
|
2907
|
+
d: Float64Array;
|
|
2908
|
+
}
|
|
2909
|
+
/** Stochastic oscillator: %K over `kPeriod`, %D = SMA(%K, dPeriod). Values 0..100. */
|
|
2910
|
+
declare function stochastic(high: ArrayLike<number>, low: ArrayLike<number>, close: ArrayLike<number>, kPeriod?: number, dPeriod?: number): Stochastic;
|
|
2911
|
+
interface Channel {
|
|
2912
|
+
middle: Float64Array;
|
|
2913
|
+
upper: Float64Array;
|
|
2914
|
+
lower: Float64Array;
|
|
2915
|
+
}
|
|
2916
|
+
/** Keltner Channels: EMA(period) ± mult·ATR(atrPeriod). */
|
|
2917
|
+
declare function keltner(high: ArrayLike<number>, low: ArrayLike<number>, close: ArrayLike<number>, period?: number, mult?: number, atrPeriod?: number): Channel;
|
|
2918
|
+
/** On-Balance Volume — a running signed volume total (no warm-up). */
|
|
2919
|
+
declare function obv(close: ArrayLike<number>, volume: ArrayLike<number>): Float64Array;
|
|
2920
|
+
interface Ichimoku {
|
|
2921
|
+
conversion: Float64Array;
|
|
2922
|
+
base: Float64Array;
|
|
2923
|
+
spanA: Float64Array;
|
|
2924
|
+
spanB: Float64Array;
|
|
2925
|
+
}
|
|
2926
|
+
/**
|
|
2927
|
+
* Ichimoku lines (conversion/base/spanA/spanB). Spans are returned **unshifted**
|
|
2928
|
+
* (traditional charts project the cloud forward by `basePeriod` bars).
|
|
2929
|
+
*/
|
|
2930
|
+
declare function ichimoku(high: ArrayLike<number>, low: ArrayLike<number>, convPeriod?: number, basePeriod?: number, spanBPeriod?: number): Ichimoku;
|
|
2931
|
+
interface Adx {
|
|
2932
|
+
adx: Float64Array;
|
|
2933
|
+
plusDI: Float64Array;
|
|
2934
|
+
minusDI: Float64Array;
|
|
2935
|
+
}
|
|
2936
|
+
/** Wilder's ADX (+DI / −DI / ADX) over `period` (default 14). */
|
|
2937
|
+
declare function adx(high: ArrayLike<number>, low: ArrayLike<number>, close: ArrayLike<number>, period?: number): Adx;
|
|
2938
|
+
interface SuperTrend {
|
|
2939
|
+
trend: Float64Array;
|
|
2940
|
+
direction: Float64Array;
|
|
2941
|
+
}
|
|
2942
|
+
/**
|
|
2943
|
+
* SuperTrend (ATR bands with trend-following flip). `trend` is the line; `direction`
|
|
2944
|
+
* is +1 (up / support below price) or −1 (down / resistance above price).
|
|
2945
|
+
*/
|
|
2946
|
+
declare function superTrend(high: ArrayLike<number>, low: ArrayLike<number>, close: ArrayLike<number>, period?: number, mult?: number): SuperTrend;
|
|
2947
|
+
interface FibLevel {
|
|
2948
|
+
ratio: number;
|
|
2949
|
+
price: number;
|
|
2950
|
+
}
|
|
2951
|
+
/** Fibonacci retracement price levels between a `high` and `low` (standard ratios). */
|
|
2952
|
+
declare function fibRetracements(high: number, low: number, ratios?: number[]): FibLevel[];
|
|
2953
|
+
|
|
2954
|
+
/**
|
|
2955
|
+
* Chart-type transforms: turn raw OHLC(V) into the geometry a specialist finance
|
|
2956
|
+
* chart needs. Each returns plain arrays you render with existing layers
|
|
2957
|
+
* (candlestick, bar, area, scatter) — see the `Plot.add*` helpers that wrap them.
|
|
2958
|
+
*/
|
|
2959
|
+
interface Ohlc {
|
|
2960
|
+
open: ArrayLike<number>;
|
|
2961
|
+
high: ArrayLike<number>;
|
|
2962
|
+
low: ArrayLike<number>;
|
|
2963
|
+
close: ArrayLike<number>;
|
|
2964
|
+
}
|
|
2965
|
+
interface OhlcArrays {
|
|
2966
|
+
open: Float64Array;
|
|
2967
|
+
high: Float64Array;
|
|
2968
|
+
low: Float64Array;
|
|
2969
|
+
close: Float64Array;
|
|
2970
|
+
}
|
|
2971
|
+
/**
|
|
2972
|
+
* Heikin-Ashi candles — a smoothed OHLC that filters noise and makes trends
|
|
2973
|
+
* obvious. Output has the same length; feed it to a candlestick layer.
|
|
2974
|
+
*
|
|
2975
|
+
* haClose = (o+h+l+c)/4
|
|
2976
|
+
* haOpen = (prevHaOpen + prevHaClose)/2 (seed: (o₀+c₀)/2)
|
|
2977
|
+
* haHigh = max(h, haOpen, haClose)
|
|
2978
|
+
* haLow = min(l, haOpen, haClose)
|
|
2979
|
+
*/
|
|
2980
|
+
declare function heikinAshi(d: Ohlc): OhlcArrays;
|
|
2981
|
+
/** One brick / box for Renko & Line-break (each renders as a wickless candle body). */
|
|
2982
|
+
interface Brick {
|
|
2983
|
+
/** Sequential column index (0..n-1); bricks are evenly spaced, time is discarded. */
|
|
2984
|
+
x: number;
|
|
2985
|
+
open: number;
|
|
2986
|
+
close: number;
|
|
2987
|
+
/** `true` when close > open (up brick). */
|
|
2988
|
+
up: boolean;
|
|
2989
|
+
}
|
|
2990
|
+
/**
|
|
2991
|
+
* Renko bricks from a close series. A new brick is emitted each time price moves
|
|
2992
|
+
* a full `brickSize` from the last brick's close (multiple bricks if it jumps
|
|
2993
|
+
* several sizes). Time is discarded — bricks are placed at successive indices.
|
|
2994
|
+
*/
|
|
2995
|
+
declare function renko(close: ArrayLike<number>, brickSize: number): Brick[];
|
|
2996
|
+
/**
|
|
2997
|
+
* Three-line-break (generalised to `lines`): a new up brick when close exceeds
|
|
2998
|
+
* the highest close of the last `lines` bricks, a down brick when it breaks the
|
|
2999
|
+
* lowest; otherwise nothing. Bricks are placed at successive indices.
|
|
3000
|
+
*/
|
|
3001
|
+
declare function lineBreak(close: ArrayLike<number>, lines?: number): Brick[];
|
|
3002
|
+
/** One P&F column: a run of X's (rising) or O's (falling) spanning `from`→`to`. */
|
|
3003
|
+
interface PfColumn {
|
|
3004
|
+
col: number;
|
|
3005
|
+
kind: "X" | "O";
|
|
3006
|
+
from: number;
|
|
3007
|
+
to: number;
|
|
3008
|
+
/** Box centers filled in this column (for plotting the X/O glyphs). */
|
|
3009
|
+
boxes: number[];
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* Point & Figure columns. Price is quantised to `boxSize`; a column of X's grows
|
|
3013
|
+
* while price rises, O's while it falls, and the column flips only after a
|
|
3014
|
+
* `reversal`-box move against it. Time is discarded.
|
|
3015
|
+
*/
|
|
3016
|
+
declare function pointAndFigure(high: ArrayLike<number>, low: ArrayLike<number>, boxSize: number, reversal?: number): PfColumn[];
|
|
3017
|
+
interface VolumeProfile {
|
|
3018
|
+
/** Bin center price for each level (length = bins). */
|
|
3019
|
+
levels: Float64Array;
|
|
3020
|
+
/** Total volume traded in each price bin. */
|
|
3021
|
+
volume: Float64Array;
|
|
3022
|
+
binSize: number;
|
|
3023
|
+
priceMin: number;
|
|
3024
|
+
priceMax: number;
|
|
3025
|
+
/** Bin index of the highest-volume level (the Point of Control). */
|
|
3026
|
+
pocIndex: number;
|
|
3027
|
+
}
|
|
3028
|
+
/**
|
|
3029
|
+
* Volume profile — a histogram of traded volume by price level. Plot it as
|
|
3030
|
+
* horizontal bars (`orientation:"h"`) with `levels` on the y axis.
|
|
3031
|
+
*/
|
|
3032
|
+
declare function volumeProfile(price: ArrayLike<number>, volume: ArrayLike<number>, bins?: number): VolumeProfile;
|
|
3033
|
+
interface DepthCurves {
|
|
3034
|
+
/** Bid side: prices ascending toward mid, cumulative volume (best bid = largest cum). */
|
|
3035
|
+
bidPrice: Float64Array;
|
|
3036
|
+
bidCum: Float64Array;
|
|
3037
|
+
/** Ask side: prices ascending away from mid, cumulative volume. */
|
|
3038
|
+
askPrice: Float64Array;
|
|
3039
|
+
askCum: Float64Array;
|
|
3040
|
+
}
|
|
3041
|
+
/**
|
|
3042
|
+
* Order-book depth curves. `bids`/`asks` are `[price, size]` pairs (any order);
|
|
3043
|
+
* returns cumulative-volume step curves ready for two step-area layers.
|
|
3044
|
+
*/
|
|
3045
|
+
declare function depth(bids: ArrayLike<readonly [number, number]>, asks: ArrayLike<readonly [number, number]>): DepthCurves;
|
|
3046
|
+
|
|
3047
|
+
/**
|
|
3048
|
+
* Convenience builders for specialist finance charts. Each takes a {@link Plot}
|
|
3049
|
+
* and composes existing layers from a transform/indicator — mirroring the
|
|
3050
|
+
* `addMap(plot, …)` free-function style. Import from `@photonviz/core`.
|
|
3051
|
+
*/
|
|
3052
|
+
|
|
3053
|
+
/** Raw OHLC input shared by the candle-style helpers. */
|
|
3054
|
+
interface OhlcInput {
|
|
3055
|
+
x: ArrayLike<number>;
|
|
3056
|
+
open: ArrayLike<number>;
|
|
3057
|
+
high: ArrayLike<number>;
|
|
3058
|
+
low: ArrayLike<number>;
|
|
3059
|
+
close: ArrayLike<number>;
|
|
3060
|
+
}
|
|
3061
|
+
interface HeikinAshiOptions extends Omit<CandlestickOptions, "open" | "high" | "low" | "close"> {
|
|
3062
|
+
open: ArrayLike<number>;
|
|
3063
|
+
high: ArrayLike<number>;
|
|
3064
|
+
low: ArrayLike<number>;
|
|
3065
|
+
close: ArrayLike<number>;
|
|
3066
|
+
}
|
|
3067
|
+
/** Heikin-Ashi candles: smooth the OHLC, then draw it as a candlestick layer. */
|
|
3068
|
+
declare function addHeikinAshi(plot: Plot, opts: HeikinAshiOptions): CandlestickLayer;
|
|
3069
|
+
interface RenkoOptions {
|
|
3070
|
+
close: ArrayLike<number>;
|
|
3071
|
+
/** Fixed brick height in price units. */
|
|
3072
|
+
brickSize: number;
|
|
3073
|
+
upColor?: string | Color;
|
|
3074
|
+
downColor?: string | Color;
|
|
3075
|
+
name?: string;
|
|
3076
|
+
yAxis?: string;
|
|
3077
|
+
renderType?: RenderType;
|
|
3078
|
+
}
|
|
3079
|
+
/**
|
|
3080
|
+
* Renko chart — bricks at successive integer indices (time discarded). Rendered
|
|
3081
|
+
* as wickless candles, so pair it with an `ordinal-time`/linear x axis.
|
|
3082
|
+
*/
|
|
3083
|
+
declare function addRenko(plot: Plot, opts: RenkoOptions): CandlestickLayer;
|
|
3084
|
+
interface VolumeProfileOptions {
|
|
3085
|
+
/** Price per sample (typically close). */
|
|
3086
|
+
price: ArrayLike<number>;
|
|
3087
|
+
volume: ArrayLike<number>;
|
|
3088
|
+
/** Number of price bins. Default 24. */
|
|
3089
|
+
bins?: number;
|
|
3090
|
+
color?: string | Color;
|
|
3091
|
+
/** Highlight the Point-of-Control bin with this color. */
|
|
3092
|
+
pocColor?: string | Color;
|
|
3093
|
+
name?: string;
|
|
3094
|
+
yAxis?: string;
|
|
3095
|
+
renderType?: RenderType;
|
|
3096
|
+
}
|
|
3097
|
+
/** Volume-by-price histogram as horizontal bars (price on the y axis). */
|
|
3098
|
+
declare function addVolumeProfile(plot: Plot, opts: VolumeProfileOptions): BarLayer;
|
|
3099
|
+
interface BollingerOptions {
|
|
3100
|
+
x: ArrayLike<number>;
|
|
3101
|
+
close: ArrayLike<number>;
|
|
3102
|
+
period?: number;
|
|
3103
|
+
k?: number;
|
|
3104
|
+
/** Line color for the bands + middle. Default light blue. */
|
|
3105
|
+
color?: string | Color;
|
|
3106
|
+
/** Fill color between the bands (omit to skip the fill). */
|
|
3107
|
+
bandColor?: string | Color;
|
|
3108
|
+
width?: number;
|
|
3109
|
+
yAxis?: string;
|
|
3110
|
+
renderType?: RenderType;
|
|
3111
|
+
}
|
|
3112
|
+
/** Bollinger Bands: a shaded band between upper/lower plus the three lines. */
|
|
3113
|
+
interface BollingerHandle {
|
|
3114
|
+
band?: AreaLayer;
|
|
3115
|
+
upper: LineLayer;
|
|
3116
|
+
middle: LineLayer;
|
|
3117
|
+
lower: LineLayer;
|
|
3118
|
+
}
|
|
3119
|
+
declare function addBollinger(plot: Plot, opts: BollingerOptions): BollingerHandle;
|
|
3120
|
+
interface DepthOptions {
|
|
3121
|
+
/** `[price, size]` levels (any order). */
|
|
3122
|
+
bids: ArrayLike<readonly [number, number]>;
|
|
3123
|
+
asks: ArrayLike<readonly [number, number]>;
|
|
3124
|
+
bidColor?: string | Color;
|
|
3125
|
+
askColor?: string | Color;
|
|
3126
|
+
yAxis?: string;
|
|
3127
|
+
renderType?: RenderType;
|
|
3128
|
+
}
|
|
3129
|
+
/** Order-book depth: cumulative bid/ask volume as two filled areas. */
|
|
3130
|
+
interface DepthHandle {
|
|
3131
|
+
bid: AreaLayer;
|
|
3132
|
+
ask: AreaLayer;
|
|
3133
|
+
}
|
|
3134
|
+
declare function addDepth(plot: Plot, opts: DepthOptions): DepthHandle;
|
|
3135
|
+
|
|
3136
|
+
/**
|
|
3137
|
+
* A tiny dependency-free CSV parser + typed-array column access — the common
|
|
3138
|
+
* "load a CSV and plot a column" path. Handles quoted fields, escaped quotes
|
|
3139
|
+
* (`""`), and `\n` / `\r\n` line endings.
|
|
3140
|
+
*/
|
|
3141
|
+
interface CSVOptions {
|
|
3142
|
+
/** Field delimiter. Default `","`. */
|
|
3143
|
+
delimiter?: string;
|
|
3144
|
+
/** Treat the first row as headers. Default `true`. */
|
|
3145
|
+
header?: boolean;
|
|
3146
|
+
/** Drop blank lines. Default `true`. */
|
|
3147
|
+
skipEmpty?: boolean;
|
|
3148
|
+
}
|
|
3149
|
+
/** A parsed CSV: header names + string rows, with typed column accessors. */
|
|
3150
|
+
interface Table {
|
|
3151
|
+
headers: string[];
|
|
3152
|
+
rows: string[][];
|
|
3153
|
+
/** Number of data rows. */
|
|
3154
|
+
readonly length: number;
|
|
3155
|
+
/** A column's raw string values (by name or index). */
|
|
3156
|
+
column(name: string | number): string[];
|
|
3157
|
+
/** A column parsed to a `Float64Array` (non-numeric cells become `NaN`). */
|
|
3158
|
+
numeric(name: string | number): Float64Array;
|
|
3159
|
+
}
|
|
3160
|
+
/** Parse CSV text into a {@link Table}. */
|
|
3161
|
+
declare function parseCSV(text: string, opts?: CSVOptions): Table;
|
|
3162
|
+
|
|
3163
|
+
/**
|
|
3164
|
+
* Largest-Triangle-Three-Buckets (LTTB) downsampling — reduce a series to
|
|
3165
|
+
* `threshold` points while preserving its visual shape (peaks/troughs), the
|
|
3166
|
+
* standard technique for plotting very long line series. First and last points
|
|
3167
|
+
* are always kept.
|
|
3168
|
+
*/
|
|
3169
|
+
declare function lttb(x: ArrayLike<number>, y: ArrayLike<number>, threshold: number): {
|
|
3170
|
+
x: Float64Array;
|
|
3171
|
+
y: Float64Array;
|
|
3172
|
+
};
|
|
3173
|
+
|
|
3174
|
+
/**
|
|
3175
|
+
* Squarified treemap — a pure layout plus a {@link Plot} builder that composes
|
|
3176
|
+
* the existing {@link PatchesLayer} (one rect patch per item) and a centered
|
|
3177
|
+
* label annotation per cell. Import from `@photonviz/core`.
|
|
3178
|
+
*/
|
|
3179
|
+
|
|
3180
|
+
/** A weighted item to lay into the treemap. */
|
|
3181
|
+
interface TreemapItem {
|
|
3182
|
+
label: string;
|
|
3183
|
+
value: number;
|
|
3184
|
+
/** Explicit fill; otherwise a palette color is cycled by index. */
|
|
3185
|
+
color?: string;
|
|
3186
|
+
}
|
|
3187
|
+
/** A laid-out cell: the input item plus its axis-aligned rect `[x0,y0]`–`[x1,y1]`. */
|
|
3188
|
+
interface TreemapCell {
|
|
3189
|
+
label: string;
|
|
3190
|
+
value: number;
|
|
3191
|
+
color?: string;
|
|
3192
|
+
x0: number;
|
|
3193
|
+
y0: number;
|
|
3194
|
+
x1: number;
|
|
3195
|
+
y1: number;
|
|
3196
|
+
}
|
|
3197
|
+
/** The rectangle the layout fills. */
|
|
3198
|
+
interface TreemapExtent {
|
|
3199
|
+
x: [number, number];
|
|
3200
|
+
y: [number, number];
|
|
3201
|
+
}
|
|
3202
|
+
/** tab10-ish default palette, cycled by index for items without a color. */
|
|
3203
|
+
declare const TREEMAP_PALETTE: readonly string[];
|
|
3204
|
+
/**
|
|
3205
|
+
* Squarified treemap layout: sizes rects ∝ `value`, packing them into `extent`
|
|
3206
|
+
* with aspect ratios kept near 1. Pure — no side effects. Zero/negative values
|
|
3207
|
+
* and empty input yield no cells.
|
|
3208
|
+
*/
|
|
3209
|
+
declare function treemapLayout(items: readonly TreemapItem[], extent?: TreemapExtent): TreemapCell[];
|
|
3210
|
+
interface TreemapOptions {
|
|
3211
|
+
items: TreemapItem[];
|
|
3212
|
+
extent?: TreemapExtent;
|
|
3213
|
+
/** Palette cycled by index for items lacking a `color`. Defaults to {@link TREEMAP_PALETTE}. */
|
|
3214
|
+
colors?: string[];
|
|
3215
|
+
opacity?: number;
|
|
3216
|
+
name?: string;
|
|
3217
|
+
renderType?: RenderType;
|
|
3218
|
+
/** Draw a centered label per cell (tiny cells are skipped). Default true. */
|
|
3219
|
+
labels?: boolean;
|
|
3220
|
+
}
|
|
3221
|
+
/**
|
|
3222
|
+
* Add a squarified treemap: one filled rect {@link Patch} per item plus centered
|
|
3223
|
+
* labels. Composes {@link Plot.addPatches} — low-risk, no new layer type.
|
|
3224
|
+
*/
|
|
3225
|
+
declare function addTreemap(plot: Plot, opts: TreemapOptions): PatchesLayer;
|
|
3226
|
+
|
|
3227
|
+
/**
|
|
3228
|
+
* Funnel chart — a pure layout plus a {@link Plot} builder that composes the
|
|
3229
|
+
* existing {@link PatchesLayer} (one centered trapezoid per stage) with a
|
|
3230
|
+
* centered label per stage. Import from `@photonviz/core`.
|
|
3231
|
+
*/
|
|
3232
|
+
|
|
3233
|
+
/** One funnel stage: a labeled weighted value. */
|
|
3234
|
+
interface FunnelItem {
|
|
3235
|
+
label: string;
|
|
3236
|
+
value: number;
|
|
3237
|
+
/** Explicit fill; otherwise a palette color is cycled by index. */
|
|
3238
|
+
color?: string;
|
|
3239
|
+
}
|
|
3240
|
+
/** A laid-out stage: the input item plus its trapezoid polygon ring. */
|
|
3241
|
+
interface FunnelStage {
|
|
3242
|
+
label: string;
|
|
3243
|
+
value: number;
|
|
3244
|
+
color?: string;
|
|
3245
|
+
/** Closed polygon ring (4 corners) in data space. */
|
|
3246
|
+
poly: {
|
|
3247
|
+
x: number[];
|
|
3248
|
+
y: number[];
|
|
3249
|
+
};
|
|
3250
|
+
}
|
|
3251
|
+
interface FunnelLayoutOptions {
|
|
3252
|
+
/** Full plot width the largest stage spans. Default 1 (extent `[-0.5, 0.5]`). */
|
|
3253
|
+
width?: number;
|
|
3254
|
+
/** Total stack height. Default 1 (extent `[0, 1]`, top stage first). */
|
|
3255
|
+
height?: number;
|
|
3256
|
+
/** Bottom width of the last stage as a fraction of its value width. Default 0.4. */
|
|
3257
|
+
neck?: number;
|
|
3258
|
+
}
|
|
3259
|
+
/** tab10-ish default palette, cycled by index for stages without a color. */
|
|
3260
|
+
declare const FUNNEL_PALETTE: readonly string[];
|
|
3261
|
+
/**
|
|
3262
|
+
* Funnel layout: centered trapezoids stacked top-to-bottom, each stage's top
|
|
3263
|
+
* width ∝ its value and bottom width ∝ the next value (the last stage tapers to
|
|
3264
|
+
* a `neck` fraction of its own width). Pure — no side effects.
|
|
3265
|
+
*/
|
|
3266
|
+
declare function funnelLayout(items: readonly FunnelItem[], opts?: FunnelLayoutOptions): FunnelStage[];
|
|
3267
|
+
interface FunnelOptions {
|
|
3268
|
+
items: FunnelItem[];
|
|
3269
|
+
width?: number;
|
|
3270
|
+
height?: number;
|
|
3271
|
+
neck?: number;
|
|
3272
|
+
/** Palette cycled by index for stages lacking a `color`. Defaults to {@link FUNNEL_PALETTE}. */
|
|
3273
|
+
colors?: string[];
|
|
3274
|
+
opacity?: number;
|
|
3275
|
+
name?: string;
|
|
3276
|
+
renderType?: RenderType;
|
|
3277
|
+
/** Draw a centered label per stage. Default true. */
|
|
3278
|
+
labels?: boolean;
|
|
3279
|
+
}
|
|
3280
|
+
/**
|
|
3281
|
+
* Add a funnel chart: one filled trapezoid {@link Patch} per stage plus centered
|
|
3282
|
+
* labels. Composes {@link Plot.addPatches} — low-risk, no new layer type.
|
|
3283
|
+
*/
|
|
3284
|
+
declare function addFunnel(plot: Plot, opts: FunnelOptions): PatchesLayer;
|
|
3285
|
+
|
|
3286
|
+
/**
|
|
3287
|
+
* Sunburst (radial icicle) builder. Renders a hierarchy as concentric annular
|
|
3288
|
+
* sectors — one ring per depth, angular span ∝ summed leaf value — by
|
|
3289
|
+
* tessellating each sector into a polygon {@link Patch} ring. Pure
|
|
3290
|
+
* {@link sunburstLayout} does the math; {@link addSunburst} composes the
|
|
3291
|
+
* existing {@link PatchesLayer}. Import from `@photonviz/core`.
|
|
3292
|
+
*/
|
|
3293
|
+
|
|
3294
|
+
/** A node in the input hierarchy; `value` counts only for leaves. */
|
|
3295
|
+
interface SunburstNode {
|
|
3296
|
+
name: string;
|
|
3297
|
+
value?: number;
|
|
3298
|
+
color?: string;
|
|
3299
|
+
children?: SunburstNode[];
|
|
3300
|
+
}
|
|
3301
|
+
/** Tunables for {@link sunburstLayout}. */
|
|
3302
|
+
interface SunburstLayoutOptions {
|
|
3303
|
+
/** Radial thickness of each depth ring, in data units. Default 1. */
|
|
3304
|
+
ringWidth?: number;
|
|
3305
|
+
/** Inner radius of the depth-0 ring (hole at the center). Default 0. */
|
|
3306
|
+
center?: number;
|
|
3307
|
+
/** Angle of the first sector edge, radians. Default `Math.PI / 2` (12 o'clock). */
|
|
3308
|
+
startAngle?: number;
|
|
3309
|
+
}
|
|
3310
|
+
/** One laid-out sector: angular range `[a0,a1]` (radians) and radial ring `[r0,r1]`. */
|
|
3311
|
+
interface SunburstArc {
|
|
3312
|
+
name: string;
|
|
3313
|
+
depth: number;
|
|
3314
|
+
a0: number;
|
|
3315
|
+
a1: number;
|
|
3316
|
+
r0: number;
|
|
3317
|
+
r1: number;
|
|
3318
|
+
color?: string;
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* Lay a hierarchy out into flat annular sectors. Angular span is proportional to
|
|
3322
|
+
* summed leaf value; each depth occupies its own radius ring. Side-effect-free.
|
|
3323
|
+
*/
|
|
3324
|
+
declare function sunburstLayout(root: SunburstNode, opts?: SunburstLayoutOptions): SunburstArc[];
|
|
3325
|
+
/** Options for {@link addSunburst}. */
|
|
3326
|
+
interface SunburstOptions {
|
|
3327
|
+
root: SunburstNode;
|
|
3328
|
+
/** Radial thickness of each depth ring, in data units. Default 1. */
|
|
3329
|
+
ringWidth?: number;
|
|
3330
|
+
/** Explicit palette, cycled by node index. Falls back to a built-in palette. */
|
|
3331
|
+
colors?: string[];
|
|
3332
|
+
/** Fill opacity, 0..1. Default 1. */
|
|
3333
|
+
opacity?: number;
|
|
3334
|
+
name?: string;
|
|
3335
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming. Default `"static"`. */
|
|
3336
|
+
renderType?: RenderType;
|
|
3337
|
+
}
|
|
3338
|
+
/**
|
|
3339
|
+
* Build a sunburst from a hierarchy and add it as a {@link PatchesLayer} centered
|
|
3340
|
+
* at (0,0). Set the plot's `equalAspect: true` so the rings stay circular.
|
|
3341
|
+
*/
|
|
3342
|
+
declare function addSunburst(plot: Plot, opts: SunburstOptions): PatchesLayer;
|
|
3343
|
+
|
|
3344
|
+
/**
|
|
3345
|
+
* Radial gauge builder. Draws a background track arc, a colored value arc over
|
|
3346
|
+
* `[min,max]` mapped to an angular sweep (default 220°, 200°→-20°), and a needle.
|
|
3347
|
+
* Pure {@link gaugeLayout} produces tessellated polygons; {@link addGauge}
|
|
3348
|
+
* composes the existing {@link PatchesLayer}. Import from `@photonviz/core`.
|
|
3349
|
+
*/
|
|
3350
|
+
|
|
3351
|
+
/** An annular-sector polygon, tessellated into a single ring. */
|
|
3352
|
+
interface Ring {
|
|
3353
|
+
x: number[];
|
|
3354
|
+
y: number[];
|
|
3355
|
+
}
|
|
3356
|
+
/** A `{value, color}` band; the arc takes the color of the highest one `value` reaches. */
|
|
3357
|
+
interface GaugeThreshold {
|
|
3358
|
+
value: number;
|
|
3359
|
+
color: string;
|
|
3360
|
+
}
|
|
3361
|
+
/** Tunables for {@link gaugeLayout}. */
|
|
3362
|
+
interface GaugeLayoutOptions {
|
|
3363
|
+
value: number;
|
|
3364
|
+
/** Value at the start of the sweep. Default 0. */
|
|
3365
|
+
min?: number;
|
|
3366
|
+
/** Value at the end of the sweep. Default 100. */
|
|
3367
|
+
max?: number;
|
|
3368
|
+
/** Angle of the sweep start, degrees. Default 200. */
|
|
3369
|
+
startAngle?: number;
|
|
3370
|
+
/** Angle of the sweep end, degrees. Default -20. */
|
|
3371
|
+
endAngle?: number;
|
|
3372
|
+
/** Outer radius, data units. Default 1. */
|
|
3373
|
+
radius?: number;
|
|
3374
|
+
/** Inner (track) radius, data units. Default 0.7. */
|
|
3375
|
+
innerRadius?: number;
|
|
3376
|
+
}
|
|
3377
|
+
/**
|
|
3378
|
+
* Compute the gauge geometry: a full background sector, a value sector clamped to
|
|
3379
|
+
* `[min,max]`, and a thin needle triangle from the center to the value angle.
|
|
3380
|
+
* Angles sweep from `startAngle` to `endAngle` (degrees). Side-effect-free.
|
|
3381
|
+
*/
|
|
3382
|
+
declare function gaugeLayout(opts: GaugeLayoutOptions): {
|
|
3383
|
+
bg: Ring;
|
|
3384
|
+
value: Ring;
|
|
3385
|
+
needle: {
|
|
3386
|
+
x: number[];
|
|
3387
|
+
y: number[];
|
|
3388
|
+
};
|
|
3389
|
+
};
|
|
3390
|
+
/** Options for {@link addGauge}. */
|
|
3391
|
+
interface GaugeOptions {
|
|
3392
|
+
value: number;
|
|
3393
|
+
/** Value at the start of the sweep. Default 0. */
|
|
3394
|
+
min?: number;
|
|
3395
|
+
/** Value at the end of the sweep. Default 100. */
|
|
3396
|
+
max?: number;
|
|
3397
|
+
/** `{value,color}` bands; the value arc takes the color of the highest one reached. */
|
|
3398
|
+
thresholds?: GaugeThreshold[];
|
|
3399
|
+
/** Value-arc color when no thresholds apply. Default blue. */
|
|
3400
|
+
color?: string;
|
|
3401
|
+
/** Background-track color. Default a muted gray. */
|
|
3402
|
+
trackColor?: string;
|
|
3403
|
+
/** Angle of the sweep start, degrees. Default 200. */
|
|
3404
|
+
startAngle?: number;
|
|
3405
|
+
/** Angle of the sweep end, degrees. Default -20. */
|
|
3406
|
+
endAngle?: number;
|
|
3407
|
+
/** Needle color. Default a dark slate. */
|
|
3408
|
+
needleColor?: string;
|
|
3409
|
+
/** Center label text; defaults to the numeric value. Pass `false` to omit. */
|
|
3410
|
+
label?: string | false;
|
|
3411
|
+
name?: string;
|
|
3412
|
+
/** Buffer-usage hint; set `"dynamic"` when streaming. Default `"static"`. */
|
|
3413
|
+
renderType?: RenderType;
|
|
3414
|
+
}
|
|
3415
|
+
/**
|
|
3416
|
+
* Build a radial gauge (track + value arc + needle) and add it as a
|
|
3417
|
+
* {@link PatchesLayer} centered at (0,0), with an optional center label.
|
|
3418
|
+
* Set the plot's `equalAspect: true` so it stays circular.
|
|
3419
|
+
*/
|
|
3420
|
+
declare function addGauge(plot: Plot, opts: GaugeOptions): PatchesLayer;
|
|
3421
|
+
|
|
3422
|
+
/** A node: a display `name` and an optional explicit fill `color`. */
|
|
3423
|
+
interface SankeyNode {
|
|
3424
|
+
name: string;
|
|
3425
|
+
color?: string;
|
|
3426
|
+
}
|
|
3427
|
+
/** A flow from node index `source` to node index `target` carrying `value`. */
|
|
3428
|
+
interface SankeyLink {
|
|
3429
|
+
source: number;
|
|
3430
|
+
target: number;
|
|
3431
|
+
value: number;
|
|
3432
|
+
}
|
|
3433
|
+
/** Tuning for the pure {@link sankeyLayout}. All in normalized-extent units. */
|
|
3434
|
+
interface SankeyLayoutOptions {
|
|
3435
|
+
/** Drawing box. Defaults to x `[0,1]`, y `[0,1]`. */
|
|
3436
|
+
extent?: {
|
|
3437
|
+
x?: Range;
|
|
3438
|
+
y?: Range;
|
|
3439
|
+
};
|
|
3440
|
+
/** Node rectangle width along x. Default 0.02. */
|
|
3441
|
+
nodeWidth?: number;
|
|
3442
|
+
/** Vertical gap between stacked nodes, as a fraction of the y extent. Default 0.02. */
|
|
3443
|
+
nodePadding?: number;
|
|
3444
|
+
}
|
|
3445
|
+
/** One laid-out node rectangle, keyed by node index `i`. */
|
|
3446
|
+
interface SankeyNodeRect {
|
|
3447
|
+
i: number;
|
|
3448
|
+
x0: number;
|
|
3449
|
+
y0: number;
|
|
3450
|
+
x1: number;
|
|
3451
|
+
y1: number;
|
|
3452
|
+
}
|
|
3453
|
+
/** One laid-out ribbon polygon (closed ring), keyed by link index. */
|
|
3454
|
+
interface SankeyRibbon {
|
|
3455
|
+
link: number;
|
|
3456
|
+
x: number[];
|
|
3457
|
+
y: number[];
|
|
3458
|
+
}
|
|
3459
|
+
/** Result of {@link sankeyLayout}: node rectangles and link ribbons. */
|
|
3460
|
+
interface SankeyLayoutResult {
|
|
3461
|
+
nodeRects: SankeyNodeRect[];
|
|
3462
|
+
ribbons: SankeyRibbon[];
|
|
3463
|
+
}
|
|
3464
|
+
/**
|
|
3465
|
+
* Pure, side-effect-free Sankey layout. Assigns each node a layer by longest
|
|
3466
|
+
* path from the sources, stacks nodes vertically by throughput, and traces each
|
|
3467
|
+
* link as a bezier ribbon between its source and target edges.
|
|
3468
|
+
*/
|
|
3469
|
+
declare function sankeyLayout(nodes: SankeyNode[], links: SankeyLink[], opts?: SankeyLayoutOptions): SankeyLayoutResult;
|
|
3470
|
+
/** Options for {@link addSankey}. */
|
|
3471
|
+
interface SankeyOptions {
|
|
3472
|
+
nodes: SankeyNode[];
|
|
3473
|
+
links: SankeyLink[];
|
|
3474
|
+
/** Drawing box in data space. Defaults to x `[0,1]`, y `[0,1]`. */
|
|
3475
|
+
extent?: {
|
|
3476
|
+
x?: Range;
|
|
3477
|
+
y?: Range;
|
|
3478
|
+
};
|
|
3479
|
+
nodeWidth?: number;
|
|
3480
|
+
nodePadding?: number;
|
|
3481
|
+
/** Per-node colors (by index); overridden by a node's own `color`. */
|
|
3482
|
+
colors?: string[];
|
|
3483
|
+
/** Layer fill opacity (0..1), forwarded to the patches layer. Default 1. */
|
|
3484
|
+
opacity?: number;
|
|
3485
|
+
name?: string;
|
|
3486
|
+
renderType?: RenderType;
|
|
3487
|
+
/** Draw node name labels. Default true. */
|
|
3488
|
+
labels?: boolean;
|
|
3489
|
+
}
|
|
3490
|
+
/**
|
|
3491
|
+
* Build a Sankey diagram on `plot`: one node rectangle {@link Patch} per node
|
|
3492
|
+
* plus one semi-transparent ribbon patch per link (colored from its source
|
|
3493
|
+
* node), added as a single {@link PatchesLayer}. Node name labels are added as
|
|
3494
|
+
* plot annotations unless `labels` is false.
|
|
3495
|
+
*/
|
|
3496
|
+
declare function addSankey(plot: Plot, opts: SankeyOptions): PatchesLayer;
|
|
3497
|
+
|
|
3498
|
+
/**
|
|
3499
|
+
* Chord diagram — a pure circular layout plus a {@link Plot} builder that composes
|
|
3500
|
+
* the existing {@link PatchesLayer}: thin annular sectors for the group arcs and
|
|
3501
|
+
* bezier-bounded ribbons for the flows between groups, with labels outside each
|
|
3502
|
+
* arc. Import from `@photonviz/core`. Use `equalAspect: true` so it stays circular.
|
|
3503
|
+
*/
|
|
3504
|
+
|
|
3505
|
+
/** tab10-ish default palette, cycled by group index. */
|
|
3506
|
+
declare const CHORD_PALETTE: readonly string[];
|
|
3507
|
+
/** A laid-out group arc as a closed ring of `x`/`y` (thin annular sector). */
|
|
3508
|
+
interface ChordGroupArc {
|
|
3509
|
+
i: number;
|
|
3510
|
+
x: number[];
|
|
3511
|
+
y: number[];
|
|
3512
|
+
}
|
|
3513
|
+
/** A laid-out ribbon between groups `i` and `j` as a closed ring of `x`/`y`. */
|
|
3514
|
+
interface ChordRibbon {
|
|
3515
|
+
i: number;
|
|
3516
|
+
j: number;
|
|
3517
|
+
x: number[];
|
|
3518
|
+
y: number[];
|
|
3519
|
+
}
|
|
3520
|
+
/** The result of {@link chordLayout}: outer group arcs plus inter-group ribbons. */
|
|
3521
|
+
interface ChordLayoutResult {
|
|
3522
|
+
groupArcs: ChordGroupArc[];
|
|
3523
|
+
ribbons: ChordRibbon[];
|
|
3524
|
+
}
|
|
3525
|
+
/** Tunable geometry for {@link chordLayout}. */
|
|
3526
|
+
interface ChordLayoutOptions {
|
|
3527
|
+
/** Outer radius of the group arcs. Default 1. */
|
|
3528
|
+
radius?: number;
|
|
3529
|
+
/** Total angular gap (radians) split evenly between groups. Default 0.1·2π. */
|
|
3530
|
+
padAngle?: number;
|
|
3531
|
+
/** Thickness of the outer arc as a fraction of `radius`. Default 0.06. */
|
|
3532
|
+
arcWidth?: number;
|
|
3533
|
+
/** Points sampled along each connecting bezier edge of a ribbon. Default 24. */
|
|
3534
|
+
samples?: number;
|
|
3535
|
+
}
|
|
3536
|
+
/**
|
|
3537
|
+
* Chord layout: groups sit around a circle with angular span ∝ their row-sum
|
|
3538
|
+
* (standard chord convention), separated by `padAngle`. Each group's arc is
|
|
3539
|
+
* sub-divided per target `j`; a ribbon between `i` and `j` is bounded by the two
|
|
3540
|
+
* matching sub-arcs and closed by quadratic beziers curving through the center.
|
|
3541
|
+
* Pure — no side effects. Empty/zero-flow input yields empty arrays.
|
|
3542
|
+
*/
|
|
3543
|
+
declare function chordLayout(matrix: number[][], opts?: ChordLayoutOptions): ChordLayoutResult;
|
|
3544
|
+
interface ChordOptions {
|
|
3545
|
+
/** Square flow matrix; `matrix[i][j]` is the flow from group `i` to group `j`. */
|
|
3546
|
+
matrix: number[][];
|
|
3547
|
+
/** Optional group labels, placed just outside each arc. */
|
|
3548
|
+
labels?: string[];
|
|
3549
|
+
/** Outer radius. Default 1. */
|
|
3550
|
+
radius?: number;
|
|
3551
|
+
/** Palette cycled by group index. Defaults to {@link CHORD_PALETTE}. */
|
|
3552
|
+
colors?: string[];
|
|
3553
|
+
/** Ribbon fill opacity, 0..1. Default 0.65. */
|
|
3554
|
+
opacity?: number;
|
|
3555
|
+
name?: string;
|
|
3556
|
+
renderType?: RenderType;
|
|
3557
|
+
}
|
|
3558
|
+
/**
|
|
3559
|
+
* Add a chord diagram: opaque per-group outer arcs plus semi-transparent ribbons
|
|
3560
|
+
* (colored by their source group) as {@link Patch}es, with labels outside each
|
|
3561
|
+
* arc. Composes {@link Plot.addPatches} — set `equalAspect: true` on the plot.
|
|
3562
|
+
*/
|
|
3563
|
+
declare function addChord(plot: Plot, opts: ChordOptions): PatchesLayer;
|
|
3564
|
+
|
|
3565
|
+
/**
|
|
3566
|
+
* Parallel coordinates — a pure per-dimension normalization plus a {@link Plot}
|
|
3567
|
+
* builder that composes existing {@link LineLayer}s: one polyline per row crossing
|
|
3568
|
+
* N vertical axes, each axis drawn as a `span` guide with a name label on top.
|
|
3569
|
+
* Import from `@photonviz/core`.
|
|
3570
|
+
*/
|
|
3571
|
+
|
|
3572
|
+
/** tab10-ish default palette, cycled by row index (or by `colorBy` band). */
|
|
3573
|
+
declare const PARALLEL_PALETTE: readonly string[];
|
|
3574
|
+
/** A laid-out axis: its dimension name, x position, and observed value range. */
|
|
3575
|
+
interface ParallelAxis {
|
|
3576
|
+
dim: string;
|
|
3577
|
+
x: number;
|
|
3578
|
+
min: number;
|
|
3579
|
+
max: number;
|
|
3580
|
+
}
|
|
3581
|
+
/** A laid-out row as a polyline of N points (one per dimension). */
|
|
3582
|
+
interface ParallelLine {
|
|
3583
|
+
row: number;
|
|
3584
|
+
x: number[];
|
|
3585
|
+
y: number[];
|
|
3586
|
+
}
|
|
3587
|
+
/** The result of {@link parallelLayout}: axis metadata plus per-row polylines. */
|
|
3588
|
+
interface ParallelLayoutResult {
|
|
3589
|
+
axes: ParallelAxis[];
|
|
3590
|
+
lines: ParallelLine[];
|
|
3591
|
+
}
|
|
3592
|
+
/**
|
|
3593
|
+
* Parallel-coordinates layout: axis `i` sits at `x = i`; each dimension's values
|
|
3594
|
+
* are normalized to `y ∈ [0,1]` by its own min/max (a flat dimension maps to 0.5).
|
|
3595
|
+
* Each row becomes an N-point polyline. Pure — no side effects. Non-finite values
|
|
3596
|
+
* fall back to the axis midpoint.
|
|
3597
|
+
*/
|
|
3598
|
+
declare function parallelLayout(dimensions: string[], rows: number[][]): ParallelLayoutResult;
|
|
3599
|
+
interface ParallelOptions {
|
|
3600
|
+
/** One name per axis, left to right. */
|
|
3601
|
+
dimensions: string[];
|
|
3602
|
+
/** Data rows, each parallel to `dimensions`. */
|
|
3603
|
+
rows: number[][];
|
|
3604
|
+
/** Optional per-row value mapped through a palette ramp for coloring. */
|
|
3605
|
+
colorBy?: number[];
|
|
3606
|
+
/** Palette cycled by row index (or banded by `colorBy`). Defaults to {@link PARALLEL_PALETTE}. */
|
|
3607
|
+
colors?: string[];
|
|
3608
|
+
/** Polyline width in px. Default 1. */
|
|
3609
|
+
width?: number;
|
|
3610
|
+
/** Line opacity, 0..1. Default 0.7. */
|
|
3611
|
+
opacity?: number;
|
|
3612
|
+
name?: string;
|
|
3613
|
+
renderType?: RenderType;
|
|
3614
|
+
}
|
|
3615
|
+
/** The layers created by {@link addParallelCoordinates}: one {@link LineLayer} per row. */
|
|
3616
|
+
interface ParallelHandle {
|
|
3617
|
+
lines: LineLayer[];
|
|
3618
|
+
}
|
|
3619
|
+
/**
|
|
3620
|
+
* Add a parallel-coordinates plot: each row as a {@link Plot.addLine} polyline
|
|
3621
|
+
* (colored via `colorBy` ramp or a cycled palette), each axis as a vertical
|
|
3622
|
+
* `span` guide, plus a dimension-name label at the top of every axis.
|
|
3623
|
+
*/
|
|
3624
|
+
declare function addParallelCoordinates(plot: Plot, opts: ParallelOptions): ParallelHandle;
|
|
3625
|
+
|
|
2271
3626
|
/** Parse a CSS hex/rgb color string into normalized RGBA (0..1). */
|
|
2272
3627
|
declare function parseColor(input: string): [number, number, number, number];
|
|
2273
3628
|
/** Normalized RGBA (0..1) back to a CSS `rgba(...)` string. */
|
|
2274
3629
|
declare function toColorCss(c: readonly [number, number, number, number]): string;
|
|
2275
3630
|
|
|
2276
|
-
export { type Annotation, AreaLayer, type AreaOptions, type AreaSeries, Axis, type AxisConfig, type AxisFrame, type AxisScaleOptions, Bar3DLayer, type Bar3DOptions, BarLayer, type BarOptions, type BarSeries, type Bounds, type Bounds3, type BoxGroup, BoxLayer, type BoxOptions, type BoxStats, CandlestickLayer, type CandlestickOptions, CategoricalScale, type Color, type ColorInfo, type ColormapName, Contour3DLayer, type Contour3DOptions, ContourLayer, type ContourOptions, type Density, type Dim, type DrawState, ErrorBarLayer, type ErrorBarOptions, type ForceLayoutOptions, type GraphInput, GraphLayer, type GraphOptions, type GroupedBarOptions, HeatmapLayer, type HeatmapOptions, HexbinLayer, type HexbinOptions, type Histogram, type HoverReadoutRow, ImageLayer, type ImageOptions, type ImageSource, type InteractionMode, IsosurfaceLayer, type IsosurfaceOptions, type Layer, type Layer3D, type Layout, type LegendOptions, Line3DLayer, type Line3DOptions, LineLayer, type LineOptions, LinearScale, LogScale, type MarkerShape, type Patch, PatchesLayer, type PatchesOptions, type PickMode, PieLayer, type PieOptions, Plot, Plot3D, type Plot3DOptions, type PlotOptions, type PlotTitleOptions, PointCloudLayer, type PointCloudOptions, type PolarLineOptions, type PolarOptions, PolarPlot, type PolarScatterOptions, type PolarSeries, Quiver3DLayer, type Quiver3DOptions, QuiverLayer, type QuiverOptions, type RGB, type Range, type ResolvedAxisStyle, type Scale, type ScaleType, ScatterLayer, type ScatterOptions, type Spectrogram, type StackedAreaOptions, type StackedBarOptions, StemLayer, type StemOptions, SurfaceLayer, type SurfaceOptions, TRANSFORM_GLSL, TRANSFORM_UNIFORMS, type Theme, type Tick, type TicksSpec, TimeScale, type ToolbarHost, type ToolbarTheme, VolumeLayer, type VolumeOptions, type YAxisOptions, autoTicks, boxStats, colormap, colormapLUT, createProgram, createToolbar, darkTheme, defaultFormat, earcut, fft, forceLayout, histogram, kde, lightTheme, makeScale, marchingCubes, parseColor, quantileSorted, resolveAxisStyle, resolveTicks, setTransformUniforms, spectrogram, toColorCss, uniformLocations, withMinorTicks };
|
|
3631
|
+
export { type Adx, type Annotation, AreaLayer, type AreaOptions, type AreaSeries, Axis, type AxisConfig, type AxisFrame, type AxisScaleOptions, Bar3DLayer, type Bar3DOptions, BarLayer, type BarOptions, type BarSeries, type BollingerBands, type BollingerHandle, type BollingerOptions, type Bounds, type Bounds3, type BoxGroup, BoxLayer, type BoxOptions, type BoxStats, type Brick, CHORD_PALETTE, type CSVOptions, type Candle, type CandlestickData, CandlestickLayer, type CandlestickOptions, CategoricalScale, type Channel, type ChordGroupArc, type ChordLayoutOptions, type ChordLayoutResult, type ChordOptions, type ChordRibbon, type Color, type ColorInfo, type ColormapName, Contour3DLayer, type Contour3DOptions, ContourLayer, type ContourOptions, type Density, type DepthCurves, type DepthHandle, type DepthOptions, type Dim, type DrawState, type DrawTool, ErrorBarLayer, type ErrorBarOptions, type ExportOptions, FUNNEL_PALETTE, type FibLevel, type ForceLayoutOptions, type FunnelItem, type FunnelLayoutOptions, type FunnelOptions, type FunnelStage, type GaugeLayoutOptions, type GaugeOptions, type GaugeThreshold, type GraphInput, GraphLayer, type GraphOptions, type GroupedBarOptions, HeatmapLayer, type HeatmapOptions, type HeikinAshiOptions, HexbinLayer, type HexbinOptions, type Histogram, type HoverReadoutRow, type Ichimoku, ImageLayer, type ImageOptions, type ImageSource, type InteractionMode, IsosurfaceLayer, type IsosurfaceOptions, type Layer, type Layer3D, type Layout, type LegendOptions, Line3DLayer, type Line3DOptions, LineLayer, type LineOptions, LinearScale, LogScale, type Macd, type MarkerShape, type Ohlc, type OhlcArrays, type OhlcInput, OhlcLayer, type OhlcOptions, OrdinalTimeScale, PARALLEL_PALETTE, type ParallelAxis, type ParallelHandle, type ParallelLayoutResult, type ParallelLine, type ParallelOptions, type Patch, PatchesLayer, type PatchesOptions, type PfColumn, type PickMode, PieLayer, type PieOptions, Plot, Plot3D, type Plot3DOptions, type PlotOptions, type PlotTitleOptions, PointCloudLayer, type PointCloudOptions, type PolarLineOptions, type PolarOptions, PolarPlot, type PolarScatterOptions, type PolarSeries, Quiver3DLayer, type Quiver3DOptions, QuiverLayer, type QuiverOptions, type RGB, type Range, type RenderType, type RenkoOptions, type ResolvedAxisStyle, type Ring, type SankeyLayoutOptions, type SankeyLayoutResult, type SankeyLink, type SankeyNode, type SankeyNodeRect, type SankeyOptions, type SankeyRibbon, type Scale, type ScaleType, ScatterLayer, type ScatterOptions, type Spectrogram, type StackedAreaOptions, type StackedBarOptions, StemLayer, type StemOptions, type Stochastic, type SunburstArc, type SunburstLayoutOptions, type SunburstNode, type SunburstOptions, type SuperTrend, SurfaceLayer, type SurfaceOptions, TRANSFORM_GLSL, TRANSFORM_UNIFORMS, TREEMAP_PALETTE, type Table, type Theme, type Tick, type TicksSpec, TimeScale, type ToolbarHost, type ToolbarTheme, type TreemapCell, type TreemapExtent, type TreemapItem, type TreemapOptions, VolumeLayer, type VolumeOptions, type VolumeProfile, type VolumeProfileOptions, type YAxisOptions, addBollinger, addChord, addDepth, addFunnel, addGauge, addHeikinAshi, addParallelCoordinates, addRenko, addSankey, addSunburst, addTreemap, addVolumeProfile, adx, atr, autoTicks, bollinger, boxStats, bufferUsage, canvasToBlob, chordLayout, colormap, colormapLUT, copyCanvasToClipboard, createProgram, createToolbar, darkTheme, defaultFormat, depth, downloadCanvas, earcut, ema, fft, fibRetracements, firstFinite, forceLayout, funnelLayout, gaugeLayout, heikinAshi, histogram, ichimoku, kde, keltner, lightTheme, lineBreak, linkX, lttb, macd, makeScale, marchingCubes, obv, parallelLayout, parseCSV, parseColor, pointAndFigure, quantileSorted, renko, resolveAxisStyle, resolveTicks, rollingStd, rsi, sankeyLayout, setTransformUniforms, sma, spectrogram, stochastic, sunburstLayout, superTrend, toColorCss, treemapLayout, trueRange, uniformLocations, volumeProfile, vwap, withMinorTicks, wma };
|