scichart-engine 1.1.2 → 1.2.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.
@@ -20,8 +20,29 @@ export interface FFTResult {
20
20
  magnitude: Float32Array;
21
21
  /** Phase spectrum in radians */
22
22
  phase: Float32Array;
23
- /** Full complex spectrum */
23
+ /** Full complex spectrum as Complex[] array */
24
24
  complex: Complex[];
25
+ /** Real part of full spectrum as Float32Array */
26
+ real: Float32Array;
27
+ /** Imaginary part of full spectrum as Float32Array */
28
+ imag: Float32Array;
29
+ }
30
+ /** Complex FFT Result - full spectrum with separate real/imag arrays */
31
+ export interface ComplexFFTResult {
32
+ /** Real part of spectrum */
33
+ real: Float32Array;
34
+ /** Imaginary part of spectrum */
35
+ imag: Float32Array;
36
+ /** Frequency bins in Hz (if sample rate provided) */
37
+ frequency: Float32Array;
38
+ /** Magnitude spectrum (sqrt(real² + imag²)) */
39
+ magnitude: Float32Array;
40
+ /** Phase spectrum in radians (atan2(imag, real)) */
41
+ phase: Float32Array;
42
+ /** Original spectrum length (power of 2) */
43
+ length: number;
44
+ /** Nyquist index (length / 2) */
45
+ nyquist: number;
25
46
  }
26
47
  /** Power spectrum result */
27
48
  export interface PowerSpectrumResult {
@@ -72,3 +93,46 @@ export declare function hammingWindow(data: Float32Array | Float64Array): Float3
72
93
  * Apply Blackman window to data
73
94
  */
74
95
  export declare function blackmanWindow(data: Float32Array | Float64Array): Float32Array;
96
+ /**
97
+ * Compute full complex FFT analysis with separate real and imaginary arrays
98
+ * This is useful when you need direct access to real/imag components
99
+ */
100
+ export declare function analyzeComplexSpectrum(data: Float32Array | Float64Array | number[], sampleRate?: number): ComplexFFTResult;
101
+ /**
102
+ * Compute FFT from complex input (real + imaginary arrays)
103
+ * Useful for processing complex signals or chaining FFT operations
104
+ */
105
+ export declare function fftFromComplexInput(real: Float32Array | Float64Array | number[], imag: Float32Array | Float64Array | number[]): ComplexFFTResult;
106
+ /**
107
+ * Convert Complex[] array to separate real and imaginary Float32Arrays
108
+ */
109
+ export declare function complexToArrays(complex: Complex[]): {
110
+ real: Float32Array;
111
+ imag: Float32Array;
112
+ };
113
+ /**
114
+ * Convert separate real and imaginary arrays to Complex[] array
115
+ */
116
+ export declare function arraysToComplex(real: Float32Array | Float64Array | number[], imag: Float32Array | Float64Array | number[]): Complex[];
117
+ /**
118
+ * Compute inverse FFT from separate real and imaginary arrays
119
+ * Returns the real part of the inverse transform
120
+ */
121
+ export declare function ifftFromArrays(real: Float32Array | Float64Array | number[], imag: Float32Array | Float64Array | number[]): Float32Array;
122
+ /**
123
+ * Compute inverse FFT returning complex result (both real and imaginary parts)
124
+ */
125
+ export declare function ifftComplex(spectrum: Complex[]): {
126
+ real: Float32Array;
127
+ imag: Float32Array;
128
+ };
129
+ /**
130
+ * Get only positive frequencies (up to Nyquist) from complex spectrum
131
+ */
132
+ export declare function getPositiveFrequencies(result: ComplexFFTResult): {
133
+ real: Float32Array;
134
+ imag: Float32Array;
135
+ frequency: Float32Array;
136
+ magnitude: Float32Array;
137
+ phase: Float32Array;
138
+ };
@@ -10,8 +10,8 @@ export { fitData, } from './fitting';
10
10
  export type { CycleInfo, Peak, PrefixInfo, ValidationResult, DataStats, } from './utils';
11
11
  export type { FitType, FitOptions, FitResult, } from './fitting';
12
12
  export * from './contours';
13
- export { fft, ifft, analyzeSpectrum, powerSpectrum, dominantFrequency, hanningWindow, hammingWindow, blackmanWindow, nextPowerOf2, } from './fft';
14
- export type { Complex, FFTResult, PowerSpectrumResult, } from './fft';
13
+ export { fft, ifft, analyzeSpectrum, powerSpectrum, dominantFrequency, hanningWindow, hammingWindow, blackmanWindow, nextPowerOf2, analyzeComplexSpectrum, fftFromComplexInput, complexToArrays, arraysToComplex, ifftFromArrays, ifftComplex, getPositiveFrequencies, } from './fft';
14
+ export type { Complex, FFTResult, ComplexFFTResult, PowerSpectrumResult, } from './fft';
15
15
  export { lowPassFilter, highPassFilter, bandPassFilter, bandStopFilter, butterworth, exponentialMovingAverage, gaussianSmooth, savitzkyGolay, medianFilter, } from './filters';
16
16
  export type { FilterType, FilterOptions, ButterworthOptions, } from './filters';
17
17
  export { crossCorrelation, autoCorrelation, detectAnomalies, trapezoidalIntegration, simpsonsIntegration, cumulativeIntegration as cumulativeIntegral2, tTest, } from './statistics';
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Chart Initialization Queue
3
+ *
4
+ * Internal system that manages sequential initialization of multiple charts.
5
+ * This is automatically integrated into createChart - no external usage needed.
6
+ */
7
+ /**
8
+ * Internal: Wait for turn in initialization queue
9
+ * Returns the assigned chart ID
10
+ */
11
+ export declare function waitForInitTurn(): Promise<string>;
12
+ /**
13
+ * Internal: Mark chart initialization as complete
14
+ */
15
+ export declare function markInitComplete(id: string): void;
16
+ /**
17
+ * Get queue status (for debugging)
18
+ */
19
+ export declare function getInitQueueStatus(): {
20
+ pending: number;
21
+ completed: number;
22
+ currentId: string | null;
23
+ isProcessing: boolean;
24
+ };
25
+ /**
26
+ * Reset the queue (call on page navigation if needed)
27
+ */
28
+ export declare function resetInitQueue(): void;
29
+ export declare class ChartInitQueue {
30
+ private static instance;
31
+ static getStatus(): {
32
+ pending: number;
33
+ completed: number;
34
+ currentId: string | null;
35
+ isProcessing: boolean;
36
+ };
37
+ static reset(): void;
38
+ }
39
+ export declare function getChartInitQueue(): {
40
+ getStatus: () => {
41
+ pending: number;
42
+ completed: number;
43
+ currentId: string | null;
44
+ isProcessing: boolean;
45
+ };
46
+ reset: () => void;
47
+ };
48
+ export declare function queueChartInit(_id: string, fn: () => Promise<void>): Promise<void>;
49
+ export declare function waitForAnimations(durationMs?: number): Promise<void>;
50
+ export declare function resetChartQueue(): void;
@@ -99,6 +99,10 @@ export declare class AnimationEngine {
99
99
  * Check if any animations are running
100
100
  */
101
101
  isAnimating(): boolean;
102
+ /**
103
+ * Returns a promise that resolves when all current animations are complete
104
+ */
105
+ waitForIdle(): Promise<void>;
102
106
  /**
103
107
  * Get number of active animations
104
108
  */
@@ -40,10 +40,15 @@ export declare class ChartImpl implements Chart {
40
40
  private animationFrameId;
41
41
  private needsFullRender;
42
42
  private needsOverlayRender;
43
- private isDestroyed;
43
+ private _isDestroyed;
44
44
  private autoScroll;
45
45
  private showStatistics;
46
46
  private stats;
47
+ private initQueueId;
48
+ private initStarted;
49
+ private commandQueue;
50
+ /** Whether the chart has been destroyed */
51
+ get isDestroyed(): boolean;
47
52
  private selectionRect;
48
53
  private annotationManager;
49
54
  readonly tooltip: TooltipManager;
@@ -55,6 +60,20 @@ export declare class ChartImpl implements Chart {
55
60
  private selectionManager;
56
61
  private responsiveManager;
57
62
  constructor(options: ChartOptions);
63
+ /**
64
+ * Start the chart initialization (called by queue system)
65
+ * This performs the actual render startup that was deferred from constructor
66
+ */
67
+ startInit(): void;
68
+ /**
69
+ * Mark this chart's initialization as complete in the queue
70
+ */
71
+ completeInit(): Promise<void>;
72
+ private executeOrQueue;
73
+ /**
74
+ * Set the initialization queue ID (internal use)
75
+ */
76
+ setInitQueueId(id: string): void;
58
77
  private initControls;
59
78
  private toggleLegend;
60
79
  private initLegend;
@@ -229,8 +248,13 @@ export declare class ChartImpl implements Chart {
229
248
  private pixelToDataX;
230
249
  private pixelToDataY;
231
250
  private startRenderLoop;
251
+ private scheduleRenderFrame;
232
252
  on<K extends keyof ChartEventMap>(e: K, h: (d: ChartEventMap[K]) => void): void;
233
253
  off<K extends keyof ChartEventMap>(e: K, h: (d: ChartEventMap[K]) => void): void;
234
254
  destroy(): void;
235
255
  }
256
+ /**
257
+ * Create a new chart. Charts are automatically queued for sequential
258
+ * initialization when multiple charts are created on the same page.
259
+ */
236
260
  export declare function createChart(options: ChartOptions): Chart;
@@ -4,6 +4,12 @@ import { createChart } from './index';
4
4
  * Example: Basic CV Plot
5
5
  */
6
6
  export declare function exampleBasicCV(): import('./index').Chart;
7
+ /**
8
+ * Example: FFT of sine, square, and mixed waves
9
+ */
10
+ export declare function exampleFFTWaveforms(target?: HTMLDivElement): {
11
+ destroy(): void;
12
+ };
7
13
  /**
8
14
  * Example: Streaming data (real-time)
9
15
  */
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export { EventEmitter } from './core/EventEmitter';
18
18
  export type { Chart, ChartOptions, ExportOptions } from './core/Chart';
19
19
  export { AnimationEngine, easings, DEFAULT_ANIMATION_CONFIG, mergeAnimationConfig, getSharedAnimationEngine, } from './core/animation';
20
20
  export type { AnimationOptions, AnimationHandle, BoundsAnimation, ChartAnimationConfig, EasingFunction, EasingName, } from './core/animation';
21
+ export { ChartInitQueue, getChartInitQueue, queueChartInit, waitForAnimations, resetChartQueue, } from './core/ChartInitQueue';
21
22
  export { AnnotationManager } from './core/annotations';
22
23
  export type { Annotation, AnnotationType, HorizontalLineAnnotation, VerticalLineAnnotation, RectangleAnnotation, BandAnnotation, TextAnnotation, ArrowAnnotation, } from './core/annotations';
23
24
  export type { AxisOptions, SeriesOptions, SeriesData, SeriesStyle, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Point, Bounds, Range, ScaleType, SeriesType, StepMode, ErrorBarStyle, ErrorBarDirection, ScatterSymbol, } from './types';