scichart-engine 0.4.1
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 +81 -0
- package/dist/analysis/contours.d.ts +20 -0
- package/dist/analysis/fitting.d.ts +24 -0
- package/dist/analysis/index.d.ts +12 -0
- package/dist/analysis/math.d.ts +32 -0
- package/dist/analysis/utils.d.ts +150 -0
- package/dist/core/Chart.d.ts +15 -0
- package/dist/core/ChartControls.d.ts +30 -0
- package/dist/core/ChartLegend.d.ts +35 -0
- package/dist/core/ChartStatistics.d.ts +18 -0
- package/dist/core/EventEmitter.d.ts +30 -0
- package/dist/core/InteractionManager.d.ts +67 -0
- package/dist/core/OverlayRenderer.d.ts +67 -0
- package/dist/core/Series.d.ts +4 -0
- 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 +157 -0
- package/dist/core/chart/ChartCore.d.ts +103 -0
- package/dist/core/chart/ChartExporter.d.ts +18 -0
- package/dist/core/chart/ChartNavigation.d.ts +33 -0
- package/dist/core/chart/ChartRenderer.d.ts +53 -0
- package/dist/core/chart/ChartScaling.d.ts +26 -0
- package/dist/core/chart/ChartSeries.d.ts +4 -0
- package/dist/core/chart/ChartSetup.d.ts +64 -0
- package/dist/core/chart/ChartUI.d.ts +22 -0
- package/dist/core/chart/exporter/SVGExporter.d.ts +6 -0
- package/dist/core/chart/exporter/index.d.ts +5 -0
- package/dist/core/chart/index.d.ts +14 -0
- package/dist/core/chart/plugins/PluginManager.d.ts +13 -0
- package/dist/core/chart/plugins/types.d.ts +13 -0
- package/dist/core/chart/series/SeriesActions.d.ts +7 -0
- package/dist/core/chart/series/SeriesBuffer.d.ts +4 -0
- package/dist/core/chart/series/SeriesFit.d.ts +3 -0
- package/dist/core/chart/series/index.d.ts +7 -0
- package/dist/core/chart/series/types.d.ts +22 -0
- package/dist/core/chart/types.d.ts +72 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/series/Series.d.ts +52 -0
- package/dist/core/series/SeriesBounds.d.ts +3 -0
- package/dist/core/series/SeriesDataUtils.d.ts +7 -0
- package/dist/core/series/index.d.ts +6 -0
- package/dist/core/tooltip/TooltipManager.d.ts +203 -0
- package/dist/core/tooltip/TooltipPositioner.d.ts +83 -0
- package/dist/core/tooltip/TooltipRenderer.d.ts +64 -0
- package/dist/core/tooltip/index.d.ts +18 -0
- package/dist/core/tooltip/templates/AnnotationTemplate.d.ts +18 -0
- package/dist/core/tooltip/templates/CrosshairTemplate.d.ts +30 -0
- package/dist/core/tooltip/templates/DefaultTemplate.d.ts +30 -0
- package/dist/core/tooltip/templates/HeatmapTemplate.d.ts +34 -0
- package/dist/core/tooltip/templates/MinimalTemplate.d.ts +26 -0
- package/dist/core/tooltip/templates/RangeTemplate.d.ts +18 -0
- package/dist/core/tooltip/templates/ScientificTemplate.d.ts +34 -0
- package/dist/core/tooltip/templates/index.d.ts +27 -0
- package/dist/core/tooltip/themes.d.ts +48 -0
- package/dist/core/tooltip/types.d.ts +396 -0
- package/dist/examples.d.ts +19 -0
- package/dist/gpu/adapter/gpuRenderer.d.ts +135 -0
- package/dist/gpu/adapter/index.d.ts +7 -0
- package/dist/gpu/adapter/seriesAdapter.d.ts +88 -0
- package/dist/gpu/backends/webgl/WebGLBackend.d.ts +42 -0
- package/dist/gpu/backends/webgl/index.d.ts +5 -0
- package/dist/gpu/backends/webgl/programFactory.d.ts +30 -0
- package/dist/gpu/backends/webgl/shaders.d.ts +14 -0
- package/dist/gpu/backends/webgpu/MassiveDataRenderer.d.ts +111 -0
- package/dist/gpu/backends/webgpu/WebGPUBackend.d.ts +58 -0
- package/dist/gpu/backends/webgpu/pipelines/bandPipeline.d.ts +24 -0
- package/dist/gpu/backends/webgpu/pipelines/heatmapPipeline.d.ts +28 -0
- package/dist/gpu/backends/webgpu/pipelines/index.d.ts +10 -0
- package/dist/gpu/backends/webgpu/pipelines/instancedLinePipeline.d.ts +23 -0
- package/dist/gpu/backends/webgpu/pipelines/instancedPointPipeline.d.ts +25 -0
- package/dist/gpu/backends/webgpu/pipelines/linePipeline.d.ts +23 -0
- package/dist/gpu/backends/webgpu/pipelines/pointPipeline.d.ts +28 -0
- package/dist/gpu/backends/webgpu/pipelines/trianglePipeline.d.ts +5 -0
- package/dist/gpu/backends/webgpu/pipelines/triangleShader.d.ts +1 -0
- package/dist/gpu/backends/webgpu/shaders/heatmap.wgsl.d.ts +8 -0
- package/dist/gpu/backends/webgpu/shaders/index.d.ts +8 -0
- package/dist/gpu/backends/webgpu/shaders/instanced.wgsl.d.ts +16 -0
- package/dist/gpu/backends/webgpu/shaders/line.wgsl.d.ts +8 -0
- package/dist/gpu/backends/webgpu/shaders/point.wgsl.d.ts +9 -0
- package/dist/gpu/benchmark/benchmark.d.ts +74 -0
- package/dist/gpu/benchmark/index.d.ts +5 -0
- package/dist/gpu/compute/gpuCompute.d.ts +72 -0
- package/dist/gpu/compute/index.d.ts +6 -0
- package/dist/gpu/compute/shaders.d.ts +9 -0
- package/dist/gpu/drawList.d.ts +77 -0
- package/dist/gpu/examples/gallery.d.ts +20 -0
- package/dist/gpu/examples/index.d.ts +3 -0
- package/dist/gpu/examples/webgpu-line-demo.d.ts +8 -0
- package/dist/gpu/examples/webgpu-triangle.d.ts +1 -0
- package/dist/gpu/frame.d.ts +25 -0
- package/dist/gpu/index.d.ts +24 -0
- package/dist/gpu/resources/bufferStore.d.ts +40 -0
- package/dist/gpu/resources/index.d.ts +9 -0
- package/dist/gpu/resources/pipelineCache.d.ts +33 -0
- package/dist/gpu/resources/textureStore.d.ts +41 -0
- package/dist/gpu/types.d.ts +47 -0
- package/dist/index.d.ts +34 -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/BarRenderer.d.ts +14 -0
- package/dist/renderer/CandlestickRenderer.d.ts +12 -0
- package/dist/renderer/HeatmapRenderer.d.ts +15 -0
- package/dist/renderer/NativeWebGLRenderer.d.ts +16 -0
- package/dist/renderer/RendererInterface.d.ts +70 -0
- package/dist/renderer/WebGPURenderer.d.ts +16 -0
- package/dist/renderer/index.d.ts +10 -0
- package/dist/renderer/native/NativeWebGLRenderer.d.ts +30 -0
- package/dist/renderer/native/bufferStore.d.ts +11 -0
- package/dist/renderer/native/draw.d.ts +31 -0
- package/dist/renderer/native/programFactory.d.ts +3 -0
- package/dist/renderer/native/renderFrame.d.ts +3 -0
- package/dist/renderer/native/shaderSources.d.ts +6 -0
- package/dist/renderer/native/textureStore.d.ts +8 -0
- package/dist/renderer/native/types.d.ts +58 -0
- package/dist/renderer/native/utils.d.ts +4 -0
- package/dist/renderer/shaders.d.ts +77 -0
- package/dist/scales/index.d.ts +54 -0
- package/dist/scichart-engine.es.js +8408 -0
- package/dist/scichart-engine.es.js.map +1 -0
- package/dist/scichart-engine.umd.js +871 -0
- package/dist/scichart-engine.umd.js.map +1 -0
- package/dist/streaming/index.d.ts +7 -0
- package/dist/streaming/mock.d.ts +12 -0
- package/dist/streaming/types.d.ts +57 -0
- package/dist/streaming/utils.d.ts +19 -0
- package/dist/streaming/websocket.d.ts +6 -0
- package/dist/theme/index.d.ts +123 -0
- package/dist/types.d.ts +333 -0
- package/dist/workers/downsample.d.ts +34 -0
- package/dist/workers/downsample.worker.d.ts +46 -0
- package/package.json +59 -0
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
/** Tooltip text or configuration */
|
|
19
|
+
tooltip?: string | any;
|
|
20
|
+
}
|
|
21
|
+
export interface HorizontalLineAnnotation extends BaseAnnotation {
|
|
22
|
+
type: 'horizontal-line';
|
|
23
|
+
/** Y value in data coordinates */
|
|
24
|
+
y: number;
|
|
25
|
+
/** Optional: limit line extent to X range */
|
|
26
|
+
xMin?: number;
|
|
27
|
+
xMax?: number;
|
|
28
|
+
/** Line color (hex or rgba) */
|
|
29
|
+
color?: string;
|
|
30
|
+
/** Line width in pixels */
|
|
31
|
+
lineWidth?: number;
|
|
32
|
+
/** Dash pattern [dash, gap] - empty for solid */
|
|
33
|
+
lineDash?: number[];
|
|
34
|
+
/** Label text */
|
|
35
|
+
label?: string;
|
|
36
|
+
/** Label position along the line */
|
|
37
|
+
labelPosition?: 'left' | 'right' | 'center';
|
|
38
|
+
/** Label background color */
|
|
39
|
+
labelBackground?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface VerticalLineAnnotation extends BaseAnnotation {
|
|
42
|
+
type: 'vertical-line';
|
|
43
|
+
/** X value in data coordinates */
|
|
44
|
+
x: number;
|
|
45
|
+
/** Optional: limit line extent to Y range */
|
|
46
|
+
yMin?: number;
|
|
47
|
+
yMax?: number;
|
|
48
|
+
/** Line color */
|
|
49
|
+
color?: string;
|
|
50
|
+
/** Line width in pixels */
|
|
51
|
+
lineWidth?: number;
|
|
52
|
+
/** Dash pattern */
|
|
53
|
+
lineDash?: number[];
|
|
54
|
+
/** Label text */
|
|
55
|
+
label?: string;
|
|
56
|
+
/** Label position */
|
|
57
|
+
labelPosition?: 'top' | 'bottom' | 'center';
|
|
58
|
+
/** Label background color */
|
|
59
|
+
labelBackground?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface RectangleAnnotation extends BaseAnnotation {
|
|
62
|
+
type: 'rectangle';
|
|
63
|
+
/** Rectangle bounds in data coordinates */
|
|
64
|
+
xMin: number;
|
|
65
|
+
xMax: number;
|
|
66
|
+
yMin: number;
|
|
67
|
+
yMax: number;
|
|
68
|
+
/** Fill color (use alpha for transparency) */
|
|
69
|
+
fillColor?: string;
|
|
70
|
+
/** Border color */
|
|
71
|
+
strokeColor?: string;
|
|
72
|
+
/** Border width */
|
|
73
|
+
strokeWidth?: number;
|
|
74
|
+
/** Border dash pattern */
|
|
75
|
+
strokeDash?: number[];
|
|
76
|
+
/** Label text */
|
|
77
|
+
label?: string;
|
|
78
|
+
}
|
|
79
|
+
export interface BandAnnotation extends BaseAnnotation {
|
|
80
|
+
type: 'band';
|
|
81
|
+
/** Band bounds - vertical band if only x specified, horizontal if only y */
|
|
82
|
+
xMin?: number;
|
|
83
|
+
xMax?: number;
|
|
84
|
+
yMin?: number;
|
|
85
|
+
yMax?: number;
|
|
86
|
+
/** Fill color */
|
|
87
|
+
fillColor?: string;
|
|
88
|
+
/** Border color */
|
|
89
|
+
strokeColor?: string;
|
|
90
|
+
/** Border width */
|
|
91
|
+
strokeWidth?: number;
|
|
92
|
+
/** Label text */
|
|
93
|
+
label?: string;
|
|
94
|
+
/** Label position */
|
|
95
|
+
labelPosition?: 'center' | 'top' | 'bottom' | 'left' | 'right';
|
|
96
|
+
}
|
|
97
|
+
export interface TextAnnotation extends BaseAnnotation {
|
|
98
|
+
type: 'text';
|
|
99
|
+
/** Position in data coordinates */
|
|
100
|
+
x: number;
|
|
101
|
+
y: number;
|
|
102
|
+
/** Text content */
|
|
103
|
+
text: string;
|
|
104
|
+
/** Font size in pixels */
|
|
105
|
+
fontSize?: number;
|
|
106
|
+
/** Font family */
|
|
107
|
+
fontFamily?: string;
|
|
108
|
+
/** Font weight */
|
|
109
|
+
fontWeight?: 'normal' | 'bold';
|
|
110
|
+
/** Text color */
|
|
111
|
+
color?: string;
|
|
112
|
+
/** Background color */
|
|
113
|
+
backgroundColor?: string;
|
|
114
|
+
/** Background padding */
|
|
115
|
+
padding?: number;
|
|
116
|
+
/** Rotation in degrees */
|
|
117
|
+
rotation?: number;
|
|
118
|
+
/** Anchor point for positioning */
|
|
119
|
+
anchor?: 'center' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center' | 'left-center' | 'right-center';
|
|
120
|
+
}
|
|
121
|
+
export interface ArrowAnnotation extends BaseAnnotation {
|
|
122
|
+
type: 'arrow';
|
|
123
|
+
/** Start point in data coordinates */
|
|
124
|
+
x1: number;
|
|
125
|
+
y1: number;
|
|
126
|
+
/** End point (arrow head) in data coordinates */
|
|
127
|
+
x2: number;
|
|
128
|
+
y2: number;
|
|
129
|
+
/** Line color */
|
|
130
|
+
color?: string;
|
|
131
|
+
/** Line width */
|
|
132
|
+
lineWidth?: number;
|
|
133
|
+
/** Arrow head size in pixels */
|
|
134
|
+
headSize?: number;
|
|
135
|
+
/** Arrow head style */
|
|
136
|
+
headStyle?: 'filled' | 'open' | 'none';
|
|
137
|
+
/** Show tail arrow */
|
|
138
|
+
showTail?: boolean;
|
|
139
|
+
/** Label text */
|
|
140
|
+
label?: string;
|
|
141
|
+
}
|
|
142
|
+
export type Annotation = HorizontalLineAnnotation | VerticalLineAnnotation | RectangleAnnotation | BandAnnotation | TextAnnotation | ArrowAnnotation;
|
|
143
|
+
export interface ResolvedAnnotation extends BaseAnnotation {
|
|
144
|
+
id: string;
|
|
145
|
+
}
|
|
146
|
+
export interface AnnotationEvent {
|
|
147
|
+
annotation: Annotation;
|
|
148
|
+
originalEvent?: MouseEvent;
|
|
149
|
+
}
|
|
150
|
+
export interface AnnotationDragEvent extends AnnotationEvent {
|
|
151
|
+
deltaX: number;
|
|
152
|
+
deltaY: number;
|
|
153
|
+
newPosition: {
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ChartOptions, SeriesOptions, HeatmapOptions, 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 { TooltipManager } from '../tooltip';
|
|
7
|
+
import { Chart, ExportOptions } from './types';
|
|
8
|
+
|
|
9
|
+
import * as analysis from "../../analysis";
|
|
10
|
+
export declare class ChartImpl implements Chart {
|
|
11
|
+
private container;
|
|
12
|
+
private webglCanvas;
|
|
13
|
+
private overlayCanvas;
|
|
14
|
+
private overlayCtx;
|
|
15
|
+
private series;
|
|
16
|
+
private events;
|
|
17
|
+
private viewBounds;
|
|
18
|
+
private xAxisOptions;
|
|
19
|
+
private yAxisOptionsMap;
|
|
20
|
+
private primaryYAxisId;
|
|
21
|
+
private dpr;
|
|
22
|
+
private backgroundColor;
|
|
23
|
+
private renderer;
|
|
24
|
+
private overlay;
|
|
25
|
+
private interaction;
|
|
26
|
+
private xScale;
|
|
27
|
+
private yScales;
|
|
28
|
+
private get yScale();
|
|
29
|
+
private theme;
|
|
30
|
+
private cursorOptions;
|
|
31
|
+
private cursorPosition;
|
|
32
|
+
private showLegend;
|
|
33
|
+
private legend;
|
|
34
|
+
private showControls;
|
|
35
|
+
private controls;
|
|
36
|
+
private animationFrameId;
|
|
37
|
+
private needsFullRender;
|
|
38
|
+
private needsOverlayRender;
|
|
39
|
+
private isDestroyed;
|
|
40
|
+
private autoScroll;
|
|
41
|
+
private showStatistics;
|
|
42
|
+
private stats;
|
|
43
|
+
private selectionRect;
|
|
44
|
+
private annotationManager;
|
|
45
|
+
readonly tooltip: TooltipManager;
|
|
46
|
+
private pluginManager;
|
|
47
|
+
private initialOptions;
|
|
48
|
+
readonly analysis: typeof analysis;
|
|
49
|
+
constructor(options: ChartOptions);
|
|
50
|
+
private initControls;
|
|
51
|
+
private toggleLegend;
|
|
52
|
+
private initLegend;
|
|
53
|
+
setTheme(theme: string | ChartTheme): void;
|
|
54
|
+
getPlotArea(): {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
};
|
|
60
|
+
private getInteractedBounds;
|
|
61
|
+
exportImage(type?: "png" | "jpeg"): string;
|
|
62
|
+
private getSeriesContext;
|
|
63
|
+
addSeries(options: SeriesOptions | HeatmapOptions): void;
|
|
64
|
+
addBar(options: Omit<SeriesOptions, "type">): void;
|
|
65
|
+
addHeatmap(options: HeatmapOptions): void;
|
|
66
|
+
removeSeries(id: string): void;
|
|
67
|
+
updateSeries(id: string, data: SeriesUpdateData): void;
|
|
68
|
+
appendData(id: string, x: number[] | Float32Array, y: number[] | Float32Array): void;
|
|
69
|
+
setAutoScroll(enabled: boolean): void;
|
|
70
|
+
setMaxPoints(id: string, maxPoints: number): void;
|
|
71
|
+
addFitLine(seriesId: string, type: FitType, options?: FitOptions): string;
|
|
72
|
+
getSeries(id: string): Series | undefined;
|
|
73
|
+
getAllSeries(): Series[];
|
|
74
|
+
private getNavContext;
|
|
75
|
+
zoom(options: ZoomOptions): void;
|
|
76
|
+
pan(deltaX: number, deltaY: number, axisId?: string): void;
|
|
77
|
+
resetZoom(): void;
|
|
78
|
+
getViewBounds(): Bounds;
|
|
79
|
+
autoScale(): void;
|
|
80
|
+
private handleBoxZoom;
|
|
81
|
+
enableCursor(options: CursorOptions): void;
|
|
82
|
+
disableCursor(): void;
|
|
83
|
+
addAnnotation(annotation: Annotation): string;
|
|
84
|
+
removeAnnotation(id: string): boolean;
|
|
85
|
+
updateAnnotation(id: string, updates: Partial<Annotation>): void;
|
|
86
|
+
getAnnotation(id: string): Annotation | undefined;
|
|
87
|
+
getAnnotations(): Annotation[];
|
|
88
|
+
clearAnnotations(): void;
|
|
89
|
+
exportCSV(options?: ExportOptions): string;
|
|
90
|
+
exportJSON(options?: ExportOptions): string;
|
|
91
|
+
use(plugin: any): void;
|
|
92
|
+
resize(): void;
|
|
93
|
+
requestRender(): void;
|
|
94
|
+
requestOverlayRender(): void;
|
|
95
|
+
render(full?: boolean): void;
|
|
96
|
+
private pixelToDataX;
|
|
97
|
+
private pixelToDataY;
|
|
98
|
+
private startRenderLoop;
|
|
99
|
+
on<K extends keyof ChartEventMap>(e: K, h: (d: ChartEventMap[K]) => void): void;
|
|
100
|
+
off<K extends keyof ChartEventMap>(e: K, h: (d: ChartEventMap[K]) => void): void;
|
|
101
|
+
destroy(): void;
|
|
102
|
+
}
|
|
103
|
+
export declare function createChart(options: ChartOptions): Chart;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Series } from '../Series';
|
|
2
|
+
import { Bounds } from '../../types';
|
|
3
|
+
import { ExportOptions } from './types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Export series data to CSV format
|
|
7
|
+
*/
|
|
8
|
+
export declare function exportToCSV(series: Series[], options?: ExportOptions): string;
|
|
9
|
+
/**
|
|
10
|
+
* Export series data to JSON format
|
|
11
|
+
*/
|
|
12
|
+
export declare function exportToJSON(series: Series[], viewBounds: Bounds, options?: ExportOptions): string;
|
|
13
|
+
/**
|
|
14
|
+
* Export chart to image
|
|
15
|
+
*/
|
|
16
|
+
export declare function exportToImage(webglCanvas: HTMLCanvasElement, overlayCanvas: HTMLCanvasElement, backgroundColor: [number, number, number, number], legend: {
|
|
17
|
+
draw: (ctx: CanvasRenderingContext2D, dpr: number) => void;
|
|
18
|
+
} | null, showLegend: boolean, dpr: number, type?: "png" | "jpeg"): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Bounds, ZoomOptions, AxisOptions, ChartEventMap } from '../../types';
|
|
2
|
+
import { Scale } from '../../scales';
|
|
3
|
+
import { EventEmitter } from '../EventEmitter';
|
|
4
|
+
|
|
5
|
+
export interface NavigationContext {
|
|
6
|
+
viewBounds: Bounds;
|
|
7
|
+
yScales: Map<string, Scale>;
|
|
8
|
+
yAxisOptionsMap: Map<string, AxisOptions>;
|
|
9
|
+
xAxisOptions: AxisOptions;
|
|
10
|
+
primaryYAxisId: string;
|
|
11
|
+
getPlotArea: () => {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
events: EventEmitter<ChartEventMap>;
|
|
18
|
+
requestRender: () => void;
|
|
19
|
+
series: Map<string, {
|
|
20
|
+
isVisible(): boolean;
|
|
21
|
+
getBounds(): Bounds | null;
|
|
22
|
+
getYAxisId(): string | undefined;
|
|
23
|
+
getType(): string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Apply zoom to the chart
|
|
28
|
+
*/
|
|
29
|
+
export declare function applyZoom(ctx: NavigationContext, options: ZoomOptions): void;
|
|
30
|
+
/**
|
|
31
|
+
* Apply pan to the chart
|
|
32
|
+
*/
|
|
33
|
+
export declare function applyPan(ctx: NavigationContext, deltaX: number, deltaY: number, axisId?: string): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Bounds, CursorOptions, AxisOptions, PlotArea, ChartEventMap } from '../../types';
|
|
2
|
+
import { Series } from '../Series';
|
|
3
|
+
import { Scale } from '../../scales';
|
|
4
|
+
import { NativeWebGLRenderer, NativeSeriesRenderData as SeriesRenderData } from '../../renderer/NativeWebGLRenderer';
|
|
5
|
+
import { OverlayRenderer } from '../OverlayRenderer';
|
|
6
|
+
import { AnnotationManager } from '../annotations';
|
|
7
|
+
import { ChartStatistics } from '../ChartStatistics';
|
|
8
|
+
import { EventEmitter } from '../EventEmitter';
|
|
9
|
+
|
|
10
|
+
export interface RenderContext {
|
|
11
|
+
webglCanvas: HTMLCanvasElement;
|
|
12
|
+
overlayCanvas: HTMLCanvasElement;
|
|
13
|
+
overlayCtx: CanvasRenderingContext2D;
|
|
14
|
+
container: HTMLDivElement;
|
|
15
|
+
series: Map<string, Series>;
|
|
16
|
+
viewBounds: Bounds;
|
|
17
|
+
xScale: Scale;
|
|
18
|
+
yScales: Map<string, Scale>;
|
|
19
|
+
yAxisOptionsMap: Map<string, AxisOptions>;
|
|
20
|
+
xAxisOptions: AxisOptions;
|
|
21
|
+
primaryYAxisId: string;
|
|
22
|
+
renderer: NativeWebGLRenderer;
|
|
23
|
+
overlay: OverlayRenderer;
|
|
24
|
+
annotationManager: AnnotationManager;
|
|
25
|
+
backgroundColor: [number, number, number, number];
|
|
26
|
+
cursorOptions: CursorOptions | null;
|
|
27
|
+
cursorPosition: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
} | null;
|
|
31
|
+
selectionRect: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
} | null;
|
|
37
|
+
stats: ChartStatistics | null;
|
|
38
|
+
showStatistics: boolean;
|
|
39
|
+
events: EventEmitter<ChartEventMap>;
|
|
40
|
+
updateSeriesBuffer: (s: Series) => void;
|
|
41
|
+
getPlotArea: () => PlotArea;
|
|
42
|
+
pixelToDataX: (px: number) => number;
|
|
43
|
+
pixelToDataY: (py: number) => number;
|
|
44
|
+
tooltip: import('../tooltip').TooltipManager;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Prepare series data for WebGL rendering
|
|
48
|
+
*/
|
|
49
|
+
export declare function prepareSeriesData(ctx: RenderContext, plotArea: PlotArea): SeriesRenderData[];
|
|
50
|
+
/**
|
|
51
|
+
* Render overlay elements (axes, grid, annotations, etc.)
|
|
52
|
+
*/
|
|
53
|
+
export declare function renderOverlay(ctx: RenderContext, plotArea: PlotArea, primaryYScale: Scale): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NavigationContext } from './ChartNavigation';
|
|
2
|
+
import { ZoomOptions } from '../../types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Auto-scale all axes to fit data
|
|
6
|
+
*/
|
|
7
|
+
export declare function autoScaleAll(ctx: NavigationContext): void;
|
|
8
|
+
/**
|
|
9
|
+
* Handle box zoom selection
|
|
10
|
+
*/
|
|
11
|
+
export declare function handleBoxZoom(ctx: NavigationContext, selectionRect: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
} | null, currentRect: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
} | null, zoom: (options: ZoomOptions) => void): {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
} | null;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ChartOptions, AxisOptions } from '../../types';
|
|
2
|
+
import { Scale } from '../../scales';
|
|
3
|
+
import { ChartTheme } from '../../theme';
|
|
4
|
+
|
|
5
|
+
export interface SetupResult {
|
|
6
|
+
theme: ChartTheme;
|
|
7
|
+
backgroundColor: [number, number, number, number];
|
|
8
|
+
showLegend: boolean;
|
|
9
|
+
showControls: boolean;
|
|
10
|
+
autoScroll: boolean;
|
|
11
|
+
showStatistics: boolean;
|
|
12
|
+
dpr: number;
|
|
13
|
+
xAxisOptions: AxisOptions;
|
|
14
|
+
xScale: Scale;
|
|
15
|
+
yAxisOptionsMap: Map<string, AxisOptions>;
|
|
16
|
+
yScales: Map<string, Scale>;
|
|
17
|
+
primaryYAxisId: string;
|
|
18
|
+
webglCanvas: HTMLCanvasElement;
|
|
19
|
+
overlayCanvas: HTMLCanvasElement;
|
|
20
|
+
overlayCtx: CanvasRenderingContext2D;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Initialize chart configuration from options
|
|
24
|
+
*/
|
|
25
|
+
export declare function initializeChart(container: HTMLDivElement, options: ChartOptions): SetupResult;
|
|
26
|
+
/**
|
|
27
|
+
* Create a canvas element
|
|
28
|
+
*/
|
|
29
|
+
export declare function createCanvas(type: "webgl" | "overlay"): HTMLCanvasElement;
|
|
30
|
+
/**
|
|
31
|
+
* Calculate the plot area based on container size and margins
|
|
32
|
+
*/
|
|
33
|
+
export declare function getPlotArea(container: HTMLDivElement, yAxisOptionsMap: Map<string, AxisOptions>): {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Get axes layout for interaction manager
|
|
41
|
+
*/
|
|
42
|
+
export declare function getAxesLayout(yAxisOptionsMap: Map<string, AxisOptions>): Array<{
|
|
43
|
+
id: string;
|
|
44
|
+
position: 'left' | 'right';
|
|
45
|
+
offset: number;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Resize canvases to match container
|
|
49
|
+
*/
|
|
50
|
+
export declare function resizeCanvases(container: HTMLDivElement, webglCanvas: HTMLCanvasElement, overlayCanvas: HTMLCanvasElement, overlayCtx: CanvasRenderingContext2D, dpr: number): boolean;
|
|
51
|
+
export declare function pixelToDataX(px: number, plotArea: {
|
|
52
|
+
x: number;
|
|
53
|
+
width: number;
|
|
54
|
+
}, viewBounds: {
|
|
55
|
+
xMin: number;
|
|
56
|
+
xMax: number;
|
|
57
|
+
}): number;
|
|
58
|
+
export declare function pixelToDataY(py: number, plotArea: {
|
|
59
|
+
y: number;
|
|
60
|
+
height: number;
|
|
61
|
+
}, viewBounds: {
|
|
62
|
+
yMin: number;
|
|
63
|
+
yMax: number;
|
|
64
|
+
}): number;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ChartControls } from '../ChartControls';
|
|
2
|
+
import { ChartLegend } from '../ChartLegend';
|
|
3
|
+
import { ChartTheme } from '../../theme';
|
|
4
|
+
import { ChartOptions } from '../../types';
|
|
5
|
+
import { Series } from '../Series';
|
|
6
|
+
|
|
7
|
+
export interface UIContext {
|
|
8
|
+
container: HTMLDivElement;
|
|
9
|
+
theme: ChartTheme;
|
|
10
|
+
showControls: boolean;
|
|
11
|
+
showLegend: boolean;
|
|
12
|
+
series: Map<string, Series>;
|
|
13
|
+
autoScale: () => void;
|
|
14
|
+
resetZoom: () => void;
|
|
15
|
+
requestRender: () => void;
|
|
16
|
+
exportImage: () => string;
|
|
17
|
+
setPanMode: (active: boolean) => void;
|
|
18
|
+
onLegendMove: (x: number, y: number) => void;
|
|
19
|
+
toggleLegend: () => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function initControls(ctx: UIContext): ChartControls | null;
|
|
22
|
+
export declare function initLegend(ctx: UIContext, options: ChartOptions): ChartLegend | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Series } from '../../Series';
|
|
2
|
+
import { Bounds, PlotArea } from '../../../types';
|
|
3
|
+
import { Scale } from '../../../scales';
|
|
4
|
+
import { ChartTheme } from '../../../theme';
|
|
5
|
+
|
|
6
|
+
export declare function exportToSVG(series: Series[], _viewBounds: Bounds, plotArea: PlotArea, xAxis: Scale, yAxes: Map<string, Scale>, theme: ChartTheme, width: number, height: number): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart barrel export
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all chart submodules for clean imports.
|
|
5
|
+
*/
|
|
6
|
+
export type { Chart, ExportOptions } from './types';
|
|
7
|
+
export { MARGINS } from './types';
|
|
8
|
+
export { exportToCSV, exportToJSON, exportToImage } from './ChartExporter';
|
|
9
|
+
export { applyZoom, applyPan, } from './ChartNavigation';
|
|
10
|
+
export { autoScaleAll, handleBoxZoom } from './ChartScaling';
|
|
11
|
+
export type { NavigationContext } from './ChartNavigation';
|
|
12
|
+
export { prepareSeriesData, renderOverlay } from './ChartRenderer';
|
|
13
|
+
export type { RenderContext } from './ChartRenderer';
|
|
14
|
+
export { ChartImpl, createChart } from './ChartCore';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChartPlugin, PluginManager as IPluginManager } from './types';
|
|
2
|
+
import { Chart } from '../types';
|
|
3
|
+
|
|
4
|
+
export declare class PluginManagerImpl implements IPluginManager {
|
|
5
|
+
private plugins;
|
|
6
|
+
private chart;
|
|
7
|
+
constructor(chart: Chart);
|
|
8
|
+
use(plugin: ChartPlugin): void;
|
|
9
|
+
remove(name: string): boolean;
|
|
10
|
+
get(name: string): ChartPlugin | undefined;
|
|
11
|
+
notify(hook: keyof Omit<ChartPlugin, 'name' | 'init'>, ...args: any[]): void;
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Chart, ChartPlugin } from '../types';
|
|
2
|
+
|
|
3
|
+
export type { Chart, ChartPlugin };
|
|
4
|
+
export interface PluginManager {
|
|
5
|
+
/** Attach a plugin */
|
|
6
|
+
use(plugin: ChartPlugin): void;
|
|
7
|
+
/** Remove a plugin by name */
|
|
8
|
+
remove(name: string): boolean;
|
|
9
|
+
/** Get a plugin by name */
|
|
10
|
+
get(name: string): ChartPlugin | undefined;
|
|
11
|
+
/** Notify all plugins of an event */
|
|
12
|
+
notify(hook: keyof Omit<ChartPlugin, 'name' | 'init'>, ...args: any[]): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SeriesOptions, HeatmapOptions, SeriesUpdateData } from '../../../types';
|
|
2
|
+
|
|
3
|
+
export declare function addSeries(ctx: any, options: SeriesOptions | HeatmapOptions): void;
|
|
4
|
+
export declare function removeSeries(ctx: any, id: string): void;
|
|
5
|
+
export declare function updateSeries(ctx: any, id: string, data: SeriesUpdateData): void;
|
|
6
|
+
export declare function appendData(ctx: any, id: string, x: number[] | Float32Array, y: number[] | Float32Array): void;
|
|
7
|
+
export declare function setMaxPoints(ctx: any, id: string, maxPoints: number): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Series } from '../../Series';
|
|
2
|
+
import { NativeWebGLRenderer } from '../../../renderer';
|
|
3
|
+
import { Bounds } from '../../../types';
|
|
4
|
+
import { Annotation } from '../../annotations';
|
|
5
|
+
|
|
6
|
+
export interface SeriesManagerContext {
|
|
7
|
+
series: Map<string, Series>;
|
|
8
|
+
renderer: NativeWebGLRenderer;
|
|
9
|
+
viewBounds: Bounds;
|
|
10
|
+
autoScale: () => void;
|
|
11
|
+
requestRender: () => void;
|
|
12
|
+
addAnnotation: (annotation: Annotation) => string;
|
|
13
|
+
xAxisOptions: {
|
|
14
|
+
auto?: boolean;
|
|
15
|
+
};
|
|
16
|
+
yAxisOptionsMap: Map<string, {
|
|
17
|
+
auto?: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
autoScrollEnabled: boolean;
|
|
20
|
+
updateLegend?: () => void;
|
|
21
|
+
addSeries: (options: any) => void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { SeriesOptions, HeatmapOptions, SeriesUpdateData, ZoomOptions, CursorOptions, ChartEventMap, Bounds } from '../../types';
|
|
2
|
+
import { Series } from '../Series';
|
|
3
|
+
import { FitType, FitOptions } from '../../analysis';
|
|
4
|
+
import { Annotation } from '../annotations';
|
|
5
|
+
|
|
6
|
+
import * as analysis from "../../analysis";
|
|
7
|
+
export interface Chart {
|
|
8
|
+
addSeries(options: SeriesOptions | HeatmapOptions): void;
|
|
9
|
+
addBar(options: Omit<SeriesOptions, "type">): void;
|
|
10
|
+
addHeatmap(options: Omit<HeatmapOptions, "type">): void;
|
|
11
|
+
removeSeries(id: string): void;
|
|
12
|
+
updateSeries(id: string, data: SeriesUpdateData): void;
|
|
13
|
+
getSeries(id: string): Series | undefined;
|
|
14
|
+
getAllSeries(): Series[];
|
|
15
|
+
appendData(id: string, x: number[] | Float32Array, y: number[] | Float32Array): void;
|
|
16
|
+
setAutoScroll(enabled: boolean): void;
|
|
17
|
+
setMaxPoints(id: string, maxPoints: number): void;
|
|
18
|
+
addFitLine(seriesId: string, type: FitType, options?: FitOptions): string;
|
|
19
|
+
zoom(options: ZoomOptions): void;
|
|
20
|
+
pan(deltaX: number, deltaY: number): void;
|
|
21
|
+
resetZoom(): void;
|
|
22
|
+
getViewBounds(): Bounds;
|
|
23
|
+
enableCursor(options: CursorOptions): void;
|
|
24
|
+
disableCursor(): void;
|
|
25
|
+
resize(width?: number, height?: number): void;
|
|
26
|
+
render(): void;
|
|
27
|
+
on<K extends keyof ChartEventMap>(event: K, handler: (data: ChartEventMap[K]) => void): void;
|
|
28
|
+
off<K extends keyof ChartEventMap>(event: K, handler: (data: ChartEventMap[K]) => void): void;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
exportImage(type?: "png" | "jpeg"): string;
|
|
31
|
+
autoScale(): void;
|
|
32
|
+
setTheme(theme: string | object): void;
|
|
33
|
+
/** Access to data analysis utilities */
|
|
34
|
+
readonly analysis: typeof analysis;
|
|
35
|
+
addAnnotation(annotation: Annotation): string;
|
|
36
|
+
removeAnnotation(id: string): boolean;
|
|
37
|
+
updateAnnotation(id: string, updates: Partial<Annotation>): void;
|
|
38
|
+
getAnnotation(id: string): Annotation | undefined;
|
|
39
|
+
getAnnotations(): Annotation[];
|
|
40
|
+
clearAnnotations(): void;
|
|
41
|
+
exportCSV(options?: ExportOptions): string;
|
|
42
|
+
exportJSON(options?: ExportOptions): string;
|
|
43
|
+
/** Attach a plugin to extend chart functionality */
|
|
44
|
+
use(plugin: ChartPlugin): void;
|
|
45
|
+
/** Access to the tooltip system */
|
|
46
|
+
readonly tooltip: import('../tooltip').TooltipManager;
|
|
47
|
+
}
|
|
48
|
+
export interface ChartPlugin {
|
|
49
|
+
name: string;
|
|
50
|
+
init?: (chart: Chart) => void;
|
|
51
|
+
onBeforeRender?: (chart: Chart) => void;
|
|
52
|
+
onAfterRender?: (chart: Chart) => void;
|
|
53
|
+
onSeriesAdded?: (series: Series) => void;
|
|
54
|
+
destroy?: () => void;
|
|
55
|
+
}
|
|
56
|
+
/** Options for data export */
|
|
57
|
+
export interface ExportOptions {
|
|
58
|
+
/** Series IDs to export (default: all) */
|
|
59
|
+
seriesIds?: string[];
|
|
60
|
+
/** Include headers in CSV (default: true) */
|
|
61
|
+
includeHeaders?: boolean;
|
|
62
|
+
/** Decimal precision (default: 6) */
|
|
63
|
+
precision?: number;
|
|
64
|
+
/** CSV delimiter (default: ',') */
|
|
65
|
+
delimiter?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare const MARGINS: {
|
|
68
|
+
top: number;
|
|
69
|
+
right: number;
|
|
70
|
+
bottom: number;
|
|
71
|
+
left: number;
|
|
72
|
+
};
|