@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.
@@ -3,7 +3,7 @@ export interface Props {
3
3
  type: ChartType;
4
4
  heatmapElementID?: string;
5
5
  }
6
- export default function useSpectrumChartType({ type, heatmapElementID, }: Props): {
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
- const range = (0, utils.Ce)({
13500
- frequency: null != band.centerFrequency ? Number(band.centerFrequency) : void 0,
13501
- bandwidth: null != band.bandwidth ? Number(band.bandwidth) : void 0,
13502
- startFrequency: null != band.startFrequency ? Number(band.startFrequency) : void 0,
13503
- stopFrequency: null != band.stopFrequency ? Number(band.stopFrequency) : void 0
13504
- });
13505
- if (!range) return null;
13506
- if (null != band.startFrequency && null != band.stopFrequency) return {
13507
- start: range.startFreq,
13508
- stop: range.stopFreq,
13509
- type: 'range'
13510
- };
13511
- if (null != band.centerFrequency && null != band.bandwidth) return {
13512
- start: range.startFreq,
13513
- stop: range.stopFreq,
13514
- frequency: Number(band.centerFrequency),
13515
- bandwidth: Number(band.bandwidth),
13516
- type: 'centerBandwidth'
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: `${segment.progress?.[0] || 0}%`,
13553
- width: `${(segment.progress?.[1] || 100) - (segment.progress?.[0] || 0)}%`
13561
+ left: `${segmentLeft}%`,
13562
+ width: `${segmentWidth}%`
13554
13563
  }
13555
13564
  };
13556
13565
  });
package/package.json CHANGED
@@ -5,6 +5,6 @@
5
5
  "types": "index.d.ts",
6
6
  "author": "Hxgh",
7
7
  "license": "MIT",
8
- "version": "1.2.18",
8
+ "version": "1.2.19",
9
9
  "private": false
10
10
  }