scichart-engine 0.4.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/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/analysis/contours.d.ts +20 -0
- package/dist/analysis/fitting.d.ts +24 -0
- package/dist/analysis/index.d.ts +12 -0
- package/dist/analysis/math.d.ts +32 -0
- package/dist/analysis/utils.d.ts +150 -0
- package/dist/core/Chart.d.ts +15 -0
- package/dist/core/ChartControls.d.ts +30 -0
- package/dist/core/ChartLegend.d.ts +35 -0
- package/dist/core/ChartStatistics.d.ts +18 -0
- package/dist/core/EventEmitter.d.ts +30 -0
- package/dist/core/InteractionManager.d.ts +67 -0
- package/dist/core/OverlayRenderer.d.ts +67 -0
- package/dist/core/Series.d.ts +4 -0
- package/dist/core/annotations/AnnotationManager.d.ts +57 -0
- package/dist/core/annotations/index.d.ts +5 -0
- package/dist/core/annotations/types.d.ts +157 -0
- package/dist/core/chart/ChartCore.d.ts +103 -0
- package/dist/core/chart/ChartExporter.d.ts +18 -0
- package/dist/core/chart/ChartNavigation.d.ts +33 -0
- package/dist/core/chart/ChartRenderer.d.ts +53 -0
- package/dist/core/chart/ChartScaling.d.ts +26 -0
- package/dist/core/chart/ChartSeries.d.ts +4 -0
- package/dist/core/chart/ChartSetup.d.ts +64 -0
- package/dist/core/chart/ChartUI.d.ts +22 -0
- package/dist/core/chart/exporter/SVGExporter.d.ts +6 -0
- package/dist/core/chart/exporter/index.d.ts +5 -0
- package/dist/core/chart/index.d.ts +14 -0
- package/dist/core/chart/plugins/PluginManager.d.ts +13 -0
- package/dist/core/chart/plugins/types.d.ts +13 -0
- package/dist/core/chart/series/SeriesActions.d.ts +7 -0
- package/dist/core/chart/series/SeriesBuffer.d.ts +4 -0
- package/dist/core/chart/series/SeriesFit.d.ts +3 -0
- package/dist/core/chart/series/index.d.ts +7 -0
- package/dist/core/chart/series/types.d.ts +22 -0
- package/dist/core/chart/types.d.ts +72 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/series/Series.d.ts +52 -0
- package/dist/core/series/SeriesBounds.d.ts +3 -0
- package/dist/core/series/SeriesDataUtils.d.ts +7 -0
- package/dist/core/series/index.d.ts +6 -0
- package/dist/core/tooltip/TooltipManager.d.ts +203 -0
- package/dist/core/tooltip/TooltipPositioner.d.ts +83 -0
- package/dist/core/tooltip/TooltipRenderer.d.ts +64 -0
- package/dist/core/tooltip/index.d.ts +18 -0
- package/dist/core/tooltip/templates/AnnotationTemplate.d.ts +18 -0
- package/dist/core/tooltip/templates/CrosshairTemplate.d.ts +30 -0
- package/dist/core/tooltip/templates/DefaultTemplate.d.ts +30 -0
- package/dist/core/tooltip/templates/HeatmapTemplate.d.ts +34 -0
- package/dist/core/tooltip/templates/MinimalTemplate.d.ts +26 -0
- package/dist/core/tooltip/templates/RangeTemplate.d.ts +18 -0
- package/dist/core/tooltip/templates/ScientificTemplate.d.ts +34 -0
- package/dist/core/tooltip/templates/index.d.ts +27 -0
- package/dist/core/tooltip/themes.d.ts +48 -0
- package/dist/core/tooltip/types.d.ts +396 -0
- package/dist/examples.d.ts +19 -0
- package/dist/gpu/adapter/gpuRenderer.d.ts +135 -0
- package/dist/gpu/adapter/index.d.ts +7 -0
- package/dist/gpu/adapter/seriesAdapter.d.ts +88 -0
- package/dist/gpu/backends/webgl/WebGLBackend.d.ts +42 -0
- package/dist/gpu/backends/webgl/index.d.ts +5 -0
- package/dist/gpu/backends/webgl/programFactory.d.ts +30 -0
- package/dist/gpu/backends/webgl/shaders.d.ts +14 -0
- package/dist/gpu/backends/webgpu/MassiveDataRenderer.d.ts +111 -0
- package/dist/gpu/backends/webgpu/WebGPUBackend.d.ts +58 -0
- package/dist/gpu/backends/webgpu/pipelines/bandPipeline.d.ts +24 -0
- package/dist/gpu/backends/webgpu/pipelines/heatmapPipeline.d.ts +28 -0
- package/dist/gpu/backends/webgpu/pipelines/index.d.ts +10 -0
- package/dist/gpu/backends/webgpu/pipelines/instancedLinePipeline.d.ts +23 -0
- package/dist/gpu/backends/webgpu/pipelines/instancedPointPipeline.d.ts +25 -0
- package/dist/gpu/backends/webgpu/pipelines/linePipeline.d.ts +23 -0
- package/dist/gpu/backends/webgpu/pipelines/pointPipeline.d.ts +28 -0
- package/dist/gpu/backends/webgpu/pipelines/trianglePipeline.d.ts +5 -0
- package/dist/gpu/backends/webgpu/pipelines/triangleShader.d.ts +1 -0
- package/dist/gpu/backends/webgpu/shaders/heatmap.wgsl.d.ts +8 -0
- package/dist/gpu/backends/webgpu/shaders/index.d.ts +8 -0
- package/dist/gpu/backends/webgpu/shaders/instanced.wgsl.d.ts +16 -0
- package/dist/gpu/backends/webgpu/shaders/line.wgsl.d.ts +8 -0
- package/dist/gpu/backends/webgpu/shaders/point.wgsl.d.ts +9 -0
- package/dist/gpu/benchmark/benchmark.d.ts +74 -0
- package/dist/gpu/benchmark/index.d.ts +5 -0
- package/dist/gpu/compute/gpuCompute.d.ts +72 -0
- package/dist/gpu/compute/index.d.ts +6 -0
- package/dist/gpu/compute/shaders.d.ts +9 -0
- package/dist/gpu/drawList.d.ts +77 -0
- package/dist/gpu/examples/gallery.d.ts +20 -0
- package/dist/gpu/examples/index.d.ts +3 -0
- package/dist/gpu/examples/webgpu-line-demo.d.ts +8 -0
- package/dist/gpu/examples/webgpu-triangle.d.ts +1 -0
- package/dist/gpu/frame.d.ts +25 -0
- package/dist/gpu/index.d.ts +24 -0
- package/dist/gpu/resources/bufferStore.d.ts +40 -0
- package/dist/gpu/resources/index.d.ts +9 -0
- package/dist/gpu/resources/pipelineCache.d.ts +33 -0
- package/dist/gpu/resources/textureStore.d.ts +41 -0
- package/dist/gpu/types.d.ts +47 -0
- package/dist/index.d.ts +34 -0
- package/dist/overlay/CanvasOverlay.d.ts +102 -0
- package/dist/overlay/index.d.ts +4 -0
- package/dist/react/SciChart.d.ts +60 -0
- package/dist/react/index.d.ts +5 -0
- package/dist/react/useSciChart.d.ts +56 -0
- package/dist/renderer/BarRenderer.d.ts +14 -0
- package/dist/renderer/CandlestickRenderer.d.ts +12 -0
- package/dist/renderer/HeatmapRenderer.d.ts +15 -0
- package/dist/renderer/NativeWebGLRenderer.d.ts +16 -0
- package/dist/renderer/RendererInterface.d.ts +70 -0
- package/dist/renderer/WebGPURenderer.d.ts +16 -0
- package/dist/renderer/index.d.ts +10 -0
- package/dist/renderer/native/NativeWebGLRenderer.d.ts +30 -0
- package/dist/renderer/native/bufferStore.d.ts +11 -0
- package/dist/renderer/native/draw.d.ts +31 -0
- package/dist/renderer/native/programFactory.d.ts +3 -0
- package/dist/renderer/native/renderFrame.d.ts +3 -0
- package/dist/renderer/native/shaderSources.d.ts +6 -0
- package/dist/renderer/native/textureStore.d.ts +8 -0
- package/dist/renderer/native/types.d.ts +58 -0
- package/dist/renderer/native/utils.d.ts +4 -0
- package/dist/renderer/shaders.d.ts +77 -0
- package/dist/scales/index.d.ts +54 -0
- package/dist/scichart-engine.es.js +8408 -0
- package/dist/scichart-engine.es.js.map +1 -0
- package/dist/scichart-engine.umd.js +871 -0
- package/dist/scichart-engine.umd.js.map +1 -0
- package/dist/streaming/index.d.ts +7 -0
- package/dist/streaming/mock.d.ts +12 -0
- package/dist/streaming/types.d.ts +57 -0
- package/dist/streaming/utils.d.ts +19 -0
- package/dist/streaming/websocket.d.ts +6 -0
- package/dist/theme/index.d.ts +123 -0
- package/dist/types.d.ts +333 -0
- package/dist/workers/downsample.d.ts +34 -0
- package/dist/workers/downsample.worker.d.ts +46 -0
- package/package.json +59 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU Benchmark Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides tools for measuring rendering performance across backends.
|
|
5
|
+
*/
|
|
6
|
+
export interface BenchmarkResult {
|
|
7
|
+
backend: "webgpu" | "webgl" | "unknown";
|
|
8
|
+
pointCount: number;
|
|
9
|
+
fps: number;
|
|
10
|
+
avgFrameTime: number;
|
|
11
|
+
minFrameTime: number;
|
|
12
|
+
maxFrameTime: number;
|
|
13
|
+
totalFrames: number;
|
|
14
|
+
duration: number;
|
|
15
|
+
}
|
|
16
|
+
export interface BenchmarkOptions {
|
|
17
|
+
/** Number of points to render */
|
|
18
|
+
pointCount?: number;
|
|
19
|
+
/** Duration of benchmark in milliseconds */
|
|
20
|
+
durationMs?: number;
|
|
21
|
+
/** Warm-up frames before measuring */
|
|
22
|
+
warmupFrames?: number;
|
|
23
|
+
/** Callback for progress updates */
|
|
24
|
+
onProgress?: (progress: number) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Benchmark runner for GPU backends
|
|
28
|
+
*/
|
|
29
|
+
export declare class GpuBenchmark {
|
|
30
|
+
private canvas;
|
|
31
|
+
private results;
|
|
32
|
+
constructor(canvas?: HTMLCanvasElement);
|
|
33
|
+
/**
|
|
34
|
+
* Generate random line data
|
|
35
|
+
*/
|
|
36
|
+
private generateLineData;
|
|
37
|
+
/**
|
|
38
|
+
* Measure frame times
|
|
39
|
+
*/
|
|
40
|
+
private measureFrameTimes;
|
|
41
|
+
/**
|
|
42
|
+
* Run benchmark with WebGPU backend
|
|
43
|
+
*/
|
|
44
|
+
benchmarkWebGPU(options?: BenchmarkOptions): Promise<BenchmarkResult | null>;
|
|
45
|
+
/**
|
|
46
|
+
* Run benchmark with WebGL backend
|
|
47
|
+
*/
|
|
48
|
+
benchmarkWebGL(options?: BenchmarkOptions): Promise<BenchmarkResult | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Calculate benchmark result from frame times
|
|
51
|
+
*/
|
|
52
|
+
private calculateResult;
|
|
53
|
+
/**
|
|
54
|
+
* Run comparative benchmark
|
|
55
|
+
*/
|
|
56
|
+
runComparison(options?: BenchmarkOptions): Promise<{
|
|
57
|
+
webgpu: BenchmarkResult | null;
|
|
58
|
+
webgl: BenchmarkResult | null;
|
|
59
|
+
winner: "webgpu" | "webgl" | "tie" | "unknown";
|
|
60
|
+
speedup: number;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Get all results
|
|
64
|
+
*/
|
|
65
|
+
getResults(): BenchmarkResult[];
|
|
66
|
+
/**
|
|
67
|
+
* Clear results
|
|
68
|
+
*/
|
|
69
|
+
clearResults(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Format result as string
|
|
72
|
+
*/
|
|
73
|
+
static formatResult(result: BenchmarkResult): string;
|
|
74
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU Compute Engine
|
|
3
|
+
*
|
|
4
|
+
* Provides GPU-accelerated data analysis using WebGPU compute shaders.
|
|
5
|
+
* Includes statistics calculation, bounds computation, downsampling, and peak detection.
|
|
6
|
+
*/
|
|
7
|
+
export interface DataStats {
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
mean: number;
|
|
11
|
+
std: number;
|
|
12
|
+
count: number;
|
|
13
|
+
}
|
|
14
|
+
export interface DataBounds {
|
|
15
|
+
xMin: number;
|
|
16
|
+
xMax: number;
|
|
17
|
+
yMin: number;
|
|
18
|
+
yMax: number;
|
|
19
|
+
}
|
|
20
|
+
export interface Peak {
|
|
21
|
+
index: number;
|
|
22
|
+
value: number;
|
|
23
|
+
}
|
|
24
|
+
export interface GpuComputeOptions {
|
|
25
|
+
/** WebGPU device (if already available) */
|
|
26
|
+
device?: any;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* GPU Compute Engine for data analysis
|
|
30
|
+
*/
|
|
31
|
+
export declare class GpuCompute {
|
|
32
|
+
private options;
|
|
33
|
+
private device;
|
|
34
|
+
private statsPipeline;
|
|
35
|
+
private minmaxPipeline;
|
|
36
|
+
private downsamplePipeline;
|
|
37
|
+
private peaksPipeline;
|
|
38
|
+
private isInitialized;
|
|
39
|
+
constructor(options?: GpuComputeOptions);
|
|
40
|
+
/**
|
|
41
|
+
* Check if GPU compute is available
|
|
42
|
+
*/
|
|
43
|
+
static isSupported(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Initialize the compute engine
|
|
46
|
+
*/
|
|
47
|
+
init(): Promise<void>;
|
|
48
|
+
private createPipelines;
|
|
49
|
+
/**
|
|
50
|
+
* Calculate statistics for a 1D array of values
|
|
51
|
+
*/
|
|
52
|
+
calculateStats(data: Float32Array): Promise<DataStats>;
|
|
53
|
+
/**
|
|
54
|
+
* Calculate bounds for 2D point data
|
|
55
|
+
*/
|
|
56
|
+
calculateBounds(points: Float32Array): Promise<DataBounds>;
|
|
57
|
+
/**
|
|
58
|
+
* Downsample point data using min-max algorithm
|
|
59
|
+
*/
|
|
60
|
+
downsample(points: Float32Array, targetCount: number): Promise<Float32Array>;
|
|
61
|
+
/**
|
|
62
|
+
* Detect peaks in 1D data
|
|
63
|
+
*/
|
|
64
|
+
detectPeaks(data: Float32Array, options?: {
|
|
65
|
+
threshold?: number;
|
|
66
|
+
minDistance?: number;
|
|
67
|
+
}): Promise<Peak[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Cleanup resources
|
|
70
|
+
*/
|
|
71
|
+
destroy(): void;
|
|
72
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU Compute Index
|
|
3
|
+
*/
|
|
4
|
+
export { GpuCompute } from './gpuCompute';
|
|
5
|
+
export type { DataStats, DataBounds, Peak, GpuComputeOptions, } from './gpuCompute';
|
|
6
|
+
export { STATS_COMPUTE_WGSL, MINMAX_COMPUTE_WGSL, DOWNSAMPLE_COMPUTE_WGSL, PEAK_DETECT_COMPUTE_WGSL, } from './shaders';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU Compute - Compute shader infrastructure for WebGPU
|
|
3
|
+
*
|
|
4
|
+
* Provides GPU-accelerated data analysis capabilities.
|
|
5
|
+
*/
|
|
6
|
+
export declare const STATS_COMPUTE_WGSL = "\nstruct StatsResult {\n min_val: f32,\n max_val: f32,\n sum: f32,\n sum_sq: f32,\n count: u32,\n padding: vec3<u32>,\n}\n\n@group(0) @binding(0) var<storage, read> input_data: array<f32>;\n@group(0) @binding(1) var<storage, read_write> result: StatsResult;\n\nvar<workgroup> local_min: array<f32, 256>;\nvar<workgroup> local_max: array<f32, 256>;\nvar<workgroup> local_sum: array<f32, 256>;\nvar<workgroup> local_sum_sq: array<f32, 256>;\nvar<workgroup> local_count: array<u32, 256>;\n\n@compute @workgroup_size(256)\nfn main(\n @builtin(global_invocation_id) global_id: vec3<u32>,\n @builtin(local_invocation_id) local_id: vec3<u32>,\n @builtin(workgroup_id) workgroup_id: vec3<u32>\n) {\n let idx = global_id.x;\n let lid = local_id.x;\n let data_len = arrayLength(&input_data);\n \n // Initialize local values\n if (idx < data_len) {\n let val = input_data[idx];\n local_min[lid] = val;\n local_max[lid] = val;\n local_sum[lid] = val;\n local_sum_sq[lid] = val * val;\n local_count[lid] = 1u;\n } else {\n local_min[lid] = 3.402823e+38; // f32 max\n local_max[lid] = -3.402823e+38; // f32 min\n local_sum[lid] = 0.0;\n local_sum_sq[lid] = 0.0;\n local_count[lid] = 0u;\n }\n \n workgroupBarrier();\n \n // Parallel reduction\n for (var stride: u32 = 128u; stride > 0u; stride = stride >> 1u) {\n if (lid < stride) {\n local_min[lid] = min(local_min[lid], local_min[lid + stride]);\n local_max[lid] = max(local_max[lid], local_max[lid + stride]);\n local_sum[lid] = local_sum[lid] + local_sum[lid + stride];\n local_sum_sq[lid] = local_sum_sq[lid] + local_sum_sq[lid + stride];\n local_count[lid] = local_count[lid] + local_count[lid + stride];\n }\n workgroupBarrier();\n }\n \n // First thread writes result (atomic for multi-workgroup)\n if (lid == 0u) {\n // Use atomics for multi-workgroup reduction\n // For now, we assume single workgroup or post-process on CPU\n result.min_val = local_min[0];\n result.max_val = local_max[0];\n result.sum = local_sum[0];\n result.sum_sq = local_sum_sq[0];\n result.count = local_count[0];\n }\n}\n";
|
|
7
|
+
export declare const MINMAX_COMPUTE_WGSL = "\nstruct MinMax {\n min_x: f32,\n max_x: f32,\n min_y: f32,\n max_y: f32,\n}\n\n@group(0) @binding(0) var<storage, read> points: array<vec2<f32>>;\n@group(0) @binding(1) var<storage, read_write> result: MinMax;\n\nvar<workgroup> local_min_x: array<f32, 256>;\nvar<workgroup> local_max_x: array<f32, 256>;\nvar<workgroup> local_min_y: array<f32, 256>;\nvar<workgroup> local_max_y: array<f32, 256>;\n\n@compute @workgroup_size(256)\nfn main(\n @builtin(global_invocation_id) global_id: vec3<u32>,\n @builtin(local_invocation_id) local_id: vec3<u32>\n) {\n let idx = global_id.x;\n let lid = local_id.x;\n let data_len = arrayLength(&points);\n \n if (idx < data_len) {\n let pt = points[idx];\n local_min_x[lid] = pt.x;\n local_max_x[lid] = pt.x;\n local_min_y[lid] = pt.y;\n local_max_y[lid] = pt.y;\n } else {\n local_min_x[lid] = 3.402823e+38;\n local_max_x[lid] = -3.402823e+38;\n local_min_y[lid] = 3.402823e+38;\n local_max_y[lid] = -3.402823e+38;\n }\n \n workgroupBarrier();\n \n for (var stride: u32 = 128u; stride > 0u; stride = stride >> 1u) {\n if (lid < stride) {\n local_min_x[lid] = min(local_min_x[lid], local_min_x[lid + stride]);\n local_max_x[lid] = max(local_max_x[lid], local_max_x[lid + stride]);\n local_min_y[lid] = min(local_min_y[lid], local_min_y[lid + stride]);\n local_max_y[lid] = max(local_max_y[lid], local_max_y[lid + stride]);\n }\n workgroupBarrier();\n }\n \n if (lid == 0u) {\n result.min_x = local_min_x[0];\n result.max_x = local_max_x[0];\n result.min_y = local_min_y[0];\n result.max_y = local_max_y[0];\n }\n}\n";
|
|
8
|
+
export declare const DOWNSAMPLE_COMPUTE_WGSL = "\nstruct Params {\n input_count: u32,\n output_count: u32,\n bucket_size: u32,\n padding: u32,\n}\n\n@group(0) @binding(0) var<uniform> params: Params;\n@group(0) @binding(1) var<storage, read> input_points: array<vec2<f32>>;\n@group(0) @binding(2) var<storage, read_write> output_points: array<vec2<f32>>;\n\n@compute @workgroup_size(64)\nfn main(@builtin(global_invocation_id) global_id: vec3<u32>) {\n let bucket_idx = global_id.x;\n \n if (bucket_idx >= params.output_count / 2u) {\n return;\n }\n \n let start = bucket_idx * params.bucket_size;\n let end = min(start + params.bucket_size, params.input_count);\n \n if (start >= params.input_count) {\n return;\n }\n \n var min_y = input_points[start].y;\n var max_y = input_points[start].y;\n var min_idx = start;\n var max_idx = start;\n \n for (var i = start; i < end; i = i + 1u) {\n let y = input_points[i].y;\n if (y < min_y) {\n min_y = y;\n min_idx = i;\n }\n if (y > max_y) {\n max_y = y;\n max_idx = i;\n }\n }\n \n // Output min and max points (preserving x,y pairs)\n let out_base = bucket_idx * 2u;\n \n // Ensure min comes before max in x order\n if (min_idx <= max_idx) {\n output_points[out_base] = input_points[min_idx];\n output_points[out_base + 1u] = input_points[max_idx];\n } else {\n output_points[out_base] = input_points[max_idx];\n output_points[out_base + 1u] = input_points[min_idx];\n }\n}\n";
|
|
9
|
+
export declare const PEAK_DETECT_COMPUTE_WGSL = "\nstruct Params {\n data_count: u32,\n threshold: f32,\n min_distance: u32,\n padding: u32,\n}\n\nstruct Peak {\n index: u32,\n value: f32,\n is_peak: u32,\n padding: u32,\n}\n\n@group(0) @binding(0) var<uniform> params: Params;\n@group(0) @binding(1) var<storage, read> data: array<f32>;\n@group(0) @binding(2) var<storage, read_write> peaks: array<Peak>;\n\n@compute @workgroup_size(64)\nfn main(@builtin(global_invocation_id) global_id: vec3<u32>) {\n let idx = global_id.x;\n \n if (idx >= params.data_count) {\n return;\n }\n \n peaks[idx].index = idx;\n peaks[idx].value = data[idx];\n peaks[idx].is_peak = 0u;\n \n // Skip edges\n if (idx < params.min_distance || idx >= params.data_count - params.min_distance) {\n return;\n }\n \n let val = data[idx];\n \n // Check if above threshold\n if (val < params.threshold) {\n return;\n }\n \n // Check if local maximum\n var is_max = true;\n for (var i = 1u; i <= params.min_distance; i = i + 1u) {\n if (data[idx - i] >= val || data[idx + i] >= val) {\n is_max = false;\n break;\n }\n }\n \n if (is_max) {\n peaks[idx].is_peak = 1u;\n }\n}\n";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { BufferId, TextureId, RGBA } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Draw kinds matching the original NativeWebGLRenderer series types
|
|
5
|
+
*/
|
|
6
|
+
export type DrawKind = "triangles" | "line" | "points" | "scatter" | "line+scatter" | "step" | "step+scatter" | "band" | "bar" | "heatmap";
|
|
7
|
+
/**
|
|
8
|
+
* Common style properties for all draw calls
|
|
9
|
+
*/
|
|
10
|
+
export interface CommonStyle {
|
|
11
|
+
color?: RGBA;
|
|
12
|
+
opacity?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Style for line-type series
|
|
16
|
+
*/
|
|
17
|
+
export interface LineStyle extends CommonStyle {
|
|
18
|
+
lineWidth?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Point symbol types matching the original implementation
|
|
22
|
+
*/
|
|
23
|
+
export type PointSymbol = "circle" | "square" | "diamond" | "triangle" | "triangleDown" | "cross" | "x" | "star";
|
|
24
|
+
/**
|
|
25
|
+
* Style for point/scatter-type series
|
|
26
|
+
*/
|
|
27
|
+
export interface PointStyle extends CommonStyle {
|
|
28
|
+
pointSize?: number;
|
|
29
|
+
symbol?: PointSymbol;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Style for heatmap-type series
|
|
33
|
+
*/
|
|
34
|
+
export interface HeatmapStyle {
|
|
35
|
+
zBounds?: {
|
|
36
|
+
min: number;
|
|
37
|
+
max: number;
|
|
38
|
+
};
|
|
39
|
+
colormap?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Combined style type
|
|
43
|
+
*/
|
|
44
|
+
export type DrawStyle = CommonStyle | LineStyle | PointStyle | HeatmapStyle;
|
|
45
|
+
/**
|
|
46
|
+
* A single draw call in the draw list
|
|
47
|
+
*/
|
|
48
|
+
export interface DrawCall {
|
|
49
|
+
/** Unique identifier for this draw call */
|
|
50
|
+
id: string;
|
|
51
|
+
/** Type of primitive to draw */
|
|
52
|
+
kind: DrawKind;
|
|
53
|
+
/** Reference to the vertex buffer */
|
|
54
|
+
bufferId: BufferId;
|
|
55
|
+
/** Number of vertices/instances to draw */
|
|
56
|
+
count: number;
|
|
57
|
+
/** Whether this draw call should be rendered */
|
|
58
|
+
visible: boolean;
|
|
59
|
+
/** Styling properties */
|
|
60
|
+
style?: DrawStyle;
|
|
61
|
+
/** Reference to texture (for heatmaps) */
|
|
62
|
+
textureId?: TextureId;
|
|
63
|
+
/** Step buffer for step charts */
|
|
64
|
+
stepBufferId?: BufferId;
|
|
65
|
+
stepCount?: number;
|
|
66
|
+
/** Optional Y-bounds override for multi-axis support */
|
|
67
|
+
yBounds?: {
|
|
68
|
+
min: number;
|
|
69
|
+
max: number;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The draw list contains all draw calls for a frame
|
|
74
|
+
*/
|
|
75
|
+
export interface DrawList {
|
|
76
|
+
items: DrawCall[];
|
|
77
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface GpuDemo {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
init: (canvas: HTMLCanvasElement) => Promise<{
|
|
5
|
+
render: () => void;
|
|
6
|
+
destroy: () => void;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 1M Line Demo
|
|
11
|
+
*/
|
|
12
|
+
export declare const LinePerformanceDemo: GpuDemo;
|
|
13
|
+
/**
|
|
14
|
+
* Instanced Scatter Demo
|
|
15
|
+
*/
|
|
16
|
+
export declare const ScatterInstancedDemo: GpuDemo;
|
|
17
|
+
/**
|
|
18
|
+
* Dynamic Heatmap Demo
|
|
19
|
+
*/
|
|
20
|
+
export declare const DynamicHeatmapDemo: GpuDemo;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebGPU Line Demo - Demonstrates line rendering with the GPU abstraction layer
|
|
3
|
+
*/
|
|
4
|
+
export declare function runWebGPULineDemo(container: HTMLElement): Promise<() => void>;
|
|
5
|
+
/**
|
|
6
|
+
* WebGPU Chart Demo - Demonstrates multiple series types
|
|
7
|
+
*/
|
|
8
|
+
export declare function runWebGPUChartDemo(container: HTMLElement): Promise<() => void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runWebGPUTriangleDemo(container: HTMLElement): Promise<() => void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GpuViewport, RGBA } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Frame uniforms passed to each render call
|
|
5
|
+
*/
|
|
6
|
+
export interface FrameUniforms {
|
|
7
|
+
/** Viewport dimensions */
|
|
8
|
+
viewport: GpuViewport;
|
|
9
|
+
/** Background/clear color */
|
|
10
|
+
clearColor: RGBA;
|
|
11
|
+
/** Optional bounds for coordinate transforms */
|
|
12
|
+
bounds?: {
|
|
13
|
+
xMin: number;
|
|
14
|
+
xMax: number;
|
|
15
|
+
yMin: number;
|
|
16
|
+
yMax: number;
|
|
17
|
+
};
|
|
18
|
+
/** Optional plot area for clipping */
|
|
19
|
+
plotArea?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GPU Abstraction Layer - Backend-agnostic GPU API
|
|
3
|
+
*
|
|
4
|
+
* This module provides a unified interface for GPU rendering
|
|
5
|
+
* that can work with WebGPU (primary) or WebGL (fallback).
|
|
6
|
+
*/
|
|
7
|
+
export type { GpuBackendType, RGBA, GpuViewport, GpuLimits, GpuBackendInfo, BufferId, TextureId, BufferUsage, BufferDescriptor, TextureFormat, Texture1DDescriptor, Dispose, GpuBackend, } from './types';
|
|
8
|
+
export type { FrameUniforms } from './frame';
|
|
9
|
+
export type { DrawKind, CommonStyle, LineStyle, PointStyle, PointSymbol, HeatmapStyle, DrawStyle, DrawCall, DrawList, } from './drawList';
|
|
10
|
+
export type { BufferEntry, IBufferStore, TextureEntry, ITextureStore, PipelineKind, PipelineKey, IPipelineCache, } from './resources';
|
|
11
|
+
export { BaseBufferStore, BaseTextureStore, PipelineCache } from './resources';
|
|
12
|
+
export { SeriesAdapter, parseColorToRGBA, GpuRenderer, createGpuRenderer, } from './adapter';
|
|
13
|
+
export type { SeriesData, SeriesStyle, Bounds, GpuSeriesRenderData, GpuRenderOptions, BackendPreference, GpuRendererOptions, } from './adapter';
|
|
14
|
+
export { WebGPUBackend } from './backends/webgpu/WebGPUBackend';
|
|
15
|
+
export type { WebGPUBackendOptions } from './backends/webgpu/WebGPUBackend';
|
|
16
|
+
export { WebGLBackend } from './backends/webgl/WebGLBackend';
|
|
17
|
+
export type { WebGLBackendOptions } from './backends/webgl/WebGLBackend';
|
|
18
|
+
export { runWebGPUTriangleDemo, runWebGPULineDemo, runWebGPUChartDemo, } from './examples';
|
|
19
|
+
export { GpuBenchmark } from './benchmark';
|
|
20
|
+
export type { BenchmarkResult, BenchmarkOptions } from './benchmark';
|
|
21
|
+
export { GpuCompute } from './compute';
|
|
22
|
+
export type { DataStats, DataBounds, Peak, GpuComputeOptions, } from './compute';
|
|
23
|
+
export { MassiveDataRenderer } from './backends/webgpu/MassiveDataRenderer';
|
|
24
|
+
export type { MassiveDataConfig, RenderStats, LODLevel, } from './backends/webgpu/MassiveDataRenderer';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BufferId, BufferUsage } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface BufferEntry {
|
|
4
|
+
id: BufferId;
|
|
5
|
+
usage: BufferUsage;
|
|
6
|
+
byteLength: number;
|
|
7
|
+
lastUpdated: number;
|
|
8
|
+
}
|
|
9
|
+
export interface IBufferStore {
|
|
10
|
+
/** Create or update a buffer with new data */
|
|
11
|
+
createOrUpdate(id: BufferId, data: ArrayBufferView, usage?: BufferUsage): void;
|
|
12
|
+
/** Partially update a buffer at an offset */
|
|
13
|
+
partialUpdate(id: BufferId, data: ArrayBufferView, offsetBytes: number): boolean;
|
|
14
|
+
/** Get buffer metadata */
|
|
15
|
+
getInfo(id: BufferId): BufferEntry | undefined;
|
|
16
|
+
/** Check if buffer exists */
|
|
17
|
+
has(id: BufferId): boolean;
|
|
18
|
+
/** Delete a buffer */
|
|
19
|
+
delete(id: BufferId): void;
|
|
20
|
+
/** Get all buffer IDs */
|
|
21
|
+
keys(): IterableIterator<BufferId>;
|
|
22
|
+
/** Get buffer count */
|
|
23
|
+
readonly size: number;
|
|
24
|
+
/** Cleanup all buffers */
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Abstract base class for buffer stores
|
|
29
|
+
*/
|
|
30
|
+
export declare abstract class BaseBufferStore implements IBufferStore {
|
|
31
|
+
protected entries: Map<string, BufferEntry>;
|
|
32
|
+
abstract createOrUpdate(id: BufferId, data: ArrayBufferView, usage?: BufferUsage): void;
|
|
33
|
+
abstract partialUpdate(id: BufferId, data: ArrayBufferView, offsetBytes: number): boolean;
|
|
34
|
+
abstract delete(id: BufferId): void;
|
|
35
|
+
abstract destroy(): void;
|
|
36
|
+
getInfo(id: BufferId): BufferEntry | undefined;
|
|
37
|
+
has(id: BufferId): boolean;
|
|
38
|
+
keys(): IterableIterator<BufferId>;
|
|
39
|
+
get size(): number;
|
|
40
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resources Index - Export all resource management utilities
|
|
3
|
+
*/
|
|
4
|
+
export type { BufferEntry, IBufferStore } from './bufferStore';
|
|
5
|
+
export { BaseBufferStore } from './bufferStore';
|
|
6
|
+
export type { TextureEntry, ITextureStore } from './textureStore';
|
|
7
|
+
export { BaseTextureStore } from './textureStore';
|
|
8
|
+
export type { PipelineKind, PipelineKey, IPipelineCache } from './pipelineCache';
|
|
9
|
+
export { PipelineCache } from './pipelineCache';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PipelineCache - Manages GPU pipeline lifecycle
|
|
3
|
+
*
|
|
4
|
+
* Caches compiled pipelines to avoid recompilation overhead.
|
|
5
|
+
*/
|
|
6
|
+
export type PipelineKind = "triangle" | "line" | "point" | "band" | "heatmap";
|
|
7
|
+
export interface PipelineKey {
|
|
8
|
+
kind: PipelineKind;
|
|
9
|
+
variant?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IPipelineCache {
|
|
12
|
+
/** Get or create a pipeline */
|
|
13
|
+
getOrCreate<T>(key: PipelineKey, factory: () => T): T;
|
|
14
|
+
/** Check if pipeline exists */
|
|
15
|
+
has(key: PipelineKey): boolean;
|
|
16
|
+
/** Delete a pipeline */
|
|
17
|
+
delete(key: PipelineKey): void;
|
|
18
|
+
/** Get pipeline count */
|
|
19
|
+
readonly size: number;
|
|
20
|
+
/** Cleanup all pipelines */
|
|
21
|
+
destroy(): void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Generic pipeline cache implementation
|
|
25
|
+
*/
|
|
26
|
+
export declare class PipelineCache implements IPipelineCache {
|
|
27
|
+
private pipelines;
|
|
28
|
+
getOrCreate<T>(key: PipelineKey, factory: () => T): T;
|
|
29
|
+
has(key: PipelineKey): boolean;
|
|
30
|
+
delete(key: PipelineKey): void;
|
|
31
|
+
get size(): number;
|
|
32
|
+
destroy(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { TextureId, TextureFormat } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface TextureEntry {
|
|
4
|
+
id: TextureId;
|
|
5
|
+
format: TextureFormat;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
lastUpdated: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ITextureStore {
|
|
11
|
+
/** Create or update a 1D texture (for colormaps) */
|
|
12
|
+
createOrUpdate1D(id: TextureId, data: Uint8Array, width?: number): void;
|
|
13
|
+
/** Create or update a 2D texture */
|
|
14
|
+
createOrUpdate2D(id: TextureId, data: Uint8Array, width: number, height: number): void;
|
|
15
|
+
/** Get texture metadata */
|
|
16
|
+
getInfo(id: TextureId): TextureEntry | undefined;
|
|
17
|
+
/** Check if texture exists */
|
|
18
|
+
has(id: TextureId): boolean;
|
|
19
|
+
/** Delete a texture */
|
|
20
|
+
delete(id: TextureId): void;
|
|
21
|
+
/** Get all texture IDs */
|
|
22
|
+
keys(): IterableIterator<TextureId>;
|
|
23
|
+
/** Get texture count */
|
|
24
|
+
readonly size: number;
|
|
25
|
+
/** Cleanup all textures */
|
|
26
|
+
destroy(): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Abstract base class for texture stores
|
|
30
|
+
*/
|
|
31
|
+
export declare abstract class BaseTextureStore implements ITextureStore {
|
|
32
|
+
protected entries: Map<string, TextureEntry>;
|
|
33
|
+
abstract createOrUpdate1D(id: TextureId, data: Uint8Array, width?: number): void;
|
|
34
|
+
abstract createOrUpdate2D(id: TextureId, data: Uint8Array, width: number, height: number): void;
|
|
35
|
+
abstract delete(id: TextureId): void;
|
|
36
|
+
abstract destroy(): void;
|
|
37
|
+
getInfo(id: TextureId): TextureEntry | undefined;
|
|
38
|
+
has(id: TextureId): boolean;
|
|
39
|
+
keys(): IterableIterator<TextureId>;
|
|
40
|
+
get size(): number;
|
|
41
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { DrawList } from './drawList';
|
|
2
|
+
import { FrameUniforms } from './frame';
|
|
3
|
+
|
|
4
|
+
export type GpuBackendType = "webgpu" | "webgl";
|
|
5
|
+
export type RGBA = readonly [number, number, number, number];
|
|
6
|
+
export interface GpuViewport {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
dpr: number;
|
|
10
|
+
}
|
|
11
|
+
export interface GpuLimits {
|
|
12
|
+
maxTextureDimension2D?: number;
|
|
13
|
+
maxBufferSize?: number;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
export interface GpuBackendInfo {
|
|
17
|
+
type: GpuBackendType;
|
|
18
|
+
available: boolean;
|
|
19
|
+
limits?: GpuLimits;
|
|
20
|
+
}
|
|
21
|
+
export type BufferId = string;
|
|
22
|
+
export type TextureId = string;
|
|
23
|
+
export type BufferUsage = "vertex" | "index" | "uniform";
|
|
24
|
+
export interface BufferDescriptor {
|
|
25
|
+
id: BufferId;
|
|
26
|
+
usage: BufferUsage;
|
|
27
|
+
byteStride?: number;
|
|
28
|
+
}
|
|
29
|
+
export type TextureFormat = "rgba8unorm" | "bgra8unorm";
|
|
30
|
+
export interface Texture1DDescriptor {
|
|
31
|
+
id: TextureId;
|
|
32
|
+
format: TextureFormat;
|
|
33
|
+
width: number;
|
|
34
|
+
}
|
|
35
|
+
export interface Dispose {
|
|
36
|
+
destroy(): void;
|
|
37
|
+
}
|
|
38
|
+
export interface GpuBackend extends Dispose {
|
|
39
|
+
readonly info: GpuBackendInfo;
|
|
40
|
+
init(): Promise<void>;
|
|
41
|
+
setViewport(viewport: GpuViewport): void;
|
|
42
|
+
createOrUpdateBuffer(id: BufferId, data: ArrayBufferView, desc?: Partial<BufferDescriptor>): void;
|
|
43
|
+
deleteBuffer(id: BufferId): void;
|
|
44
|
+
createOrUpdateTexture1D(id: TextureId, data: Uint8Array, desc?: Partial<Texture1DDescriptor>): void;
|
|
45
|
+
deleteTexture(id: TextureId): void;
|
|
46
|
+
render(drawList: DrawList, frame: FrameUniforms): void;
|
|
47
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SciChart Engine - High-Performance Scientific Charting
|
|
3
|
+
*
|
|
4
|
+
* A WebGL-based charting engine designed for scientific data visualization
|
|
5
|
+
* and high-performance rendering of large datasets.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - 10⁵–10⁶ points at 60 FPS
|
|
9
|
+
* - Zoom/pan via GPU uniforms (no buffer recreation)
|
|
10
|
+
* - Scientific precision with Float32/Float64 arrays
|
|
11
|
+
* - Data analysis utilities (peak detection, cycle detection, etc.)
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
export { createChart } from './core/Chart';
|
|
16
|
+
export { Series } from './core/Series';
|
|
17
|
+
export { EventEmitter } from './core/EventEmitter';
|
|
18
|
+
export type { Chart, ChartOptions, ExportOptions } from './core/Chart';
|
|
19
|
+
export { AnnotationManager } from './core/annotations';
|
|
20
|
+
export type { Annotation, AnnotationType, HorizontalLineAnnotation, VerticalLineAnnotation, RectangleAnnotation, BandAnnotation, TextAnnotation, ArrowAnnotation, } from './core/annotations';
|
|
21
|
+
export type { AxisOptions, SeriesOptions, SeriesData, SeriesStyle, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Point, Bounds, Range, ScaleType, SeriesType, StepMode, ErrorBarStyle, ErrorBarDirection, ScatterSymbol, } from './types';
|
|
22
|
+
export { LinearScale, LogScale, createScale, type Scale } from './scales';
|
|
23
|
+
export { NativeWebGLRenderer, interleaveData, parseColor, createRenderer, createNativeRenderer, WebGPURenderer, type WebGPURendererOptions, type IWebGLRenderer, type SeriesRenderData, type RenderOptions, } from './renderer';
|
|
24
|
+
export { DARK_THEME, LIGHT_THEME, MIDNIGHT_THEME, ELECTROCHEM_THEME, DEFAULT_THEME, createTheme, getThemeByName, type ChartTheme, type GridTheme, type AxisTheme, type LegendTheme, type CursorTheme, } from './theme';
|
|
25
|
+
export { OverlayRenderer, } from './core/OverlayRenderer';
|
|
26
|
+
export type { PlotArea, CursorState, } from './types';
|
|
27
|
+
export { TooltipManager, TOOLTIP_THEMES, getTooltipThemeForChartTheme, } from './core/tooltip';
|
|
28
|
+
export type { TooltipData, TooltipType, TooltipTheme, TooltipOptions, TooltipTemplate, DataPointTooltip, CrosshairTooltip, HeatmapTooltip, } from './core/tooltip';
|
|
29
|
+
export { lttbDownsample, minMaxDownsample, calculateTargetPoints, } from './workers/downsample';
|
|
30
|
+
export { formatWithPrefix, formatValue, formatScientific, getBestPrefix, detectCycles, generateCycleColors, detectPeaks, validateData, calculateStats, movingAverage, downsampleLTTB, type CycleInfo, type Peak, type PrefixInfo, type ValidationResult, type DataStats, } from './analysis';
|
|
31
|
+
export { createWebSocketStream, connectStreamToChart, createMessageParser, createMockStream, type WebSocketStream, type WebSocketStreamConfig, type DataPoint, type StreamStats, type WebSocketState, } from './streaming';
|
|
32
|
+
export { SciChart, useSciChart, type SciChartProps, type SciChartRef, type SciChartSeries, type UseSciChartOptions, type UseSciChartReturn, } from './react';
|
|
33
|
+
export { WebGPUBackend, WebGLBackend, GpuRenderer, createGpuRenderer, SeriesAdapter, parseColorToRGBA, PipelineCache, BaseBufferStore, BaseTextureStore, GpuBenchmark, GpuCompute, } from './gpu';
|
|
34
|
+
export type { GpuBackendType, RGBA, GpuViewport, GpuBackend, BufferId, TextureId, FrameUniforms, DrawKind, DrawCall, DrawList, PointSymbol, SeriesData as GpuSeriesData, Bounds as GpuBounds, GpuRenderOptions, GpuRendererOptions, BackendPreference, WebGPUBackendOptions, BenchmarkResult, BenchmarkOptions, DataStats as GpuDataStats, DataBounds as GpuDataBounds, Peak as GpuPeak, GpuComputeOptions, } from './gpu';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Bounds } from '../types';
|
|
2
|
+
import { Scale } from '../scales';
|
|
3
|
+
|
|
4
|
+
export interface OverlayTheme {
|
|
5
|
+
/** Background color (usually transparent) */
|
|
6
|
+
background: string;
|
|
7
|
+
/** Axis line color */
|
|
8
|
+
axisColor: string;
|
|
9
|
+
/** Tick mark color */
|
|
10
|
+
tickColor: string;
|
|
11
|
+
/** Label text color */
|
|
12
|
+
labelColor: string;
|
|
13
|
+
/** Grid line color */
|
|
14
|
+
gridColor: string;
|
|
15
|
+
/** Cursor line color */
|
|
16
|
+
cursorColor: string;
|
|
17
|
+
/** Font family */
|
|
18
|
+
fontFamily: string;
|
|
19
|
+
/** Base font size */
|
|
20
|
+
fontSize: number;
|
|
21
|
+
}
|
|
22
|
+
export declare const DEFAULT_THEME: OverlayTheme;
|
|
23
|
+
export interface AxisConfig {
|
|
24
|
+
/** Axis label (e.g., 'E / V') */
|
|
25
|
+
label?: string;
|
|
26
|
+
/** Tick values to draw */
|
|
27
|
+
ticks?: number[];
|
|
28
|
+
/** Format function for tick labels */
|
|
29
|
+
tickFormat?: (value: number) => string;
|
|
30
|
+
/** Show grid lines */
|
|
31
|
+
showGrid?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface CursorState {
|
|
34
|
+
/** Cursor enabled */
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
/** Cursor X position in pixels */
|
|
37
|
+
x: number;
|
|
38
|
+
/** Cursor Y position in pixels */
|
|
39
|
+
y: number;
|
|
40
|
+
/** Show crosshair */
|
|
41
|
+
crosshair: boolean;
|
|
42
|
+
/** Tooltip text */
|
|
43
|
+
tooltip?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Canvas Overlay manages the 2D rendering layer
|
|
47
|
+
*/
|
|
48
|
+
export declare class CanvasOverlay {
|
|
49
|
+
private canvas;
|
|
50
|
+
private ctx;
|
|
51
|
+
private dpr;
|
|
52
|
+
private theme;
|
|
53
|
+
private readonly MARGIN;
|
|
54
|
+
constructor(parentElement: HTMLElement, theme?: Partial<OverlayTheme>);
|
|
55
|
+
/**
|
|
56
|
+
* Resize the overlay canvas
|
|
57
|
+
*/
|
|
58
|
+
resize(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Get the plot area (excluding margins)
|
|
61
|
+
*/
|
|
62
|
+
getPlotArea(): {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Clear the overlay
|
|
70
|
+
*/
|
|
71
|
+
clear(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Render axes
|
|
74
|
+
*/
|
|
75
|
+
renderAxes(bounds: Bounds, xAxis?: AxisConfig, yAxis?: AxisConfig, xScale?: Scale, yScale?: Scale): void;
|
|
76
|
+
private renderGrid;
|
|
77
|
+
private renderXAxis;
|
|
78
|
+
private renderYAxis;
|
|
79
|
+
private renderXAxisLabel;
|
|
80
|
+
private renderYAxisLabel;
|
|
81
|
+
/**
|
|
82
|
+
* Render cursor/crosshair
|
|
83
|
+
*/
|
|
84
|
+
renderCursor(cursor: CursorState): void;
|
|
85
|
+
/**
|
|
86
|
+
* Render tooltip
|
|
87
|
+
*/
|
|
88
|
+
renderTooltip(x: number, y: number, text: string): void;
|
|
89
|
+
/**
|
|
90
|
+
* Render FPS counter (debug)
|
|
91
|
+
*/
|
|
92
|
+
renderFPS(fps: number, frameTime: number): void;
|
|
93
|
+
private dataToPixelX;
|
|
94
|
+
private dataToPixelY;
|
|
95
|
+
private generateTicks;
|
|
96
|
+
private formatNumber;
|
|
97
|
+
private formatScientific;
|
|
98
|
+
/**
|
|
99
|
+
* Destroy the overlay
|
|
100
|
+
*/
|
|
101
|
+
destroy(): void;
|
|
102
|
+
}
|