summaryrefslogtreecommitdiff
path: root/gr-qtgui/lib/HistogramDisplayPlot.cc
diff options
context:
space:
mode:
authorTom Rondeau <tom@trondeau.com>2013-08-02 16:54:16 -0400
committerTom Rondeau <tom@trondeau.com>2013-08-02 16:58:13 -0400
commitbd043f9c74d32a63e42547c023c68abe2f1d5e2b (patch)
tree8da38fa103ecfc2f4049f4b1a5b53a9b3c5722a0 /gr-qtgui/lib/HistogramDisplayPlot.cc
parent1f03cbc66bc5b60a9997e78be349e259ea739114 (diff)
qtgui: improved handling of scale in histogram plots.
Mouse scroll zooms in/out horizonatally. Added auto-scale feature, can set x-min and max in constructor. Mouse scroll in constellation plot now does both axes at the same time.
Diffstat (limited to 'gr-qtgui/lib/HistogramDisplayPlot.cc')
-rw-r--r--gr-qtgui/lib/HistogramDisplayPlot.cc30
1 files changed, 18 insertions, 12 deletions
diff --git a/gr-qtgui/lib/HistogramDisplayPlot.cc b/gr-qtgui/lib/HistogramDisplayPlot.cc
index 01b69d4a07..bcdab6b3f4 100644
--- a/gr-qtgui/lib/HistogramDisplayPlot.cc
+++ b/gr-qtgui/lib/HistogramDisplayPlot.cc
@@ -90,16 +90,14 @@ protected:
QwtText t;
QwtDoublePoint dp = QwtPlotZoomer::invTransform(p);
if((dp.y() > 0.0001) && (dp.y() < 10000)) {
- t.setText(QString("%1 %2, %3 V").
- arg(dp.x(), 0, 'f', getTimePrecision()).
- arg(_unitType.c_str()).
- arg(dp.y(), 0, 'f', 4));
+ t.setText(QString("%1, %2").
+ arg(dp.x(), 0, 'f', 4).
+ arg(dp.y(), 0, 'f', 0));
}
else {
- t.setText(QString("%1 %2, %3 V").
- arg(dp.x(), 0, 'f', getTimePrecision()).
- arg(_unitType.c_str()).
- arg(dp.y(), 0, 'e', 4));
+ t.setText(QString("%1, %2").
+ arg(dp.x(), 0, 'f', 4).
+ arg(dp.y(), 0, 'e', 0));
}
return t;
@@ -138,6 +136,9 @@ HistogramDisplayPlot::HistogramDisplayPlot(int nplots, QWidget* parent)
_zoomer->setRubberBandPen(c);
_zoomer->setTrackerPen(c);
+ _magnifier->setAxisEnabled(QwtPlot::xBottom, true);
+ _magnifier->setAxisEnabled(QwtPlot::yLeft, false);
+
d_semilogx = false;
d_semilogy = false;
@@ -254,20 +255,25 @@ HistogramDisplayPlot::_resetXAxisPoints(double bottom, double top)
_xAxisPoints[loc] = bottom + loc*width;
}
+ if(!_autoscale_state) {
+ bottom = axisScaleDiv(QwtPlot::xBottom)->lowerBound();
+ top = axisScaleDiv(QwtPlot::xBottom)->upperBound();
+ }
+
// Set up zoomer base for maximum unzoom x-axis
// and reset to maximum unzoom level
QwtDoubleRect zbase = _zoomer->zoomBase();
if(d_semilogx) {
- setAxisScale(QwtPlot::xBottom, 1e-1, _xAxisPoints[_bins-1]);
+ setAxisScale(QwtPlot::xBottom, 1e-1, top);
zbase.setLeft(1e-1);
}
else {
- setAxisScale(QwtPlot::xBottom, _xAxisPoints[0], _xAxisPoints[_bins-1]);
- zbase.setLeft(_xAxisPoints[0]);
+ setAxisScale(QwtPlot::xBottom, bottom, top);
+ zbase.setLeft(bottom);
}
- zbase.setRight(_xAxisPoints[_bins-1]);
+ zbase.setRight(top);
_zoomer->zoom(zbase);
_zoomer->setZoomBase(zbase);
_zoomer->zoom(0);