scichart-engine 1.2.0 → 1.4.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/dist/analysis/index.d.ts +2 -0
- package/dist/analysis/indicators.d.ts +148 -0
- package/dist/core/InteractionManager.d.ts +1 -1
- package/dist/core/chart/ChartCore.d.ts +15 -3
- package/dist/core/chart/types.d.ts +10 -2
- package/dist/core/clipboard/index.d.ts +137 -0
- package/dist/core/debug/index.d.ts +143 -0
- package/dist/core/delta-tool/index.d.ts +146 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/keybindings/index.d.ts +157 -0
- package/dist/core/loading/index.d.ts +104 -0
- package/dist/core/locale/index.d.ts +91 -0
- package/dist/core/peak-tool/index.d.ts +146 -0
- package/dist/core/sync/index.d.ts +147 -0
- package/dist/core/theme-editor/index.d.ts +122 -0
- package/dist/index.d.ts +10 -0
- package/dist/scichart-engine.es.js +6208 -2729
- package/dist/scichart-engine.es.js.map +1 -1
- package/dist/scichart-engine.umd.js +180 -37
- package/dist/scichart-engine.umd.js.map +1 -1
- package/dist/streaming/backpressure.d.ts +179 -0
- package/dist/testing/index.d.ts +225 -0
- package/dist/types.d.ts +84 -0
- package/package.json +1 -1
package/dist/analysis/index.d.ts
CHANGED
|
@@ -16,3 +16,5 @@ export { lowPassFilter, highPassFilter, bandPassFilter, bandStopFilter, butterwo
|
|
|
16
16
|
export type { FilterType, FilterOptions, ButterworthOptions, } from './filters';
|
|
17
17
|
export { crossCorrelation, autoCorrelation, detectAnomalies, trapezoidalIntegration, simpsonsIntegration, cumulativeIntegration as cumulativeIntegral2, tTest, } from './statistics';
|
|
18
18
|
export type { CorrelationResult, AnomalyResult, AnomalyOptions, TTestResult, } from './statistics';
|
|
19
|
+
export { sma, ema, wma, dema, tema, rsi, macd, stochastic, roc, momentum, bollingerBands, atr, standardDeviation, vwap, obv, adx, aroon, percentChange, cumsum, normalize, } from './indicators';
|
|
20
|
+
export type { IndicatorResult, OHLCData, } from './indicators';
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SciChart Engine - Financial/Technical Indicators Module
|
|
3
|
+
*
|
|
4
|
+
* Provides common financial and technical analysis indicators:
|
|
5
|
+
* - Moving Averages (SMA, EMA, WMA)
|
|
6
|
+
* - Momentum Indicators (RSI, MACD, Stochastic)
|
|
7
|
+
* - Volatility (Bollinger Bands, ATR)
|
|
8
|
+
* - Volume (VWAP, OBV)
|
|
9
|
+
* - Trend (ADX, Aroon)
|
|
10
|
+
*
|
|
11
|
+
* @module indicators
|
|
12
|
+
*/
|
|
13
|
+
export interface IndicatorResult {
|
|
14
|
+
/** Indicator values (NaN for insufficient data) */
|
|
15
|
+
values: Float32Array;
|
|
16
|
+
/** Additional line (e.g., signal line for MACD) */
|
|
17
|
+
signal?: Float32Array;
|
|
18
|
+
/** Upper band (e.g., Bollinger upper) */
|
|
19
|
+
upper?: Float32Array;
|
|
20
|
+
/** Lower band (e.g., Bollinger lower) */
|
|
21
|
+
lower?: Float32Array;
|
|
22
|
+
/** Histogram (e.g., MACD histogram) */
|
|
23
|
+
histogram?: Float32Array;
|
|
24
|
+
}
|
|
25
|
+
export interface OHLCData {
|
|
26
|
+
open: Float32Array | Float64Array;
|
|
27
|
+
high: Float32Array | Float64Array;
|
|
28
|
+
low: Float32Array | Float64Array;
|
|
29
|
+
close: Float32Array | Float64Array;
|
|
30
|
+
volume?: Float32Array | Float64Array;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Simple Moving Average (SMA)
|
|
34
|
+
* @param data Input data array
|
|
35
|
+
* @param period Number of periods
|
|
36
|
+
*/
|
|
37
|
+
export declare function sma(data: Float32Array | Float64Array | number[], period: number): Float32Array;
|
|
38
|
+
/**
|
|
39
|
+
* Exponential Moving Average (EMA)
|
|
40
|
+
* @param data Input data array
|
|
41
|
+
* @param period Number of periods
|
|
42
|
+
*/
|
|
43
|
+
export declare function ema(data: Float32Array | Float64Array | number[], period: number): Float32Array;
|
|
44
|
+
/**
|
|
45
|
+
* Weighted Moving Average (WMA)
|
|
46
|
+
* @param data Input data array
|
|
47
|
+
* @param period Number of periods
|
|
48
|
+
*/
|
|
49
|
+
export declare function wma(data: Float32Array | Float64Array | number[], period: number): Float32Array;
|
|
50
|
+
/**
|
|
51
|
+
* Double Exponential Moving Average (DEMA)
|
|
52
|
+
* @param data Input data array
|
|
53
|
+
* @param period Number of periods
|
|
54
|
+
*/
|
|
55
|
+
export declare function dema(data: Float32Array | Float64Array | number[], period: number): Float32Array;
|
|
56
|
+
/**
|
|
57
|
+
* Triple Exponential Moving Average (TEMA)
|
|
58
|
+
* @param data Input data array
|
|
59
|
+
* @param period Number of periods
|
|
60
|
+
*/
|
|
61
|
+
export declare function tema(data: Float32Array | Float64Array | number[], period: number): Float32Array;
|
|
62
|
+
/**
|
|
63
|
+
* Relative Strength Index (RSI)
|
|
64
|
+
* @param data Close prices
|
|
65
|
+
* @param period RSI period (default: 14)
|
|
66
|
+
*/
|
|
67
|
+
export declare function rsi(data: Float32Array | Float64Array | number[], period?: number): Float32Array;
|
|
68
|
+
/**
|
|
69
|
+
* Moving Average Convergence Divergence (MACD)
|
|
70
|
+
* @param data Close prices
|
|
71
|
+
* @param fastPeriod Fast EMA period (default: 12)
|
|
72
|
+
* @param slowPeriod Slow EMA period (default: 26)
|
|
73
|
+
* @param signalPeriod Signal line period (default: 9)
|
|
74
|
+
*/
|
|
75
|
+
export declare function macd(data: Float32Array | Float64Array | number[], fastPeriod?: number, slowPeriod?: number, signalPeriod?: number): IndicatorResult;
|
|
76
|
+
/**
|
|
77
|
+
* Stochastic Oscillator
|
|
78
|
+
* @param ohlc OHLC data
|
|
79
|
+
* @param kPeriod %K period (default: 14)
|
|
80
|
+
* @param dPeriod %D smoothing period (default: 3)
|
|
81
|
+
*/
|
|
82
|
+
export declare function stochastic(ohlc: OHLCData, kPeriod?: number, dPeriod?: number): IndicatorResult;
|
|
83
|
+
/**
|
|
84
|
+
* Rate of Change (ROC)
|
|
85
|
+
* @param data Close prices
|
|
86
|
+
* @param period ROC period (default: 10)
|
|
87
|
+
*/
|
|
88
|
+
export declare function roc(data: Float32Array | Float64Array | number[], period?: number): Float32Array;
|
|
89
|
+
/**
|
|
90
|
+
* Momentum
|
|
91
|
+
* @param data Close prices
|
|
92
|
+
* @param period Momentum period (default: 10)
|
|
93
|
+
*/
|
|
94
|
+
export declare function momentum(data: Float32Array | Float64Array | number[], period?: number): Float32Array;
|
|
95
|
+
/**
|
|
96
|
+
* Bollinger Bands
|
|
97
|
+
* @param data Close prices
|
|
98
|
+
* @param period SMA period (default: 20)
|
|
99
|
+
* @param stdDev Standard deviation multiplier (default: 2)
|
|
100
|
+
*/
|
|
101
|
+
export declare function bollingerBands(data: Float32Array | Float64Array | number[], period?: number, stdDev?: number): IndicatorResult;
|
|
102
|
+
/**
|
|
103
|
+
* Average True Range (ATR)
|
|
104
|
+
* @param ohlc OHLC data
|
|
105
|
+
* @param period ATR period (default: 14)
|
|
106
|
+
*/
|
|
107
|
+
export declare function atr(ohlc: OHLCData, period?: number): Float32Array;
|
|
108
|
+
/**
|
|
109
|
+
* Standard Deviation
|
|
110
|
+
* @param data Input data
|
|
111
|
+
* @param period Period for calculation (default: 20)
|
|
112
|
+
*/
|
|
113
|
+
export declare function standardDeviation(data: Float32Array | Float64Array | number[], period?: number): Float32Array;
|
|
114
|
+
/**
|
|
115
|
+
* Volume Weighted Average Price (VWAP)
|
|
116
|
+
* @param ohlc OHLC data with volume
|
|
117
|
+
*/
|
|
118
|
+
export declare function vwap(ohlc: OHLCData): Float32Array;
|
|
119
|
+
/**
|
|
120
|
+
* On-Balance Volume (OBV)
|
|
121
|
+
* @param close Close prices
|
|
122
|
+
* @param volume Volume data
|
|
123
|
+
*/
|
|
124
|
+
export declare function obv(close: Float32Array | Float64Array | number[], volume: Float32Array | Float64Array | number[]): Float32Array;
|
|
125
|
+
/**
|
|
126
|
+
* Average Directional Index (ADX)
|
|
127
|
+
* @param ohlc OHLC data
|
|
128
|
+
* @param period ADX period (default: 14)
|
|
129
|
+
*/
|
|
130
|
+
export declare function adx(ohlc: OHLCData, period?: number): IndicatorResult;
|
|
131
|
+
/**
|
|
132
|
+
* Aroon Indicator
|
|
133
|
+
* @param ohlc OHLC data
|
|
134
|
+
* @param period Aroon period (default: 25)
|
|
135
|
+
*/
|
|
136
|
+
export declare function aroon(ohlc: OHLCData, period?: number): IndicatorResult;
|
|
137
|
+
/**
|
|
138
|
+
* Calculate percentage change
|
|
139
|
+
*/
|
|
140
|
+
export declare function percentChange(data: Float32Array | Float64Array | number[], period?: number): Float32Array;
|
|
141
|
+
/**
|
|
142
|
+
* Calculate cumulative sum
|
|
143
|
+
*/
|
|
144
|
+
export declare function cumsum(data: Float32Array | Float64Array | number[]): Float32Array;
|
|
145
|
+
/**
|
|
146
|
+
* Normalize data to 0-100 range
|
|
147
|
+
*/
|
|
148
|
+
export declare function normalize(data: Float32Array | Float64Array | number[]): Float32Array;
|
|
@@ -44,7 +44,7 @@ export interface BoundsGetter {
|
|
|
44
44
|
export interface AxisLayoutGetter {
|
|
45
45
|
(): AxisLayout[];
|
|
46
46
|
}
|
|
47
|
-
export type InteractionMode = 'pan' | 'boxZoom' | 'select';
|
|
47
|
+
export type InteractionMode = 'pan' | 'boxZoom' | 'select' | 'delta' | 'peak';
|
|
48
48
|
export declare class InteractionManager {
|
|
49
49
|
private container;
|
|
50
50
|
private callbacks;
|
|
@@ -9,6 +9,8 @@ import { ResponsiveConfig, ResponsiveState } from '../responsive';
|
|
|
9
9
|
import { ChartState, SerializeOptions, DeserializeOptions } from '../../serialization';
|
|
10
10
|
import { Chart, ExportOptions } from './types';
|
|
11
11
|
import { ChartAnimationConfig } from '../animation';
|
|
12
|
+
import { DeltaTool } from '../delta-tool';
|
|
13
|
+
import { PeakTool } from '../peak-tool';
|
|
12
14
|
|
|
13
15
|
import * as analysis from "../../analysis";
|
|
14
16
|
export declare class ChartImpl implements Chart {
|
|
@@ -59,6 +61,8 @@ export declare class ChartImpl implements Chart {
|
|
|
59
61
|
private animationConfig;
|
|
60
62
|
private selectionManager;
|
|
61
63
|
private responsiveManager;
|
|
64
|
+
private deltaTool;
|
|
65
|
+
private peakTool;
|
|
62
66
|
constructor(options: ChartOptions);
|
|
63
67
|
/**
|
|
64
68
|
* Start the chart initialization (called by queue system)
|
|
@@ -201,13 +205,21 @@ export declare class ChartImpl implements Chart {
|
|
|
201
205
|
setPanMode(enabled: boolean): void;
|
|
202
206
|
/**
|
|
203
207
|
* Set the interaction mode
|
|
204
|
-
* @param mode - 'pan' for pan/drag, 'boxZoom' for rectangle zoom, 'select' for point selection
|
|
208
|
+
* @param mode - 'pan' for pan/drag, 'boxZoom' for rectangle zoom, 'select' for point selection, 'delta' for measurements
|
|
205
209
|
*/
|
|
206
|
-
setMode(mode: 'pan' | 'boxZoom' | 'select'): void;
|
|
210
|
+
setMode(mode: 'pan' | 'boxZoom' | 'select' | 'delta' | 'peak'): void;
|
|
207
211
|
/**
|
|
208
212
|
* Get the current interaction mode
|
|
209
213
|
*/
|
|
210
|
-
getMode(): 'pan' | 'boxZoom' | 'select';
|
|
214
|
+
getMode(): 'pan' | 'boxZoom' | 'select' | 'delta' | 'peak';
|
|
215
|
+
/**
|
|
216
|
+
* Get the Delta Tool instance for advanced measurements
|
|
217
|
+
*/
|
|
218
|
+
getDeltaTool(): DeltaTool | null;
|
|
219
|
+
/**
|
|
220
|
+
* Get the Peak Tool instance for peak integration
|
|
221
|
+
*/
|
|
222
|
+
getPeakTool(): PeakTool | null;
|
|
211
223
|
/**
|
|
212
224
|
* Handle responsive state changes
|
|
213
225
|
*/
|
|
@@ -98,11 +98,19 @@ export interface Chart {
|
|
|
98
98
|
* Set the interaction mode
|
|
99
99
|
* @param mode - 'pan' for pan/drag, 'boxZoom' for rectangle zoom, 'select' for point selection
|
|
100
100
|
*/
|
|
101
|
-
setMode(mode: 'pan' | 'boxZoom' | 'select'): void;
|
|
101
|
+
setMode(mode: 'pan' | 'boxZoom' | 'select' | 'delta' | 'peak'): void;
|
|
102
102
|
/**
|
|
103
103
|
* Get the current interaction mode
|
|
104
104
|
*/
|
|
105
|
-
getMode(): 'pan' | 'boxZoom' | 'select';
|
|
105
|
+
getMode(): 'pan' | 'boxZoom' | 'select' | 'delta' | 'peak';
|
|
106
|
+
/**
|
|
107
|
+
* Get the Delta Tool instance for advanced measurements
|
|
108
|
+
*/
|
|
109
|
+
getDeltaTool(): import('../delta-tool').DeltaTool | null;
|
|
110
|
+
/**
|
|
111
|
+
* Get the Peak Tool instance for peak integration
|
|
112
|
+
*/
|
|
113
|
+
getPeakTool(): import('../peak-tool').PeakTool | null;
|
|
106
114
|
/** Get current responsive state */
|
|
107
115
|
getResponsiveState(): import('../responsive').ResponsiveState;
|
|
108
116
|
/** Configure responsive behavior */
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SciChart Engine - Clipboard Module
|
|
3
|
+
*
|
|
4
|
+
* Provides clipboard operations for copying chart data to various formats.
|
|
5
|
+
* Supports copying selected points, visible data, or all data.
|
|
6
|
+
*
|
|
7
|
+
* @module clipboard
|
|
8
|
+
*/
|
|
9
|
+
export type ClipboardFormat = 'tsv' | 'csv' | 'json' | 'markdown';
|
|
10
|
+
export interface ClipboardOptions {
|
|
11
|
+
/** Output format (default: 'tsv' - Excel compatible) */
|
|
12
|
+
format?: ClipboardFormat;
|
|
13
|
+
/** Include column headers (default: true) */
|
|
14
|
+
includeHeaders?: boolean;
|
|
15
|
+
/** Decimal precision (default: 6) */
|
|
16
|
+
precision?: number;
|
|
17
|
+
/** Use scientific notation for very large/small numbers (default: true) */
|
|
18
|
+
scientific?: boolean;
|
|
19
|
+
/** Scientific notation threshold (default: 1e6) */
|
|
20
|
+
scientificThreshold?: number;
|
|
21
|
+
/** Custom column separator (overrides format default) */
|
|
22
|
+
separator?: string;
|
|
23
|
+
/** Custom line separator (default: '\n') */
|
|
24
|
+
lineSeparator?: string;
|
|
25
|
+
/** Include series name in output (default: true for multi-series) */
|
|
26
|
+
includeSeriesName?: boolean;
|
|
27
|
+
/** Custom header names */
|
|
28
|
+
headers?: {
|
|
29
|
+
x?: string;
|
|
30
|
+
y?: string;
|
|
31
|
+
series?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface ClipboardDataPoint {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
seriesId?: string;
|
|
38
|
+
seriesName?: string;
|
|
39
|
+
index?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface ClipboardResult {
|
|
42
|
+
/** Whether the copy was successful */
|
|
43
|
+
success: boolean;
|
|
44
|
+
/** Number of points copied */
|
|
45
|
+
pointCount: number;
|
|
46
|
+
/** Number of series included */
|
|
47
|
+
seriesCount: number;
|
|
48
|
+
/** The formatted text that was copied */
|
|
49
|
+
text?: string;
|
|
50
|
+
/** Error message if failed */
|
|
51
|
+
error?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare class ClipboardManager {
|
|
54
|
+
private defaultOptions;
|
|
55
|
+
constructor(options?: Partial<ClipboardOptions>);
|
|
56
|
+
/**
|
|
57
|
+
* Copy data points to clipboard
|
|
58
|
+
*/
|
|
59
|
+
copyPoints(points: ClipboardDataPoint[], options?: Partial<ClipboardOptions>): Promise<ClipboardResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Copy series data to clipboard
|
|
62
|
+
*/
|
|
63
|
+
copySeries(seriesData: {
|
|
64
|
+
id: string;
|
|
65
|
+
name?: string;
|
|
66
|
+
x: Float32Array | Float64Array;
|
|
67
|
+
y: Float32Array | Float64Array;
|
|
68
|
+
}[], options?: Partial<ClipboardOptions>): Promise<ClipboardResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Format data points to string
|
|
71
|
+
*/
|
|
72
|
+
formatPoints(points: ClipboardDataPoint[], options: ClipboardOptions): string;
|
|
73
|
+
/**
|
|
74
|
+
* Format as delimited text (TSV/CSV)
|
|
75
|
+
*/
|
|
76
|
+
private formatAsDelimited;
|
|
77
|
+
/**
|
|
78
|
+
* Format as JSON
|
|
79
|
+
*/
|
|
80
|
+
private formatAsJson;
|
|
81
|
+
/**
|
|
82
|
+
* Format as Markdown table
|
|
83
|
+
*/
|
|
84
|
+
private formatAsMarkdown;
|
|
85
|
+
/**
|
|
86
|
+
* Format a number for output
|
|
87
|
+
*/
|
|
88
|
+
private formatNumber;
|
|
89
|
+
/**
|
|
90
|
+
* Round a number to specified precision
|
|
91
|
+
*/
|
|
92
|
+
private roundNumber;
|
|
93
|
+
/**
|
|
94
|
+
* Write text to system clipboard
|
|
95
|
+
*/
|
|
96
|
+
private writeToClipboard;
|
|
97
|
+
/**
|
|
98
|
+
* Fallback clipboard copy using hidden textarea
|
|
99
|
+
*/
|
|
100
|
+
private fallbackCopyToClipboard;
|
|
101
|
+
/**
|
|
102
|
+
* Read from clipboard (for paste functionality)
|
|
103
|
+
*/
|
|
104
|
+
readFromClipboard(): Promise<string | null>;
|
|
105
|
+
/**
|
|
106
|
+
* Parse clipboard text to data points
|
|
107
|
+
*/
|
|
108
|
+
parseClipboardData(text: string, format?: ClipboardFormat): ClipboardDataPoint[];
|
|
109
|
+
/**
|
|
110
|
+
* Detect format from text content
|
|
111
|
+
*/
|
|
112
|
+
private detectFormat;
|
|
113
|
+
/**
|
|
114
|
+
* Parse JSON data
|
|
115
|
+
*/
|
|
116
|
+
private parseJson;
|
|
117
|
+
/**
|
|
118
|
+
* Set default options
|
|
119
|
+
*/
|
|
120
|
+
setDefaults(options: Partial<ClipboardOptions>): void;
|
|
121
|
+
/**
|
|
122
|
+
* Get current default options
|
|
123
|
+
*/
|
|
124
|
+
getDefaults(): ClipboardOptions;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get the global clipboard manager instance
|
|
128
|
+
*/
|
|
129
|
+
export declare function getClipboardManager(): ClipboardManager;
|
|
130
|
+
/**
|
|
131
|
+
* Copy data points to clipboard (convenience function)
|
|
132
|
+
*/
|
|
133
|
+
export declare function copyToClipboard(points: ClipboardDataPoint[], options?: Partial<ClipboardOptions>): Promise<ClipboardResult>;
|
|
134
|
+
/**
|
|
135
|
+
* Format data as delimited string (without copying)
|
|
136
|
+
*/
|
|
137
|
+
export declare function formatData(points: ClipboardDataPoint[], options?: Partial<ClipboardOptions>): string;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SciChart Engine - Debug Overlay Module
|
|
3
|
+
*
|
|
4
|
+
* Provides a visual debug overlay showing performance metrics,
|
|
5
|
+
* rendering info, and chart state for development and debugging.
|
|
6
|
+
*
|
|
7
|
+
* @module debug
|
|
8
|
+
*/
|
|
9
|
+
export interface DebugStats {
|
|
10
|
+
/** Current frames per second */
|
|
11
|
+
fps: number;
|
|
12
|
+
/** Average frame time in ms */
|
|
13
|
+
frameTime: number;
|
|
14
|
+
/** Total number of points being rendered */
|
|
15
|
+
pointCount: number;
|
|
16
|
+
/** Number of visible series */
|
|
17
|
+
seriesCount: number;
|
|
18
|
+
/** Current view bounds */
|
|
19
|
+
viewBounds: {
|
|
20
|
+
xMin: number;
|
|
21
|
+
xMax: number;
|
|
22
|
+
yMin: number;
|
|
23
|
+
yMax: number;
|
|
24
|
+
};
|
|
25
|
+
/** WebGL/WebGPU renderer info */
|
|
26
|
+
rendererInfo: {
|
|
27
|
+
type: 'webgl' | 'webgpu' | 'unknown';
|
|
28
|
+
vendor?: string;
|
|
29
|
+
renderer?: string;
|
|
30
|
+
};
|
|
31
|
+
/** Memory usage estimate (bytes) */
|
|
32
|
+
memoryEstimate: number;
|
|
33
|
+
/** Number of draw calls per frame */
|
|
34
|
+
drawCalls: number;
|
|
35
|
+
/** Whether GPU downsampling is active */
|
|
36
|
+
downsamplingActive: boolean;
|
|
37
|
+
/** Device pixel ratio */
|
|
38
|
+
devicePixelRatio: number;
|
|
39
|
+
/** Canvas dimensions */
|
|
40
|
+
canvasSize: {
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
};
|
|
44
|
+
/** Plot area dimensions */
|
|
45
|
+
plotArea: {
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface DebugOverlayOptions {
|
|
53
|
+
/** Show FPS counter (default: true) */
|
|
54
|
+
showFps?: boolean;
|
|
55
|
+
/** Show point count (default: true) */
|
|
56
|
+
showPointCount?: boolean;
|
|
57
|
+
/** Show view bounds (default: true) */
|
|
58
|
+
showBounds?: boolean;
|
|
59
|
+
/** Show renderer info (default: true) */
|
|
60
|
+
showRendererInfo?: boolean;
|
|
61
|
+
/** Show memory estimate (default: true) */
|
|
62
|
+
showMemory?: boolean;
|
|
63
|
+
/** Show draw calls (default: true) */
|
|
64
|
+
showDrawCalls?: boolean;
|
|
65
|
+
/** Position: 'top-left', 'top-right', 'bottom-left', 'bottom-right' */
|
|
66
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
67
|
+
/** Background opacity (0-1, default: 0.8) */
|
|
68
|
+
opacity?: number;
|
|
69
|
+
/** Font size in pixels (default: 11) */
|
|
70
|
+
fontSize?: number;
|
|
71
|
+
/** Update interval in ms (default: 250) */
|
|
72
|
+
updateInterval?: number;
|
|
73
|
+
/** Custom CSS class name */
|
|
74
|
+
className?: string;
|
|
75
|
+
}
|
|
76
|
+
export declare class DebugOverlay {
|
|
77
|
+
private container;
|
|
78
|
+
private element;
|
|
79
|
+
private options;
|
|
80
|
+
private visible;
|
|
81
|
+
private updateIntervalId;
|
|
82
|
+
private statsProvider;
|
|
83
|
+
private lastStats;
|
|
84
|
+
private frameCount;
|
|
85
|
+
private lastFpsUpdate;
|
|
86
|
+
private currentFps;
|
|
87
|
+
private frameTimes;
|
|
88
|
+
constructor(container: HTMLElement, options?: DebugOverlayOptions);
|
|
89
|
+
/**
|
|
90
|
+
* Set the stats provider function
|
|
91
|
+
*/
|
|
92
|
+
setStatsProvider(provider: () => Partial<DebugStats>): void;
|
|
93
|
+
/**
|
|
94
|
+
* Record a frame for FPS calculation
|
|
95
|
+
*/
|
|
96
|
+
recordFrame(frameTime?: number): void;
|
|
97
|
+
/**
|
|
98
|
+
* Show the debug overlay
|
|
99
|
+
*/
|
|
100
|
+
show(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Hide the debug overlay
|
|
103
|
+
*/
|
|
104
|
+
hide(): void;
|
|
105
|
+
/**
|
|
106
|
+
* Toggle visibility
|
|
107
|
+
*/
|
|
108
|
+
toggle(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Check if visible
|
|
111
|
+
*/
|
|
112
|
+
isVisible(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Update the display with new stats
|
|
115
|
+
*/
|
|
116
|
+
update(stats?: Partial<DebugStats>): void;
|
|
117
|
+
/**
|
|
118
|
+
* Get current stats
|
|
119
|
+
*/
|
|
120
|
+
getStats(): Partial<DebugStats>;
|
|
121
|
+
/**
|
|
122
|
+
* Destroy the overlay
|
|
123
|
+
*/
|
|
124
|
+
destroy(): void;
|
|
125
|
+
private createElement;
|
|
126
|
+
private destroyElement;
|
|
127
|
+
private getPositionStyles;
|
|
128
|
+
private startUpdates;
|
|
129
|
+
private stopUpdates;
|
|
130
|
+
private getAverageFrameTime;
|
|
131
|
+
private renderStats;
|
|
132
|
+
private formatNumber;
|
|
133
|
+
private formatBytes;
|
|
134
|
+
private formatValue;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Create a debug overlay for a chart container
|
|
138
|
+
*/
|
|
139
|
+
export declare function createDebugOverlay(container: HTMLElement, options?: DebugOverlayOptions): DebugOverlay;
|
|
140
|
+
/**
|
|
141
|
+
* Quick enable debug mode (attaches to first chart container found)
|
|
142
|
+
*/
|
|
143
|
+
export declare function enableDebugMode(options?: DebugOverlayOptions): DebugOverlay | null;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { DeltaMeasurement, Bounds } from '../../types';
|
|
2
|
+
|
|
3
|
+
export interface DeltaToolOptions {
|
|
4
|
+
/** Line color for measurement (default: '#ff6b6b') */
|
|
5
|
+
lineColor?: string;
|
|
6
|
+
/** Line width in pixels (default: 2) */
|
|
7
|
+
lineWidth?: number;
|
|
8
|
+
/** Show labels at measurement points (default: true) */
|
|
9
|
+
showLabels?: boolean;
|
|
10
|
+
/** Label font size (default: 12) */
|
|
11
|
+
labelFontSize?: number;
|
|
12
|
+
/** Label background color (default: 'rgba(0,0,0,0.8)') */
|
|
13
|
+
labelBackground?: string;
|
|
14
|
+
/** Label text color (default: '#ffffff') */
|
|
15
|
+
labelColor?: string;
|
|
16
|
+
/** Show delta values inline (default: true) */
|
|
17
|
+
showDelta?: boolean;
|
|
18
|
+
/** Number precision for values (default: 4) */
|
|
19
|
+
precision?: number;
|
|
20
|
+
/** Show slope value (default: true) */
|
|
21
|
+
showSlope?: boolean;
|
|
22
|
+
/** Show distance value (default: true) */
|
|
23
|
+
showDistance?: boolean;
|
|
24
|
+
/** Custom CSS class for overlay elements */
|
|
25
|
+
className?: string;
|
|
26
|
+
/** Point highlight size when hovering (default: 10) */
|
|
27
|
+
highlightSize?: number;
|
|
28
|
+
/** Point highlight color (default: '#00f2ff') */
|
|
29
|
+
highlightColor?: string;
|
|
30
|
+
/** Snap radius in pixels for detecting nearby points (default: 20) */
|
|
31
|
+
snapRadius?: number;
|
|
32
|
+
}
|
|
33
|
+
/** Data point with series information */
|
|
34
|
+
export interface DataPoint {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
seriesId: string;
|
|
38
|
+
index: number;
|
|
39
|
+
pixelX: number;
|
|
40
|
+
pixelY: number;
|
|
41
|
+
}
|
|
42
|
+
export interface DeltaToolState {
|
|
43
|
+
/** Whether the tool is enabled */
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
/** Selection state: 'idle' | 'waitingSecond' | 'complete' */
|
|
46
|
+
selectionState: 'idle' | 'waitingSecond' | 'complete';
|
|
47
|
+
/** First selected point */
|
|
48
|
+
point1: DataPoint | null;
|
|
49
|
+
/** Second selected point */
|
|
50
|
+
point2: DataPoint | null;
|
|
51
|
+
/** Currently hovered point (for highlighting) */
|
|
52
|
+
hoveredPoint: DataPoint | null;
|
|
53
|
+
/** Last completed measurement */
|
|
54
|
+
lastMeasurement: DeltaMeasurement | null;
|
|
55
|
+
}
|
|
56
|
+
export interface SeriesData {
|
|
57
|
+
id: string;
|
|
58
|
+
x: Float32Array | Float64Array | number[];
|
|
59
|
+
y: Float32Array | Float64Array | number[];
|
|
60
|
+
}
|
|
61
|
+
export interface DeltaToolContext {
|
|
62
|
+
container: HTMLElement;
|
|
63
|
+
getPlotArea: () => {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
};
|
|
69
|
+
getViewBounds: () => Bounds;
|
|
70
|
+
requestRender: () => void;
|
|
71
|
+
getSeries?: () => SeriesData[];
|
|
72
|
+
onMeasure?: (measurement: DeltaMeasurement) => void;
|
|
73
|
+
}
|
|
74
|
+
export declare class DeltaTool {
|
|
75
|
+
private ctx;
|
|
76
|
+
private options;
|
|
77
|
+
private state;
|
|
78
|
+
private overlayCanvas;
|
|
79
|
+
private overlayCtx;
|
|
80
|
+
private labelOffset;
|
|
81
|
+
private isDraggingLabel;
|
|
82
|
+
private labelBounds;
|
|
83
|
+
private dragStart;
|
|
84
|
+
private boundMouseMove;
|
|
85
|
+
private boundClick;
|
|
86
|
+
private boundKeyDown;
|
|
87
|
+
private boundMouseDown;
|
|
88
|
+
private boundMouseUp;
|
|
89
|
+
private boundResize;
|
|
90
|
+
constructor(context: DeltaToolContext, options?: DeltaToolOptions);
|
|
91
|
+
/**
|
|
92
|
+
* Enable the delta measurement tool
|
|
93
|
+
*/
|
|
94
|
+
enable(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Disable the delta measurement tool
|
|
97
|
+
*/
|
|
98
|
+
disable(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Toggle the tool on/off
|
|
101
|
+
*/
|
|
102
|
+
toggle(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Check if tool is enabled
|
|
105
|
+
*/
|
|
106
|
+
isEnabled(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Get the current state
|
|
109
|
+
*/
|
|
110
|
+
getState(): DeltaToolState;
|
|
111
|
+
/**
|
|
112
|
+
* Get the last completed measurement
|
|
113
|
+
*/
|
|
114
|
+
getMeasurement(): DeltaMeasurement | null;
|
|
115
|
+
/**
|
|
116
|
+
* Clear the current measurement
|
|
117
|
+
*/
|
|
118
|
+
clear(): void;
|
|
119
|
+
/**
|
|
120
|
+
* Destroy the tool and cleanup
|
|
121
|
+
*/
|
|
122
|
+
destroy(): void;
|
|
123
|
+
private createOverlay;
|
|
124
|
+
private resizeOverlay;
|
|
125
|
+
private destroyOverlay;
|
|
126
|
+
private attachListeners;
|
|
127
|
+
private detachListeners;
|
|
128
|
+
private handleMouseMove;
|
|
129
|
+
private handleLabelMouseDown;
|
|
130
|
+
private handleLabelMouseUp;
|
|
131
|
+
private handleClick;
|
|
132
|
+
private handleKeyDown;
|
|
133
|
+
private findNearestPoint;
|
|
134
|
+
private calculateMeasurement;
|
|
135
|
+
private renderOverlay;
|
|
136
|
+
private drawPointTooltip;
|
|
137
|
+
private drawPointLabel;
|
|
138
|
+
private drawMeasurementLabel;
|
|
139
|
+
private drawStatusIndicator;
|
|
140
|
+
private roundRect;
|
|
141
|
+
private formatValue;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Create a delta tool for a chart context
|
|
145
|
+
*/
|
|
146
|
+
export declare function createDeltaTool(context: DeltaToolContext, options?: DeltaToolOptions): DeltaTool;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -9,3 +9,10 @@ export { InteractionManager, type InteractionMode } from './InteractionManager';
|
|
|
9
9
|
export * from './annotations';
|
|
10
10
|
export * from './selection';
|
|
11
11
|
export * from './responsive';
|
|
12
|
+
export * from './delta-tool';
|
|
13
|
+
export * from './loading';
|
|
14
|
+
export * from './locale';
|
|
15
|
+
export * from './keybindings';
|
|
16
|
+
export * from './debug';
|
|
17
|
+
export * from './clipboard';
|
|
18
|
+
export * from './sync';
|