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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 jigonzalez930209
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# SciChart Engine 🚀
|
|
2
|
+
|
|
3
|
+
A high-performance, WebGL-powered scientific charting engine built for precision, speed, and deep interactivity. Optimized for electrochemical and scientific data visualization.
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.npmjs.com/package/scichart-engine)
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
- **🚀 High Performance**: Render millions of data points at 60 FPS using a specialized raw WebGL renderer.
|
|
11
|
+
- **📈 Advanced Analysis**: Built-in peak detection, integration, baseline correction, and customizable curve fitting (linear/poly/exp).
|
|
12
|
+
- **📊 Specialized Series**: Support for Lines, Scatter (SDF symbols), Step charts, Band series, Area charts, **Candlesticks** (OHLC), and **Stacked Charts**.
|
|
13
|
+
- **↕️ Multi-Axis Engine**: Independent scales and units with axis-specific scrolling and zooming.
|
|
14
|
+
- **📏 Professional Tooling**: Real-time Statistics panel, Annotations (Lines/Shapes/Text), and **high-fidelity SVG/PNG export**.
|
|
15
|
+
- **🔌 Extensible**: **Plugin System** with lifecycle hooks for custom drawing and data analysis.
|
|
16
|
+
- **⚛️ Framework First**: Native React support via hooks and high-level components.
|
|
17
|
+
- **🎨 Dynamic Theming**: Sleek built-in themes (Light/Midnight) with support for custom CSS-based skins.
|
|
18
|
+
- **🏗️ Modular Core**: Built on a modern, decoupled architecture for maximum extendability.
|
|
19
|
+
|
|
20
|
+
## 🛠️ Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install scichart-engine
|
|
24
|
+
# or
|
|
25
|
+
pnpm add scichart-engine
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 🚀 Quick Examples
|
|
29
|
+
|
|
30
|
+
### React (Recommended)
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { SciChart } from 'scichart-engine/react';
|
|
34
|
+
|
|
35
|
+
function App() {
|
|
36
|
+
const data = {
|
|
37
|
+
x: new Float32Array([0, 1, 2, 3]),
|
|
38
|
+
y: new Float32Array([10, 20, 15, 25])
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div style={{ width: '800px', height: '400px' }}>
|
|
43
|
+
<SciChart
|
|
44
|
+
series={[{ id: 's1', ...data, color: '#00f2ff' }]}
|
|
45
|
+
xAxis={{ label: 'Time (s)' }}
|
|
46
|
+
yAxis={{ label: 'Voltage (V)' }}
|
|
47
|
+
showControls
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Vanilla JavaScript
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { createChart } from 'scichart-engine';
|
|
58
|
+
|
|
59
|
+
const chart = createChart({
|
|
60
|
+
container: document.getElementById('chart-container'),
|
|
61
|
+
title: 'Real-time Signal'
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
chart.addSeries({
|
|
65
|
+
id: 'signal',
|
|
66
|
+
type: 'line',
|
|
67
|
+
data: { x: [...], y: [...] }
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 📖 Documentation
|
|
72
|
+
|
|
73
|
+
Visit [SciChart Engine Docs](https://jigonzalez930209.github.io/scichart-engine/) for:
|
|
74
|
+
- [Getting Started Guide](https://jigonzalez930209.github.io/scichart-engine/guide/)
|
|
75
|
+
- [Core Concepts](https://jigonzalez930209.github.io/scichart-engine/guide/concepts)
|
|
76
|
+
- [API Reference](https://jigonzalez930209.github.io/scichart-engine/api/chart)
|
|
77
|
+
- [Interactive Examples](https://jigonzalez930209.github.io/scichart-engine/examples/)
|
|
78
|
+
|
|
79
|
+
## 📄 License
|
|
80
|
+
|
|
81
|
+
MIT © [jigonzalez930209](https://github.com/jigonzalez930209)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contour Plot Generation (Marching Squares)
|
|
3
|
+
*/
|
|
4
|
+
export interface ContourPoint {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ContourLine {
|
|
9
|
+
level: number;
|
|
10
|
+
points: ContourPoint[];
|
|
11
|
+
}
|
|
12
|
+
export interface ContourOptions {
|
|
13
|
+
levels?: number[];
|
|
14
|
+
numLevels?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generate contour lines from a 2D grid of values
|
|
18
|
+
* Values are assumed to be in row-major order: z = values[y * width + x]
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateContours(z: Float32Array | number[], xValues: Float32Array | number[], yValues: Float32Array | number[], options?: ContourOptions): ContourLine[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type FitType = 'linear' | 'polynomial' | 'exponential' | 'logarithmic' | 'power';
|
|
2
|
+
export interface FitOptions {
|
|
3
|
+
/** Degree for polynomial fit (default: 2) */
|
|
4
|
+
degree?: number;
|
|
5
|
+
/** Custom label for the equation */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Number of decimals in equation string */
|
|
8
|
+
precision?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface FitResult {
|
|
11
|
+
type: FitType;
|
|
12
|
+
/** Coefficients (a, b, c...) */
|
|
13
|
+
coefficients: number[];
|
|
14
|
+
/** Formatted equation string */
|
|
15
|
+
equation: string;
|
|
16
|
+
/** Coefficient of determination */
|
|
17
|
+
rSquared: number;
|
|
18
|
+
/** Function to calculate value at X */
|
|
19
|
+
predict: (x: number) => number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Perform regression on a dataset
|
|
23
|
+
*/
|
|
24
|
+
export declare function fitData(x: number[] | Float32Array, y: number[] | Float32Array, type: FitType, options?: FitOptions): FitResult;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data Analysis module exports
|
|
3
|
+
*
|
|
4
|
+
* General-purpose utilities for data formatting, cycle detection,
|
|
5
|
+
* peak detection, and data validation.
|
|
6
|
+
*/
|
|
7
|
+
export { formatWithPrefix, formatValue, formatScientific, getBestPrefix, detectCycles, generateCycleColors, detectPeaks, validateData, calculateStats, movingAverage, downsampleLTTB, subtractBaseline, } from './utils';
|
|
8
|
+
export { solveLinearSystem, calculateR2, integrate, derivative, cumulativeIntegral, } from './math';
|
|
9
|
+
export { fitData, } from './fitting';
|
|
10
|
+
export type { CycleInfo, Peak, PrefixInfo, ValidationResult, DataStats, } from './utils';
|
|
11
|
+
export type { FitType, FitOptions, FitResult, } from './fitting';
|
|
12
|
+
export * from './contours';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mathematical utilities for numerical analysis and regression.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Solve a system of linear equations Ax = B using Gaussian elimination with partial pivoting.
|
|
6
|
+
*
|
|
7
|
+
* @param A - Matrix coefficients
|
|
8
|
+
* @param B - Right hand side vector
|
|
9
|
+
* @returns Solution vector x
|
|
10
|
+
*/
|
|
11
|
+
export declare function solveLinearSystem(A: number[][], B: number[]): number[];
|
|
12
|
+
/**
|
|
13
|
+
* Calculate R² (coefficient of determination)
|
|
14
|
+
*/
|
|
15
|
+
export declare function calculateR2(x: number[] | Float32Array, y: number[] | Float32Array, fitFn: (x: number) => number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Numerical integration using the trapezoidal rule.
|
|
18
|
+
*
|
|
19
|
+
* @param x - X values (must be sorted)
|
|
20
|
+
* @param y - Y values
|
|
21
|
+
* @param xMin - Optional start of integration range
|
|
22
|
+
* @param xMax - Optional end of integration range
|
|
23
|
+
*/
|
|
24
|
+
export declare function integrate(x: number[] | Float32Array, y: number[] | Float32Array, xMin?: number, xMax?: number): number;
|
|
25
|
+
/**
|
|
26
|
+
* Calculate numerical derivative dy/dx
|
|
27
|
+
*/
|
|
28
|
+
export declare function derivative(x: number[] | Float32Array, y: number[] | Float32Array): Float32Array;
|
|
29
|
+
/**
|
|
30
|
+
* Calculate cumulative integral (area array)
|
|
31
|
+
*/
|
|
32
|
+
export declare function cumulativeIntegral(x: number[] | Float32Array, y: number[] | Float32Array): Float32Array;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data Analysis Utilities
|
|
3
|
+
*
|
|
4
|
+
* General-purpose utilities for scientific data formatting,
|
|
5
|
+
* cycle detection, peak detection, and data validation.
|
|
6
|
+
*/
|
|
7
|
+
type SIPrefix = 'p' | 'n' | 'µ' | 'm' | '' | 'k' | 'M' | 'G';
|
|
8
|
+
export interface PrefixInfo {
|
|
9
|
+
symbol: SIPrefix;
|
|
10
|
+
factor: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Find the best SI prefix for a value
|
|
14
|
+
*/
|
|
15
|
+
export declare function getBestPrefix(value: number): PrefixInfo;
|
|
16
|
+
/**
|
|
17
|
+
* Format a value with automatic SI prefix
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* formatWithPrefix(0.000001, 'A') // "1.00 µA"
|
|
21
|
+
* formatWithPrefix(0.5, 'V') // "500 mV"
|
|
22
|
+
* formatWithPrefix(1500, 'm') // "1.50 km"
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatWithPrefix(value: number, unit: string, decimals?: number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Format a numeric value with specified decimals
|
|
27
|
+
* Automatically switches to scientific notation for very large/small values
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatValue(value: number, decimals?: number): string;
|
|
30
|
+
/**
|
|
31
|
+
* Format value in scientific notation
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatScientific(value: number, decimals?: number): string;
|
|
34
|
+
export interface CycleInfo {
|
|
35
|
+
/** Cycle number (1-indexed) */
|
|
36
|
+
number: number;
|
|
37
|
+
/** Start index in data array */
|
|
38
|
+
startIndex: number;
|
|
39
|
+
/** End index in data array */
|
|
40
|
+
endIndex: number;
|
|
41
|
+
/** Direction at start: 1 = forward, -1 = reverse */
|
|
42
|
+
direction: 1 | -1;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Detect cycles in oscillating data
|
|
46
|
+
*
|
|
47
|
+
* A cycle is complete when the signal returns to its starting value
|
|
48
|
+
* after going through both sweep directions. Useful for:
|
|
49
|
+
* - Cyclic voltammetry data
|
|
50
|
+
* - Periodic signals
|
|
51
|
+
* - Oscillation analysis
|
|
52
|
+
*
|
|
53
|
+
* @param signal - The signal data (e.g., potential, position, etc.)
|
|
54
|
+
* @param tolerance - How close to starting value to consider a cycle complete
|
|
55
|
+
*/
|
|
56
|
+
export declare function detectCycles(signal: Float32Array | Float64Array | number[], tolerance?: number): CycleInfo[];
|
|
57
|
+
/**
|
|
58
|
+
* Generate distinct colors for cycles/series
|
|
59
|
+
*
|
|
60
|
+
* Uses HSL color space to generate evenly distributed hues
|
|
61
|
+
*/
|
|
62
|
+
export declare function generateCycleColors(count: number): string[];
|
|
63
|
+
export interface Peak {
|
|
64
|
+
/** Index in data array */
|
|
65
|
+
index: number;
|
|
66
|
+
/** X value at peak */
|
|
67
|
+
x: number;
|
|
68
|
+
/** Y value at peak */
|
|
69
|
+
y: number;
|
|
70
|
+
/** Peak type */
|
|
71
|
+
type: 'max' | 'min';
|
|
72
|
+
/** Prominence of the peak */
|
|
73
|
+
prominence: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Detect peaks (local maxima and minima) in data
|
|
77
|
+
*
|
|
78
|
+
* Uses simple local extrema detection with optional prominence filtering.
|
|
79
|
+
* Useful for:
|
|
80
|
+
* - Signal peak detection
|
|
81
|
+
* - Finding local maxima/minima
|
|
82
|
+
* - Feature extraction
|
|
83
|
+
*
|
|
84
|
+
* @param x - X values (independent variable)
|
|
85
|
+
* @param y - Y values (dependent variable)
|
|
86
|
+
* @param options - Detection options
|
|
87
|
+
*/
|
|
88
|
+
export declare function detectPeaks(x: Float32Array | Float64Array | number[], y: Float32Array | Float64Array | number[], options?: {
|
|
89
|
+
/** Minimum prominence to be considered a peak */
|
|
90
|
+
minProminence?: number;
|
|
91
|
+
/** Only return 'max' or 'min' peaks */
|
|
92
|
+
type?: 'max' | 'min' | 'both';
|
|
93
|
+
}): Peak[];
|
|
94
|
+
export interface ValidationResult {
|
|
95
|
+
/** Whether all data is valid */
|
|
96
|
+
valid: boolean;
|
|
97
|
+
/** Number of invalid values (NaN, Infinity, etc.) */
|
|
98
|
+
invalidCount: number;
|
|
99
|
+
/** Index of first invalid value (-1 if all valid) */
|
|
100
|
+
firstInvalidIndex: number;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Validate that data contains only finite numbers
|
|
104
|
+
*
|
|
105
|
+
* Checks for NaN, Infinity, and -Infinity values.
|
|
106
|
+
* Useful for data quality checks before rendering.
|
|
107
|
+
*/
|
|
108
|
+
export declare function validateData(data: Float32Array | Float64Array | number[]): ValidationResult;
|
|
109
|
+
export interface DataStats {
|
|
110
|
+
min: number;
|
|
111
|
+
max: number;
|
|
112
|
+
mean: number;
|
|
113
|
+
stdDev: number;
|
|
114
|
+
count: number;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Calculate basic statistics for a dataset
|
|
118
|
+
*/
|
|
119
|
+
export declare function calculateStats(data: Float32Array | Float64Array | number[]): DataStats;
|
|
120
|
+
/**
|
|
121
|
+
* Apply moving average smoothing to data
|
|
122
|
+
*
|
|
123
|
+
* @param data - Input data array
|
|
124
|
+
* @param windowSize - Number of points to average (must be odd)
|
|
125
|
+
*/
|
|
126
|
+
export declare function movingAverage(data: Float32Array | Float64Array | number[], windowSize: number): Float32Array;
|
|
127
|
+
/**
|
|
128
|
+
* Downsample data using LTTB (Largest Triangle Three Buckets) algorithm
|
|
129
|
+
*
|
|
130
|
+
* Preserves visual characteristics while reducing point count.
|
|
131
|
+
* Ideal for rendering large datasets efficiently.
|
|
132
|
+
*
|
|
133
|
+
* @param x - X values
|
|
134
|
+
* @param y - Y values
|
|
135
|
+
* @param targetPoints - Desired number of output points
|
|
136
|
+
*/
|
|
137
|
+
export declare function downsampleLTTB(x: Float32Array | Float64Array, y: Float32Array | Float64Array, targetPoints: number): {
|
|
138
|
+
x: Float32Array;
|
|
139
|
+
y: Float32Array;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Subtract a linear baseline from data
|
|
143
|
+
*
|
|
144
|
+
* @param x - X data
|
|
145
|
+
* @param y - Y data
|
|
146
|
+
* @param x1 - Start of baseline segment
|
|
147
|
+
* @param x2 - End of baseline segment
|
|
148
|
+
*/
|
|
149
|
+
export declare function subtractBaseline(x: Float32Array | number[], y: Float32Array | number[], x1: number, x2: number): Float32Array;
|
|
150
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart - Main SciChart Engine Entry Point
|
|
3
|
+
*
|
|
4
|
+
* This file re-exports the chart API from the modular implementation.
|
|
5
|
+
* For the core implementation, see ./chart/ChartCore.ts
|
|
6
|
+
*/
|
|
7
|
+
export type { Chart, ExportOptions } from './chart/types';
|
|
8
|
+
export { MARGINS } from './chart/types';
|
|
9
|
+
export { createChart, ChartImpl } from './chart/ChartCore';
|
|
10
|
+
export { exportToCSV, exportToJSON, exportToImage } from './chart/ChartExporter';
|
|
11
|
+
export { applyZoom, applyPan } from './chart/ChartNavigation';
|
|
12
|
+
export { autoScaleAll, handleBoxZoom } from './chart/ChartScaling';
|
|
13
|
+
export type { NavigationContext } from './chart/ChartNavigation';
|
|
14
|
+
export type { RenderContext } from './chart/ChartRenderer';
|
|
15
|
+
export type { ChartOptions } from '../types';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ChartTheme } from '../theme';
|
|
2
|
+
|
|
3
|
+
export interface ChartControlsCallbacks {
|
|
4
|
+
onResetZoom: () => void;
|
|
5
|
+
onSetType: (type: "line" | "scatter" | "line+scatter") => void;
|
|
6
|
+
onToggleSmoothing: () => void;
|
|
7
|
+
onTogglePan: (active: boolean) => void;
|
|
8
|
+
onExport: () => void;
|
|
9
|
+
onAutoScale: () => void;
|
|
10
|
+
onToggleLegend: (visible: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class ChartControls {
|
|
13
|
+
private container;
|
|
14
|
+
private toolbar;
|
|
15
|
+
private callbacks;
|
|
16
|
+
private theme;
|
|
17
|
+
private isSmoothing;
|
|
18
|
+
private isPanMode;
|
|
19
|
+
private isLegendVisible;
|
|
20
|
+
private currentType;
|
|
21
|
+
constructor(parent: HTMLElement, theme: ChartTheme, callbacks: ChartControlsCallbacks);
|
|
22
|
+
private isDarkTheme;
|
|
23
|
+
private updateToolbarStyle;
|
|
24
|
+
private createButtons;
|
|
25
|
+
private enforceSVGVisibility;
|
|
26
|
+
private createButton;
|
|
27
|
+
private updateButtonStates;
|
|
28
|
+
updateTheme(theme: ChartTheme): void;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ChartTheme } from '../theme';
|
|
2
|
+
import { Series } from './Series';
|
|
3
|
+
|
|
4
|
+
export interface ChartLegendCallbacks {
|
|
5
|
+
onMove: (x: number, y: number) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare class ChartLegend {
|
|
8
|
+
private container;
|
|
9
|
+
private header;
|
|
10
|
+
private content;
|
|
11
|
+
private theme;
|
|
12
|
+
private series;
|
|
13
|
+
private callbacks;
|
|
14
|
+
private isDragging;
|
|
15
|
+
private startX;
|
|
16
|
+
private startY;
|
|
17
|
+
private initialX;
|
|
18
|
+
private initialY;
|
|
19
|
+
constructor(parent: HTMLElement, theme: ChartTheme, options: {
|
|
20
|
+
x?: number;
|
|
21
|
+
y?: number;
|
|
22
|
+
}, callbacks: ChartLegendCallbacks);
|
|
23
|
+
private updateStyle;
|
|
24
|
+
private initDragging;
|
|
25
|
+
update(series: Series[]): void;
|
|
26
|
+
private render;
|
|
27
|
+
/**
|
|
28
|
+
* Internal symbol drawing logic (shared with canvas export)
|
|
29
|
+
*/
|
|
30
|
+
private drawSymbol;
|
|
31
|
+
draw(ctx: CanvasRenderingContext2D, dpr: number): void;
|
|
32
|
+
updateTheme(theme: ChartTheme): void;
|
|
33
|
+
setVisible(visible: boolean): void;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChartTheme } from '../theme';
|
|
2
|
+
import { Series } from './Series';
|
|
3
|
+
import { Bounds } from '../types';
|
|
4
|
+
|
|
5
|
+
export declare class ChartStatistics {
|
|
6
|
+
private container;
|
|
7
|
+
private content;
|
|
8
|
+
private theme;
|
|
9
|
+
private series;
|
|
10
|
+
private isExpanded;
|
|
11
|
+
constructor(parent: HTMLElement, theme: ChartTheme, series: Map<string, Series>);
|
|
12
|
+
private isDarkTheme;
|
|
13
|
+
private updateContainerStyle;
|
|
14
|
+
update(viewBounds: Bounds): void;
|
|
15
|
+
toggle(): void;
|
|
16
|
+
updateTheme(theme: ChartTheme): void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe event emitter for chart events
|
|
3
|
+
*/
|
|
4
|
+
export declare class EventEmitter<EventMap extends object> {
|
|
5
|
+
private listeners;
|
|
6
|
+
/**
|
|
7
|
+
* Subscribe to an event
|
|
8
|
+
*/
|
|
9
|
+
on<K extends keyof EventMap>(event: K, handler: (data: EventMap[K]) => void): void;
|
|
10
|
+
/**
|
|
11
|
+
* Unsubscribe from an event
|
|
12
|
+
*/
|
|
13
|
+
off<K extends keyof EventMap>(event: K, handler: (data: EventMap[K]) => void): void;
|
|
14
|
+
/**
|
|
15
|
+
* Emit an event with data
|
|
16
|
+
*/
|
|
17
|
+
emit<K extends keyof EventMap>(event: K, data: EventMap[K]): void;
|
|
18
|
+
/**
|
|
19
|
+
* Subscribe to an event once
|
|
20
|
+
*/
|
|
21
|
+
once<K extends keyof EventMap>(event: K, handler: (data: EventMap[K]) => void): void;
|
|
22
|
+
/**
|
|
23
|
+
* Remove all listeners
|
|
24
|
+
*/
|
|
25
|
+
clear(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get listener count for an event
|
|
28
|
+
*/
|
|
29
|
+
listenerCount(event: keyof EventMap): number;
|
|
30
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Bounds } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface AxisLayout {
|
|
4
|
+
id: string;
|
|
5
|
+
position: 'left' | 'right';
|
|
6
|
+
offset: number;
|
|
7
|
+
}
|
|
8
|
+
export interface InteractionCallbacks {
|
|
9
|
+
onZoom: (bounds: Bounds, axisId?: string) => void;
|
|
10
|
+
onPan: (deltaX: number, deltaY: number, axisId?: string) => void;
|
|
11
|
+
onBoxZoom: (rect: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
} | null) => void;
|
|
17
|
+
onCursorMove: (x: number, y: number) => void;
|
|
18
|
+
onCursorLeave: () => void;
|
|
19
|
+
}
|
|
20
|
+
export interface PlotAreaGetter {
|
|
21
|
+
(): {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface BoundsGetter {
|
|
29
|
+
(axisId?: string): Bounds;
|
|
30
|
+
}
|
|
31
|
+
export interface AxisLayoutGetter {
|
|
32
|
+
(): AxisLayout[];
|
|
33
|
+
}
|
|
34
|
+
export declare class InteractionManager {
|
|
35
|
+
private container;
|
|
36
|
+
private callbacks;
|
|
37
|
+
private getPlotArea;
|
|
38
|
+
private getBounds;
|
|
39
|
+
private getAxesLayout;
|
|
40
|
+
private isDragging;
|
|
41
|
+
private panningAxisId?;
|
|
42
|
+
private isBoxSelecting;
|
|
43
|
+
private selectionStart;
|
|
44
|
+
private lastMousePos;
|
|
45
|
+
private isPanMode;
|
|
46
|
+
private boundWheel;
|
|
47
|
+
private boundMouseDown;
|
|
48
|
+
private boundMouseMove;
|
|
49
|
+
private boundMouseUp;
|
|
50
|
+
private boundMouseLeave;
|
|
51
|
+
private boundTouchStart;
|
|
52
|
+
private boundTouchMove;
|
|
53
|
+
private boundTouchEnd;
|
|
54
|
+
constructor(container: HTMLElement, callbacks: InteractionCallbacks, getPlotArea: PlotAreaGetter, getBounds: BoundsGetter, getAxesLayout: AxisLayoutGetter);
|
|
55
|
+
private attachListeners;
|
|
56
|
+
private detachListeners;
|
|
57
|
+
setPanMode(enabled: boolean): void;
|
|
58
|
+
private handleWheel;
|
|
59
|
+
private handleMouseDown;
|
|
60
|
+
private handleMouseMove;
|
|
61
|
+
private handleMouseUp;
|
|
62
|
+
private handleMouseLeave;
|
|
63
|
+
private handleTouchStart;
|
|
64
|
+
private handleTouchMove;
|
|
65
|
+
private handleTouchEnd;
|
|
66
|
+
destroy(): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Scale } from '../scales';
|
|
2
|
+
import { ChartTheme } from '../theme';
|
|
3
|
+
import { Series } from './Series';
|
|
4
|
+
import { PlotArea, CursorState } from '../types';
|
|
5
|
+
|
|
6
|
+
export declare class OverlayRenderer {
|
|
7
|
+
private ctx;
|
|
8
|
+
private theme;
|
|
9
|
+
constructor(ctx: CanvasRenderingContext2D, theme: ChartTheme);
|
|
10
|
+
/**
|
|
11
|
+
* Update the theme
|
|
12
|
+
*/
|
|
13
|
+
setTheme(theme: ChartTheme): void;
|
|
14
|
+
/**
|
|
15
|
+
* Clear the overlay
|
|
16
|
+
*/
|
|
17
|
+
clear(width: number, height: number): void;
|
|
18
|
+
/**
|
|
19
|
+
* Draw the grid
|
|
20
|
+
*/
|
|
21
|
+
drawGrid(plotArea: PlotArea, xScale: Scale, yScale: Scale): void;
|
|
22
|
+
/**
|
|
23
|
+
* Draw X axis with ticks and labels
|
|
24
|
+
*/
|
|
25
|
+
drawXAxis(plotArea: PlotArea, xScale: Scale, label?: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Draw Y axis with ticks and labels
|
|
28
|
+
*/
|
|
29
|
+
drawYAxis(plotArea: PlotArea, yScale: Scale, label?: string, position?: "left" | "right", offset?: number): void;
|
|
30
|
+
/**
|
|
31
|
+
* Draw plot area border
|
|
32
|
+
*/
|
|
33
|
+
drawPlotBorder(plotArea: PlotArea): void;
|
|
34
|
+
/**
|
|
35
|
+
* Draw legend
|
|
36
|
+
*/
|
|
37
|
+
drawLegend(plotArea: PlotArea, series: Series[]): void;
|
|
38
|
+
/**
|
|
39
|
+
* Helper to draw a symbol in the legend
|
|
40
|
+
*/
|
|
41
|
+
private drawLegendSymbol;
|
|
42
|
+
/**
|
|
43
|
+
* Draw cursor/crosshair
|
|
44
|
+
*/
|
|
45
|
+
drawCursor(plotArea: PlotArea, cursor: CursorState): void;
|
|
46
|
+
/**
|
|
47
|
+
* Draw tooltip
|
|
48
|
+
*/
|
|
49
|
+
private drawTooltip;
|
|
50
|
+
/**
|
|
51
|
+
* Draw selection rectangle (Box Zoom)
|
|
52
|
+
*/
|
|
53
|
+
drawSelectionRect(rect: {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
width: number;
|
|
57
|
+
height: number;
|
|
58
|
+
}): void;
|
|
59
|
+
/**
|
|
60
|
+
* Draw error bars for a series
|
|
61
|
+
*/
|
|
62
|
+
drawErrorBars(plotArea: PlotArea, series: Series, xScale: Scale, yScale: Scale): void;
|
|
63
|
+
private generateMinorTicks;
|
|
64
|
+
private formatXTick;
|
|
65
|
+
private formatYTick;
|
|
66
|
+
private toScientificUnicode;
|
|
67
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Bounds } from '../../types';
|
|
2
|
+
import { Annotation } from './types';
|
|
3
|
+
|
|
4
|
+
export interface PlotArea {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class AnnotationManager {
|
|
11
|
+
private annotations;
|
|
12
|
+
private idCounter;
|
|
13
|
+
/**
|
|
14
|
+
* Add a new annotation
|
|
15
|
+
* @returns The annotation ID
|
|
16
|
+
*/
|
|
17
|
+
add(annotation: Annotation): string;
|
|
18
|
+
/**
|
|
19
|
+
* Remove an annotation by ID
|
|
20
|
+
*/
|
|
21
|
+
remove(id: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Update an annotation
|
|
24
|
+
*/
|
|
25
|
+
update(id: string, updates: Partial<Annotation>): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get an annotation by ID
|
|
28
|
+
*/
|
|
29
|
+
get(id: string): Annotation | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Get all annotations
|
|
32
|
+
*/
|
|
33
|
+
getAll(): Annotation[];
|
|
34
|
+
/**
|
|
35
|
+
* Clear all annotations
|
|
36
|
+
*/
|
|
37
|
+
clear(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get count of annotations
|
|
40
|
+
*/
|
|
41
|
+
get count(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Render all annotations
|
|
44
|
+
*/
|
|
45
|
+
render(ctx: CanvasRenderingContext2D, plotArea: PlotArea, bounds: Bounds): void;
|
|
46
|
+
private renderAnnotation;
|
|
47
|
+
private dataToPixelX;
|
|
48
|
+
private dataToPixelY;
|
|
49
|
+
private renderHorizontalLine;
|
|
50
|
+
private renderVerticalLine;
|
|
51
|
+
private renderRectangle;
|
|
52
|
+
private renderBand;
|
|
53
|
+
private renderText;
|
|
54
|
+
private renderArrow;
|
|
55
|
+
private renderLineLabel;
|
|
56
|
+
private renderCenteredLabel;
|
|
57
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Annotations module exports
|
|
3
|
+
*/
|
|
4
|
+
export { AnnotationManager, type PlotArea } from './AnnotationManager';
|
|
5
|
+
export type { Annotation, AnnotationType, BaseAnnotation, HorizontalLineAnnotation, VerticalLineAnnotation, RectangleAnnotation, BandAnnotation, TextAnnotation, ArrowAnnotation, AnnotationEvent, AnnotationDragEvent, } from './types';
|