scichart-engine 1.1.1 → 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';
@@ -1,10 +1,12 @@
1
1
  import { ChartTheme } from '../theme';
2
+ import { InteractionMode } from './InteractionManager';
2
3
 
3
4
  export interface ChartControlsCallbacks {
4
5
  onResetZoom: () => void;
5
6
  onSetType: (type: "line" | "scatter" | "line+scatter") => void;
6
7
  onToggleSmoothing: () => void;
7
8
  onTogglePan: (active: boolean) => void;
9
+ onSetMode: (mode: InteractionMode) => void;
8
10
  onExport: () => void;
9
11
  onAutoScale: () => void;
10
12
  onToggleLegend: (visible: boolean) => void;
@@ -15,7 +17,7 @@ export declare class ChartControls {
15
17
  private callbacks;
16
18
  private theme;
17
19
  private isSmoothing;
18
- private isPanMode;
20
+ private currentMode;
19
21
  private isLegendVisible;
20
22
  private currentType;
21
23
  constructor(parent: HTMLElement, theme: ChartTheme, callbacks: ChartControlsCallbacks);
@@ -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;
@@ -25,6 +25,10 @@ export interface InteractionCallbacks {
25
25
  } | null, additive: boolean) => void;
26
26
  onBoxSelectUpdate?: (pixelX: number, pixelY: number) => void;
27
27
  onBoxSelectStart?: (pixelX: number, pixelY: number) => void;
28
+ /** Called when any drag operation starts (pan, box zoom, box select) */
29
+ onDragStart?: () => void;
30
+ /** Called when any drag operation ends */
31
+ onDragEnd?: () => void;
28
32
  }
29
33
  export interface PlotAreaGetter {
30
34
  (): {
@@ -40,6 +44,7 @@ export interface BoundsGetter {
40
44
  export interface AxisLayoutGetter {
41
45
  (): AxisLayout[];
42
46
  }
47
+ export type InteractionMode = 'pan' | 'boxZoom' | 'select';
43
48
  export declare class InteractionManager {
44
49
  private container;
45
50
  private callbacks;
@@ -49,9 +54,10 @@ export declare class InteractionManager {
49
54
  private isDragging;
50
55
  private panningAxisId?;
51
56
  private isBoxSelecting;
57
+ private isBoxZooming;
52
58
  private selectionStart;
53
59
  private lastMousePos;
54
- private isPanMode;
60
+ private mode;
55
61
  private boundWheel;
56
62
  private boundMouseDown;
57
63
  private boundMouseMove;
@@ -63,7 +69,19 @@ export declare class InteractionManager {
63
69
  constructor(container: HTMLElement, callbacks: InteractionCallbacks, getPlotArea: PlotAreaGetter, getBounds: BoundsGetter, getAxesLayout: AxisLayoutGetter);
64
70
  private attachListeners;
65
71
  private detachListeners;
72
+ /**
73
+ * Set the interaction mode
74
+ * @deprecated Use setMode instead
75
+ */
66
76
  setPanMode(enabled: boolean): void;
77
+ /**
78
+ * Set the interaction mode: 'pan', 'boxZoom', or 'select'
79
+ */
80
+ setMode(mode: InteractionMode): void;
81
+ /**
82
+ * Get the current interaction mode
83
+ */
84
+ getMode(): InteractionMode;
67
85
  private handleWheel;
68
86
  private handleMouseDown;
69
87
  private handleMouseMove;
@@ -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;
@@ -177,8 +196,18 @@ export declare class ChartImpl implements Chart {
177
196
  configureSelection(config: Partial<SelectionConfig>): void;
178
197
  /**
179
198
  * Set pan mode (true = pan, false = selection)
199
+ * @deprecated Use setMode('pan') or setMode('select') instead
180
200
  */
181
201
  setPanMode(enabled: boolean): void;
202
+ /**
203
+ * Set the interaction mode
204
+ * @param mode - 'pan' for pan/drag, 'boxZoom' for rectangle zoom, 'select' for point selection
205
+ */
206
+ setMode(mode: 'pan' | 'boxZoom' | 'select'): void;
207
+ /**
208
+ * Get the current interaction mode
209
+ */
210
+ getMode(): 'pan' | 'boxZoom' | 'select';
182
211
  /**
183
212
  * Handle responsive state changes
184
213
  */
@@ -219,8 +248,13 @@ export declare class ChartImpl implements Chart {
219
248
  private pixelToDataX;
220
249
  private pixelToDataY;
221
250
  private startRenderLoop;
251
+ private scheduleRenderFrame;
222
252
  on<K extends keyof ChartEventMap>(e: K, h: (d: ChartEventMap[K]) => void): void;
223
253
  off<K extends keyof ChartEventMap>(e: K, h: (d: ChartEventMap[K]) => void): void;
224
254
  destroy(): void;
225
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
+ */
226
260
  export declare function createChart(options: ChartOptions): Chart;
@@ -3,6 +3,7 @@ import { ChartLegend } from '../ChartLegend';
3
3
  import { ChartTheme } from '../../theme';
4
4
  import { ChartOptions } from '../../types';
5
5
  import { Series } from '../Series';
6
+ import { InteractionMode } from '../InteractionManager';
6
7
 
7
8
  export interface UIContext {
8
9
  container: HTMLDivElement;
@@ -15,6 +16,7 @@ export interface UIContext {
15
16
  requestRender: () => void;
16
17
  exportImage: () => string;
17
18
  setPanMode: (active: boolean) => void;
19
+ setMode: (mode: InteractionMode) => void;
18
20
  onLegendMove: (x: number, y: number) => void;
19
21
  toggleLegend: () => void;
20
22
  }
@@ -89,8 +89,20 @@ export interface Chart {
89
89
  getSelectionCount(): number;
90
90
  /** Configure selection behavior */
91
91
  configureSelection(config: Partial<import('../selection').SelectionConfig>): void;
92
- /** Set pan mode (true = pan, false = selection) */
92
+ /**
93
+ * Set pan mode (true = pan, false = selection)
94
+ * @deprecated Use setMode('pan') or setMode('select') instead
95
+ */
93
96
  setPanMode(enabled: boolean): void;
97
+ /**
98
+ * Set the interaction mode
99
+ * @param mode - 'pan' for pan/drag, 'boxZoom' for rectangle zoom, 'select' for point selection
100
+ */
101
+ setMode(mode: 'pan' | 'boxZoom' | 'select'): void;
102
+ /**
103
+ * Get the current interaction mode
104
+ */
105
+ getMode(): 'pan' | 'boxZoom' | 'select';
94
106
  /** Get current responsive state */
95
107
  getResponsiveState(): import('../responsive').ResponsiveState;
96
108
  /** Configure responsive behavior */
@@ -5,7 +5,7 @@ export { createChart, type Chart, type ChartOptions, type ExportOptions } from '
5
5
  export { Series } from './Series';
6
6
  export { EventEmitter } from './EventEmitter';
7
7
  export { OverlayRenderer } from './OverlayRenderer';
8
- export { InteractionManager } from './InteractionManager';
8
+ export { InteractionManager, type InteractionMode } from './InteractionManager';
9
9
  export * from './annotations';
10
10
  export * from './selection';
11
11
  export * from './responsive';
@@ -53,6 +53,7 @@ export declare class TooltipManager {
53
53
  private largeDatasetThreshold;
54
54
  private lastKnownDataSize;
55
55
  private hysteresisRatio;
56
+ private suspended;
56
57
  constructor(config: TooltipManagerConfig);
57
58
  /**
58
59
  * Register built-in templates
@@ -74,6 +75,15 @@ export declare class TooltipManager {
74
75
  * Check if tooltips are enabled
75
76
  */
76
77
  isEnabled(): boolean;
78
+ /**
79
+ * Suspend tooltip display (used during drag operations)
80
+ * When suspended, tooltips are immediately hidden and cursor movements are ignored
81
+ */
82
+ setSuspended(suspended: boolean): void;
83
+ /**
84
+ * Check if tooltips are suspended
85
+ */
86
+ isSuspended(): boolean;
77
87
  /**
78
88
  * Set tooltip theme
79
89
  */
@@ -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';