diff options
author | trondeau | 2009-07-06 04:39:24 +0000 |
---|---|---|
committer | trondeau | 2009-07-06 04:39:24 +0000 |
commit | 471ebf621da0426fefda870dfe29d75cd9ef2da6 (patch) | |
tree | 5b7f59db5b4b6ffd4d932450e4598dcf20865313 /gr-qtgui/src/lib/FrequencyDisplayPlot.cc | |
parent | fadb55f262e1b5514988c3dc86a5e580378655dc (diff) | |
download | gnuradio-471ebf621da0426fefda870dfe29d75cd9ef2da6.tar.gz gnuradio-471ebf621da0426fefda870dfe29d75cd9ef2da6.tar.bz2 gnuradio-471ebf621da0426fefda870dfe29d75cd9ef2da6.zip |
Merging trondeau/qt branch r11231:11360. This merge improves the usability and examples of the QT-based interface.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11361 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-qtgui/src/lib/FrequencyDisplayPlot.cc')
-rw-r--r-- | gr-qtgui/src/lib/FrequencyDisplayPlot.cc | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc index 63d68b9b3..154c8d234 100644 --- a/gr-qtgui/src/lib/FrequencyDisplayPlot.cc +++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.cc @@ -117,8 +117,10 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent) setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)"); + _minYAxis = -120; + _maxYAxis = 10; setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); - set_yaxis(-210, 5); + setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis); setAxisTitle(QwtPlot::yLeft, "Power (dB)"); // Automatically deleted when parent is deleted @@ -225,7 +227,15 @@ FrequencyDisplayPlot::~FrequencyDisplayPlot() void FrequencyDisplayPlot::set_yaxis(double min, double max) { - setAxisScale(QwtPlot::yLeft, min, max); + // Get the new max/min values for the plot + _minYAxis = min; + _maxYAxis = max; + + // Set the axis max/min to the new values + setAxisScale(QwtPlot::yLeft, _minYAxis, _maxYAxis); + + // Reset the base zoom level to the new axis scale set here + _zoomer->setZoomBase(); } void @@ -249,17 +259,14 @@ FrequencyDisplayPlot::SetFrequencyRange(const double constStartFreq, _startFrequency = startFreq; _stopFrequency = stopFreq; _resetXAxisPoints(); - + setAxisScale(QwtPlot::xBottom, _startFrequency, _stopFrequency); setAxisScaleDraw(QwtPlot::xBottom, new FreqDisplayScaleDraw(2)); setAxisTitle(QwtPlot::xBottom, QString("Frequency (%1)").arg(strunits.c_str())); ((FreqDisplayZoomer*)_zoomer)->SetFrequencyPrecision(2); // Load up the new base zoom settings - QwtDoubleRect newSize = _zoomer->zoomBase(); - newSize.setLeft(_startFrequency); - newSize.setWidth(_stopFrequency-_startFrequency); - _zoomer->setZoomBase(newSize); + _zoomer->setZoomBase(); // Zooms back to the base and clears any other zoom levels _zoomer->zoom(0); @@ -362,7 +369,7 @@ void FrequencyDisplayPlot::ClearMaxData() { for(int64_t number = 0; number < _numPoints; number++){ - _maxFFTPoints[number] = -280.0; + _maxFFTPoints[number] = _maxYAxis; } } @@ -370,7 +377,7 @@ void FrequencyDisplayPlot::ClearMinData() { for(int64_t number = 0; number < _numPoints; number++){ - _minFFTPoints[number] = 200.0; + _minFFTPoints[number] = _minYAxis; } } |