Hi everybody!
I've implemented simple class derived from QwtPlot , it contains 3 pointers:
QwtPlotCurve *curve1;
QwtPlotCurve *curve2;
QwtPlotZoomer* zoomer;
To copy to clipboard, switch view to plain text mode
in constructor I create objects:
curve1->attach(this);
curve2->attach(this);
zoomer
->setTrackerPen
( QColor( Qt
::black ) );
zoomer
->setTrackerMode
(QwtPicker::AlwaysOff);
zoomer
->setMousePattern
( QwtEventPattern::MouseSelect2, Qt
::RightButton, Qt
::ControlModifier );
zoomer->setZoomBase();
curve1 = new QwtPlotCurve("Curve 1");
curve1->attach(this);
curve2 = new QwtPlotCurve("Curve 2");
curve2->attach(this);
zoomer = new QwtPlotZoomer( canvas() );
zoomer->setTrackerPen( QColor( Qt::black ) );
zoomer->setTrackerMode(QwtPicker::AlwaysOff);
zoomer->setMousePattern( QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier );
zoomer->setMousePattern( QwtEventPattern::MouseSelect3, Qt::RightButton );
zoomer->setZoomBase();
To copy to clipboard, switch view to plain text mode
There is a function inside my class to assign data to curves, it basically does:
QwtPointSeriesData* myData = new QwtPointSeriesData;
...
curve1->setData(myData); // or curve2->setData(myData); , only one curve updated at a time
zoomer->setZoomBase();
QwtPointSeriesData* myData = new QwtPointSeriesData;
...
curve1->setData(myData); // or curve2->setData(myData); , only one curve updated at a time
zoomer->setZoomBase();
To copy to clipboard, switch view to plain text mode
And here is what happens - I have two different data sets with quite different value scales. I can call function to assign one particular dataset to curve. If I assign one dataset and then another without zooming graph it works perfect, but , if I zoom with first dataset and then switch to another zoomer will lock on a range of the first datset. It seems to me that there is something that prevents value ranges from update so, to fix this I tried:
- to reset zoom to 0 level before actual update of curve - not working
- to detach curve object from plot and attach it after update of dataset - not working
Is there anything I can do to correctly update zoomer state after data changes?
Thanks in advance!
PS: QWT ver 6.0.1 , Qt 4.7.4
Bookmarks