@rfkit/charts 1.0.89 → 1.0.91
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/index.d.ts +1 -1
- package/index.js +41 -19
- package/package.json +1 -1
- package/types/publish.d.ts +1 -0
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Spectrum, LevelStream, IQ, Gauge, Dial, Heatmap, Occupancy, } from './lib';
|
|
2
2
|
export type { RecursiveObject, // 递归对象 后期会删除
|
|
3
3
|
RecursiveFunction, // 递归方法 后期会删除
|
|
4
|
-
AxisYRange, AxisXProps, SeriesConfig, SegmentsOriginal, SpectrumBandwidth, MarkerType, SetSeries, SetSpectrumBandwidth, SetSegments, SetAntennaFactor, SetChannels, SetMarker, SpectrumExtraData, PublishSpectrum, PublishHeatmap, PublishOccupancy, PublishLevelStream, PublishIQ, PublishDial, PublishGauge, Reset, Render, PublishData, } from './types';
|
|
4
|
+
AxisYRange, AxisXProps, SeriesConfig, SegmentsOriginal, SpectrumBandwidth, MarkerType, SetSeries, SetSpectrumBandwidth, SetSegments, SetAntennaFactor, SetChannels, SetMarker, SpectrumExtraData, PublishSpectrum, PublishHeatmap, PublishOccupancy, PublishLevelStream, PublishIQ, PublishDial, PublishGauge, Reset, Render, PublishData, Publish, } from './types';
|
|
5
5
|
export { HeatmapCaptureType } from './types';
|
|
6
6
|
export { PSType, ChartType, SegmentsEvent, MarkerEventType, SeriesType, OptionKey, } from './config';
|
package/index.js
CHANGED
|
@@ -4829,6 +4829,9 @@ const store = Store;
|
|
|
4829
4829
|
const PUB_SUB = (globalID, func)=>subscription_createSubscriptionManager(`PUB_SUB-${globalID}`, '0', func);
|
|
4830
4830
|
const usePublish = ({ publish = ()=>{}, subscribe = ()=>{} })=>{
|
|
4831
4831
|
const { state: { globalID }, dispatch } = useStore_useStore();
|
|
4832
|
+
const getSourceData = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>withDatabase(globalID), [
|
|
4833
|
+
globalID
|
|
4834
|
+
]);
|
|
4832
4835
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
4833
4836
|
if (globalID) PUB_SUB(globalID, subscribe);
|
|
4834
4837
|
}, [
|
|
@@ -4837,12 +4840,14 @@ const usePublish = ({ publish = ()=>{}, subscribe = ()=>{} })=>{
|
|
|
4837
4840
|
]);
|
|
4838
4841
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
4839
4842
|
if (globalID) {
|
|
4843
|
+
const p = PUB_SUB(globalID);
|
|
4844
|
+
p.getSourceData = getSourceData;
|
|
4840
4845
|
dispatch({
|
|
4841
4846
|
payload: {
|
|
4842
|
-
publish:
|
|
4847
|
+
publish: p
|
|
4843
4848
|
}
|
|
4844
4849
|
});
|
|
4845
|
-
publish?.(
|
|
4850
|
+
publish?.(p);
|
|
4846
4851
|
}
|
|
4847
4852
|
}, [
|
|
4848
4853
|
JSON.stringify(publish),
|
|
@@ -5509,6 +5514,12 @@ class engine_Engine {
|
|
|
5509
5514
|
const canvas = document.createElement('canvas');
|
|
5510
5515
|
const ctx = canvas.getContext?.('2d');
|
|
5511
5516
|
canvas.style.transform = 'scaleY(-1)';
|
|
5517
|
+
if (ctx) {
|
|
5518
|
+
ctx.imageSmoothingEnabled = false;
|
|
5519
|
+
ctx.lineJoin = 'miter';
|
|
5520
|
+
ctx.lineCap = 'butt';
|
|
5521
|
+
ctx.textBaseline = 'middle';
|
|
5522
|
+
}
|
|
5512
5523
|
this.updateProps({
|
|
5513
5524
|
container,
|
|
5514
5525
|
canvas,
|
|
@@ -5609,6 +5620,8 @@ class Series extends engine_Engine {
|
|
|
5609
5620
|
if (!disabledClearRect) this.clearRect();
|
|
5610
5621
|
const seriesArray = Object.values(series);
|
|
5611
5622
|
const { range: [min, , rangeY], canvas: { width, height } } = this.state;
|
|
5623
|
+
ctx.save();
|
|
5624
|
+
ctx.translate(0.5, 0.5);
|
|
5612
5625
|
for(let s = 0; s < seriesArray.length; s += 1){
|
|
5613
5626
|
const { display, thickness, color, type, data, orientation } = seriesArray[s];
|
|
5614
5627
|
if (!data || !display) continue;
|
|
@@ -5641,7 +5654,7 @@ class Series extends engine_Engine {
|
|
|
5641
5654
|
points = [];
|
|
5642
5655
|
}
|
|
5643
5656
|
} else {
|
|
5644
|
-
const x = (i + 0.5) * per;
|
|
5657
|
+
const x = Math.round((i + 0.5) * per);
|
|
5645
5658
|
const y = Math.round((value - min) / rangeY * height);
|
|
5646
5659
|
points.push([
|
|
5647
5660
|
x,
|
|
@@ -5667,20 +5680,21 @@ class Series extends engine_Engine {
|
|
|
5667
5680
|
ctx.beginPath();
|
|
5668
5681
|
ctx.moveTo(points[0][0], points[0][1]);
|
|
5669
5682
|
for(let j = 1; j < points.length; j++){
|
|
5670
|
-
const [
|
|
5683
|
+
const [_, py] = points[j - 1];
|
|
5671
5684
|
const [cx, cy] = points[j];
|
|
5672
|
-
ctx.lineTo(
|
|
5685
|
+
ctx.lineTo(cx, py);
|
|
5673
5686
|
ctx.lineTo(cx, cy);
|
|
5674
5687
|
}
|
|
5675
5688
|
const [lx, ly] = points[points.length - 1];
|
|
5676
|
-
|
|
5689
|
+
const endX = Math.round(lx + per);
|
|
5690
|
+
ctx.lineTo(endX, ly);
|
|
5677
5691
|
ctx.lineWidth = thickness;
|
|
5678
5692
|
ctx.strokeStyle = color;
|
|
5679
5693
|
ctx.stroke();
|
|
5680
5694
|
points = [];
|
|
5681
5695
|
}
|
|
5682
5696
|
} else {
|
|
5683
|
-
const x = i * per;
|
|
5697
|
+
const x = Math.round(i * per);
|
|
5684
5698
|
const y = Math.round((value - min) / rangeY * height);
|
|
5685
5699
|
points.push([
|
|
5686
5700
|
x,
|
|
@@ -5692,13 +5706,14 @@ class Series extends engine_Engine {
|
|
|
5692
5706
|
ctx.beginPath();
|
|
5693
5707
|
ctx.moveTo(points[0][0], points[0][1]);
|
|
5694
5708
|
for(let j = 1; j < points.length; j++){
|
|
5695
|
-
const [
|
|
5709
|
+
const [_, py] = points[j - 1];
|
|
5696
5710
|
const [cx, cy] = points[j];
|
|
5697
|
-
ctx.lineTo(
|
|
5711
|
+
ctx.lineTo(cx, py);
|
|
5698
5712
|
ctx.lineTo(cx, cy);
|
|
5699
5713
|
}
|
|
5700
5714
|
const [lx, ly] = points[points.length - 1];
|
|
5701
|
-
|
|
5715
|
+
const endX = Math.round(lx + per);
|
|
5716
|
+
ctx.lineTo(endX, ly);
|
|
5702
5717
|
ctx.lineWidth = thickness;
|
|
5703
5718
|
ctx.strokeStyle = color;
|
|
5704
5719
|
ctx.stroke();
|
|
@@ -5708,7 +5723,7 @@ class Series extends engine_Engine {
|
|
|
5708
5723
|
const radius = thickness / 2;
|
|
5709
5724
|
const endAngle = 2 * Math.PI;
|
|
5710
5725
|
for(let i = 0; i < len; i += 1){
|
|
5711
|
-
const x = (i + 0.5) * per;
|
|
5726
|
+
const x = Math.round((i + 0.5) * per);
|
|
5712
5727
|
const y = Math.round((data[i] - min) / rangeY * height);
|
|
5713
5728
|
ctx.beginPath();
|
|
5714
5729
|
ctx.arc(x, y, radius, 0, endAngle);
|
|
@@ -5719,7 +5734,7 @@ class Series extends engine_Engine {
|
|
|
5719
5734
|
if (type === type_GraphicType.Rect) {
|
|
5720
5735
|
const side = +thickness;
|
|
5721
5736
|
for(let i = 0; i < len; i += 1){
|
|
5722
|
-
const x = (i + 0.5) * per;
|
|
5737
|
+
const x = Math.round((i + 0.5) * per);
|
|
5723
5738
|
const y = Math.round((data[i] - min) / rangeY * height);
|
|
5724
5739
|
ctx.beginPath();
|
|
5725
5740
|
ctx.rect(x, y, side, side);
|
|
@@ -5750,6 +5765,7 @@ class Series extends engine_Engine {
|
|
|
5750
5765
|
ctx.fill();
|
|
5751
5766
|
}
|
|
5752
5767
|
}
|
|
5768
|
+
ctx.restore();
|
|
5753
5769
|
}
|
|
5754
5770
|
}
|
|
5755
5771
|
var Tooltip_styles_module = __webpack_require__("../../../node_modules/.pnpm/@rsbuild+core@1.3.18/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[11].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[11].use[2]!../../../node_modules/.pnpm/@rsbuild+plugin-less@1.2.4_@rsbuild+core@1.3.22/node_modules/@rsbuild/plugin-less/compiled/less-loader/index.js??ruleSet[1].rules[11].use[3]!./src/components/Tooltip/styles.module.less");
|
|
@@ -10217,27 +10233,29 @@ const GridLinesSVG = ({ row = 10, col = 10, strokeColor = 'var(--theme-border-ba
|
|
|
10217
10233
|
const cellWidth = width / col;
|
|
10218
10234
|
const cellHeight = height / row;
|
|
10219
10235
|
for(let i = 0; i <= row; i++){
|
|
10220
|
-
const y = i * cellHeight;
|
|
10236
|
+
const y = Math.round(i * cellHeight);
|
|
10221
10237
|
newHorizontalLines.push(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("line", {
|
|
10222
10238
|
x1: 0,
|
|
10223
10239
|
y1: y,
|
|
10224
|
-
x2: width,
|
|
10240
|
+
x2: Math.round(width),
|
|
10225
10241
|
y2: y,
|
|
10226
10242
|
stroke: strokeColor,
|
|
10227
10243
|
strokeWidth: strokeWidth,
|
|
10228
|
-
strokeDasharray: strokeDasharray
|
|
10244
|
+
strokeDasharray: strokeDasharray,
|
|
10245
|
+
vectorEffect: "non-scaling-stroke"
|
|
10229
10246
|
}, `h-${i}`));
|
|
10230
10247
|
}
|
|
10231
10248
|
for(let i = 0; i <= col; i++){
|
|
10232
|
-
const x = i * cellWidth;
|
|
10249
|
+
const x = Math.round(i * cellWidth);
|
|
10233
10250
|
newVerticalLines.push(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("line", {
|
|
10234
10251
|
x1: x,
|
|
10235
10252
|
y1: 0,
|
|
10236
10253
|
x2: x,
|
|
10237
|
-
y2: height,
|
|
10254
|
+
y2: Math.round(height),
|
|
10238
10255
|
stroke: strokeColor,
|
|
10239
10256
|
strokeWidth: strokeWidth,
|
|
10240
|
-
strokeDasharray: strokeDasharray
|
|
10257
|
+
strokeDasharray: strokeDasharray,
|
|
10258
|
+
vectorEffect: "non-scaling-stroke"
|
|
10241
10259
|
}, `v-${i}`));
|
|
10242
10260
|
}
|
|
10243
10261
|
setHorizontalLines(newHorizontalLines);
|
|
@@ -10269,6 +10287,8 @@ const GridLinesSVG = ({ row = 10, col = 10, strokeColor = 'var(--theme-border-ba
|
|
|
10269
10287
|
width: '100%',
|
|
10270
10288
|
height: '100%'
|
|
10271
10289
|
},
|
|
10290
|
+
shapeRendering: "crispEdges",
|
|
10291
|
+
imageRendering: "pixelated",
|
|
10272
10292
|
children: [
|
|
10273
10293
|
horizontalLines,
|
|
10274
10294
|
verticalLines
|
|
@@ -13188,7 +13208,7 @@ function useSeries() {
|
|
|
13188
13208
|
};
|
|
13189
13209
|
}
|
|
13190
13210
|
function useSpectrumAnalyzer(props) {
|
|
13191
|
-
const { state: { globalID, series: { enableMetrics, enableWaterfall }, axisY: { unit }, zoom: { interval }, heatmapCapture: { display: heatmapCaptureDisplay } }, dispatch } = useStore_useStore();
|
|
13211
|
+
const { state: { globalID, series: { enableMetrics, enableWaterfall }, axisY: { unit }, zoom: { interval }, heatmapCapture: { display: heatmapCaptureDisplay }, system: { width } }, dispatch } = useStore_useStore();
|
|
13192
13212
|
const analyzer = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
13193
13213
|
const globalIDRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(globalID);
|
|
13194
13214
|
const intervalRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(interval);
|
|
@@ -13309,8 +13329,10 @@ function useSpectrumAnalyzer(props) {
|
|
|
13309
13329
|
]);
|
|
13310
13330
|
const getEnableOption = (globalValue, propValue)=>false === globalValue ? false : propValue ?? true;
|
|
13311
13331
|
if (!analyzer.current && globalID) {
|
|
13332
|
+
const outputPoints = 1 | Math.floor(width / 2);
|
|
13312
13333
|
analyzer.current = new __WEBPACK_EXTERNAL_MODULE__rfkit_spectrum_analyzer_159ab12b__.SpectrumAnalyzer({
|
|
13313
13334
|
...props,
|
|
13335
|
+
outputPoints,
|
|
13314
13336
|
processing: {
|
|
13315
13337
|
...props?.processing,
|
|
13316
13338
|
enableMetrics: getEnableOption(enableMetrics, props?.processing?.enableMetrics),
|
package/package.json
CHANGED
package/types/publish.d.ts
CHANGED
|
@@ -94,4 +94,5 @@ export interface Render {
|
|
|
94
94
|
[key: string]: unknown;
|
|
95
95
|
}
|
|
96
96
|
export type PublishData = SetOption | SetSeries | SetSpectrumBandwidth | SetSegments | SetChannels | SetMarker | SetAntennaFactor | SetStationInfo | PublishSpectrum | PublishHeatmap | PublishOccupancy | PublishLevelStream | PublishIQ | PublishDial | PublishGauge | Reset | Render;
|
|
97
|
+
export type Publish = (p: PublishData) => void;
|
|
97
98
|
export {};
|