Skip to content

Commit f48e167

Browse files
committed
Code issues are resolved
1 parent 750991a commit f48e167

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/graph_spectrum_calc.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ GraphSpectrumCalc.dataLoadFrequencyPSD = function() {
113113
const psd = this._psd(flightSamples.samples, this._blackBoxRate, points_per_segment, overlap_count);
114114
let min = 1e6,
115115
max = -1e6;
116-
for (let i = 0; i < psd.length; i++) {
117-
min = Math.min(psd[i], min);
118-
max = Math.max(psd[i], max);
116+
for (const value of psd) {
117+
min = Math.min(value, min);
118+
max = Math.max(value, max);
119119
}
120120

121121
const psdData = {
@@ -531,8 +531,8 @@ GraphSpectrumCalc._psd = function(samples, fs, n_per_seg, n_overlap, scaling =
531531
const window = Array(n_per_seg).fill(1);
532532
this._hanningWindow(window, n_per_seg);
533533
let skSum = 0;
534-
for (const i in window) {
535-
skSum += window[i] ** 2;
534+
for (const value of window) {
535+
skSum += value ** 2;
536536
}
537537
scale = 1 / (fs * skSum);
538538
} else {
@@ -543,8 +543,8 @@ GraphSpectrumCalc._psd = function(samples, fs, n_per_seg, n_overlap, scaling =
543543
const window = Array(n_per_seg).fill(1);
544544
this._hanningWindow(window, n_per_seg);
545545
let sum = 0;
546-
for (const i in window) {
547-
sum += window[i];
546+
for (const value of window) {
547+
sum += value;
548548
}
549549
scale = 1 / sum ** 2;
550550
} else {

src/graph_spectrum_plot.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ GraphSpectrumPlot._drawFrequencyGraph = function (canvasCtx) {
299299
this._fftData.fieldName,
300300
WIDTH - 4,
301301
HEIGHT - 6,
302-
"right"
302+
"right",
303303
);
304304
this._drawHorizontalGridLines(
305305
canvasCtx,
@@ -309,7 +309,7 @@ GraphSpectrumPlot._drawFrequencyGraph = function (canvasCtx) {
309309
WIDTH,
310310
HEIGHT,
311311
MARGIN,
312-
"Hz"
312+
"Hz",
313313
);
314314
};
315315

@@ -319,7 +319,6 @@ GraphSpectrumPlot._drawFrequencyPSDGraph = function (canvasCtx) {
319319
const LEFT = canvasCtx.canvas.left;
320320
const TOP = canvasCtx.canvas.top;
321321

322-
const PLOTTED_BUFFER_LENGTH = this._fftData.psdLength / this._zoomX;
323322
const PLOTTED_BLACKBOX_RATE = this._fftData.blackBoxRate / this._zoomX;
324323

325324
canvasCtx.save();
@@ -351,7 +350,7 @@ GraphSpectrumPlot._drawFrequencyPSDGraph = function (canvasCtx) {
351350
this._fftData.fieldName,
352351
WIDTH - 4,
353352
HEIGHT - 6,
354-
"right"
353+
"right",
355354
);
356355
this._drawHorizontalGridLines(
357356
canvasCtx,
@@ -361,9 +360,9 @@ GraphSpectrumPlot._drawFrequencyPSDGraph = function (canvasCtx) {
361360
WIDTH,
362361
HEIGHT,
363362
MARGIN,
364-
"Hz"
363+
"Hz",
365364
);
366-
}
365+
};
367366

368367
GraphSpectrumPlot._drawFrequencyVsXGraph = function (canvasCtx) {
369368
const PLOTTED_BLACKBOX_RATE = this._fftData.blackBoxRate / this._zoomX;

0 commit comments

Comments
 (0)