diff --git a/spectrum.js b/spectrum.js index f6e6b09..78fdc1c 100644 --- a/spectrum.js +++ b/spectrum.js @@ -148,7 +148,15 @@ Spectrum.prototype.updateAxes = function() { freq = freq / 1e6 + "M"; else if (this.centerHz + this.spanHz > 1e3) freq = freq / 1e3 + "k"; - this.ctx_axes.fillText(freq, x + adjust, height - 3); + + if(this.horizontalAxisPosition === 'both') { + this.ctx_axes.fillText(freq, x + adjust, height); + this.ctx_axes.fillText(freq, x + adjust, 12); + } else if(this.horizontalAxisPosition === 'bottom') { + this.ctx_axes.fillText(freq, x + adjust, height); + } else if(this.horizontalAxisPosition === 'top') { + this.ctx_axes.fillText(freq, x + adjust, 12); + } } this.ctx_axes.beginPath(); @@ -328,6 +336,7 @@ function Spectrum(id, options) { this.spectrumPercent = (options && options.spectrumPercent) ? options.spectrumPercent : 25; this.spectrumPercentStep = (options && options.spectrumPercentStep) ? options.spectrumPercentStep : 5; this.averaging = (options && options.averaging) ? options.averaging : 0.5; + this.horizontalAxisPosition = (options && options.horizontalAxisPosition) ? options.horizontalAxisPosition : 'bottom'; // either 'top', 'bottom' or 'both' // Setup state this.paused = false;