Hi,

I have a gui that plots curves that a user inputs. The user can also change the dates so the curves go farther back in time. My problem comes when the user changes the dates. For the first curve the plot looks correct and is set to whatever dates were entered, but when the dates are edited the plot does not resize to the new dates, but rather stays over the dates of the first curve. This problem only happens if I zoom in or out at all on the first plot which leads me to believe it has something to do with the zoomer. I think using the zoom on the first curve is breaking something about my qwtplot axes but I don't know where. I tried to setZoomBase but that hasn't changed anything about the scales of the x axis.

Here is some of the code, maybe someone can spot my error :

Qt Code:
  1. class MyZoomer : public QwtPlotZoomer{
  2. public:
  3. MyZoomer(QwtPlotCanvas *canvas) : QwtPlotZoomer(canvas)
  4. {
  5. setTrackerMode(AlwaysOn);
  6. }
  7. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "MyZoomer.h"
  2.  
  3. class MyPlot : public QwtPlot
  4. {
  5. QwtPlotCurve *Curve;
  6. public:
  7. MyPlot(){
  8. zoomer = new MyZoomer(canvas());
  9. const QColor c(Qt::darkBlue);
  10. zoomer->setRubberBandPen(c);
  11. zoomer->setTrackerPen(c);
  12.  
  13. setAxisScaleDraw(QwtPlot::xBottom, new XaxisDates);
  14. }
  15. QwtPlotZoomer *zoomer;
  16. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. MyWidget::MyWidget(QWidget * parent):QWidget(parent){
  2. myPlot = new MyPlot;
  3. }
  4. void MyWidger::plotCurves(){
  5. getDates(); ///this gets the start and end dates that the user entered
  6. getInstructionsANDplot();
  7. }
  8. void MyWidget::getInstructionsANDplot{
  9. ///gets file name from user
  10. myPlot->addFile(filename, start, end);
  11. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "MyPlot.h"
  2. void MyPlot::addFile( const char * fn, double st, double end ){
  3. Curve = new QwtPlotCurve(fn);
  4.  
  5. //load the data with the user inputed start and end times
  6.  
  7. Curve->setRawSamples(time, values, newNumbPts);
  8. Curve->attach(this);
  9. zoomer->setZoomBase();
  10.  
  11. }
To copy to clipboard, switch view to plain text mode 

Like I said, I'm pretty sure it is the zoomer. Whatever size I was zoomed in on the first curve when I load more dates is where the x and y axes stay no matter what. However, if I load a curve and never zoom, I can change the dates and the view adjusts to hold all the information like it should.

I hope this makes sense, thanks for any insight.