@rm-graph/core 0.1.8 → 0.1.9

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 CHANGED
@@ -13,25 +13,19 @@ npm install @rm-graph/core
13
13
  ## Usage
14
14
 
15
15
  ```typescript
16
- import { createLineChart, createBarChart, createAreaChart } from '@rm-graph/core';
16
+ import { createColumn3DChart, createPRPDChart } from '@rm-graph/core';
17
17
 
18
- // Create a line chart
19
- const chart = await createLineChart('container-id', {
18
+ // Create a 3D column chart
19
+ const chart = await createColumn3DChart('container-id', {
20
20
  theme: 'dark',
21
- series: [
22
- {
23
- name: 'Revenue',
24
- data: [100, 150, 120, 180, 200],
25
- },
26
- ],
27
- xAxis: { title: 'Month' },
28
- yAxis: { title: 'Amount ($)' },
21
+ data: [[45, 1500, 1], [90, 2200, 2], [180, 1800, 3]],
22
+ xAxisTitle: 'Phase Angle (°)',
23
+ yAxisTitle: 'Amplitude (mVp)',
24
+ zAxisTitle: 'Cycle',
29
25
  });
30
26
 
31
27
  // Update data
32
- chart.setData([
33
- { name: 'Revenue', data: [200, 250, 220, 280, 300] },
34
- ]);
28
+ chart.setData([[50, 1600, 1], [95, 2300, 2]]);
35
29
 
36
30
  // Change theme
37
31
  chart.setOptions({ theme: 'light' });
@@ -42,9 +36,9 @@ chart.destroy();
42
36
 
43
37
  ## Chart Types
44
38
 
45
- - `createLineChart` - Line charts with optional points
46
- - `createBarChart` - Bar/column charts with grouping and stacking
47
- - `createAreaChart` - Area charts with gradient fills
39
+ - `createColumn3DChart` - 3D column charts for phase-resolved data
40
+ - `createPRPDChart` - Phase Resolved Partial Discharge heatmaps
41
+ - `createSurface3DChart` - 3D surface visualization
48
42
 
49
43
  ## Theming
50
44
 
package/dist/index.d.mts CHANGED
@@ -164,6 +164,26 @@ declare function createSurface3DChart(container: HTMLElement | string, config: S
164
164
 
165
165
  /** Data point for 3D column chart [x, y, z] */
166
166
  type Column3DDataPoint = [number, number, number];
167
+ /** Unit of measurement options */
168
+ type UnitOfMeasurement = "mVp" | "mVrms" | "dBm" | "dB" | number;
169
+ /** Camera preset positions */
170
+ interface CameraPreset {
171
+ position: {
172
+ x: number;
173
+ y: number;
174
+ z: number;
175
+ };
176
+ target: {
177
+ x: number;
178
+ y: number;
179
+ z: number;
180
+ };
181
+ }
182
+ /** Chart statistics */
183
+ interface Column3DChartStats {
184
+ pulseCount: number;
185
+ peakValue: number;
186
+ }
167
187
  /** Configuration for 3D Column Chart */
168
188
  interface Column3DChartConfig extends ChartConfig {
169
189
  /** Array of [x, y, z] data points */
@@ -217,7 +237,37 @@ interface Column3DChartConfig extends ChartConfig {
217
237
  sineWaveCenter?: number;
218
238
  /** Sine wave amplitude range */
219
239
  sineWaveAmplitude?: number;
240
+ /** Unit of measurement */
241
+ unitOfMeasurement?: UnitOfMeasurement;
242
+ /** Enable camera clamping to restrict camera movement */
243
+ enableCameraClamping?: boolean;
244
+ /** Maximum camera radius */
245
+ maxCameraRadius?: number;
246
+ /** Minimum camera radius */
247
+ minCameraRadius?: number;
248
+ /** Minimum yaw angle in degrees (horizontal). Default -179. */
249
+ minYaw?: number;
250
+ /** Maximum yaw angle in degrees (horizontal). Default 179. */
251
+ maxYaw?: number;
252
+ /** Minimum pitch angle in degrees (vertical). Default 0. */
253
+ minPitch?: number;
254
+ /** Maximum pitch angle in degrees (vertical). Default 88. */
255
+ maxPitch?: number;
256
+ /** Camera preset positions */
257
+ cameraPresets?: CameraPreset[];
258
+ /** Use cylinder point markers instead of columns */
259
+ useCylinderMarkers?: boolean;
260
+ /** Callback when stats change */
261
+ onStatsChange?: (stats: Column3DChartStats) => void;
220
262
  }
263
+ /** Default camera presets */
264
+ declare const DEFAULT_CAMERA_PRESETS: CameraPreset[];
265
+ /** Unit of measurement labels */
266
+ declare const UOM_LABELS: Record<number | string, string>;
267
+ /** Convert mVrms to dBm */
268
+ declare function mVrmsToDbm(mVrms: number): number;
269
+ /** Convert mVp to dB */
270
+ declare function mVpToDb(mVp: number): number;
221
271
  /**
222
272
  * 3D Column/Bar Chart implementation using SciChart
223
273
  */
@@ -229,7 +279,12 @@ declare class Column3DChart {
229
279
  private config;
230
280
  private dataSeries;
231
281
  private columnSeries;
282
+ private sineSeries;
232
283
  private isDestroyed;
284
+ private stats;
285
+ private cameraClampingEnabled;
286
+ private initialCameraPosition;
287
+ private initialCameraTarget;
233
288
  constructor(config: Column3DChartConfig);
234
289
  /**
235
290
  * Initialize the chart in the given container
@@ -239,6 +294,16 @@ declare class Column3DChart {
239
294
  * Create the SciChart 3D surface
240
295
  */
241
296
  private createSurface;
297
+ /**
298
+ * Setup camera clamping to restrict camera movement.
299
+ * Yaw snaps to boundaries: >100 → -180, >=0 → 0 (keeps view in -180..0 range).
300
+ * Pitch clamped to [0, 89]. Radius clamped to [495, 805].
301
+ */
302
+ private setupCameraClamping;
303
+ /**
304
+ * Setup axes with proper configuration
305
+ */
306
+ private setupAxes;
242
307
  /**
243
308
  * Add column data to the chart
244
309
  */
@@ -267,6 +332,26 @@ declare class Column3DChart {
267
332
  y: number;
268
333
  z: number;
269
334
  }): void;
335
+ /**
336
+ * Set camera to a preset position
337
+ */
338
+ setCameraPreset(presetIndex: number): void;
339
+ /**
340
+ * Reset camera to initial position
341
+ */
342
+ resetCamera(): void;
343
+ /**
344
+ * Update Y axis range
345
+ */
346
+ setYAxisRange(min: number, max: number): void;
347
+ /**
348
+ * Update Z axis range (cycle range)
349
+ */
350
+ setZAxisRange(min: number, max: number): void;
351
+ /**
352
+ * Get current statistics
353
+ */
354
+ getStats(): Column3DChartStats;
270
355
  /**
271
356
  * Update chart options
272
357
  */
@@ -275,6 +360,11 @@ declare class Column3DChart {
275
360
  * Get the SciChart surface for advanced operations
276
361
  */
277
362
  getSurface(): SciChart3DSurface | null;
363
+ /**
364
+ * Notify SciChart that the container has resized so the WebGL canvas
365
+ * adjusts to the new dimensions. Call after maximize / minimize.
366
+ */
367
+ resize(): void;
278
368
  /**
279
369
  * Destroy and clean up
280
370
  */
@@ -284,7 +374,7 @@ declare class Column3DChart {
284
374
  */
285
375
  getConfig(): Column3DChartConfig;
286
376
  /**
287
- * Check if chart is ready (initialized and not destroyed)
377
+ * Check if chart is ready
288
378
  */
289
379
  isReady(): boolean;
290
380
  }
@@ -479,4 +569,4 @@ declare function configureSciChart(options: {
479
569
  wasmUrl?: string;
480
570
  }): void;
481
571
 
482
- export { BaseChart, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DDataPoint, DataPoint, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, VERSION, calculateDataRange, clamp, configureSciChart, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, normalizeDataPoints, parseSize, throttle };
572
+ export { BaseChart, type CameraPreset, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DChartStats, type Column3DDataPoint, DEFAULT_CAMERA_PRESETS, DataPoint, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, UOM_LABELS, type UnitOfMeasurement, VERSION, calculateDataRange, clamp, configureSciChart, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, mVpToDb, mVrmsToDbm, normalizeDataPoints, parseSize, throttle };
package/dist/index.d.ts CHANGED
@@ -164,6 +164,26 @@ declare function createSurface3DChart(container: HTMLElement | string, config: S
164
164
 
165
165
  /** Data point for 3D column chart [x, y, z] */
166
166
  type Column3DDataPoint = [number, number, number];
167
+ /** Unit of measurement options */
168
+ type UnitOfMeasurement = "mVp" | "mVrms" | "dBm" | "dB" | number;
169
+ /** Camera preset positions */
170
+ interface CameraPreset {
171
+ position: {
172
+ x: number;
173
+ y: number;
174
+ z: number;
175
+ };
176
+ target: {
177
+ x: number;
178
+ y: number;
179
+ z: number;
180
+ };
181
+ }
182
+ /** Chart statistics */
183
+ interface Column3DChartStats {
184
+ pulseCount: number;
185
+ peakValue: number;
186
+ }
167
187
  /** Configuration for 3D Column Chart */
168
188
  interface Column3DChartConfig extends ChartConfig {
169
189
  /** Array of [x, y, z] data points */
@@ -217,7 +237,37 @@ interface Column3DChartConfig extends ChartConfig {
217
237
  sineWaveCenter?: number;
218
238
  /** Sine wave amplitude range */
219
239
  sineWaveAmplitude?: number;
240
+ /** Unit of measurement */
241
+ unitOfMeasurement?: UnitOfMeasurement;
242
+ /** Enable camera clamping to restrict camera movement */
243
+ enableCameraClamping?: boolean;
244
+ /** Maximum camera radius */
245
+ maxCameraRadius?: number;
246
+ /** Minimum camera radius */
247
+ minCameraRadius?: number;
248
+ /** Minimum yaw angle in degrees (horizontal). Default -179. */
249
+ minYaw?: number;
250
+ /** Maximum yaw angle in degrees (horizontal). Default 179. */
251
+ maxYaw?: number;
252
+ /** Minimum pitch angle in degrees (vertical). Default 0. */
253
+ minPitch?: number;
254
+ /** Maximum pitch angle in degrees (vertical). Default 88. */
255
+ maxPitch?: number;
256
+ /** Camera preset positions */
257
+ cameraPresets?: CameraPreset[];
258
+ /** Use cylinder point markers instead of columns */
259
+ useCylinderMarkers?: boolean;
260
+ /** Callback when stats change */
261
+ onStatsChange?: (stats: Column3DChartStats) => void;
220
262
  }
263
+ /** Default camera presets */
264
+ declare const DEFAULT_CAMERA_PRESETS: CameraPreset[];
265
+ /** Unit of measurement labels */
266
+ declare const UOM_LABELS: Record<number | string, string>;
267
+ /** Convert mVrms to dBm */
268
+ declare function mVrmsToDbm(mVrms: number): number;
269
+ /** Convert mVp to dB */
270
+ declare function mVpToDb(mVp: number): number;
221
271
  /**
222
272
  * 3D Column/Bar Chart implementation using SciChart
223
273
  */
@@ -229,7 +279,12 @@ declare class Column3DChart {
229
279
  private config;
230
280
  private dataSeries;
231
281
  private columnSeries;
282
+ private sineSeries;
232
283
  private isDestroyed;
284
+ private stats;
285
+ private cameraClampingEnabled;
286
+ private initialCameraPosition;
287
+ private initialCameraTarget;
233
288
  constructor(config: Column3DChartConfig);
234
289
  /**
235
290
  * Initialize the chart in the given container
@@ -239,6 +294,16 @@ declare class Column3DChart {
239
294
  * Create the SciChart 3D surface
240
295
  */
241
296
  private createSurface;
297
+ /**
298
+ * Setup camera clamping to restrict camera movement.
299
+ * Yaw snaps to boundaries: >100 → -180, >=0 → 0 (keeps view in -180..0 range).
300
+ * Pitch clamped to [0, 89]. Radius clamped to [495, 805].
301
+ */
302
+ private setupCameraClamping;
303
+ /**
304
+ * Setup axes with proper configuration
305
+ */
306
+ private setupAxes;
242
307
  /**
243
308
  * Add column data to the chart
244
309
  */
@@ -267,6 +332,26 @@ declare class Column3DChart {
267
332
  y: number;
268
333
  z: number;
269
334
  }): void;
335
+ /**
336
+ * Set camera to a preset position
337
+ */
338
+ setCameraPreset(presetIndex: number): void;
339
+ /**
340
+ * Reset camera to initial position
341
+ */
342
+ resetCamera(): void;
343
+ /**
344
+ * Update Y axis range
345
+ */
346
+ setYAxisRange(min: number, max: number): void;
347
+ /**
348
+ * Update Z axis range (cycle range)
349
+ */
350
+ setZAxisRange(min: number, max: number): void;
351
+ /**
352
+ * Get current statistics
353
+ */
354
+ getStats(): Column3DChartStats;
270
355
  /**
271
356
  * Update chart options
272
357
  */
@@ -275,6 +360,11 @@ declare class Column3DChart {
275
360
  * Get the SciChart surface for advanced operations
276
361
  */
277
362
  getSurface(): SciChart3DSurface | null;
363
+ /**
364
+ * Notify SciChart that the container has resized so the WebGL canvas
365
+ * adjusts to the new dimensions. Call after maximize / minimize.
366
+ */
367
+ resize(): void;
278
368
  /**
279
369
  * Destroy and clean up
280
370
  */
@@ -284,7 +374,7 @@ declare class Column3DChart {
284
374
  */
285
375
  getConfig(): Column3DChartConfig;
286
376
  /**
287
- * Check if chart is ready (initialized and not destroyed)
377
+ * Check if chart is ready
288
378
  */
289
379
  isReady(): boolean;
290
380
  }
@@ -479,4 +569,4 @@ declare function configureSciChart(options: {
479
569
  wasmUrl?: string;
480
570
  }): void;
481
571
 
482
- export { BaseChart, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DDataPoint, DataPoint, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, VERSION, calculateDataRange, clamp, configureSciChart, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, normalizeDataPoints, parseSize, throttle };
572
+ export { BaseChart, type CameraPreset, ChartConfig, ChartEventMap, ChartInstance, Column3DChart, type Column3DChartConfig, type Column3DChartStats, type Column3DDataPoint, DEFAULT_CAMERA_PRESETS, DataPoint, PRPDChart, PRPDChartConfig, PRPDChartStats, PRPDDataPoint, PRPDResolutionLabel, PRPDWindowingRegion, SeriesData, Surface3DChart, Surface3DChartConfig, ThemeConfig, UOM_LABELS, type UnitOfMeasurement, VERSION, calculateDataRange, clamp, configureSciChart, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, mVpToDb, mVrmsToDbm, normalizeDataPoints, parseSize, throttle };