@photonviz/core 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +242 -3
- package/dist/index.js +1428 -193
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -196,6 +196,51 @@ declare class BoxLayer implements Layer {
|
|
|
196
196
|
dispose(): void;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
interface CandlestickOptions {
|
|
200
|
+
/** Candle positions (data space — e.g. epoch ms on a time axis). */
|
|
201
|
+
x: ArrayLike<number>;
|
|
202
|
+
open: ArrayLike<number>;
|
|
203
|
+
high: ArrayLike<number>;
|
|
204
|
+
low: ArrayLike<number>;
|
|
205
|
+
close: ArrayLike<number>;
|
|
206
|
+
/** Body width in data units. Defaults to 70% of the median spacing. */
|
|
207
|
+
width?: number;
|
|
208
|
+
/** Close ≥ open color. Default green. */
|
|
209
|
+
upColor?: string | Color;
|
|
210
|
+
/** Close < open color. Default red. */
|
|
211
|
+
downColor?: string | Color;
|
|
212
|
+
/** Wick thickness in CSS px. Default 1.5. */
|
|
213
|
+
wickWidth?: number;
|
|
214
|
+
name?: string;
|
|
215
|
+
yAxis?: string;
|
|
216
|
+
}
|
|
217
|
+
declare class CandlestickLayer implements Layer {
|
|
218
|
+
readonly id: string;
|
|
219
|
+
readonly name: string;
|
|
220
|
+
readonly colorCss: string;
|
|
221
|
+
readonly yAxis: string;
|
|
222
|
+
private gl;
|
|
223
|
+
private progs;
|
|
224
|
+
private bodyVao;
|
|
225
|
+
private wickVao;
|
|
226
|
+
private buffers;
|
|
227
|
+
private uBody;
|
|
228
|
+
private uWick;
|
|
229
|
+
private wickWidth;
|
|
230
|
+
private count;
|
|
231
|
+
private xRef;
|
|
232
|
+
private yRef;
|
|
233
|
+
private xBounds;
|
|
234
|
+
private yBounds;
|
|
235
|
+
constructor(gl: WebGL2RenderingContext, opts: CandlestickOptions);
|
|
236
|
+
bounds(): {
|
|
237
|
+
x: Range;
|
|
238
|
+
y: Range;
|
|
239
|
+
} | null;
|
|
240
|
+
draw(state: DrawState): void;
|
|
241
|
+
dispose(): void;
|
|
242
|
+
}
|
|
243
|
+
|
|
199
244
|
type RGB = [number, number, number];
|
|
200
245
|
type ColormapName = "viridis" | "plasma" | "coolwarm" | "grayscale";
|
|
201
246
|
/** Returns a `(t in 0..1) => RGB` sampler for the named colormap. */
|
|
@@ -238,6 +283,68 @@ declare class ContourLayer implements Layer {
|
|
|
238
283
|
dispose(): void;
|
|
239
284
|
}
|
|
240
285
|
|
|
286
|
+
/** A per-point error, given as one value for all points or an array. */
|
|
287
|
+
type ErrInput = ArrayLike<number> | number;
|
|
288
|
+
interface ErrorBarOptions {
|
|
289
|
+
x: ArrayLike<number>;
|
|
290
|
+
y: ArrayLike<number>;
|
|
291
|
+
/** Symmetric y error (half-height). Scalar or per-point. */
|
|
292
|
+
yerr?: ErrInput;
|
|
293
|
+
/** Asymmetric y error below/above `y` (overrides `yerr`). */
|
|
294
|
+
yerrLow?: ErrInput;
|
|
295
|
+
yerrHigh?: ErrInput;
|
|
296
|
+
/** Symmetric x error (half-width). Scalar or per-point. */
|
|
297
|
+
xerr?: ErrInput;
|
|
298
|
+
color?: string | Color;
|
|
299
|
+
/** Whisker/cap thickness in CSS px. Default 1.5. */
|
|
300
|
+
width?: number;
|
|
301
|
+
/** Cap length in CSS px (0 hides caps). Default 6. */
|
|
302
|
+
capSize?: number;
|
|
303
|
+
/** Draw I-beam whiskers. Default true. */
|
|
304
|
+
whiskers?: boolean;
|
|
305
|
+
/** Fill a shaded band between the low/high y bounds. Default false. */
|
|
306
|
+
band?: boolean;
|
|
307
|
+
/** Band fill opacity. Default 0.2. */
|
|
308
|
+
bandOpacity?: number;
|
|
309
|
+
name?: string;
|
|
310
|
+
yAxis?: string;
|
|
311
|
+
}
|
|
312
|
+
declare class ErrorBarLayer implements Layer {
|
|
313
|
+
readonly id: string;
|
|
314
|
+
readonly name: string;
|
|
315
|
+
readonly colorCss: string;
|
|
316
|
+
readonly yAxis: string;
|
|
317
|
+
private gl;
|
|
318
|
+
private progs;
|
|
319
|
+
private segVao;
|
|
320
|
+
private capVao;
|
|
321
|
+
private bandVao;
|
|
322
|
+
private buffers;
|
|
323
|
+
private uSeg;
|
|
324
|
+
private uCap;
|
|
325
|
+
private uBand;
|
|
326
|
+
private color;
|
|
327
|
+
private width;
|
|
328
|
+
private capSize;
|
|
329
|
+
private bandOpacity;
|
|
330
|
+
private showWhiskers;
|
|
331
|
+
private showBand;
|
|
332
|
+
private segCount;
|
|
333
|
+
private capCount;
|
|
334
|
+
private bandVerts;
|
|
335
|
+
private xRef;
|
|
336
|
+
private yRef;
|
|
337
|
+
private xBounds;
|
|
338
|
+
private yBounds;
|
|
339
|
+
constructor(gl: WebGL2RenderingContext, opts: ErrorBarOptions);
|
|
340
|
+
bounds(): {
|
|
341
|
+
x: Range;
|
|
342
|
+
y: Range;
|
|
343
|
+
} | null;
|
|
344
|
+
draw(state: DrawState): void;
|
|
345
|
+
dispose(): void;
|
|
346
|
+
}
|
|
347
|
+
|
|
241
348
|
interface HeatmapOptions {
|
|
242
349
|
/** Row-major grid values, length `cols * rows` (row 0 at the bottom). */
|
|
243
350
|
values: ArrayLike<number>;
|
|
@@ -309,6 +416,8 @@ declare class HexbinLayer implements Layer {
|
|
|
309
416
|
dispose(): void;
|
|
310
417
|
}
|
|
311
418
|
|
|
419
|
+
/** How adjacent segments meet at a vertex. */
|
|
420
|
+
type LineJoin = "round" | "miter" | "bevel" | "butt";
|
|
312
421
|
interface LineOptions {
|
|
313
422
|
x: ArrayLike<number>;
|
|
314
423
|
y: ArrayLike<number>;
|
|
@@ -318,8 +427,20 @@ interface LineOptions {
|
|
|
318
427
|
name?: string;
|
|
319
428
|
yAxis?: string;
|
|
320
429
|
step?: "before" | "after" | "center";
|
|
321
|
-
/**
|
|
322
|
-
|
|
430
|
+
/**
|
|
431
|
+
* How segments meet at each vertex:
|
|
432
|
+
* - `round` (default) — round caps and joins via an SDF; no seams.
|
|
433
|
+
* - `miter` — sharp mitered corners, clamped to {@link LineOptions.miterLimit}.
|
|
434
|
+
* - `bevel` — corners cut flat.
|
|
435
|
+
* - `butt` — flat ends with no join fill (segments may gap at sharp angles).
|
|
436
|
+
*/
|
|
437
|
+
join?: LineJoin;
|
|
438
|
+
/**
|
|
439
|
+
* For `join: "miter"`, the max ratio of miter length to half line-width before
|
|
440
|
+
* a corner falls back to a bevel (prevents spikes at very sharp angles).
|
|
441
|
+
* Default 4.
|
|
442
|
+
*/
|
|
443
|
+
miterLimit?: number;
|
|
323
444
|
/**
|
|
324
445
|
* Min/max decimate very large series to ~2 points per pixel column when
|
|
325
446
|
* zoomed out (preserves peaks). Requires monotonic x; auto-detected. Default true.
|
|
@@ -333,18 +454,25 @@ declare class LineLayer implements Layer {
|
|
|
333
454
|
readonly yAxis: string;
|
|
334
455
|
private gl;
|
|
335
456
|
private program;
|
|
457
|
+
private joinProgram;
|
|
336
458
|
private fullVao;
|
|
337
459
|
private decVao;
|
|
460
|
+
private joinFullVao;
|
|
461
|
+
private joinDecVao;
|
|
338
462
|
private cornerBuf;
|
|
339
463
|
private posBuf;
|
|
340
464
|
private decBuf;
|
|
341
465
|
private uniforms;
|
|
466
|
+
private joinUniforms;
|
|
342
467
|
private count;
|
|
343
468
|
private color;
|
|
344
469
|
private width;
|
|
345
470
|
private round;
|
|
471
|
+
private joinStyle;
|
|
472
|
+
private miterLimit;
|
|
346
473
|
private decimateOn;
|
|
347
474
|
private monotonic;
|
|
475
|
+
private gpuDec;
|
|
348
476
|
private step?;
|
|
349
477
|
private xRef;
|
|
350
478
|
private yRef;
|
|
@@ -355,7 +483,10 @@ declare class LineLayer implements Layer {
|
|
|
355
483
|
private decKey;
|
|
356
484
|
private decSegments;
|
|
357
485
|
constructor(gl: WebGL2RenderingContext, opts: LineOptions);
|
|
486
|
+
private syncGpu;
|
|
487
|
+
private disposeGpu;
|
|
358
488
|
private configureVao;
|
|
489
|
+
private configureJoinVao;
|
|
359
490
|
bounds(): {
|
|
360
491
|
x: Range;
|
|
361
492
|
y: Range;
|
|
@@ -376,6 +507,60 @@ declare class LineLayer implements Layer {
|
|
|
376
507
|
dispose(): void;
|
|
377
508
|
}
|
|
378
509
|
|
|
510
|
+
interface QuiverOptions {
|
|
511
|
+
/** Arrow anchor positions (data space). */
|
|
512
|
+
x: ArrayLike<number>;
|
|
513
|
+
y: ArrayLike<number>;
|
|
514
|
+
/** Vector components at each anchor. */
|
|
515
|
+
u: ArrayLike<number>;
|
|
516
|
+
v: ArrayLike<number>;
|
|
517
|
+
/** Multiplier applied to (u,v) in data units. Default auto-fits the field. */
|
|
518
|
+
scale?: number;
|
|
519
|
+
color?: string | Color;
|
|
520
|
+
/** Shaft thickness in CSS px. Default 1.5. */
|
|
521
|
+
width?: number;
|
|
522
|
+
/** Arrowhead length in CSS px. Default 9. */
|
|
523
|
+
headSize?: number;
|
|
524
|
+
/** Color each arrow by a value (default: its magnitude) through a colormap. */
|
|
525
|
+
colorBy?: {
|
|
526
|
+
values?: ArrayLike<number>;
|
|
527
|
+
colormap?: ColormapName;
|
|
528
|
+
domain?: Range;
|
|
529
|
+
};
|
|
530
|
+
name?: string;
|
|
531
|
+
yAxis?: string;
|
|
532
|
+
}
|
|
533
|
+
declare class QuiverLayer implements Layer {
|
|
534
|
+
readonly id: string;
|
|
535
|
+
readonly name: string;
|
|
536
|
+
readonly colorCss: string;
|
|
537
|
+
readonly yAxis: string;
|
|
538
|
+
private gl;
|
|
539
|
+
private progs;
|
|
540
|
+
private shaftVao;
|
|
541
|
+
private headVao;
|
|
542
|
+
private buffers;
|
|
543
|
+
private uShaft;
|
|
544
|
+
private uHead;
|
|
545
|
+
private color;
|
|
546
|
+
private width;
|
|
547
|
+
private headSize;
|
|
548
|
+
private useVertexColor;
|
|
549
|
+
private count;
|
|
550
|
+
private xRef;
|
|
551
|
+
private yRef;
|
|
552
|
+
private xBounds;
|
|
553
|
+
private yBounds;
|
|
554
|
+
constructor(gl: WebGL2RenderingContext, opts: QuiverOptions);
|
|
555
|
+
private bindInstanceAttribs;
|
|
556
|
+
bounds(): {
|
|
557
|
+
x: Range;
|
|
558
|
+
y: Range;
|
|
559
|
+
} | null;
|
|
560
|
+
draw(state: DrawState): void;
|
|
561
|
+
dispose(): void;
|
|
562
|
+
}
|
|
563
|
+
|
|
379
564
|
interface ScatterOptions {
|
|
380
565
|
x: ArrayLike<number>;
|
|
381
566
|
y: ArrayLike<number>;
|
|
@@ -428,6 +613,56 @@ declare class ScatterLayer implements Layer {
|
|
|
428
613
|
dispose(): void;
|
|
429
614
|
}
|
|
430
615
|
|
|
616
|
+
interface StemOptions {
|
|
617
|
+
x: ArrayLike<number>;
|
|
618
|
+
y: ArrayLike<number>;
|
|
619
|
+
/** Where stems start. Default 0. */
|
|
620
|
+
baseline?: number;
|
|
621
|
+
color?: string | Color;
|
|
622
|
+
/** Stem thickness in CSS px. Default 1.5. */
|
|
623
|
+
width?: number;
|
|
624
|
+
/** Tip marker diameter in CSS px (0 hides). Default 6. */
|
|
625
|
+
markerSize?: number;
|
|
626
|
+
name?: string;
|
|
627
|
+
yAxis?: string;
|
|
628
|
+
}
|
|
629
|
+
declare class StemLayer implements Layer {
|
|
630
|
+
readonly id: string;
|
|
631
|
+
readonly name: string;
|
|
632
|
+
readonly colorCss: string;
|
|
633
|
+
readonly yAxis: string;
|
|
634
|
+
private gl;
|
|
635
|
+
private progs;
|
|
636
|
+
private stemVao;
|
|
637
|
+
private markerVao;
|
|
638
|
+
private buffers;
|
|
639
|
+
private uStem;
|
|
640
|
+
private uMarker;
|
|
641
|
+
private color;
|
|
642
|
+
private width;
|
|
643
|
+
private markerSize;
|
|
644
|
+
private count;
|
|
645
|
+
private baseline;
|
|
646
|
+
private xRef;
|
|
647
|
+
private yRef;
|
|
648
|
+
private xs;
|
|
649
|
+
private ys;
|
|
650
|
+
private xBounds;
|
|
651
|
+
private yBounds;
|
|
652
|
+
constructor(gl: WebGL2RenderingContext, opts: StemOptions);
|
|
653
|
+
bounds(): {
|
|
654
|
+
x: Range;
|
|
655
|
+
y: Range;
|
|
656
|
+
} | null;
|
|
657
|
+
nearestByX(x: number): {
|
|
658
|
+
x: number;
|
|
659
|
+
y: number;
|
|
660
|
+
index: number;
|
|
661
|
+
} | null;
|
|
662
|
+
draw(state: DrawState): void;
|
|
663
|
+
dispose(): void;
|
|
664
|
+
}
|
|
665
|
+
|
|
431
666
|
/**
|
|
432
667
|
* A scale maps data-space values to normalized [0,1] and back, and knows how to
|
|
433
668
|
* generate its own "nice" ticks + default label format. `log` tells layers to
|
|
@@ -587,6 +822,10 @@ declare class Plot {
|
|
|
587
822
|
addBox(opts: BoxOptions): BoxLayer;
|
|
588
823
|
addHexbin(opts: HexbinOptions): HexbinLayer;
|
|
589
824
|
addContour(opts: ContourOptions): ContourLayer;
|
|
825
|
+
addErrorBar(opts: ErrorBarOptions): ErrorBarLayer;
|
|
826
|
+
addStem(opts: StemOptions): StemLayer;
|
|
827
|
+
addQuiver(opts: QuiverOptions): QuiverLayer;
|
|
828
|
+
addCandlestick(opts: CandlestickOptions): CandlestickLayer;
|
|
590
829
|
/** Compute an STFT of `signal` and render it as a heatmap (time × frequency). */
|
|
591
830
|
addHeatmapSpectrogram(signal: ArrayLike<number>, opts?: {
|
|
592
831
|
fftSize?: number;
|
|
@@ -958,4 +1197,4 @@ declare function parseColor(input: string): [number, number, number, number];
|
|
|
958
1197
|
/** Normalized RGBA (0..1) back to a CSS `rgba(...)` string. */
|
|
959
1198
|
declare function toColorCss(c: readonly [number, number, number, number]): string;
|
|
960
1199
|
|
|
961
|
-
export { AreaLayer, type AreaOptions, Axis, type AxisConfig, type AxisFrame, type AxisScaleOptions, BarLayer, type BarOptions, type Bounds, type Bounds3, type BoxGroup, BoxLayer, type BoxOptions, type BoxStats, type Color, type ColormapName, ContourLayer, type ContourOptions, type Density, type Dim, type DrawState, HeatmapLayer, type HeatmapOptions, HexbinLayer, type HexbinOptions, type Histogram, type InteractionMode, type Layer, type Layer3D, type Layout, LineLayer, type LineOptions, LinearScale, LogScale, Plot, Plot3D, type Plot3DOptions, type PlotOptions, PointCloudLayer, type PointCloudOptions, type PolarLineOptions, type PolarOptions, PolarPlot, type PolarScatterOptions, type PolarSeries, type RGB, type Range, type Scale, type ScaleType, ScatterLayer, type ScatterOptions, type Spectrogram, SurfaceLayer, type SurfaceOptions, type Theme, type Tick, type TicksSpec, TimeScale, type ToolbarHost, type ToolbarTheme, type YAxisOptions, autoTicks, boxStats, colormap, createToolbar, darkTheme, defaultFormat, fft, histogram, kde, lightTheme, makeScale, parseColor, quantileSorted, resolveTicks, spectrogram, toColorCss, withMinorTicks };
|
|
1200
|
+
export { AreaLayer, type AreaOptions, Axis, type AxisConfig, type AxisFrame, type AxisScaleOptions, BarLayer, type BarOptions, type Bounds, type Bounds3, type BoxGroup, BoxLayer, type BoxOptions, type BoxStats, CandlestickLayer, type CandlestickOptions, type Color, type ColormapName, ContourLayer, type ContourOptions, type Density, type Dim, type DrawState, ErrorBarLayer, type ErrorBarOptions, HeatmapLayer, type HeatmapOptions, HexbinLayer, type HexbinOptions, type Histogram, type InteractionMode, type Layer, type Layer3D, type Layout, LineLayer, type LineOptions, LinearScale, LogScale, Plot, Plot3D, type Plot3DOptions, type PlotOptions, PointCloudLayer, type PointCloudOptions, type PolarLineOptions, type PolarOptions, PolarPlot, type PolarScatterOptions, type PolarSeries, QuiverLayer, type QuiverOptions, type RGB, type Range, type Scale, type ScaleType, ScatterLayer, type ScatterOptions, type Spectrogram, StemLayer, type StemOptions, SurfaceLayer, type SurfaceOptions, type Theme, type Tick, type TicksSpec, TimeScale, type ToolbarHost, type ToolbarTheme, type YAxisOptions, autoTicks, boxStats, colormap, createToolbar, darkTheme, defaultFormat, fft, histogram, kde, lightTheme, makeScale, parseColor, quantileSorted, resolveTicks, spectrogram, toColorCss, withMinorTicks };
|