Skip to content

Commit d4e4ef8

Browse files
committed
Added horizont mouse position marker line at PSD chart
1 parent 4e3ebea commit d4e4ef8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/graph_spectrum_plot.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ GraphSpectrumPlot._drawPowerSpectralDensityGraph = function (canvasCtx) {
338338
const maxY = (Math.floor(this._fftData.maximum / dbStep) + 1) * dbStep;
339339
const ticksCount = (maxY - minY) / dbStep;
340340
const scaleY = HEIGHT / (maxY - minY);
341+
//Store vsRange for _drawMousePosition
342+
this._fftData.vsRange = {
343+
min: minY,
344+
max: maxY,
345+
};
341346
canvasCtx.moveTo(0, 0);
342347
for (let pointNum = 0; pointNum < pointsCount; pointNum++) {
343348
const freq = PLOTTED_BLACKBOX_RATE / 2 * pointNum / pointsCount;
@@ -374,14 +379,15 @@ GraphSpectrumPlot._drawPowerSpectralDensityGraph = function (canvasCtx) {
374379
"db/Hz",
375380
ticksCount,
376381
);
382+
const offset = 0;
377383
this._drawInterestFrequency(
378384
canvasCtx,
379385
this._fftData.maxNoiseIdx,
380386
PLOTTED_BLACKBOX_RATE,
381387
"Max noise",
382388
WIDTH,
383389
HEIGHT,
384-
15 * 5 + MARGIN,
390+
15 * offset + MARGIN,
385391
"rgba(255,0,0,0.50)",
386392
3,
387393
);
@@ -1473,6 +1479,9 @@ GraphSpectrumPlot._drawMousePosition = function (
14731479
case SPECTRUM_TYPE.FREQ_VS_RPM:
14741480
unitLabel = "Hz";
14751481
break;
1482+
case SPECTRUM_TYPE.POWER_SPECTRAL_DENSITY:
1483+
unitLabel = "db/Hz";
1484+
break;
14761485
default:
14771486
unitLabel = null;
14781487
break;

0 commit comments

Comments
 (0)