@rm-graph/core 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -451,9 +451,16 @@ var Surface3DChart = class {
451
451
  if (!this.container) {
452
452
  throw new Error("Container not set");
453
453
  }
454
+ if (!this.container.id) {
455
+ this.container.id = this.id;
456
+ }
454
457
  const { sciChart3DSurface, wasmContext } = await SciChart3DSurface.create(
455
458
  this.container.id
456
459
  );
460
+ if (this.isDestroyed) {
461
+ sciChart3DSurface.delete();
462
+ return;
463
+ }
457
464
  this.surface = sciChart3DSurface;
458
465
  this.wasmContext = wasmContext;
459
466
  sciChart3DSurface.xAxis = new NumericAxis3D(wasmContext, {
@@ -574,12 +581,20 @@ var Surface3DChart = class {
574
581
  */
575
582
  destroy() {
576
583
  if (this.isDestroyed) return;
577
- this.clearSurface();
584
+ this.isDestroyed = true;
585
+ try {
586
+ this.clearSurface();
587
+ } catch (e) {
588
+ }
578
589
  if (this.surface) {
579
- this.surface.delete();
590
+ try {
591
+ this.surface.delete();
592
+ } catch (e) {
593
+ }
580
594
  this.surface = null;
581
595
  }
582
- this.isDestroyed = true;
596
+ this.container = null;
597
+ this.wasmContext = null;
583
598
  }
584
599
  /**
585
600
  * Get current configuration
@@ -656,12 +671,19 @@ var Column3DChart = class {
656
671
  if (!this.container) {
657
672
  throw new Error("Container not set");
658
673
  }
674
+ if (!this.container.id) {
675
+ this.container.id = this.id;
676
+ }
659
677
  const { sciChart3DSurface, wasmContext } = await SciChart3DSurface.create(
660
678
  this.container.id,
661
679
  {
662
680
  isZYPlaneVisible: false
663
681
  }
664
682
  );
683
+ if (this.isDestroyed) {
684
+ sciChart3DSurface.delete();
685
+ return;
686
+ }
665
687
  this.surface = sciChart3DSurface;
666
688
  this.wasmContext = wasmContext;
667
689
  const cameraPos = this.config.cameraPosition ?? { x: -250, y: 450, z: 280 };
@@ -833,11 +855,16 @@ var Column3DChart = class {
833
855
  */
834
856
  destroy() {
835
857
  if (this.isDestroyed) return;
858
+ this.isDestroyed = true;
836
859
  if (this.surface) {
837
- this.surface.delete();
860
+ try {
861
+ this.surface.delete();
862
+ } catch (e) {
863
+ }
838
864
  this.surface = null;
839
865
  }
840
- this.isDestroyed = true;
866
+ this.container = null;
867
+ this.wasmContext = null;
841
868
  }
842
869
  /**
843
870
  * Get current configuration
@@ -1381,30 +1408,49 @@ var PRPDChart = class {
1381
1408
  */
1382
1409
  destroy() {
1383
1410
  if (this.isDestroyed) return;
1384
- this.clearHeatmapLegend();
1385
- if (this.sineLineSeries && this.surface) {
1386
- this.surface.renderableSeries.remove(this.sineLineSeries);
1387
- this.sineLineSeries.delete();
1388
- this.sineLineSeries = null;
1411
+ this.isDestroyed = true;
1412
+ try {
1413
+ this.clearHeatmapLegend();
1414
+ } catch (e) {
1389
1415
  }
1390
- if (this.sineDataSeries) {
1391
- this.sineDataSeries.delete();
1392
- this.sineDataSeries = null;
1416
+ try {
1417
+ if (this.sineLineSeries && this.surface) {
1418
+ this.surface.renderableSeries.remove(this.sineLineSeries);
1419
+ this.sineLineSeries.delete();
1420
+ }
1421
+ } catch (e) {
1393
1422
  }
1394
- if (this.heatmapSeries && this.surface) {
1395
- this.surface.renderableSeries.remove(this.heatmapSeries);
1396
- this.heatmapSeries.delete();
1397
- this.heatmapSeries = null;
1423
+ this.sineLineSeries = null;
1424
+ try {
1425
+ if (this.sineDataSeries) {
1426
+ this.sineDataSeries.delete();
1427
+ }
1428
+ } catch (e) {
1398
1429
  }
1399
- if (this.heatmapDataSeries) {
1400
- this.heatmapDataSeries.delete();
1401
- this.heatmapDataSeries = null;
1430
+ this.sineDataSeries = null;
1431
+ try {
1432
+ if (this.heatmapSeries && this.surface) {
1433
+ this.surface.renderableSeries.remove(this.heatmapSeries);
1434
+ this.heatmapSeries.delete();
1435
+ }
1436
+ } catch (e) {
1402
1437
  }
1403
- if (this.surface) {
1404
- this.surface.delete();
1405
- this.surface = null;
1438
+ this.heatmapSeries = null;
1439
+ try {
1440
+ if (this.heatmapDataSeries) {
1441
+ this.heatmapDataSeries.delete();
1442
+ }
1443
+ } catch (e) {
1406
1444
  }
1407
- this.isDestroyed = true;
1445
+ this.heatmapDataSeries = null;
1446
+ try {
1447
+ if (this.surface) {
1448
+ this.surface.chartModifiers.clear();
1449
+ this.surface.delete();
1450
+ }
1451
+ } catch (e) {
1452
+ }
1453
+ this.surface = null;
1408
1454
  }
1409
1455
  };
1410
1456
  async function createPRPDChart(container, config) {