@rfkit/charts 1.2.18 → 1.2.19
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/hooks/useSpectrumChartType.d.ts +1 -1
- package/index.js +32 -23
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ export interface Props {
|
|
|
3
3
|
type: ChartType;
|
|
4
4
|
heatmapElementID?: string;
|
|
5
5
|
}
|
|
6
|
-
export default function useSpectrumChartType({ type, heatmapElementID
|
|
6
|
+
export default function useSpectrumChartType({ type, heatmapElementID }: Props): {
|
|
7
7
|
enableMetrics: boolean;
|
|
8
8
|
enableWaterfall: boolean;
|
|
9
9
|
};
|
package/index.js
CHANGED
|
@@ -12050,8 +12050,8 @@ const ToolsBar_ToolsBar = ({ type })=>{
|
|
|
12050
12050
|
const hiddenToolsSet = new Set(hiddenTools);
|
|
12051
12051
|
return (config)=>{
|
|
12052
12052
|
if (hiddenToolsSet.has(config.toolType)) return false;
|
|
12053
|
-
if (config.supportedCharts.length > 0) return config.supportedCharts.includes(type);
|
|
12054
|
-
if (config.excludedCharts && config.excludedCharts.length > 0) return !config.excludedCharts.includes(type);
|
|
12053
|
+
if (config.supportedCharts.length > 0) return type ? config.supportedCharts.includes(type) : false;
|
|
12054
|
+
if (config.excludedCharts && config.excludedCharts.length > 0) return type ? !config.excludedCharts.includes(type) : true;
|
|
12055
12055
|
return true;
|
|
12056
12056
|
};
|
|
12057
12057
|
}, [
|
|
@@ -13496,29 +13496,36 @@ const FrequencyAllocation_FrequencyAllocation = ()=>{
|
|
|
13496
13496
|
y: 0
|
|
13497
13497
|
});
|
|
13498
13498
|
const getFrequencyRange = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((band)=>{
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
}
|
|
13511
|
-
if (null != band.centerFrequency && null != band.bandwidth)
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13499
|
+
let range = null;
|
|
13500
|
+
if (null != band.startFrequency && null != band.stopFrequency) {
|
|
13501
|
+
range = (0, utils.Ce)({
|
|
13502
|
+
startFrequency: Number(band.startFrequency),
|
|
13503
|
+
stopFrequency: Number(band.stopFrequency)
|
|
13504
|
+
});
|
|
13505
|
+
if (range) return {
|
|
13506
|
+
start: range.startFreq,
|
|
13507
|
+
stop: range.stopFreq,
|
|
13508
|
+
type: 'range'
|
|
13509
|
+
};
|
|
13510
|
+
}
|
|
13511
|
+
if (null != band.centerFrequency && null != band.bandwidth) {
|
|
13512
|
+
range = (0, utils.Ce)({
|
|
13513
|
+
frequency: Number(band.centerFrequency),
|
|
13514
|
+
bandwidth: Number(band.bandwidth)
|
|
13515
|
+
});
|
|
13516
|
+
if (range) return {
|
|
13517
|
+
start: range.startFreq,
|
|
13518
|
+
stop: range.stopFreq,
|
|
13519
|
+
frequency: Number(band.centerFrequency),
|
|
13520
|
+
bandwidth: Number(band.bandwidth),
|
|
13521
|
+
type: 'centerBandwidth'
|
|
13522
|
+
};
|
|
13523
|
+
}
|
|
13518
13524
|
return null;
|
|
13519
13525
|
}, []);
|
|
13520
13526
|
const segmentData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
13521
13527
|
if (!segments?.length || !frequencyAllocationData) return [];
|
|
13528
|
+
const totalSegmentPoints = segments.reduce((sum, s)=>sum + s.point, 0);
|
|
13522
13529
|
return segments.map((segment, segmentIndex)=>{
|
|
13523
13530
|
const segmentBands = frequencyAllocationData.map((band)=>{
|
|
13524
13531
|
const range = getFrequencyRange(band);
|
|
@@ -13544,13 +13551,15 @@ const FrequencyAllocation_FrequencyAllocation = ()=>{
|
|
|
13544
13551
|
}
|
|
13545
13552
|
};
|
|
13546
13553
|
});
|
|
13554
|
+
const segmentWidth = segment.point / totalSegmentPoints * 100;
|
|
13555
|
+
const segmentLeft = segments.slice(0, segmentIndex).reduce((sum, s)=>sum + s.point / totalSegmentPoints * 100, 0);
|
|
13547
13556
|
return {
|
|
13548
13557
|
segment,
|
|
13549
13558
|
segmentIndex,
|
|
13550
13559
|
bandPositions,
|
|
13551
13560
|
style: {
|
|
13552
|
-
left: `${
|
|
13553
|
-
width: `${
|
|
13561
|
+
left: `${segmentLeft}%`,
|
|
13562
|
+
width: `${segmentWidth}%`
|
|
13554
13563
|
}
|
|
13555
13564
|
};
|
|
13556
13565
|
});
|