diff options
Diffstat (limited to 'gr-qtgui/src/lib/TimeDomainDisplayPlot.cc')
-rw-r--r-- | gr-qtgui/src/lib/TimeDomainDisplayPlot.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc index 42f827d9ab..6d8ef6ee40 100644 --- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc +++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.cc @@ -44,6 +44,8 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent){ _imagDataPoints = new double[_numPoints]; _xAxisPoints = new double[_numPoints]; + _zoomer = new TimeDomainDisplayZoomer(canvas()); + // Disable polygon clipping QwtPainter::setDeviceClipping(false); @@ -56,7 +58,7 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent){ canvas()->setPalette(palette); setAxisScaleEngine(QwtPlot::xBottom, new QwtLinearScaleEngine); - setAxisScale(QwtPlot::xBottom, 0, _numPoints); + set_xaxis(0, _numPoints); setAxisTitle(QwtPlot::xBottom, "Sample Number"); setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine); @@ -83,7 +85,6 @@ TimeDomainDisplayPlot::TimeDomainDisplayPlot(QWidget* parent):QwtPlot(parent){ replot(); - _zoomer = new TimeDomainDisplayZoomer(canvas()); #if QT_VERSION < 0x040000 _zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier); @@ -129,8 +130,17 @@ void TimeDomainDisplayPlot::set_yaxis(double min, double max) { setAxisScale(QwtPlot::yLeft, min, max); + _zoomer->setZoomBase(); +} + +void +TimeDomainDisplayPlot::set_xaxis(double min, double max) +{ + setAxisScale(QwtPlot::xBottom, min, max); + _zoomer->setZoomBase(); } + void TimeDomainDisplayPlot::replot(){ const timespec startTime = get_highres_clock(); @@ -146,7 +156,9 @@ void TimeDomainDisplayPlot::replot(){ } } -void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints, const double* imagDataPoints, const int64_t numDataPoints){ +void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints, + const double* imagDataPoints, + const int64_t numDataPoints){ if(numDataPoints > 0){ if(numDataPoints != _numPoints){ @@ -162,6 +174,8 @@ void TimeDomainDisplayPlot::PlotNewData(const double* realDataPoints, const doub _real_plot_curve->setRawData(_xAxisPoints, _realDataPoints, _numPoints); _imag_plot_curve->setRawData(_xAxisPoints, _imagDataPoints, _numPoints); + set_xaxis(0, numDataPoints); + _resetXAxisPoints(); } memcpy(_realDataPoints, realDataPoints, numDataPoints*sizeof(double)); |