PDA

View Full Version : Dont work replot() after using zoom



ruzik
24th September 2011, 17:49
Hellow!, i have one problem, for example i have QwtPlot, 2 curve and zoom
1 curve: graph of function: x^2
2 curve: graph of function: x^3
If i add 1 curve and after it 2 curve program called replot() and change size canvas inside the plot:
6879
But if 1 add 1 curve, after it use zoom, program dont change size canvas inside the plot
6880

This function i called when i want to add some graph

void RGraphics::setGraphics()
{
graphicsPlot->enableZoomMode(false);
//this->getFunctionListWidget()->getZoomButton()->setChecked(false);

//Delete all items
graphicsPlot->detachItems();
graphicsPlot->drawGrid();

/***************
*** Add curve ***
*/**************

graphicsPlot->replot();
graphicsPlot->getZoomer()->setZoomBase();
}
Zoom code i copy from qwt example:


//Zoom
d_zoomer[0] = new Zoomer( QwtPlot::xBottom, QwtPlot::yLeft,
this->canvas());
d_zoomer[0]->setRubberBand(QwtPicker::RectRubberBand);
d_zoomer[0]->setRubberBandPen(QColor(Qt::blue));
d_zoomer[0]->setTrackerMode(QwtPicker::ActiveOnly);
d_zoomer[0]->setTrackerPen(QColor(Qt::white));

d_zoomer[1] = new Zoomer(QwtPlot::xTop, QwtPlot::yRight,this->canvas());

void RGraphicsPlot::enableZoomMode(bool on)
{
d_panner->setEnabled(on);

d_zoomer[0]->setEnabled(on);
d_zoomer[0]->zoom(0);

d_zoomer[1]->setEnabled(on);
d_zoomer[1]->zoom(0);

d_picker->setEnabled(!on);

if(!on)
this->setAutoReplot(true); //I try to use it, but it is dont help
}
In advance thank you for your help!

pkj
24th September 2011, 18:50
Autoscaling is switched off for all axes once you explicitly setAxisScale or use a zoomer to do the same. You need to call QwtPlot::setAxisAutoScale(int axisid) if you want your axes to be auto-scaled and the curves visible.

ruzik
25th September 2011, 09:26
Thank you for your help!