It doesnt matter if you have less points or more points. May be you've implemented wrong. See this for how to implement the zoomer. Or take the reference of Bode plot example.
{
public:
{
// RightButton: zoom out by 1
// Ctrl+RightButton: zoom out to full size
Qt::RightButton, Qt::ControlModifier);
Qt::RightButton);
}
};
class Zoomer: public QwtPlotZoomer
{
public:
Zoomer(int xAxis, int yAxis, QwtPlotCanvas *canvas):
QwtPlotZoomer(xAxis, yAxis, canvas)
{
setTrackerMode(QwtPicker::AlwaysOff);
setRubberBand(QwtPicker::NoRubberBand);
// RightButton: zoom out by 1
// Ctrl+RightButton: zoom out to full size
setMousePattern(QwtEventPattern::MouseSelect2,
Qt::RightButton, Qt::ControlModifier);
setMousePattern(QwtEventPattern::MouseSelect3,
Qt::RightButton);
}
};
To copy to clipboard, switch view to plain text mode
d_plot->canvas()); //here replace it with your qwtplot.
d_zoomer
[0]->setRubberBand
(QwtPicker::RectRubberBand);
d_zoomer
[0]->setRubberBandPen
(QColor(Qt
::green));
d_zoomer
[0]->setTrackerMode
(QwtPicker::ActiveOnly);
d_zoomer
[0]->setTrackerPen
(QColor(Qt
::white));
d_plot->canvas()); /*here replace it with your plot. Implement this only if you have x is at Top and y is at right position. By seeing the above image, this line is not required. Skip this. */
QwtPlotZoomer *d_zoomer[2];
d_zoomer[0] = new Zoomer( QwtPlot::xBottom, QwtPlot::yLeft,
d_plot->canvas()); //here replace it with your qwtplot.
d_zoomer[0]->setRubberBand(QwtPicker::RectRubberBand);
d_zoomer[0]->setRubberBandPen(QColor(Qt::green));
d_zoomer[0]->setTrackerMode(QwtPicker::ActiveOnly);
d_zoomer[0]->setTrackerPen(QColor(Qt::white));
d_zoomer[1] = new Zoomer(QwtPlot::xTop, QwtPlot::yRight,
d_plot->canvas()); /*here replace it with your plot. Implement this only if you have x is at Top and y is at right position. By seeing the above image, this line is not required. Skip this. */
To copy to clipboard, switch view to plain text mode
I think you've understood.
Bookmarks