@rm-graph/core 0.1.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.
@@ -0,0 +1,556 @@
1
+ import { C as ChartConfig, a as ChartInstance, T as ThemeConfig, S as SeriesData, b as ChartEventMap, L as LineChartConfig, D as DataPoint, B as BarChartConfig, A as AreaChartConfig, H as HeatmapChartConfig, c as Surface3DChartConfig } from './index-DWzDIVQ9.mjs';
2
+ export { e as AnimationConfig, j as AxisConfig, l as ChartClickEvent, m as ChartHoverEvent, k as ChartType, G as GridLineConfig, n as LegendClickEvent, h as LegendConfig, o as PanEvent, P as PieChartConfig, R as RenderedEvent, d as ScatterChartConfig, t as ThemeManager, i as TitleConfig, f as TooltipConfig, g as TooltipData, X as XAxisConfig, Y as YAxisConfig, Z as ZoomEvent, q as darkTheme, u as getThemeManager, p as lightTheme, s as midnightTheme, r as modernTheme } from './index-DWzDIVQ9.mjs';
3
+ import { SciChartSurface, SciChart3DSurface } from 'scichart';
4
+ export { SciChartSurface } from 'scichart';
5
+
6
+ type SciChartSurfaceType = Awaited<ReturnType<typeof SciChartSurface.create>>["sciChartSurface"];
7
+ /**
8
+ * Abstract base class for all chart types
9
+ * Handles common functionality like initialization, theming, events, and cleanup
10
+ */
11
+ declare abstract class BaseChart<TConfig extends ChartConfig> implements ChartInstance {
12
+ readonly id: string;
13
+ protected container: HTMLElement | null;
14
+ protected surface: SciChartSurfaceType | null;
15
+ protected config: TConfig;
16
+ protected theme: ThemeConfig;
17
+ protected isInitialized: boolean;
18
+ protected isDestroyed: boolean;
19
+ private eventHandlers;
20
+ private resizeObserver;
21
+ private debouncedResize;
22
+ constructor(config: TConfig);
23
+ /**
24
+ * Initialize the chart in the given container
25
+ */
26
+ init(container: HTMLElement | string): Promise<void>;
27
+ /**
28
+ * Setup container element
29
+ */
30
+ private setupContainer;
31
+ /**
32
+ * Configure SciChart library defaults
33
+ */
34
+ private configureSciChartDefaults;
35
+ /**
36
+ * Create the SciChart surface - implemented by subclasses
37
+ */
38
+ protected abstract createSurface(): Promise<void>;
39
+ /**
40
+ * Update the chart with new data
41
+ */
42
+ abstract setData(data: SeriesData[]): void;
43
+ /**
44
+ * Update chart options
45
+ */
46
+ setOptions(options: Partial<TConfig>): void;
47
+ /**
48
+ * Apply current theme to the chart
49
+ */
50
+ protected applyTheme(): void;
51
+ /**
52
+ * Update the chart (re-render with current config)
53
+ */
54
+ protected abstract update(): void;
55
+ /**
56
+ * Set up resize observer for responsive charts
57
+ */
58
+ private setupResizeObserver;
59
+ /**
60
+ * Handle container resize
61
+ */
62
+ private handleResize;
63
+ /**
64
+ * Manually resize the chart
65
+ */
66
+ resize(width?: number, height?: number): void;
67
+ /**
68
+ * Export chart as image
69
+ */
70
+ exportImage(format?: "png" | "jpeg" | "svg"): Promise<string>;
71
+ /**
72
+ * Add event listener
73
+ */
74
+ on<K extends keyof ChartEventMap>(event: K, handler: (e: ChartEventMap[K]) => void): void;
75
+ /**
76
+ * Remove event listener
77
+ */
78
+ off<K extends keyof ChartEventMap>(event: K, handler: (e: ChartEventMap[K]) => void): void;
79
+ /**
80
+ * Emit an event
81
+ */
82
+ protected emit<K extends keyof ChartEventMap>(event: K, data: ChartEventMap[K]): void;
83
+ /**
84
+ * Destroy the chart and clean up resources
85
+ */
86
+ destroy(): void;
87
+ /**
88
+ * Get current configuration
89
+ */
90
+ getConfig(): TConfig;
91
+ /**
92
+ * Get current theme
93
+ */
94
+ getTheme(): ThemeConfig;
95
+ /**
96
+ * Check if chart is initialized
97
+ */
98
+ isReady(): boolean;
99
+ }
100
+
101
+ /**
102
+ * Line Chart implementation using SciChart
103
+ */
104
+ declare class LineChart extends BaseChart<LineChartConfig> {
105
+ private dataSeries;
106
+ private renderableSeries;
107
+ private wasmContext;
108
+ constructor(config: LineChartConfig);
109
+ /**
110
+ * Create the SciChart surface for line chart
111
+ */
112
+ protected createSurface(): Promise<void>;
113
+ /**
114
+ * Add series to the chart
115
+ */
116
+ private addSeries;
117
+ /**
118
+ * Set new data for the chart
119
+ */
120
+ setData(data: SeriesData[]): void;
121
+ /**
122
+ * Update specific series data
123
+ */
124
+ updateSeriesData(seriesName: string, data: DataPoint[] | number[]): void;
125
+ /**
126
+ * Append data to a series
127
+ */
128
+ appendData(seriesName: string, data: DataPoint | DataPoint[]): void;
129
+ /**
130
+ * Clear all series
131
+ */
132
+ private clearSeries;
133
+ /**
134
+ * Update chart
135
+ */
136
+ protected update(): void;
137
+ /**
138
+ * Apply theme to line chart
139
+ */
140
+ protected applyTheme(): void;
141
+ /**
142
+ * Destroy and clean up
143
+ */
144
+ destroy(): void;
145
+ }
146
+ /**
147
+ * Factory function to create a line chart
148
+ */
149
+ declare function createLineChart(container: HTMLElement | string, config: LineChartConfig): Promise<LineChart>;
150
+
151
+ /**
152
+ * Bar/Column Chart implementation using SciChart
153
+ */
154
+ declare class BarChart extends BaseChart<BarChartConfig> {
155
+ private dataSeries;
156
+ private renderableSeries;
157
+ private wasmContext;
158
+ constructor(config: BarChartConfig);
159
+ /**
160
+ * Create the SciChart surface for bar chart
161
+ */
162
+ protected createSurface(): Promise<void>;
163
+ /**
164
+ * Add series to the chart
165
+ */
166
+ private addSeries;
167
+ /**
168
+ * Set new data for the chart
169
+ */
170
+ setData(data: SeriesData[]): void;
171
+ /**
172
+ * Update specific series data
173
+ */
174
+ updateSeriesData(seriesName: string, data: DataPoint[] | number[]): void;
175
+ /**
176
+ * Clear all series
177
+ */
178
+ private clearSeries;
179
+ /**
180
+ * Update chart
181
+ */
182
+ protected update(): void;
183
+ /**
184
+ * Destroy and clean up
185
+ */
186
+ destroy(): void;
187
+ }
188
+ /**
189
+ * Factory function to create a bar chart
190
+ */
191
+ declare function createBarChart(container: HTMLElement | string, config: BarChartConfig): Promise<BarChart>;
192
+
193
+ /**
194
+ * Area Chart implementation using SciChart
195
+ */
196
+ declare class AreaChart extends BaseChart<AreaChartConfig> {
197
+ private dataSeries;
198
+ private renderableSeries;
199
+ private wasmContext;
200
+ constructor(config: AreaChartConfig);
201
+ /**
202
+ * Create the SciChart surface for area chart
203
+ */
204
+ protected createSurface(): Promise<void>;
205
+ /**
206
+ * Add series to the chart
207
+ */
208
+ private addSeries;
209
+ /**
210
+ * Set new data for the chart
211
+ */
212
+ setData(data: SeriesData[]): void;
213
+ /**
214
+ * Update specific series data
215
+ */
216
+ updateSeriesData(seriesName: string, data: DataPoint[] | number[]): void;
217
+ /**
218
+ * Clear all series
219
+ */
220
+ private clearSeries;
221
+ /**
222
+ * Update chart
223
+ */
224
+ protected update(): void;
225
+ /**
226
+ * Destroy and clean up
227
+ */
228
+ destroy(): void;
229
+ }
230
+ /**
231
+ * Factory function to create an area chart
232
+ */
233
+ declare function createAreaChart(container: HTMLElement | string, config: AreaChartConfig): Promise<AreaChart>;
234
+
235
+ /**
236
+ * Heatmap Chart implementation using SciChart
237
+ */
238
+ declare class HeatmapChart extends BaseChart<HeatmapChartConfig> {
239
+ private heatmapDataSeries;
240
+ private heatmapSeries;
241
+ private wasmContext;
242
+ constructor(config: HeatmapChartConfig);
243
+ /**
244
+ * Create the SciChart surface for heatmap chart
245
+ */
246
+ protected createSurface(): Promise<void>;
247
+ /**
248
+ * Add heatmap data to the chart
249
+ */
250
+ private addHeatmapData;
251
+ /**
252
+ * Set new data for the chart (for heatmap, this updates zValues)
253
+ */
254
+ setData(_data: SeriesData[]): void;
255
+ /**
256
+ * Set new z-values for the heatmap
257
+ */
258
+ setZValues(zValues: number[][]): void;
259
+ /**
260
+ * Update specific cell values
261
+ */
262
+ updateCell(x: number, y: number, value: number): void;
263
+ /**
264
+ * Clear heatmap data
265
+ */
266
+ private clearHeatmap;
267
+ /**
268
+ * Update chart
269
+ */
270
+ protected update(): void;
271
+ /**
272
+ * Destroy and clean up
273
+ */
274
+ destroy(): void;
275
+ }
276
+ /**
277
+ * Factory function to create a heatmap chart
278
+ */
279
+ declare function createHeatmapChart(container: HTMLElement | string, config: HeatmapChartConfig): Promise<HeatmapChart>;
280
+
281
+ /**
282
+ * 3D Surface Chart implementation using SciChart
283
+ */
284
+ declare class Surface3DChart {
285
+ readonly id: string;
286
+ private container;
287
+ private surface;
288
+ private wasmContext;
289
+ private config;
290
+ private dataSeries;
291
+ private meshSeries;
292
+ private isDestroyed;
293
+ constructor(config: Surface3DChartConfig);
294
+ /**
295
+ * Initialize the chart in the given container
296
+ */
297
+ init(container: HTMLElement | string): Promise<void>;
298
+ /**
299
+ * Create the SciChart 3D surface
300
+ */
301
+ private createSurface;
302
+ /**
303
+ * Add surface data to the chart
304
+ */
305
+ private addSurfaceData;
306
+ /**
307
+ * Set new Y values for the surface
308
+ */
309
+ setYValues(yValues: number[][]): void;
310
+ /**
311
+ * Set new data (alias for setYValues for consistency)
312
+ */
313
+ setData(_data: SeriesData[]): void;
314
+ /**
315
+ * Update chart options
316
+ */
317
+ setOptions(options: Partial<Surface3DChartConfig>): void;
318
+ /**
319
+ * Clear surface data
320
+ */
321
+ private clearSurface;
322
+ /**
323
+ * Destroy and clean up
324
+ */
325
+ destroy(): void;
326
+ /**
327
+ * Get current configuration
328
+ */
329
+ getConfig(): Surface3DChartConfig;
330
+ /**
331
+ * Check if chart is ready (initialized and not destroyed)
332
+ */
333
+ isReady(): boolean;
334
+ }
335
+ /**
336
+ * Factory function to create a 3D surface chart
337
+ */
338
+ declare function createSurface3DChart(container: HTMLElement | string, config: Surface3DChartConfig): Promise<Surface3DChart>;
339
+
340
+ /** Data point for 3D column chart [x, y, z] */
341
+ type Column3DDataPoint = [number, number, number];
342
+ /** Configuration for 3D Column Chart */
343
+ interface Column3DChartConfig extends ChartConfig {
344
+ /** Array of [x, y, z] data points */
345
+ data: Column3DDataPoint[];
346
+ /** X axis title */
347
+ xAxisTitle?: string;
348
+ /** Y axis title */
349
+ yAxisTitle?: string;
350
+ /** Z axis title */
351
+ zAxisTitle?: string;
352
+ /** X axis visible range */
353
+ xRange?: {
354
+ min: number;
355
+ max: number;
356
+ };
357
+ /** Y axis visible range */
358
+ yRange?: {
359
+ min: number;
360
+ max: number;
361
+ };
362
+ /** Z axis visible range */
363
+ zRange?: {
364
+ min: number;
365
+ max: number;
366
+ };
367
+ /** Bar fill color */
368
+ barFill?: string;
369
+ /** Bar stroke color */
370
+ barStroke?: string;
371
+ /** Bar opacity (0-1) */
372
+ barOpacity?: number;
373
+ /** Bar width in X direction */
374
+ barWidthX?: number;
375
+ /** Bar width in Z direction */
376
+ barWidthZ?: number;
377
+ /** Camera position */
378
+ cameraPosition?: {
379
+ x: number;
380
+ y: number;
381
+ z: number;
382
+ };
383
+ /** Camera target */
384
+ cameraTarget?: {
385
+ x: number;
386
+ y: number;
387
+ z: number;
388
+ };
389
+ /** Show sine wave reference line on back plane */
390
+ showSineWave?: boolean;
391
+ /** Sine wave amplitude center */
392
+ sineWaveCenter?: number;
393
+ /** Sine wave amplitude range */
394
+ sineWaveAmplitude?: number;
395
+ }
396
+ /**
397
+ * 3D Column/Bar Chart implementation using SciChart
398
+ */
399
+ declare class Column3DChart {
400
+ readonly id: string;
401
+ private container;
402
+ private surface;
403
+ private wasmContext;
404
+ private config;
405
+ private dataSeries;
406
+ private columnSeries;
407
+ private isDestroyed;
408
+ constructor(config: Column3DChartConfig);
409
+ /**
410
+ * Initialize the chart in the given container
411
+ */
412
+ init(container: HTMLElement | string): Promise<void>;
413
+ /**
414
+ * Create the SciChart 3D surface
415
+ */
416
+ private createSurface;
417
+ /**
418
+ * Add column data to the chart
419
+ */
420
+ private addColumnData;
421
+ /**
422
+ * Add sine wave reference line on back plane
423
+ */
424
+ private addSineWave;
425
+ /**
426
+ * Add tooltip modifier
427
+ */
428
+ private addTooltip;
429
+ /**
430
+ * Set new data for the chart
431
+ */
432
+ setData(data: Column3DDataPoint[]): void;
433
+ /**
434
+ * Update camera position
435
+ */
436
+ setCameraPosition(position: {
437
+ x: number;
438
+ y: number;
439
+ z: number;
440
+ }, target?: {
441
+ x: number;
442
+ y: number;
443
+ z: number;
444
+ }): void;
445
+ /**
446
+ * Update chart options
447
+ */
448
+ setOptions(options: Partial<Column3DChartConfig>): void;
449
+ /**
450
+ * Get the SciChart surface for advanced operations
451
+ */
452
+ getSurface(): SciChart3DSurface | null;
453
+ /**
454
+ * Destroy and clean up
455
+ */
456
+ destroy(): void;
457
+ /**
458
+ * Get current configuration
459
+ */
460
+ getConfig(): Column3DChartConfig;
461
+ /**
462
+ * Check if chart is ready (initialized and not destroyed)
463
+ */
464
+ isReady(): boolean;
465
+ }
466
+ /**
467
+ * Factory function to create a 3D column chart
468
+ */
469
+ declare function createColumn3DChart(container: HTMLElement | string, config: Column3DChartConfig): Promise<Column3DChart>;
470
+
471
+ /**
472
+ * Generate a unique ID
473
+ */
474
+ declare function generateId(prefix?: string): string;
475
+ /**
476
+ * Parse size value (handles both string and number)
477
+ */
478
+ declare function parseSize(value: string | number | undefined, fallback: number): number;
479
+ /**
480
+ * Normalize data points to standard format
481
+ */
482
+ declare function normalizeDataPoints(data: DataPoint[] | number[]): DataPoint[];
483
+ /**
484
+ * Extract x values from data points
485
+ */
486
+ declare function extractXValues(data: DataPoint[]): number[];
487
+ /**
488
+ * Extract y values from data points
489
+ */
490
+ declare function extractYValues(data: DataPoint[]): number[];
491
+ /**
492
+ * Deep merge objects
493
+ */
494
+ declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T;
495
+ /**
496
+ * Debounce function
497
+ */
498
+ declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
499
+ /**
500
+ * Throttle function
501
+ */
502
+ declare function throttle<T extends (...args: unknown[]) => void>(fn: T, limit: number): (...args: Parameters<T>) => void;
503
+ /**
504
+ * Calculate min and max from data series
505
+ */
506
+ declare function calculateDataRange(series: SeriesData[]): {
507
+ xMin: number;
508
+ xMax: number;
509
+ yMin: number;
510
+ yMax: number;
511
+ };
512
+ /**
513
+ * Format number for display
514
+ */
515
+ declare function formatNumber(value: number, precision?: number): string;
516
+ /**
517
+ * Clamp a value between min and max
518
+ */
519
+ declare function clamp(value: number, min: number, max: number): number;
520
+ /**
521
+ * Linear interpolation
522
+ */
523
+ declare function lerp(start: number, end: number, t: number): number;
524
+ /**
525
+ * Convert hex color to rgba
526
+ */
527
+ declare function hexToRgba(hex: string, alpha?: number): string;
528
+
529
+ /**
530
+ * SciChart UI - A customizable charting library built on SciChart
531
+ *
532
+ * @packageDocumentation
533
+ */
534
+
535
+ declare const VERSION = "0.1.0";
536
+
537
+ /**
538
+ * Configure SciChart WebAssembly location
539
+ * Call this before creating any charts if you need to customize the WASM location
540
+ *
541
+ * @example
542
+ * ```ts
543
+ * import { configureSciChart } from '@scichart-ui/core';
544
+ *
545
+ * configureSciChart({
546
+ * wasmUrl: '/path/to/scichart2d.wasm',
547
+ * dataUrl: '/path/to/scichart2d.data'
548
+ * });
549
+ * ```
550
+ */
551
+ declare function configureSciChart(options: {
552
+ wasmUrl?: string;
553
+ dataUrl?: string;
554
+ }): void;
555
+
556
+ export { AreaChart, AreaChartConfig, BarChart, BarChartConfig, BaseChart, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DDataPoint, DataPoint, HeatmapChart, HeatmapChartConfig, LineChart, LineChartConfig, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, VERSION, calculateDataRange, clamp, configureSciChart, createAreaChart, createBarChart, createColumn3DChart, createHeatmapChart, createLineChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, normalizeDataPoints, parseSize, throttle };