@rfkit/charts 1.0.89 → 1.0.90
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 +34 -17
- 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
|
@@ -5509,6 +5509,12 @@ class engine_Engine {
|
|
|
5509
5509
|
const canvas = document.createElement('canvas');
|
|
5510
5510
|
const ctx = canvas.getContext?.('2d');
|
|
5511
5511
|
canvas.style.transform = 'scaleY(-1)';
|
|
5512
|
+
if (ctx) {
|
|
5513
|
+
ctx.imageSmoothingEnabled = false;
|
|
5514
|
+
ctx.lineJoin = 'miter';
|
|
5515
|
+
ctx.lineCap = 'butt';
|
|
5516
|
+
ctx.textBaseline = 'middle';
|
|
5517
|
+
}
|
|
5512
5518
|
this.updateProps({
|
|
5513
5519
|
container,
|
|
5514
5520
|
canvas,
|
|
@@ -5609,6 +5615,8 @@ class Series extends engine_Engine {
|
|
|
5609
5615
|
if (!disabledClearRect) this.clearRect();
|
|
5610
5616
|
const seriesArray = Object.values(series);
|
|
5611
5617
|
const { range: [min, , rangeY], canvas: { width, height } } = this.state;
|
|
5618
|
+
ctx.save();
|
|
5619
|
+
ctx.translate(0.5, 0.5);
|
|
5612
5620
|
for(let s = 0; s < seriesArray.length; s += 1){
|
|
5613
5621
|
const { display, thickness, color, type, data, orientation } = seriesArray[s];
|
|
5614
5622
|
if (!data || !display) continue;
|
|
@@ -5641,7 +5649,7 @@ class Series extends engine_Engine {
|
|
|
5641
5649
|
points = [];
|
|
5642
5650
|
}
|
|
5643
5651
|
} else {
|
|
5644
|
-
const x = (i + 0.5) * per;
|
|
5652
|
+
const x = Math.round((i + 0.5) * per);
|
|
5645
5653
|
const y = Math.round((value - min) / rangeY * height);
|
|
5646
5654
|
points.push([
|
|
5647
5655
|
x,
|
|
@@ -5667,20 +5675,21 @@ class Series extends engine_Engine {
|
|
|
5667
5675
|
ctx.beginPath();
|
|
5668
5676
|
ctx.moveTo(points[0][0], points[0][1]);
|
|
5669
5677
|
for(let j = 1; j < points.length; j++){
|
|
5670
|
-
const [
|
|
5678
|
+
const [_, py] = points[j - 1];
|
|
5671
5679
|
const [cx, cy] = points[j];
|
|
5672
|
-
ctx.lineTo(
|
|
5680
|
+
ctx.lineTo(cx, py);
|
|
5673
5681
|
ctx.lineTo(cx, cy);
|
|
5674
5682
|
}
|
|
5675
5683
|
const [lx, ly] = points[points.length - 1];
|
|
5676
|
-
|
|
5684
|
+
const endX = Math.round(lx + per);
|
|
5685
|
+
ctx.lineTo(endX, ly);
|
|
5677
5686
|
ctx.lineWidth = thickness;
|
|
5678
5687
|
ctx.strokeStyle = color;
|
|
5679
5688
|
ctx.stroke();
|
|
5680
5689
|
points = [];
|
|
5681
5690
|
}
|
|
5682
5691
|
} else {
|
|
5683
|
-
const x = i * per;
|
|
5692
|
+
const x = Math.round(i * per);
|
|
5684
5693
|
const y = Math.round((value - min) / rangeY * height);
|
|
5685
5694
|
points.push([
|
|
5686
5695
|
x,
|
|
@@ -5692,13 +5701,14 @@ class Series extends engine_Engine {
|
|
|
5692
5701
|
ctx.beginPath();
|
|
5693
5702
|
ctx.moveTo(points[0][0], points[0][1]);
|
|
5694
5703
|
for(let j = 1; j < points.length; j++){
|
|
5695
|
-
const [
|
|
5704
|
+
const [_, py] = points[j - 1];
|
|
5696
5705
|
const [cx, cy] = points[j];
|
|
5697
|
-
ctx.lineTo(
|
|
5706
|
+
ctx.lineTo(cx, py);
|
|
5698
5707
|
ctx.lineTo(cx, cy);
|
|
5699
5708
|
}
|
|
5700
5709
|
const [lx, ly] = points[points.length - 1];
|
|
5701
|
-
|
|
5710
|
+
const endX = Math.round(lx + per);
|
|
5711
|
+
ctx.lineTo(endX, ly);
|
|
5702
5712
|
ctx.lineWidth = thickness;
|
|
5703
5713
|
ctx.strokeStyle = color;
|
|
5704
5714
|
ctx.stroke();
|
|
@@ -5708,7 +5718,7 @@ class Series extends engine_Engine {
|
|
|
5708
5718
|
const radius = thickness / 2;
|
|
5709
5719
|
const endAngle = 2 * Math.PI;
|
|
5710
5720
|
for(let i = 0; i < len; i += 1){
|
|
5711
|
-
const x = (i + 0.5) * per;
|
|
5721
|
+
const x = Math.round((i + 0.5) * per);
|
|
5712
5722
|
const y = Math.round((data[i] - min) / rangeY * height);
|
|
5713
5723
|
ctx.beginPath();
|
|
5714
5724
|
ctx.arc(x, y, radius, 0, endAngle);
|
|
@@ -5719,7 +5729,7 @@ class Series extends engine_Engine {
|
|
|
5719
5729
|
if (type === type_GraphicType.Rect) {
|
|
5720
5730
|
const side = +thickness;
|
|
5721
5731
|
for(let i = 0; i < len; i += 1){
|
|
5722
|
-
const x = (i + 0.5) * per;
|
|
5732
|
+
const x = Math.round((i + 0.5) * per);
|
|
5723
5733
|
const y = Math.round((data[i] - min) / rangeY * height);
|
|
5724
5734
|
ctx.beginPath();
|
|
5725
5735
|
ctx.rect(x, y, side, side);
|
|
@@ -5750,6 +5760,7 @@ class Series extends engine_Engine {
|
|
|
5750
5760
|
ctx.fill();
|
|
5751
5761
|
}
|
|
5752
5762
|
}
|
|
5763
|
+
ctx.restore();
|
|
5753
5764
|
}
|
|
5754
5765
|
}
|
|
5755
5766
|
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 +10228,29 @@ const GridLinesSVG = ({ row = 10, col = 10, strokeColor = 'var(--theme-border-ba
|
|
|
10217
10228
|
const cellWidth = width / col;
|
|
10218
10229
|
const cellHeight = height / row;
|
|
10219
10230
|
for(let i = 0; i <= row; i++){
|
|
10220
|
-
const y = i * cellHeight;
|
|
10231
|
+
const y = Math.round(i * cellHeight);
|
|
10221
10232
|
newHorizontalLines.push(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("line", {
|
|
10222
10233
|
x1: 0,
|
|
10223
10234
|
y1: y,
|
|
10224
|
-
x2: width,
|
|
10235
|
+
x2: Math.round(width),
|
|
10225
10236
|
y2: y,
|
|
10226
10237
|
stroke: strokeColor,
|
|
10227
10238
|
strokeWidth: strokeWidth,
|
|
10228
|
-
strokeDasharray: strokeDasharray
|
|
10239
|
+
strokeDasharray: strokeDasharray,
|
|
10240
|
+
vectorEffect: "non-scaling-stroke"
|
|
10229
10241
|
}, `h-${i}`));
|
|
10230
10242
|
}
|
|
10231
10243
|
for(let i = 0; i <= col; i++){
|
|
10232
|
-
const x = i * cellWidth;
|
|
10244
|
+
const x = Math.round(i * cellWidth);
|
|
10233
10245
|
newVerticalLines.push(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("line", {
|
|
10234
10246
|
x1: x,
|
|
10235
10247
|
y1: 0,
|
|
10236
10248
|
x2: x,
|
|
10237
|
-
y2: height,
|
|
10249
|
+
y2: Math.round(height),
|
|
10238
10250
|
stroke: strokeColor,
|
|
10239
10251
|
strokeWidth: strokeWidth,
|
|
10240
|
-
strokeDasharray: strokeDasharray
|
|
10252
|
+
strokeDasharray: strokeDasharray,
|
|
10253
|
+
vectorEffect: "non-scaling-stroke"
|
|
10241
10254
|
}, `v-${i}`));
|
|
10242
10255
|
}
|
|
10243
10256
|
setHorizontalLines(newHorizontalLines);
|
|
@@ -10269,6 +10282,8 @@ const GridLinesSVG = ({ row = 10, col = 10, strokeColor = 'var(--theme-border-ba
|
|
|
10269
10282
|
width: '100%',
|
|
10270
10283
|
height: '100%'
|
|
10271
10284
|
},
|
|
10285
|
+
shapeRendering: "crispEdges",
|
|
10286
|
+
imageRendering: "pixelated",
|
|
10272
10287
|
children: [
|
|
10273
10288
|
horizontalLines,
|
|
10274
10289
|
verticalLines
|
|
@@ -13188,7 +13203,7 @@ function useSeries() {
|
|
|
13188
13203
|
};
|
|
13189
13204
|
}
|
|
13190
13205
|
function useSpectrumAnalyzer(props) {
|
|
13191
|
-
const { state: { globalID, series: { enableMetrics, enableWaterfall }, axisY: { unit }, zoom: { interval }, heatmapCapture: { display: heatmapCaptureDisplay } }, dispatch } = useStore_useStore();
|
|
13206
|
+
const { state: { globalID, series: { enableMetrics, enableWaterfall }, axisY: { unit }, zoom: { interval }, heatmapCapture: { display: heatmapCaptureDisplay }, system: { width } }, dispatch } = useStore_useStore();
|
|
13192
13207
|
const analyzer = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
13193
13208
|
const globalIDRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(globalID);
|
|
13194
13209
|
const intervalRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(interval);
|
|
@@ -13309,8 +13324,10 @@ function useSpectrumAnalyzer(props) {
|
|
|
13309
13324
|
]);
|
|
13310
13325
|
const getEnableOption = (globalValue, propValue)=>false === globalValue ? false : propValue ?? true;
|
|
13311
13326
|
if (!analyzer.current && globalID) {
|
|
13327
|
+
const outputPoints = 1 | Math.floor(width / 2);
|
|
13312
13328
|
analyzer.current = new __WEBPACK_EXTERNAL_MODULE__rfkit_spectrum_analyzer_159ab12b__.SpectrumAnalyzer({
|
|
13313
13329
|
...props,
|
|
13330
|
+
outputPoints,
|
|
13314
13331
|
processing: {
|
|
13315
13332
|
...props?.processing,
|
|
13316
13333
|
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 {};
|