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:
b03ab41728d2f8993ec75bfd3867d69e.jpg
But if 1 add 1 curve, after it use zoom, program dont change size canvas inside the plot
8dda6827df98d91a26c9991f1a61ac89.jpg
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();
}
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();
}
To copy to clipboard, switch view to plain text mode
Zoom code i copy from qwt example:
//Zoom
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
());
//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());
To copy to clipboard, switch view to plain text mode
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
}
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
}
To copy to clipboard, switch view to plain text mode
In advance thank you for your help!
Bookmarks