Skip to content

Commit d25b398

Browse files
committed
The mouse position cursor improvement for PSD curves
1 parent 8812bae commit d25b398

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

src/graph_spectrum_plot.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,14 +1603,18 @@ GraphSpectrumPlot._drawMousePosition = function (
16031603

16041604
if (this._spectrumType === SPECTRUM_TYPE.POWER_SPECTRAL_DENSITY && this._importedPSD.curvesCount() == 0) { // single PSD spectrum
16051605
const currentPSD = this.getPSDbyFreq(mouseFrequency);
1606-
const posY = (val_max - currentPSD) / (val_max - val_min) * HEIGHT;
1607-
const psdLabel = Math.round(currentPSD).toString();
1608-
this._drawAxisLabel(
1606+
const psdLabel = Math.round(currentPSD).toString() + unitLabel;
1607+
this._drawHorizontalMarkerLine(
16091608
canvasCtx,
1609+
currentPSD,
1610+
val_min,
1611+
val_max,
16101612
psdLabel,
1611-
mouseX - 30,
1612-
posY - 4,
1613-
"left",
1613+
WIDTH,
1614+
HEIGHT,
1615+
OFFSET,
1616+
stroke,
1617+
lineWidth
16141618
);
16151619
} else if (vsArgValue >= val_min && vsArgValue <= val_max) {
16161620
const valueLabel = `${vsArgValue.toFixed(0)}${unitLabel}`;
@@ -1626,15 +1630,6 @@ GraphSpectrumPlot._drawMousePosition = function (
16261630
stroke,
16271631
lineWidth
16281632
);
1629-
if (this._spectrumType === SPECTRUM_TYPE.POWER_SPECTRAL_DENSITY) { // multiple PSD spectrum
1630-
this._drawAxisLabel(
1631-
canvasCtx,
1632-
vsArgValue.toFixed(0),
1633-
mouseX - 30,
1634-
mouseY - 4,
1635-
"left",
1636-
);
1637-
}
16381633
}
16391634
if (this._spectrumType === SPECTRUM_TYPE.PSD_VS_THROTTLE ||
16401635
this._spectrumType === SPECTRUM_TYPE.PSD_VS_RPM) {

0 commit comments

Comments
 (0)