@jigonzalez930209/scichart-engine 0.1.0 → 0.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.
- package/README.md +12 -10
- package/dist/analysis/fitting.d.ts +24 -0
- package/dist/analysis/index.d.ts +4 -1
- package/dist/analysis/math.d.ts +32 -0
- package/dist/analysis/utils.d.ts +9 -0
- package/dist/core/Chart.d.ts +14 -26
- package/dist/core/ChartControls.d.ts +2 -0
- package/dist/core/ChartLegend.d.ts +5 -0
- package/dist/core/ChartStatistics.d.ts +18 -0
- package/dist/core/InteractionManager.d.ts +14 -4
- package/dist/core/OverlayRenderer.d.ts +9 -1
- package/dist/core/Series.d.ts +23 -1
- 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 +155 -0
- package/dist/core/chart/ChartCore.d.ts +93 -0
- package/dist/core/chart/ChartExporter.d.ts +18 -0
- package/dist/core/chart/ChartNavigation.d.ts +55 -0
- package/dist/core/chart/ChartRenderer.d.ts +67 -0
- package/dist/core/chart/ChartSeries.d.ts +52 -0
- package/dist/core/chart/ChartSetup.d.ts +50 -0
- package/dist/core/chart/index.d.ts +13 -0
- package/dist/core/chart/types.d.ts +58 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/index.d.ts +4 -2
- package/dist/renderer/NativeWebGLRenderer.d.ts +42 -1
- package/dist/scichart-engine.es.js +2856 -1536
- package/dist/scichart-engine.es.js.map +1 -1
- package/dist/scichart-engine.umd.js +139 -28
- package/dist/scichart-engine.umd.js.map +1 -1
- package/dist/types.d.ts +65 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,11 +8,13 @@ A high-performance, WebGL-powered scientific charting engine built for precision
|
|
|
8
8
|
## ✨ Features
|
|
9
9
|
|
|
10
10
|
- **🚀 High Performance**: Render millions of data points with ease using a specialized raw WebGL renderer.
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
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, and Area charts.
|
|
13
|
+
- **↕️ Multi-Axis Engine**: Independent scales and units with axis-specific scrolling and zooming.
|
|
14
|
+
- **📏 Professional Tooling**: Real-time Statistics panel (Min/Max/Mean/Area), Annotations (Lines/Shapes/Text), and Data Export.
|
|
15
|
+
- **⚛️ Framework First**: Native React support via hooks and high-level components.
|
|
16
|
+
- **🎨 Dynamic Theming**: Sleek built-in themes (Light/Midnight) with support for custom CSS-based skins.
|
|
17
|
+
- **🏗️ Modular Core**: Built on a modern, decoupled architecture for maximum extendability.
|
|
16
18
|
|
|
17
19
|
## 🛠️ Installation
|
|
18
20
|
|
|
@@ -67,11 +69,11 @@ chart.addSeries({
|
|
|
67
69
|
|
|
68
70
|
## 📖 Documentation
|
|
69
71
|
|
|
70
|
-
Visit [
|
|
71
|
-
- [Getting Started Guide](https://scichart-engine
|
|
72
|
-
- [Core Concepts](https://scichart-engine
|
|
73
|
-
- [API Reference](https://scichart-engine
|
|
74
|
-
- [Interactive Examples](https://github.
|
|
72
|
+
Visit [SciChart Engine Docs](https://jigonzalez930209.github.io/scichart-engine/) for:
|
|
73
|
+
- [Getting Started Guide](https://jigonzalez930209.github.io/scichart-engine/guide/)
|
|
74
|
+
- [Core Concepts](https://jigonzalez930209.github.io/scichart-engine/guide/concepts)
|
|
75
|
+
- [API Reference](https://jigonzalez930209.github.io/scichart-engine/api/chart)
|
|
76
|
+
- [Interactive Examples](https://jigonzalez930209.github.io/scichart-engine/examples/)
|
|
75
77
|
|
|
76
78
|
## 📄 License
|
|
77
79
|
|
|
@@ -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;
|
package/dist/analysis/index.d.ts
CHANGED
|
@@ -4,5 +4,8 @@
|
|
|
4
4
|
* General-purpose utilities for data formatting, cycle detection,
|
|
5
5
|
* peak detection, and data validation.
|
|
6
6
|
*/
|
|
7
|
-
export { formatWithPrefix, formatValue, formatScientific, getBestPrefix, detectCycles, generateCycleColors, detectPeaks, validateData, calculateStats, movingAverage, downsampleLTTB, } from './utils';
|
|
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';
|
|
8
10
|
export type { CycleInfo, Peak, PrefixInfo, ValidationResult, DataStats, } from './utils';
|
|
11
|
+
export type { FitType, FitOptions, FitResult, } from './fitting';
|
|
@@ -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;
|
package/dist/analysis/utils.d.ts
CHANGED
|
@@ -138,4 +138,13 @@ export declare function downsampleLTTB(x: Float32Array | Float64Array, y: Float3
|
|
|
138
138
|
x: Float32Array;
|
|
139
139
|
y: Float32Array;
|
|
140
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;
|
|
141
150
|
export {};
|
package/dist/core/Chart.d.ts
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 };
|
|
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, autoScaleAll } from './chart/ChartNavigation';
|
|
12
|
+
export type { NavigationContext } from './chart/ChartNavigation';
|
|
13
|
+
export type { RenderContext } from './chart/ChartRenderer';
|
|
14
|
+
export type { ChartOptions } from '../types';
|
|
@@ -7,6 +7,7 @@ export interface ChartControlsCallbacks {
|
|
|
7
7
|
onTogglePan: (active: boolean) => void;
|
|
8
8
|
onExport: () => void;
|
|
9
9
|
onAutoScale: () => void;
|
|
10
|
+
onToggleLegend: (visible: boolean) => void;
|
|
10
11
|
}
|
|
11
12
|
export declare class ChartControls {
|
|
12
13
|
private container;
|
|
@@ -15,6 +16,7 @@ export declare class ChartControls {
|
|
|
15
16
|
private theme;
|
|
16
17
|
private isSmoothing;
|
|
17
18
|
private isPanMode;
|
|
19
|
+
private isLegendVisible;
|
|
18
20
|
private currentType;
|
|
19
21
|
constructor(parent: HTMLElement, theme: ChartTheme, callbacks: ChartControlsCallbacks);
|
|
20
22
|
private isDarkTheme;
|
|
@@ -24,7 +24,12 @@ export declare class ChartLegend {
|
|
|
24
24
|
private initDragging;
|
|
25
25
|
update(series: Series[]): void;
|
|
26
26
|
private render;
|
|
27
|
+
/**
|
|
28
|
+
* Internal symbol drawing logic (shared with canvas export)
|
|
29
|
+
*/
|
|
30
|
+
private drawSymbol;
|
|
27
31
|
draw(ctx: CanvasRenderingContext2D, dpr: number): void;
|
|
28
32
|
updateTheme(theme: ChartTheme): void;
|
|
33
|
+
setVisible(visible: boolean): void;
|
|
29
34
|
destroy(): void;
|
|
30
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
|
+
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Bounds } from '../types';
|
|
2
2
|
|
|
3
|
+
export interface AxisLayout {
|
|
4
|
+
id: string;
|
|
5
|
+
position: 'left' | 'right';
|
|
6
|
+
offset: number;
|
|
7
|
+
}
|
|
3
8
|
export interface InteractionCallbacks {
|
|
4
|
-
onZoom: (bounds: Bounds) => void;
|
|
5
|
-
onPan: (deltaX: number, deltaY: number) => void;
|
|
9
|
+
onZoom: (bounds: Bounds, axisId?: string) => void;
|
|
10
|
+
onPan: (deltaX: number, deltaY: number, axisId?: string) => void;
|
|
6
11
|
onBoxZoom: (rect: {
|
|
7
12
|
x: number;
|
|
8
13
|
y: number;
|
|
@@ -21,14 +26,19 @@ export interface PlotAreaGetter {
|
|
|
21
26
|
};
|
|
22
27
|
}
|
|
23
28
|
export interface BoundsGetter {
|
|
24
|
-
(): Bounds;
|
|
29
|
+
(axisId?: string): Bounds;
|
|
30
|
+
}
|
|
31
|
+
export interface AxisLayoutGetter {
|
|
32
|
+
(): AxisLayout[];
|
|
25
33
|
}
|
|
26
34
|
export declare class InteractionManager {
|
|
27
35
|
private container;
|
|
28
36
|
private callbacks;
|
|
29
37
|
private getPlotArea;
|
|
30
38
|
private getBounds;
|
|
39
|
+
private getAxesLayout;
|
|
31
40
|
private isDragging;
|
|
41
|
+
private panningAxisId?;
|
|
32
42
|
private isBoxSelecting;
|
|
33
43
|
private selectionStart;
|
|
34
44
|
private lastMousePos;
|
|
@@ -41,7 +51,7 @@ export declare class InteractionManager {
|
|
|
41
51
|
private boundTouchStart;
|
|
42
52
|
private boundTouchMove;
|
|
43
53
|
private boundTouchEnd;
|
|
44
|
-
constructor(container: HTMLElement, callbacks: InteractionCallbacks, getPlotArea: PlotAreaGetter, getBounds: BoundsGetter);
|
|
54
|
+
constructor(container: HTMLElement, callbacks: InteractionCallbacks, getPlotArea: PlotAreaGetter, getBounds: BoundsGetter, getAxesLayout: AxisLayoutGetter);
|
|
45
55
|
private attachListeners;
|
|
46
56
|
private detachListeners;
|
|
47
57
|
setPanMode(enabled: boolean): void;
|
|
@@ -42,7 +42,7 @@ export declare class OverlayRenderer {
|
|
|
42
42
|
/**
|
|
43
43
|
* Draw Y axis with ticks and labels
|
|
44
44
|
*/
|
|
45
|
-
drawYAxis(plotArea: PlotArea, yScale: Scale, label?: string): void;
|
|
45
|
+
drawYAxis(plotArea: PlotArea, yScale: Scale, label?: string, position?: "left" | "right", offset?: number): void;
|
|
46
46
|
/**
|
|
47
47
|
* Draw plot area border
|
|
48
48
|
*/
|
|
@@ -51,6 +51,10 @@ export declare class OverlayRenderer {
|
|
|
51
51
|
* Draw legend
|
|
52
52
|
*/
|
|
53
53
|
drawLegend(plotArea: PlotArea, series: Series[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Helper to draw a symbol in the legend
|
|
56
|
+
*/
|
|
57
|
+
private drawLegendSymbol;
|
|
54
58
|
/**
|
|
55
59
|
* Draw cursor/crosshair
|
|
56
60
|
*/
|
|
@@ -68,6 +72,10 @@ export declare class OverlayRenderer {
|
|
|
68
72
|
width: number;
|
|
69
73
|
height: number;
|
|
70
74
|
}): void;
|
|
75
|
+
/**
|
|
76
|
+
* Draw error bars for a series
|
|
77
|
+
*/
|
|
78
|
+
drawErrorBars(plotArea: PlotArea, series: Series, xScale: Scale, yScale: Scale): void;
|
|
71
79
|
private generateMinorTicks;
|
|
72
80
|
private formatXTick;
|
|
73
81
|
private formatYTick;
|
package/dist/core/Series.d.ts
CHANGED
|
@@ -3,10 +3,13 @@ import { SeriesOptions, SeriesData, SeriesStyle, SeriesUpdateData, Bounds, Serie
|
|
|
3
3
|
export declare class Series {
|
|
4
4
|
private id;
|
|
5
5
|
private type;
|
|
6
|
+
private yAxisId?;
|
|
6
7
|
private data;
|
|
7
8
|
private style;
|
|
8
9
|
private visible;
|
|
9
10
|
private cycle?;
|
|
11
|
+
private maxPoints?;
|
|
12
|
+
private lastAppendCount;
|
|
10
13
|
private cachedBounds;
|
|
11
14
|
private boundsNeedsUpdate;
|
|
12
15
|
private _needsBufferUpdate;
|
|
@@ -15,6 +18,8 @@ export declare class Series {
|
|
|
15
18
|
constructor(options: SeriesOptions);
|
|
16
19
|
getId(): string;
|
|
17
20
|
getType(): SeriesType;
|
|
21
|
+
getYAxisId(): string | undefined;
|
|
22
|
+
getVisible(): boolean;
|
|
18
23
|
getData(): SeriesData;
|
|
19
24
|
private getSmoothedData;
|
|
20
25
|
private applySmoothing;
|
|
@@ -22,6 +27,22 @@ export declare class Series {
|
|
|
22
27
|
isVisible(): boolean;
|
|
23
28
|
getCycle(): number | undefined;
|
|
24
29
|
getPointCount(): number;
|
|
30
|
+
getLastAppendCount(): number;
|
|
31
|
+
resetLastAppendCount(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Check if series has error bar data
|
|
34
|
+
*/
|
|
35
|
+
hasErrorData(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Get Y error values for a data point
|
|
38
|
+
* Returns [errorMinus, errorPlus] for the point at index i
|
|
39
|
+
*/
|
|
40
|
+
getYError(i: number): [number, number] | null;
|
|
41
|
+
/**
|
|
42
|
+
* Get X error values for a data point
|
|
43
|
+
* Returns [errorMinus, errorPlus] for the point at index i
|
|
44
|
+
*/
|
|
45
|
+
getXError(i: number): [number, number] | null;
|
|
25
46
|
getBounds(): Bounds | null;
|
|
26
47
|
private calculateBounds;
|
|
27
48
|
/**
|
|
@@ -34,11 +55,12 @@ export declare class Series {
|
|
|
34
55
|
/**
|
|
35
56
|
* Replace all data at once
|
|
36
57
|
*/
|
|
37
|
-
setData(x: Float32Array | Float64Array, y: Float32Array | Float64Array): void;
|
|
58
|
+
setData(x: Float32Array | Float64Array, y: Float32Array | Float64Array, y2?: Float32Array | Float64Array): void;
|
|
38
59
|
setStyle(style: Partial<SeriesStyle>): void;
|
|
39
60
|
get needsBufferUpdate(): boolean;
|
|
40
61
|
set needsBufferUpdate(val: boolean);
|
|
41
62
|
setVisible(visible: boolean): void;
|
|
42
63
|
setType(type: SeriesType): void;
|
|
64
|
+
setMaxPoints(maxPoints: number | undefined): void;
|
|
43
65
|
destroy(): void;
|
|
44
66
|
}
|
|
@@ -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';
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Annotation Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for all annotation types supported by SciChart Engine.
|
|
5
|
+
*/
|
|
6
|
+
export type AnnotationType = 'horizontal-line' | 'vertical-line' | 'rectangle' | 'band' | 'text' | 'arrow';
|
|
7
|
+
export interface BaseAnnotation {
|
|
8
|
+
/** Unique identifier (auto-generated if not provided) */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** Annotation type */
|
|
11
|
+
type: AnnotationType;
|
|
12
|
+
/** Visibility */
|
|
13
|
+
visible?: boolean;
|
|
14
|
+
/** Allow user interaction (dragging) */
|
|
15
|
+
interactive?: boolean;
|
|
16
|
+
/** Z-index for layering */
|
|
17
|
+
zIndex?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface HorizontalLineAnnotation extends BaseAnnotation {
|
|
20
|
+
type: 'horizontal-line';
|
|
21
|
+
/** Y value in data coordinates */
|
|
22
|
+
y: number;
|
|
23
|
+
/** Optional: limit line extent to X range */
|
|
24
|
+
xMin?: number;
|
|
25
|
+
xMax?: number;
|
|
26
|
+
/** Line color (hex or rgba) */
|
|
27
|
+
color?: string;
|
|
28
|
+
/** Line width in pixels */
|
|
29
|
+
lineWidth?: number;
|
|
30
|
+
/** Dash pattern [dash, gap] - empty for solid */
|
|
31
|
+
lineDash?: number[];
|
|
32
|
+
/** Label text */
|
|
33
|
+
label?: string;
|
|
34
|
+
/** Label position along the line */
|
|
35
|
+
labelPosition?: 'left' | 'right' | 'center';
|
|
36
|
+
/** Label background color */
|
|
37
|
+
labelBackground?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface VerticalLineAnnotation extends BaseAnnotation {
|
|
40
|
+
type: 'vertical-line';
|
|
41
|
+
/** X value in data coordinates */
|
|
42
|
+
x: number;
|
|
43
|
+
/** Optional: limit line extent to Y range */
|
|
44
|
+
yMin?: number;
|
|
45
|
+
yMax?: number;
|
|
46
|
+
/** Line color */
|
|
47
|
+
color?: string;
|
|
48
|
+
/** Line width in pixels */
|
|
49
|
+
lineWidth?: number;
|
|
50
|
+
/** Dash pattern */
|
|
51
|
+
lineDash?: number[];
|
|
52
|
+
/** Label text */
|
|
53
|
+
label?: string;
|
|
54
|
+
/** Label position */
|
|
55
|
+
labelPosition?: 'top' | 'bottom' | 'center';
|
|
56
|
+
/** Label background color */
|
|
57
|
+
labelBackground?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface RectangleAnnotation extends BaseAnnotation {
|
|
60
|
+
type: 'rectangle';
|
|
61
|
+
/** Rectangle bounds in data coordinates */
|
|
62
|
+
xMin: number;
|
|
63
|
+
xMax: number;
|
|
64
|
+
yMin: number;
|
|
65
|
+
yMax: number;
|
|
66
|
+
/** Fill color (use alpha for transparency) */
|
|
67
|
+
fillColor?: string;
|
|
68
|
+
/** Border color */
|
|
69
|
+
strokeColor?: string;
|
|
70
|
+
/** Border width */
|
|
71
|
+
strokeWidth?: number;
|
|
72
|
+
/** Border dash pattern */
|
|
73
|
+
strokeDash?: number[];
|
|
74
|
+
/** Label text */
|
|
75
|
+
label?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface BandAnnotation extends BaseAnnotation {
|
|
78
|
+
type: 'band';
|
|
79
|
+
/** Band bounds - vertical band if only x specified, horizontal if only y */
|
|
80
|
+
xMin?: number;
|
|
81
|
+
xMax?: number;
|
|
82
|
+
yMin?: number;
|
|
83
|
+
yMax?: number;
|
|
84
|
+
/** Fill color */
|
|
85
|
+
fillColor?: string;
|
|
86
|
+
/** Border color */
|
|
87
|
+
strokeColor?: string;
|
|
88
|
+
/** Border width */
|
|
89
|
+
strokeWidth?: number;
|
|
90
|
+
/** Label text */
|
|
91
|
+
label?: string;
|
|
92
|
+
/** Label position */
|
|
93
|
+
labelPosition?: 'center' | 'top' | 'bottom' | 'left' | 'right';
|
|
94
|
+
}
|
|
95
|
+
export interface TextAnnotation extends BaseAnnotation {
|
|
96
|
+
type: 'text';
|
|
97
|
+
/** Position in data coordinates */
|
|
98
|
+
x: number;
|
|
99
|
+
y: number;
|
|
100
|
+
/** Text content */
|
|
101
|
+
text: string;
|
|
102
|
+
/** Font size in pixels */
|
|
103
|
+
fontSize?: number;
|
|
104
|
+
/** Font family */
|
|
105
|
+
fontFamily?: string;
|
|
106
|
+
/** Font weight */
|
|
107
|
+
fontWeight?: 'normal' | 'bold';
|
|
108
|
+
/** Text color */
|
|
109
|
+
color?: string;
|
|
110
|
+
/** Background color */
|
|
111
|
+
backgroundColor?: string;
|
|
112
|
+
/** Background padding */
|
|
113
|
+
padding?: number;
|
|
114
|
+
/** Rotation in degrees */
|
|
115
|
+
rotation?: number;
|
|
116
|
+
/** Anchor point for positioning */
|
|
117
|
+
anchor?: 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center' | 'left-center' | 'right-center';
|
|
118
|
+
}
|
|
119
|
+
export interface ArrowAnnotation extends BaseAnnotation {
|
|
120
|
+
type: 'arrow';
|
|
121
|
+
/** Start point in data coordinates */
|
|
122
|
+
x1: number;
|
|
123
|
+
y1: number;
|
|
124
|
+
/** End point (arrow head) in data coordinates */
|
|
125
|
+
x2: number;
|
|
126
|
+
y2: number;
|
|
127
|
+
/** Line color */
|
|
128
|
+
color?: string;
|
|
129
|
+
/** Line width */
|
|
130
|
+
lineWidth?: number;
|
|
131
|
+
/** Arrow head size in pixels */
|
|
132
|
+
headSize?: number;
|
|
133
|
+
/** Arrow head style */
|
|
134
|
+
headStyle?: 'filled' | 'open' | 'none';
|
|
135
|
+
/** Show tail arrow */
|
|
136
|
+
showTail?: boolean;
|
|
137
|
+
/** Label text */
|
|
138
|
+
label?: string;
|
|
139
|
+
}
|
|
140
|
+
export type Annotation = HorizontalLineAnnotation | VerticalLineAnnotation | RectangleAnnotation | BandAnnotation | TextAnnotation | ArrowAnnotation;
|
|
141
|
+
export interface ResolvedAnnotation extends BaseAnnotation {
|
|
142
|
+
id: string;
|
|
143
|
+
}
|
|
144
|
+
export interface AnnotationEvent {
|
|
145
|
+
annotation: Annotation;
|
|
146
|
+
originalEvent?: MouseEvent;
|
|
147
|
+
}
|
|
148
|
+
export interface AnnotationDragEvent extends AnnotationEvent {
|
|
149
|
+
deltaX: number;
|
|
150
|
+
deltaY: number;
|
|
151
|
+
newPosition: {
|
|
152
|
+
x: number;
|
|
153
|
+
y: number;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ChartOptions, SeriesOptions, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Bounds } from '../../types';
|
|
2
|
+
import { FitType, FitOptions } from '../../analysis';
|
|
3
|
+
import { Series } from '../Series';
|
|
4
|
+
import { ChartTheme } from '../../theme';
|
|
5
|
+
import { Annotation } from '../annotations';
|
|
6
|
+
import { Chart, ExportOptions } from './types';
|
|
7
|
+
|
|
8
|
+
import * as analysis from "../../analysis";
|
|
9
|
+
export declare class ChartImpl implements Chart {
|
|
10
|
+
private container;
|
|
11
|
+
private webglCanvas;
|
|
12
|
+
private overlayCanvas;
|
|
13
|
+
private overlayCtx;
|
|
14
|
+
private series;
|
|
15
|
+
private events;
|
|
16
|
+
private viewBounds;
|
|
17
|
+
private xAxisOptions;
|
|
18
|
+
private yAxisOptionsMap;
|
|
19
|
+
private primaryYAxisId;
|
|
20
|
+
private dpr;
|
|
21
|
+
private backgroundColor;
|
|
22
|
+
private renderer;
|
|
23
|
+
private overlay;
|
|
24
|
+
private interaction;
|
|
25
|
+
private xScale;
|
|
26
|
+
private yScales;
|
|
27
|
+
private get yScale();
|
|
28
|
+
private theme;
|
|
29
|
+
private cursorOptions;
|
|
30
|
+
private cursorPosition;
|
|
31
|
+
private showLegend;
|
|
32
|
+
private legend;
|
|
33
|
+
private showControls;
|
|
34
|
+
private controls;
|
|
35
|
+
private animationFrameId;
|
|
36
|
+
private needsRender;
|
|
37
|
+
private isDestroyed;
|
|
38
|
+
private autoScroll;
|
|
39
|
+
private showStatistics;
|
|
40
|
+
private stats;
|
|
41
|
+
private selectionRect;
|
|
42
|
+
private annotationManager;
|
|
43
|
+
readonly analysis: typeof analysis;
|
|
44
|
+
constructor(options: ChartOptions);
|
|
45
|
+
private initControls;
|
|
46
|
+
private initLegend;
|
|
47
|
+
setTheme(theme: string | ChartTheme): void;
|
|
48
|
+
getPlotArea(): {
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
};
|
|
54
|
+
private getInteractedBounds;
|
|
55
|
+
exportImage(type?: "png" | "jpeg"): string;
|
|
56
|
+
private getSeriesContext;
|
|
57
|
+
addSeries(options: SeriesOptions): void;
|
|
58
|
+
removeSeries(id: string): void;
|
|
59
|
+
updateSeries(id: string, data: SeriesUpdateData): void;
|
|
60
|
+
appendData(id: string, x: number[] | Float32Array, y: number[] | Float32Array): void;
|
|
61
|
+
setAutoScroll(enabled: boolean): void;
|
|
62
|
+
setMaxPoints(id: string, maxPoints: number): void;
|
|
63
|
+
addFitLine(seriesId: string, type: FitType, options?: FitOptions): string;
|
|
64
|
+
getSeries(id: string): Series | undefined;
|
|
65
|
+
getAllSeries(): Series[];
|
|
66
|
+
private getNavContext;
|
|
67
|
+
zoom(options: ZoomOptions): void;
|
|
68
|
+
pan(deltaX: number, deltaY: number, axisId?: string): void;
|
|
69
|
+
resetZoom(): void;
|
|
70
|
+
getViewBounds(): Bounds;
|
|
71
|
+
autoScale(): void;
|
|
72
|
+
private handleBoxZoom;
|
|
73
|
+
enableCursor(options: CursorOptions): void;
|
|
74
|
+
disableCursor(): void;
|
|
75
|
+
addAnnotation(annotation: Annotation): string;
|
|
76
|
+
removeAnnotation(id: string): boolean;
|
|
77
|
+
updateAnnotation(id: string, updates: Partial<Annotation>): void;
|
|
78
|
+
getAnnotation(id: string): Annotation | undefined;
|
|
79
|
+
getAnnotations(): Annotation[];
|
|
80
|
+
clearAnnotations(): void;
|
|
81
|
+
exportCSV(options?: ExportOptions): string;
|
|
82
|
+
exportJSON(options?: ExportOptions): string;
|
|
83
|
+
resize(): void;
|
|
84
|
+
requestRender(): void;
|
|
85
|
+
render(): void;
|
|
86
|
+
private pixelToDataX;
|
|
87
|
+
private pixelToDataY;
|
|
88
|
+
private startRenderLoop;
|
|
89
|
+
on<K extends keyof ChartEventMap>(e: K, h: (d: ChartEventMap[K]) => void): void;
|
|
90
|
+
off<K extends keyof ChartEventMap>(e: K, h: (d: ChartEventMap[K]) => void): void;
|
|
91
|
+
destroy(): void;
|
|
92
|
+
}
|
|
93
|
+
export declare function createChart(options: ChartOptions): Chart;
|