@rfkit/charts 1.9.1 → 1.10.0
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 +2 -0
- package/index.js +43 -8
- package/package.json +1 -1
- package/types/publish.d.ts +1 -0
package/README.md
CHANGED
|
@@ -96,6 +96,8 @@ export function GaugeDemo() {
|
|
|
96
96
|
|
|
97
97
|
`PublishSpectrum` 支持推送内置频谱数据线,包括 `data`、`maxData`、`minData`、`avgData`、`thresholdData`、`templateData`、`backgroundNoiseData` 和 `extraData`。`thresholdData` 不传 `segmentOffset` / `offset` 时按整条门限替换;传入 `segmentOffset` 或 `offset` 时按局部门限写入。
|
|
98
98
|
|
|
99
|
+
`extraData` 默认保持完整数组设置语义;设置 `segmentedExtraData: true` 后,同一次推送中的每条额外频谱线会独立使用 `segmentOffset + offset` 拼接,并随主实时值同步缩放。
|
|
100
|
+
|
|
99
101
|
独立 `Heatmap` 可以显式开启 X/Y 同步缩放:
|
|
100
102
|
|
|
101
103
|
```tsx
|
package/index.js
CHANGED
|
@@ -19567,20 +19567,52 @@ class SpectrumAnalyzer {
|
|
|
19567
19567
|
});
|
|
19568
19568
|
this.setPendingFlag("occupancy", false);
|
|
19569
19569
|
}
|
|
19570
|
-
setExtraData(data, mode = types_ExtraDataMode.MERGE) {
|
|
19571
|
-
if (mode === types_ExtraDataMode.CLEAR
|
|
19570
|
+
setExtraData(data, mode = types_ExtraDataMode.MERGE, options) {
|
|
19571
|
+
if (mode === types_ExtraDataMode.CLEAR) {
|
|
19572
19572
|
this.extraData = {};
|
|
19573
19573
|
this.extraOutputData = {};
|
|
19574
19574
|
this.setPendingFlag("extra", false);
|
|
19575
|
+
return;
|
|
19575
19576
|
}
|
|
19576
|
-
if (
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19577
|
+
if (!data) {
|
|
19578
|
+
if (mode === types_ExtraDataMode.REPLACE) {
|
|
19579
|
+
this.extraData = {};
|
|
19580
|
+
this.extraOutputData = {};
|
|
19581
|
+
this.setPendingFlag("extra", false);
|
|
19582
|
+
}
|
|
19583
|
+
return;
|
|
19584
|
+
}
|
|
19585
|
+
const entries = Object.entries(data).map(([key, value1])=>[
|
|
19586
|
+
key,
|
|
19587
|
+
value1?.length ? new Float32Array(value1) : null
|
|
19588
|
+
]);
|
|
19589
|
+
const index = options ? this.resolveGlobalIndex(options.segmentOffset ?? 0, options.offset ?? 0) : 0;
|
|
19590
|
+
if (options) {
|
|
19591
|
+
for (const [, value1] of entries)if (value1) this.validateInput(value1, index);
|
|
19592
|
+
}
|
|
19593
|
+
if (mode === types_ExtraDataMode.REPLACE) {
|
|
19594
|
+
this.extraData = {};
|
|
19595
|
+
this.extraOutputData = {};
|
|
19596
|
+
this.setPendingFlag("extra", false);
|
|
19597
|
+
}
|
|
19598
|
+
for (const [key, value1] of entries){
|
|
19599
|
+
if (!value1) {
|
|
19580
19600
|
delete this.extraData[key];
|
|
19581
19601
|
continue;
|
|
19582
19602
|
}
|
|
19583
|
-
|
|
19603
|
+
if (!options) {
|
|
19604
|
+
this.extraData[key] = value1;
|
|
19605
|
+
continue;
|
|
19606
|
+
}
|
|
19607
|
+
let target = this.extraData[key];
|
|
19608
|
+
if (target?.length !== this.config.maxPoints) {
|
|
19609
|
+
const next = new Float32Array(this.config.maxPoints);
|
|
19610
|
+
next.fill(SPECTRUM.INITIAL_VALUE);
|
|
19611
|
+
if (target?.length) next.set(target.subarray(0, this.config.maxPoints));
|
|
19612
|
+
target = next;
|
|
19613
|
+
this.extraData[key] = target;
|
|
19614
|
+
}
|
|
19615
|
+
target.set(value1, index);
|
|
19584
19616
|
}
|
|
19585
19617
|
if (!this.hasProcessedData || this.isProcessing) return void this.setPendingFlag("extra", true);
|
|
19586
19618
|
this.extraOutputData = resampleExtraData(this.extraData, this.antennaFactorData, this.antennaFactorSwitch, this.srcIndexCache, this.getOutputData.bind(this));
|
|
@@ -33017,7 +33049,10 @@ function useSpectrumAnalyzer(props) {
|
|
|
33017
33049
|
if (e.avgData) analyzer.current.setAvgData(e.avgData);
|
|
33018
33050
|
if (e.templateData) analyzer.current.setTemplateData(e.templateData, e.templateTolerance);
|
|
33019
33051
|
if (e.backgroundNoiseData) analyzer.current.setBackgroundNoiseData(e.backgroundNoiseData);
|
|
33020
|
-
if (e.extraData) analyzer.current
|
|
33052
|
+
if (e.extraData) analyzer.current.setExtraData(e.extraData, types_ExtraDataMode.MERGE, e.segmentedExtraData ? {
|
|
33053
|
+
segmentOffset: e.segmentOffset,
|
|
33054
|
+
offset: e.offset
|
|
33055
|
+
} : void 0);
|
|
33021
33056
|
break;
|
|
33022
33057
|
case constants_PSType.Fluorescence:
|
|
33023
33058
|
if (e.data && analyzer.current) analyzer.current.setFluorescenceData(e.data.fluorescenceData, e.data.fluorescenceMaxCount);
|
package/package.json
CHANGED
package/types/publish.d.ts
CHANGED