@rm-graph/core 0.1.8 → 0.1.10
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 +60 -17
- package/dist/index.d.mts +92 -2
- package/dist/index.d.ts +92 -2
- package/dist/index.js +291 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +292 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +53 -54
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __require, ThemeManager } from './chunk-Q2ZHY445.mjs';
|
|
2
2
|
export { ThemeManager, darkTheme, getThemeManager, lightTheme, midnightTheme, modernTheme } from './chunk-Q2ZHY445.mjs';
|
|
3
|
-
import { SciChart3DSurface, NumericAxis3D, MouseWheelZoomModifier3D, OrbitModifier3D, CameraController, Vector3, UniformGridDataSeries3D, GradientColorPalette, SurfaceMeshRenderableSeries3D, EDrawMeshAs, NumberRange, XyzDataSeries3D, ColumnRenderableSeries3D, PointLineRenderableSeries3D, TooltipModifier3D, SciChartSurface, NumericAxis, EAxisAlignment, ENumericFormat, EAutoRange, CursorModifier, RubberBandXyZoomModifier, ZoomExtentsModifier, HeatmapColorMap, UniformHeatmapDataSeries, UniformHeatmapRenderableSeries, XyDataSeries, FastLineRenderableSeries, HeatmapLegend } from 'scichart';
|
|
3
|
+
import { SciChart3DSurface, NumericAxis3D, MouseWheelZoomModifier3D, OrbitModifier3D, CameraController, Vector3, UniformGridDataSeries3D, GradientColorPalette, SurfaceMeshRenderableSeries3D, EDrawMeshAs, SciChartJSLightTheme, ResetCamera3DModifier, NumberRange, XyzDataSeries3D, ColumnRenderableSeries3D, CylinderPointMarker3D, PointLineRenderableSeries3D, TooltipModifier3D, SciChartSurface, NumericAxis, EAxisAlignment, ENumericFormat, EAutoRange, CursorModifier, RubberBandXyZoomModifier, ZoomExtentsModifier, HeatmapColorMap, UniformHeatmapDataSeries, UniformHeatmapRenderableSeries, XyDataSeries, FastLineRenderableSeries, HeatmapLegend, NumericLabelProvider } from 'scichart';
|
|
4
4
|
export { SciChartSurface } from 'scichart';
|
|
5
|
-
import { SciChartJSLightTheme } from 'scichart/Charting/Themes/SciChartJSLightTheme';
|
|
5
|
+
import { SciChartJSLightTheme as SciChartJSLightTheme$1 } from 'scichart/Charting/Themes/SciChartJSLightTheme';
|
|
6
6
|
|
|
7
7
|
// src/utils/helpers.ts
|
|
8
8
|
function generateId(prefix = "chart") {
|
|
@@ -226,8 +226,8 @@ var BaseChart = class {
|
|
|
226
226
|
this.surface.background = this.theme.backgroundColor ?? "#ffffff";
|
|
227
227
|
try {
|
|
228
228
|
const themeName = this.config.theme;
|
|
229
|
-
const { SciChartJSDarkTheme, SciChartJSLightTheme:
|
|
230
|
-
const nextThemeProvider = themeName === "light" ? new
|
|
229
|
+
const { SciChartJSDarkTheme, SciChartJSLightTheme: SciChartJSLightTheme3 } = __require("scichart");
|
|
230
|
+
const nextThemeProvider = themeName === "light" ? new SciChartJSLightTheme3() : new SciChartJSDarkTheme();
|
|
231
231
|
this.surface.applyTheme?.(nextThemeProvider);
|
|
232
232
|
} catch {
|
|
233
233
|
}
|
|
@@ -646,6 +646,41 @@ function ensureSciChart3DConfigured2() {
|
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
+
var DEFAULT_CAMERA_PRESETS = [
|
|
650
|
+
{
|
|
651
|
+
// Top view
|
|
652
|
+
position: { x: -0.01, y: 532.47, z: 0.82 },
|
|
653
|
+
target: { x: 0, y: 50, z: 0 }
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
// Angle view
|
|
657
|
+
position: { x: -2.38, y: 99.55, z: 479.91 },
|
|
658
|
+
target: { x: 0, y: 50, z: 0 }
|
|
659
|
+
}
|
|
660
|
+
];
|
|
661
|
+
var UOM_LABELS = {
|
|
662
|
+
1: "mVp",
|
|
663
|
+
2: "mVrms",
|
|
664
|
+
3: "dBm",
|
|
665
|
+
4: "dB",
|
|
666
|
+
"mVp": "mVp",
|
|
667
|
+
"mVrms": "mVrms",
|
|
668
|
+
"dBm": "dBm",
|
|
669
|
+
"dB": "dB"
|
|
670
|
+
};
|
|
671
|
+
function mVrmsToDbm(mVrms) {
|
|
672
|
+
if (mVrms <= 0) return -100;
|
|
673
|
+
return 10 * Math.log10(mVrms * mVrms / 50) + 30;
|
|
674
|
+
}
|
|
675
|
+
function mVpToDb(mVp) {
|
|
676
|
+
if (mVp <= 0) return -100;
|
|
677
|
+
return 20 * Math.log10(mVp);
|
|
678
|
+
}
|
|
679
|
+
var IntegerLabelProvider = class extends NumericLabelProvider {
|
|
680
|
+
get formatLabel() {
|
|
681
|
+
return (value) => `${Math.round(value)}`;
|
|
682
|
+
}
|
|
683
|
+
};
|
|
649
684
|
var Column3DChart = class {
|
|
650
685
|
constructor(config) {
|
|
651
686
|
this.container = null;
|
|
@@ -653,9 +688,15 @@ var Column3DChart = class {
|
|
|
653
688
|
this.wasmContext = null;
|
|
654
689
|
this.dataSeries = null;
|
|
655
690
|
this.columnSeries = null;
|
|
691
|
+
this.sineSeries = null;
|
|
656
692
|
this.isDestroyed = false;
|
|
693
|
+
this.stats = { pulseCount: 0, peakValue: 0 };
|
|
694
|
+
this.cameraClampingEnabled = false;
|
|
695
|
+
this.initialCameraPosition = { x: -250, y: 450, z: 280 };
|
|
696
|
+
this.initialCameraTarget = { x: 0, y: 0, z: 0 };
|
|
657
697
|
this.id = config.id ?? generateId("column3d");
|
|
658
698
|
this.config = config;
|
|
699
|
+
this.cameraClampingEnabled = config.enableCameraClamping ?? true;
|
|
659
700
|
}
|
|
660
701
|
/**
|
|
661
702
|
* Initialize the chart in the given container
|
|
@@ -695,9 +736,28 @@ var Column3DChart = class {
|
|
|
695
736
|
let sciChart3DSurface;
|
|
696
737
|
let wasmContext;
|
|
697
738
|
try {
|
|
739
|
+
const customLightTheme = {
|
|
740
|
+
...new SciChartJSLightTheme(),
|
|
741
|
+
// Label and title colors - make them pure black
|
|
742
|
+
tickTextBrush: "#000000",
|
|
743
|
+
axisTitleColor: "#000000",
|
|
744
|
+
labelForegroundBrush: "#000000",
|
|
745
|
+
labelBackgroundBrush: "transparent",
|
|
746
|
+
// 3D specific properties
|
|
747
|
+
axis3DBandsFill: "#e5e5e5",
|
|
748
|
+
axisTitleTextColor: "#000000",
|
|
749
|
+
majorGridLineBrush: "#7e7e7e",
|
|
750
|
+
minorGridLineBrush: "#aaaaaa",
|
|
751
|
+
textAnnotationForeground: "#000000",
|
|
752
|
+
axisBorder: "#000000",
|
|
753
|
+
// Additional label properties
|
|
754
|
+
labelBorderBrush: "#000000",
|
|
755
|
+
cursorLabelForegroundBrush: "#000000"
|
|
756
|
+
};
|
|
698
757
|
const result = await SciChart3DSurface.create(
|
|
699
758
|
this.container.id,
|
|
700
759
|
{
|
|
760
|
+
theme: customLightTheme,
|
|
701
761
|
isZYPlaneVisible: false
|
|
702
762
|
}
|
|
703
763
|
);
|
|
@@ -722,48 +782,128 @@ var Column3DChart = class {
|
|
|
722
782
|
position: new Vector3(cameraPos.x, cameraPos.y, cameraPos.z),
|
|
723
783
|
target: new Vector3(cameraTarget.x, cameraTarget.y, cameraTarget.z)
|
|
724
784
|
});
|
|
785
|
+
this.initialCameraPosition = cameraPos;
|
|
786
|
+
this.initialCameraTarget = cameraTarget;
|
|
787
|
+
if (this.cameraClampingEnabled) {
|
|
788
|
+
this.setupCameraClamping();
|
|
789
|
+
}
|
|
725
790
|
sciChart3DSurface.chartModifiers.add(
|
|
726
791
|
new OrbitModifier3D(),
|
|
727
|
-
new MouseWheelZoomModifier3D()
|
|
792
|
+
new MouseWheelZoomModifier3D(),
|
|
793
|
+
new ResetCamera3DModifier()
|
|
728
794
|
);
|
|
795
|
+
this.setupAxes();
|
|
796
|
+
this.addColumnData(this.config.data);
|
|
797
|
+
if (this.config.showSineWave !== false) {
|
|
798
|
+
this.addSineWave();
|
|
799
|
+
}
|
|
800
|
+
this.addTooltip();
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Setup camera clamping to restrict camera movement.
|
|
804
|
+
* Yaw snaps to boundaries: >100 → -180, >=0 → 0 (keeps view in -180..0 range).
|
|
805
|
+
* Pitch clamped to [0, 89]. Radius clamped to [495, 805].
|
|
806
|
+
*/
|
|
807
|
+
setupCameraClamping() {
|
|
808
|
+
if (!this.surface) return;
|
|
809
|
+
let isClamping = false;
|
|
810
|
+
this.surface.camera.propertyChanged.subscribe(() => {
|
|
811
|
+
if (isClamping) return;
|
|
812
|
+
isClamping = true;
|
|
813
|
+
try {
|
|
814
|
+
if (!this.surface) return;
|
|
815
|
+
let yaw = this.surface.camera.orbitalYaw;
|
|
816
|
+
let pitch = this.surface.camera.orbitalPitch;
|
|
817
|
+
let cameraRadius = this.surface.camera.radius;
|
|
818
|
+
const maxCameraRadius = this.config.maxCameraRadius ?? 805;
|
|
819
|
+
const minCameraRadius = this.config.minCameraRadius ?? 495;
|
|
820
|
+
if (Math.floor(yaw) > 100) {
|
|
821
|
+
yaw = -180;
|
|
822
|
+
} else if (Math.floor(yaw) >= 0) {
|
|
823
|
+
yaw = 0;
|
|
824
|
+
}
|
|
825
|
+
if (pitch <= 0) {
|
|
826
|
+
pitch = 0;
|
|
827
|
+
} else if (pitch >= 89) {
|
|
828
|
+
pitch = 89;
|
|
829
|
+
}
|
|
830
|
+
if (cameraRadius >= maxCameraRadius) {
|
|
831
|
+
cameraRadius = maxCameraRadius;
|
|
832
|
+
} else if (cameraRadius <= minCameraRadius) {
|
|
833
|
+
cameraRadius = minCameraRadius;
|
|
834
|
+
}
|
|
835
|
+
if (yaw !== this.surface.camera.orbitalYaw) {
|
|
836
|
+
this.surface.camera.orbitalYaw = yaw;
|
|
837
|
+
}
|
|
838
|
+
if (pitch !== this.surface.camera.orbitalPitch) {
|
|
839
|
+
this.surface.camera.orbitalPitch = pitch;
|
|
840
|
+
}
|
|
841
|
+
if (cameraRadius !== this.surface.camera.radius) {
|
|
842
|
+
this.surface.camera.radius = cameraRadius;
|
|
843
|
+
}
|
|
844
|
+
} finally {
|
|
845
|
+
isClamping = false;
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Setup axes with proper configuration
|
|
851
|
+
*/
|
|
852
|
+
setupAxes() {
|
|
853
|
+
if (!this.surface || !this.wasmContext) return;
|
|
854
|
+
const wasmContext = this.wasmContext;
|
|
729
855
|
const xRange = this.config.xRange ?? { min: 0, max: 360 };
|
|
730
856
|
const yRange = this.config.yRange ?? { min: 0, max: 5e3 };
|
|
731
857
|
const zRange = this.config.zRange ?? { min: 0, max: 50 };
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
planeBorderThickness: 3
|
|
736
|
-
};
|
|
737
|
-
sciChart3DSurface.xAxis = new NumericAxis3D(wasmContext, {
|
|
738
|
-
...baseAxisOptions,
|
|
858
|
+
const uom = this.config.unitOfMeasurement;
|
|
859
|
+
const yAxisTitle = this.config.yAxisTitle ?? (uom ? `Amplitude (${UOM_LABELS[uom] || uom})` : "Amplitude (mVp)");
|
|
860
|
+
this.surface.xAxis = new NumericAxis3D(wasmContext, {
|
|
739
861
|
axisTitle: this.config.xAxisTitle ?? "Phase Angle (\xB0)",
|
|
740
862
|
autoTicks: false,
|
|
741
863
|
visibleRange: new NumberRange(xRange.min, xRange.max),
|
|
742
864
|
majorDelta: 45,
|
|
743
865
|
minorDelta: 15,
|
|
866
|
+
labelProvider: new IntegerLabelProvider(),
|
|
867
|
+
drawMinorGridLines: false,
|
|
868
|
+
majorGridLineStyle: { color: "#7e7e7e" },
|
|
744
869
|
flippedCoordinates: true,
|
|
745
|
-
axisBandsFill: "#d2d2d2"
|
|
870
|
+
axisBandsFill: "#d2d2d2",
|
|
871
|
+
planeBorderThickness: 3,
|
|
872
|
+
axisTitleStyle: { color: "#000000", fontFamily: "Arial" },
|
|
873
|
+
labelStyle: { color: "#000000", fontFamily: "Arial" }
|
|
746
874
|
});
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
axisTitle: this.config.yAxisTitle ?? "Amplitude (mVp)",
|
|
875
|
+
this.surface.yAxis = new NumericAxis3D(wasmContext, {
|
|
876
|
+
axisTitle: yAxisTitle,
|
|
750
877
|
visibleRange: new NumberRange(yRange.min, yRange.max),
|
|
751
|
-
|
|
878
|
+
labelProvider: new IntegerLabelProvider(),
|
|
879
|
+
drawMinorGridLines: false,
|
|
880
|
+
majorGridLineStyle: { color: "#7e7e7e" },
|
|
881
|
+
axisBandsFill: "#b1b1b1",
|
|
882
|
+
axisTitleStyle: { color: "#000000", fontFamily: "Arial" },
|
|
883
|
+
labelStyle: { color: "#000000", fontFamily: "Arial" }
|
|
752
884
|
});
|
|
753
|
-
|
|
754
|
-
...baseAxisOptions,
|
|
885
|
+
this.surface.zAxis = new NumericAxis3D(wasmContext, {
|
|
755
886
|
axisTitle: this.config.zAxisTitle ?? "Cycle",
|
|
756
887
|
majorDelta: 10,
|
|
757
888
|
minorDelta: 5,
|
|
758
889
|
visibleRange: new NumberRange(zRange.min, zRange.max),
|
|
890
|
+
drawMinorGridLines: false,
|
|
891
|
+
majorGridLineStyle: { color: "#7e7e7e" },
|
|
759
892
|
axisBandsFill: "#d0d0d0",
|
|
760
|
-
|
|
893
|
+
planeBorderThickness: 3,
|
|
894
|
+
labelPrecision: 0,
|
|
895
|
+
axisTitleStyle: { color: "#000000", fontFamily: "Arial" },
|
|
896
|
+
labelStyle: { color: "#000000", fontFamily: "Arial" }
|
|
761
897
|
});
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
this.addSineWave();
|
|
898
|
+
if (wasmContext.eSCRTTextAlignement) {
|
|
899
|
+
this.surface.yAxis.labelStyle.alignment = wasmContext.eSCRTTextAlignement.SCRT_TEXT_ALIGNEMENT_SCREEN_AUTOROTATED;
|
|
765
900
|
}
|
|
766
|
-
this.
|
|
901
|
+
this.surface.xAxis.axisTitleStyle.color = "#000000";
|
|
902
|
+
this.surface.xAxis.labelStyle.color = "#000000";
|
|
903
|
+
this.surface.yAxis.axisTitleStyle.color = "#000000";
|
|
904
|
+
this.surface.yAxis.labelStyle.color = "#000000";
|
|
905
|
+
this.surface.zAxis.axisTitleStyle.color = "#000000";
|
|
906
|
+
this.surface.zAxis.labelStyle.color = "#000000";
|
|
767
907
|
}
|
|
768
908
|
/**
|
|
769
909
|
* Add column data to the chart
|
|
@@ -771,18 +911,49 @@ var Column3DChart = class {
|
|
|
771
911
|
addColumnData(data) {
|
|
772
912
|
if (!this.surface || !this.wasmContext) return;
|
|
773
913
|
const wasmContext = this.wasmContext;
|
|
914
|
+
const uom = this.config.unitOfMeasurement;
|
|
915
|
+
const convertedData = data.map(([x, y, z]) => {
|
|
916
|
+
let convertedY = Math.abs(y);
|
|
917
|
+
if (uom === 3 || uom === "dBm") {
|
|
918
|
+
convertedY = mVrmsToDbm(convertedY);
|
|
919
|
+
} else if (uom === 4 || uom === "dB") {
|
|
920
|
+
convertedY = mVpToDb(convertedY);
|
|
921
|
+
}
|
|
922
|
+
return [x, convertedY, z];
|
|
923
|
+
});
|
|
924
|
+
let pulseCount = 0;
|
|
925
|
+
let peakValue = 0;
|
|
926
|
+
convertedData.forEach(([, y]) => {
|
|
927
|
+
pulseCount++;
|
|
928
|
+
if (y > peakValue) peakValue = y;
|
|
929
|
+
});
|
|
930
|
+
this.stats = { pulseCount, peakValue: parseFloat(peakValue.toFixed(2)) };
|
|
931
|
+
this.config.onStatsChange?.(this.stats);
|
|
774
932
|
this.dataSeries = new XyzDataSeries3D(wasmContext);
|
|
775
|
-
|
|
933
|
+
convertedData.forEach(([x, y, z]) => {
|
|
776
934
|
this.dataSeries.append(x, y, z);
|
|
777
935
|
});
|
|
778
|
-
this.
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
936
|
+
if (this.config.useCylinderMarkers) {
|
|
937
|
+
this.columnSeries = new ColumnRenderableSeries3D(wasmContext, {
|
|
938
|
+
dataSeries: this.dataSeries,
|
|
939
|
+
pointMarker: new CylinderPointMarker3D(wasmContext, {
|
|
940
|
+
fill: this.config.barFill ?? "#52aaf2"
|
|
941
|
+
}),
|
|
942
|
+
fill: this.config.barFill ?? "#52aaf2",
|
|
943
|
+
stroke: this.config.barStroke ?? "#52aaf2",
|
|
944
|
+
dataPointWidthX: this.config.barWidthX ?? 4,
|
|
945
|
+
dataPointWidthZ: this.config.barWidthZ ?? 4
|
|
946
|
+
});
|
|
947
|
+
} else {
|
|
948
|
+
this.columnSeries = new ColumnRenderableSeries3D(wasmContext, {
|
|
949
|
+
dataSeries: this.dataSeries,
|
|
950
|
+
fill: this.config.barFill ?? "#52aaf2",
|
|
951
|
+
stroke: this.config.barStroke ?? "#52aaf2",
|
|
952
|
+
opacity: this.config.barOpacity ?? 0.95,
|
|
953
|
+
dataPointWidthX: this.config.barWidthX ?? 8,
|
|
954
|
+
dataPointWidthZ: this.config.barWidthZ ?? 8
|
|
955
|
+
});
|
|
956
|
+
}
|
|
786
957
|
this.surface.renderableSeries.add(this.columnSeries);
|
|
787
958
|
}
|
|
788
959
|
/**
|
|
@@ -793,20 +964,22 @@ var Column3DChart = class {
|
|
|
793
964
|
const wasmContext = this.wasmContext;
|
|
794
965
|
const sineData = new XyzDataSeries3D(wasmContext);
|
|
795
966
|
const backPlaneZ = 0;
|
|
796
|
-
const
|
|
797
|
-
const
|
|
967
|
+
const uom = this.config.unitOfMeasurement;
|
|
968
|
+
const isDbScale = uom === 3 || uom === 4 || uom === "dBm" || uom === "dB";
|
|
969
|
+
const center = this.config.sineWaveCenter ?? (isDbScale ? 40 : 2e3);
|
|
970
|
+
const amplitude = this.config.sineWaveAmplitude ?? center;
|
|
798
971
|
for (let deg = 0; deg <= 360; deg += 5) {
|
|
799
972
|
const rad = deg * Math.PI / 180;
|
|
800
973
|
const y = center + amplitude * Math.sin(rad);
|
|
801
974
|
sineData.append(deg, y, backPlaneZ);
|
|
802
975
|
}
|
|
803
|
-
|
|
976
|
+
this.sineSeries = new PointLineRenderableSeries3D(wasmContext, {
|
|
804
977
|
dataSeries: sineData,
|
|
805
978
|
stroke: "black",
|
|
806
979
|
strokeThickness: 3,
|
|
807
980
|
opacity: 1
|
|
808
981
|
});
|
|
809
|
-
this.surface.renderableSeries.add(sineSeries);
|
|
982
|
+
this.surface.renderableSeries.add(this.sineSeries);
|
|
810
983
|
}
|
|
811
984
|
/**
|
|
812
985
|
* Add tooltip modifier
|
|
@@ -816,12 +989,14 @@ var Column3DChart = class {
|
|
|
816
989
|
const xTitle = this.config.xAxisTitle ?? "Phase Angle";
|
|
817
990
|
const yTitle = this.config.yAxisTitle ?? "Amplitude";
|
|
818
991
|
const zTitle = this.config.zAxisTitle ?? "Cycle";
|
|
992
|
+
const uom = this.config.unitOfMeasurement;
|
|
993
|
+
const unit = uom ? UOM_LABELS[uom] || uom : "mVp";
|
|
819
994
|
const tooltipModifier = new TooltipModifier3D({
|
|
820
995
|
tooltipDataTemplate: (seriesInfo) => {
|
|
821
996
|
const valuesWithLabels = [];
|
|
822
997
|
if (seriesInfo && seriesInfo.isHit) {
|
|
823
|
-
valuesWithLabels.push(`${xTitle}: ${seriesInfo.xValue}`);
|
|
824
|
-
valuesWithLabels.push(`${yTitle}: ${seriesInfo.yValue}`);
|
|
998
|
+
valuesWithLabels.push(`${xTitle}: ${seriesInfo.xValue}\xB0`);
|
|
999
|
+
valuesWithLabels.push(`${yTitle}: ${seriesInfo.yValue} ${unit}`);
|
|
825
1000
|
valuesWithLabels.push(`${zTitle}: ${seriesInfo.zValue}`);
|
|
826
1001
|
}
|
|
827
1002
|
return valuesWithLabels;
|
|
@@ -833,12 +1008,30 @@ var Column3DChart = class {
|
|
|
833
1008
|
* Set new data for the chart
|
|
834
1009
|
*/
|
|
835
1010
|
setData(data) {
|
|
836
|
-
if (!this.dataSeries) {
|
|
1011
|
+
if (!this.dataSeries || !this.surface || !this.wasmContext) {
|
|
837
1012
|
this.config.data = data;
|
|
838
1013
|
return;
|
|
839
1014
|
}
|
|
1015
|
+
const uom = this.config.unitOfMeasurement;
|
|
1016
|
+
const convertedData = data.map(([x, y, z]) => {
|
|
1017
|
+
let convertedY = Math.abs(y);
|
|
1018
|
+
if (uom === 3 || uom === "dBm") {
|
|
1019
|
+
convertedY = mVrmsToDbm(convertedY);
|
|
1020
|
+
} else if (uom === 4 || uom === "dB") {
|
|
1021
|
+
convertedY = mVpToDb(convertedY);
|
|
1022
|
+
}
|
|
1023
|
+
return [x, convertedY, z];
|
|
1024
|
+
});
|
|
1025
|
+
let pulseCount = 0;
|
|
1026
|
+
let peakValue = 0;
|
|
1027
|
+
convertedData.forEach(([, y]) => {
|
|
1028
|
+
pulseCount++;
|
|
1029
|
+
if (y > peakValue) peakValue = y;
|
|
1030
|
+
});
|
|
1031
|
+
this.stats = { pulseCount, peakValue: parseFloat(peakValue.toFixed(2)) };
|
|
1032
|
+
this.config.onStatsChange?.(this.stats);
|
|
840
1033
|
this.dataSeries.clear();
|
|
841
|
-
|
|
1034
|
+
convertedData.forEach(([x, y, z]) => {
|
|
842
1035
|
this.dataSeries.append(x, y, z);
|
|
843
1036
|
});
|
|
844
1037
|
if (this.surface) {
|
|
@@ -856,6 +1049,42 @@ var Column3DChart = class {
|
|
|
856
1049
|
}
|
|
857
1050
|
this.surface.invalidateElement();
|
|
858
1051
|
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Set camera to a preset position
|
|
1054
|
+
*/
|
|
1055
|
+
setCameraPreset(presetIndex) {
|
|
1056
|
+
const presets = this.config.cameraPresets ?? DEFAULT_CAMERA_PRESETS;
|
|
1057
|
+
if (presetIndex >= 0 && presetIndex < presets.length) {
|
|
1058
|
+
const preset = presets[presetIndex];
|
|
1059
|
+
this.setCameraPosition(preset.position, preset.target);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
/**
|
|
1063
|
+
* Reset camera to initial position
|
|
1064
|
+
*/
|
|
1065
|
+
resetCamera() {
|
|
1066
|
+
this.setCameraPosition(this.initialCameraPosition, this.initialCameraTarget);
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Update Y axis range
|
|
1070
|
+
*/
|
|
1071
|
+
setYAxisRange(min, max) {
|
|
1072
|
+
if (!this.surface) return;
|
|
1073
|
+
this.surface.yAxis.visibleRange = new NumberRange(min, max);
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Update Z axis range (cycle range)
|
|
1077
|
+
*/
|
|
1078
|
+
setZAxisRange(min, max) {
|
|
1079
|
+
if (!this.surface) return;
|
|
1080
|
+
this.surface.zAxis.visibleRange = new NumberRange(min, max);
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Get current statistics
|
|
1084
|
+
*/
|
|
1085
|
+
getStats() {
|
|
1086
|
+
return { ...this.stats };
|
|
1087
|
+
}
|
|
859
1088
|
/**
|
|
860
1089
|
* Update chart options
|
|
861
1090
|
*/
|
|
@@ -863,7 +1092,7 @@ var Column3DChart = class {
|
|
|
863
1092
|
this.config = { ...this.config, ...options };
|
|
864
1093
|
if (options.cameraPosition && this.surface && this.wasmContext) {
|
|
865
1094
|
const pos = options.cameraPosition;
|
|
866
|
-
const target = options.cameraTarget ?? { x: 0, y:
|
|
1095
|
+
const target = options.cameraTarget ?? this.config.cameraTarget ?? { x: 0, y: 50, z: 0 };
|
|
867
1096
|
this.setCameraPosition(pos, target);
|
|
868
1097
|
}
|
|
869
1098
|
if (options.barFill || options.barStroke || options.barOpacity) {
|
|
@@ -873,6 +1102,12 @@ var Column3DChart = class {
|
|
|
873
1102
|
if (options.barOpacity !== void 0) this.columnSeries.opacity = options.barOpacity;
|
|
874
1103
|
}
|
|
875
1104
|
}
|
|
1105
|
+
if (options.yRange && this.surface) {
|
|
1106
|
+
this.surface.yAxis.visibleRange = new NumberRange(options.yRange.min, options.yRange.max);
|
|
1107
|
+
}
|
|
1108
|
+
if (options.zRange && this.surface) {
|
|
1109
|
+
this.surface.zAxis.visibleRange = new NumberRange(options.zRange.min, options.zRange.max);
|
|
1110
|
+
}
|
|
876
1111
|
}
|
|
877
1112
|
/**
|
|
878
1113
|
* Get the SciChart surface for advanced operations
|
|
@@ -880,6 +1115,17 @@ var Column3DChart = class {
|
|
|
880
1115
|
getSurface() {
|
|
881
1116
|
return this.surface;
|
|
882
1117
|
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Notify SciChart that the container has resized so the WebGL canvas
|
|
1120
|
+
* adjusts to the new dimensions. Call after maximize / minimize.
|
|
1121
|
+
*/
|
|
1122
|
+
resize() {
|
|
1123
|
+
if (!this.surface || this.isDestroyed) return;
|
|
1124
|
+
try {
|
|
1125
|
+
this.surface.invalidateElement?.();
|
|
1126
|
+
} catch {
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
883
1129
|
/**
|
|
884
1130
|
* Destroy and clean up
|
|
885
1131
|
*/
|
|
@@ -903,7 +1149,7 @@ var Column3DChart = class {
|
|
|
903
1149
|
return { ...this.config };
|
|
904
1150
|
}
|
|
905
1151
|
/**
|
|
906
|
-
* Check if chart is ready
|
|
1152
|
+
* Check if chart is ready
|
|
907
1153
|
*/
|
|
908
1154
|
isReady() {
|
|
909
1155
|
return this.surface !== null && !this.isDestroyed;
|
|
@@ -953,7 +1199,7 @@ var defaultPRPDColorStops = [
|
|
|
953
1199
|
{ offset: 1, color: "Red" }
|
|
954
1200
|
];
|
|
955
1201
|
var createPRPDTheme = () => {
|
|
956
|
-
const theme = new SciChartJSLightTheme();
|
|
1202
|
+
const theme = new SciChartJSLightTheme$1();
|
|
957
1203
|
theme.sciChartBackground = "#f9f9f9";
|
|
958
1204
|
theme.gridBackgroundBrush = "grey";
|
|
959
1205
|
theme.axisBandsFill = "#dcdcdc";
|
|
@@ -962,7 +1208,7 @@ var createPRPDTheme = () => {
|
|
|
962
1208
|
return theme;
|
|
963
1209
|
};
|
|
964
1210
|
var createLegendTheme = () => {
|
|
965
|
-
const theme = new SciChartJSLightTheme();
|
|
1211
|
+
const theme = new SciChartJSLightTheme$1();
|
|
966
1212
|
theme.sciChartBackground = "#ffffff";
|
|
967
1213
|
theme.gridBackgroundBrush = "#ffffff";
|
|
968
1214
|
theme.axisBandsFill = "#ffffff";
|
|
@@ -1544,6 +1790,6 @@ function configureSciChart(options) {
|
|
|
1544
1790
|
}
|
|
1545
1791
|
}
|
|
1546
1792
|
|
|
1547
|
-
export { BaseChart, Column3DChart, PRPDChart, Surface3DChart, VERSION, calculateDataRange, clamp, configureSciChart, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, normalizeDataPoints, parseSize, throttle };
|
|
1793
|
+
export { BaseChart, Column3DChart, DEFAULT_CAMERA_PRESETS, PRPDChart, Surface3DChart, UOM_LABELS, VERSION, calculateDataRange, clamp, configureSciChart, createColumn3DChart, createPRPDChart, createSurface3DChart, debounce, deepMerge, extractXValues, extractYValues, formatNumber, generateId, hexToRgba, lerp, mVpToDb, mVrmsToDbm, normalizeDataPoints, parseSize, throttle };
|
|
1548
1794
|
//# sourceMappingURL=index.mjs.map
|
|
1549
1795
|
//# sourceMappingURL=index.mjs.map
|