@jigonzalez930209/scichart-engine 0.1.0
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 +78 -0
- package/dist/analysis/index.d.ts +8 -0
- package/dist/analysis/utils.d.ts +141 -0
- package/dist/core/Chart.d.ts +26 -0
- package/dist/core/ChartControls.d.ts +28 -0
- package/dist/core/ChartLegend.d.ts +30 -0
- package/dist/core/EventEmitter.d.ts +30 -0
- package/dist/core/InteractionManager.d.ts +57 -0
- package/dist/core/OverlayRenderer.d.ts +75 -0
- package/dist/core/Series.d.ts +44 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/examples.d.ts +19 -0
- package/dist/index.d.ts +27 -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/NativeWebGLRenderer.d.ts +69 -0
- package/dist/renderer/RendererInterface.d.ts +61 -0
- package/dist/renderer/index.d.ts +6 -0
- package/dist/renderer/shaders.d.ts +66 -0
- package/dist/scales/index.d.ts +54 -0
- package/dist/scichart-engine.es.js +2341 -0
- package/dist/scichart-engine.es.js.map +1 -0
- package/dist/scichart-engine.umd.js +130 -0
- package/dist/scichart-engine.umd.js.map +1 -0
- package/dist/theme/index.d.ts +123 -0
- package/dist/types.d.ts +172 -0
- package/dist/workers/downsample.d.ts +34 -0
- package/dist/workers/downsample.worker.d.ts +46 -0
- package/package.json +58 -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,78 @@
|
|
|
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 with ease using a specialized raw WebGL renderer.
|
|
11
|
+
- **📊 Scientific Precision**: Tailored for electrochemical (CV, DPV, etc.) and scientific data.
|
|
12
|
+
- **🖱️ Deep Interactivity**: Smooth panning, wheel zoom, and precise box-selection zoom.
|
|
13
|
+
- **⚛️ React Ready**: Native React hooks and components included.
|
|
14
|
+
- **📈 Advanced Analysis**: Built-in cycle detection, peak detection, and real-time smoothing.
|
|
15
|
+
- **🎨 Theming**: Fully customizable visual themes with premium defaults.
|
|
16
|
+
|
|
17
|
+
## 🛠️ Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @jigonzalez930209/scichart-engine
|
|
21
|
+
# or
|
|
22
|
+
pnpm add @jigonzalez930209/scichart-engine
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 🚀 Quick Examples
|
|
26
|
+
|
|
27
|
+
### React (Recommended)
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { SciChart } from '@jigonzalez930209/scichart-engine/react';
|
|
31
|
+
|
|
32
|
+
function App() {
|
|
33
|
+
const data = {
|
|
34
|
+
x: new Float32Array([0, 1, 2, 3]),
|
|
35
|
+
y: new Float32Array([10, 20, 15, 25])
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div style={{ width: '800px', height: '400px' }}>
|
|
40
|
+
<SciChart
|
|
41
|
+
series={[{ id: 's1', ...data, color: '#00f2ff' }]}
|
|
42
|
+
xAxis={{ label: 'Time (s)' }}
|
|
43
|
+
yAxis={{ label: 'Voltage (V)' }}
|
|
44
|
+
showControls
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Vanilla JavaScript
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { createChart } from '@jigonzalez930209/scichart-engine';
|
|
55
|
+
|
|
56
|
+
const chart = createChart({
|
|
57
|
+
container: document.getElementById('chart-container'),
|
|
58
|
+
title: 'Real-time Signal'
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
chart.addSeries({
|
|
62
|
+
id: 'signal',
|
|
63
|
+
type: 'line',
|
|
64
|
+
data: { x: [...], y: [...] }
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 📖 Documentation
|
|
69
|
+
|
|
70
|
+
Visit [scichart-engine.js.org](https://scichart-engine.js.org) for:
|
|
71
|
+
- [Getting Started Guide](https://scichart-engine.js.org/guide/)
|
|
72
|
+
- [Core Concepts](https://scichart-engine.js.org/guide/concepts)
|
|
73
|
+
- [API Reference](https://scichart-engine.js.org/api/chart)
|
|
74
|
+
- [Interactive Examples](https://github.com/jigonzalez930209/scichart-engine/tree/main/examples)
|
|
75
|
+
|
|
76
|
+
## 📄 License
|
|
77
|
+
|
|
78
|
+
MIT © [jigonzalez930209](https://github.com/jigonzalez930209)
|
|
@@ -0,0 +1,8 @@
|
|
|
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, } from './utils';
|
|
8
|
+
export type { CycleInfo, Peak, PrefixInfo, ValidationResult, DataStats, } from './utils';
|
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ChartOptions, SeriesOptions, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Bounds } from '../types';
|
|
2
|
+
import { Series } from './Series';
|
|
3
|
+
|
|
4
|
+
export interface Chart {
|
|
5
|
+
addSeries(options: SeriesOptions): void;
|
|
6
|
+
removeSeries(id: string): void;
|
|
7
|
+
updateSeries(id: string, data: SeriesUpdateData): void;
|
|
8
|
+
getSeries(id: string): Series | undefined;
|
|
9
|
+
getAllSeries(): Series[];
|
|
10
|
+
zoom(options: ZoomOptions): void;
|
|
11
|
+
pan(deltaX: number, deltaY: number): void;
|
|
12
|
+
resetZoom(): void;
|
|
13
|
+
getViewBounds(): Bounds;
|
|
14
|
+
enableCursor(options: CursorOptions): void;
|
|
15
|
+
disableCursor(): void;
|
|
16
|
+
resize(width?: number, height?: number): void;
|
|
17
|
+
render(): void;
|
|
18
|
+
on<K extends keyof ChartEventMap>(event: K, handler: (data: ChartEventMap[K]) => void): void;
|
|
19
|
+
off<K extends keyof ChartEventMap>(event: K, handler: (data: ChartEventMap[K]) => void): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
exportImage(type?: "png" | "jpeg"): string;
|
|
22
|
+
autoScale(): void;
|
|
23
|
+
setTheme(theme: string | object): void;
|
|
24
|
+
}
|
|
25
|
+
export declare function createChart(options: ChartOptions): Chart;
|
|
26
|
+
export { ChartOptions };
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
11
|
+
export declare class ChartControls {
|
|
12
|
+
private container;
|
|
13
|
+
private toolbar;
|
|
14
|
+
private callbacks;
|
|
15
|
+
private theme;
|
|
16
|
+
private isSmoothing;
|
|
17
|
+
private isPanMode;
|
|
18
|
+
private currentType;
|
|
19
|
+
constructor(parent: HTMLElement, theme: ChartTheme, callbacks: ChartControlsCallbacks);
|
|
20
|
+
private isDarkTheme;
|
|
21
|
+
private updateToolbarStyle;
|
|
22
|
+
private createButtons;
|
|
23
|
+
private enforceSVGVisibility;
|
|
24
|
+
private createButton;
|
|
25
|
+
private updateButtonStates;
|
|
26
|
+
updateTheme(theme: ChartTheme): void;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
draw(ctx: CanvasRenderingContext2D, dpr: number): void;
|
|
28
|
+
updateTheme(theme: ChartTheme): void;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
}
|
|
@@ -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,57 @@
|
|
|
1
|
+
import { Bounds } from '../types';
|
|
2
|
+
|
|
3
|
+
export interface InteractionCallbacks {
|
|
4
|
+
onZoom: (bounds: Bounds) => void;
|
|
5
|
+
onPan: (deltaX: number, deltaY: number) => void;
|
|
6
|
+
onBoxZoom: (rect: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
} | null) => void;
|
|
12
|
+
onCursorMove: (x: number, y: number) => void;
|
|
13
|
+
onCursorLeave: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface PlotAreaGetter {
|
|
16
|
+
(): {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface BoundsGetter {
|
|
24
|
+
(): Bounds;
|
|
25
|
+
}
|
|
26
|
+
export declare class InteractionManager {
|
|
27
|
+
private container;
|
|
28
|
+
private callbacks;
|
|
29
|
+
private getPlotArea;
|
|
30
|
+
private getBounds;
|
|
31
|
+
private isDragging;
|
|
32
|
+
private isBoxSelecting;
|
|
33
|
+
private selectionStart;
|
|
34
|
+
private lastMousePos;
|
|
35
|
+
private isPanMode;
|
|
36
|
+
private boundWheel;
|
|
37
|
+
private boundMouseDown;
|
|
38
|
+
private boundMouseMove;
|
|
39
|
+
private boundMouseUp;
|
|
40
|
+
private boundMouseLeave;
|
|
41
|
+
private boundTouchStart;
|
|
42
|
+
private boundTouchMove;
|
|
43
|
+
private boundTouchEnd;
|
|
44
|
+
constructor(container: HTMLElement, callbacks: InteractionCallbacks, getPlotArea: PlotAreaGetter, getBounds: BoundsGetter);
|
|
45
|
+
private attachListeners;
|
|
46
|
+
private detachListeners;
|
|
47
|
+
setPanMode(enabled: boolean): void;
|
|
48
|
+
private handleWheel;
|
|
49
|
+
private handleMouseDown;
|
|
50
|
+
private handleMouseMove;
|
|
51
|
+
private handleMouseUp;
|
|
52
|
+
private handleMouseLeave;
|
|
53
|
+
private handleTouchStart;
|
|
54
|
+
private handleTouchMove;
|
|
55
|
+
private handleTouchEnd;
|
|
56
|
+
destroy(): void;
|
|
57
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Scale } from '../scales';
|
|
2
|
+
import { ChartTheme } from '../theme';
|
|
3
|
+
import { Series } from './Series';
|
|
4
|
+
|
|
5
|
+
export interface PlotArea {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
export interface AxisLabels {
|
|
12
|
+
x?: string;
|
|
13
|
+
y?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CursorState {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
crosshair: boolean;
|
|
20
|
+
tooltipText?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class OverlayRenderer {
|
|
23
|
+
private ctx;
|
|
24
|
+
private theme;
|
|
25
|
+
constructor(ctx: CanvasRenderingContext2D, theme: ChartTheme);
|
|
26
|
+
/**
|
|
27
|
+
* Update the theme
|
|
28
|
+
*/
|
|
29
|
+
setTheme(theme: ChartTheme): void;
|
|
30
|
+
/**
|
|
31
|
+
* Clear the overlay
|
|
32
|
+
*/
|
|
33
|
+
clear(width: number, height: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Draw the grid
|
|
36
|
+
*/
|
|
37
|
+
drawGrid(plotArea: PlotArea, xScale: Scale, yScale: Scale): void;
|
|
38
|
+
/**
|
|
39
|
+
* Draw X axis with ticks and labels
|
|
40
|
+
*/
|
|
41
|
+
drawXAxis(plotArea: PlotArea, xScale: Scale, label?: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Draw Y axis with ticks and labels
|
|
44
|
+
*/
|
|
45
|
+
drawYAxis(plotArea: PlotArea, yScale: Scale, label?: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Draw plot area border
|
|
48
|
+
*/
|
|
49
|
+
drawPlotBorder(plotArea: PlotArea): void;
|
|
50
|
+
/**
|
|
51
|
+
* Draw legend
|
|
52
|
+
*/
|
|
53
|
+
drawLegend(plotArea: PlotArea, series: Series[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Draw cursor/crosshair
|
|
56
|
+
*/
|
|
57
|
+
drawCursor(plotArea: PlotArea, cursor: CursorState): void;
|
|
58
|
+
/**
|
|
59
|
+
* Draw tooltip
|
|
60
|
+
*/
|
|
61
|
+
private drawTooltip;
|
|
62
|
+
/**
|
|
63
|
+
* Draw selection rectangle (Box Zoom)
|
|
64
|
+
*/
|
|
65
|
+
drawSelectionRect(rect: {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
}): void;
|
|
71
|
+
private generateMinorTicks;
|
|
72
|
+
private formatXTick;
|
|
73
|
+
private formatYTick;
|
|
74
|
+
private toScientificUnicode;
|
|
75
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SeriesOptions, SeriesData, SeriesStyle, SeriesUpdateData, Bounds, SeriesType } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare class Series {
|
|
4
|
+
private id;
|
|
5
|
+
private type;
|
|
6
|
+
private data;
|
|
7
|
+
private style;
|
|
8
|
+
private visible;
|
|
9
|
+
private cycle?;
|
|
10
|
+
private cachedBounds;
|
|
11
|
+
private boundsNeedsUpdate;
|
|
12
|
+
private _needsBufferUpdate;
|
|
13
|
+
private smoothedData;
|
|
14
|
+
private smoothingNeedsUpdate;
|
|
15
|
+
constructor(options: SeriesOptions);
|
|
16
|
+
getId(): string;
|
|
17
|
+
getType(): SeriesType;
|
|
18
|
+
getData(): SeriesData;
|
|
19
|
+
private getSmoothedData;
|
|
20
|
+
private applySmoothing;
|
|
21
|
+
getStyle(): SeriesStyle;
|
|
22
|
+
isVisible(): boolean;
|
|
23
|
+
getCycle(): number | undefined;
|
|
24
|
+
getPointCount(): number;
|
|
25
|
+
getBounds(): Bounds | null;
|
|
26
|
+
private calculateBounds;
|
|
27
|
+
/**
|
|
28
|
+
* Update series data
|
|
29
|
+
*
|
|
30
|
+
* For streaming data, use append=true to avoid recreating buffers.
|
|
31
|
+
*/
|
|
32
|
+
updateData(update: SeriesUpdateData): void;
|
|
33
|
+
private appendArray;
|
|
34
|
+
/**
|
|
35
|
+
* Replace all data at once
|
|
36
|
+
*/
|
|
37
|
+
setData(x: Float32Array | Float64Array, y: Float32Array | Float64Array): void;
|
|
38
|
+
setStyle(style: Partial<SeriesStyle>): void;
|
|
39
|
+
get needsBufferUpdate(): boolean;
|
|
40
|
+
set needsBufferUpdate(val: boolean);
|
|
41
|
+
setVisible(visible: boolean): void;
|
|
42
|
+
setType(type: SeriesType): void;
|
|
43
|
+
destroy(): void;
|
|
44
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core module exports
|
|
3
|
+
*/
|
|
4
|
+
export { createChart, type Chart, type ChartOptions } from './Chart';
|
|
5
|
+
export { Series } from './Series';
|
|
6
|
+
export { EventEmitter } from './EventEmitter';
|
|
7
|
+
export { OverlayRenderer, type PlotArea, type CursorState } from './OverlayRenderer';
|
|
8
|
+
export { InteractionManager } from './InteractionManager';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createChart } from './index';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Example: Basic CV Plot
|
|
5
|
+
*/
|
|
6
|
+
export declare function exampleBasicCV(): import('./index').Chart;
|
|
7
|
+
/**
|
|
8
|
+
* Example: Streaming data (real-time)
|
|
9
|
+
*/
|
|
10
|
+
export declare function exampleStreaming(): () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Example: Multi-cycle CV with cycle detection
|
|
13
|
+
*/
|
|
14
|
+
export declare function exampleMultiCycle(): import('./index').Chart;
|
|
15
|
+
/**
|
|
16
|
+
* Example: Zoom controls
|
|
17
|
+
*/
|
|
18
|
+
export declare function exampleZoomControls(chart: ReturnType<typeof createChart>): void;
|
|
19
|
+
export { createChart };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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 } from './core/Chart';
|
|
19
|
+
export type { AxisOptions, SeriesOptions, SeriesData, SeriesStyle, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Point, Bounds, Range, ScaleType, SeriesType, } from './types';
|
|
20
|
+
export { LinearScale, LogScale, createScale, type Scale } from './scales';
|
|
21
|
+
export { NativeWebGLRenderer, interleaveData, parseColor, createRenderer, createNativeRenderer, type IWebGLRenderer, type SeriesRenderData, type RenderOptions, } from './renderer';
|
|
22
|
+
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';
|
|
23
|
+
export { OverlayRenderer, type PlotArea, type CursorState, } from './core/OverlayRenderer';
|
|
24
|
+
export { lttbDownsample, minMaxDownsample, calculateTargetPoints, } from './workers/downsample';
|
|
25
|
+
export { formatWithPrefix, formatValue, formatScientific, getBestPrefix, detectCycles, generateCycleColors, detectPeaks, validateData, calculateStats, movingAverage, downsampleLTTB, type CycleInfo, type Peak, type PrefixInfo, type ValidationResult, type DataStats, } from './analysis';
|
|
26
|
+
export { formatWithPrefix as formatPotential, formatWithPrefix as formatCurrent, } from './analysis';
|
|
27
|
+
export { SciChart, useSciChart, type SciChartProps, type SciChartRef, type SciChartSeries, type UseSciChartOptions, type UseSciChartReturn, } from './react';
|