File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -405,6 +405,11 @@ GraphSpectrumPlot._drawPowerSpectralDensityGraph = function (canvasCtx) {
405405 canvasCtx . restore ( ) ;
406406} ;
407407
408+ GraphSpectrumPlot . getPSDbyFreq = function ( frequency ) {
409+ const freqIndex = Math . round ( 2 * frequency / this . _fftData . blackBoxRate * ( this . _fftData . psdOutput . length - 1 ) ) ;
410+ return this . _fftData . psdOutput [ freqIndex ] ;
411+ } ;
412+
408413GraphSpectrumPlot . _drawFrequencyVsXGraph = function ( canvasCtx , drawPSD = false ) {
409414 const PLOTTED_BLACKBOX_RATE = this . _fftData . blackBoxRate / this . _zoomX ;
410415
@@ -1504,6 +1509,17 @@ GraphSpectrumPlot._drawMousePosition = function (
15041509 ) ;
15051510 }
15061511
1512+ if ( this . _spectrumType === SPECTRUM_TYPE . POWER_SPECTRAL_DENSITY ) {
1513+ const psdLabel = Math . round ( this . getPSDbyFreq ( mouseFrequency ) ) . toString ( ) + "dBm/Hz" ;
1514+ this . _drawAxisLabel (
1515+ canvasCtx ,
1516+ psdLabel ,
1517+ mouseX - 30 ,
1518+ mouseY - 4 ,
1519+ "left" ,
1520+ ) ;
1521+ }
1522+
15071523 // Y axis
15081524 let unitLabel ;
15091525 switch ( this . _spectrumType ) {
@@ -1547,7 +1563,7 @@ GraphSpectrumPlot._drawMousePosition = function (
15471563 this . _drawAxisLabel (
15481564 canvasCtx ,
15491565 label ,
1550- mouseX - 25 ,
1566+ mouseX - 30 ,
15511567 mouseY - 4 ,
15521568 "left" ,
15531569 ) ;
You can’t perform that action at this time.
0 commit comments