Results 1 to 3 of 3

Thread: autorescale a plot

  1. #1
    Join Date
    May 2009
    Posts
    75
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default autorescale a plot

    I'm using Qwt 5.2.2

    starting from bode axample I had write a simplified version (bode_mod.tar.gz).

    once started it shows this dialog windows:


    data are taken fron two constant vectors plus random number.

    zoom button has the same behaviour of original bode example

    clicking refresh button data are "recalculated" by adding another random number and multiplied by random factor.
    If you try to click refresh button several times it happens that the graph is correclty rescaled:


    but clicking zoom button the scale decreases back to what was at the beginning:


    and at this point no rescale happens even clicking refresh button.

    there seems to be something destructive in zoom enabling.

    How can I make it correctly rescale?

    You can try with the attached project. Just modify .pro file to match your system path to qwt.

    thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: autorescale a plot

    Assigning a scale disables autoscaling and zooming in/out explicitly does this.

    See: QwtPlot::setAxisScale() ( implicitely called by the zoomer ) and QwtPlot::setAxisAutoScale().

    Uwe

  3. #3
    Join Date
    May 2009
    Posts
    75
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: autorescale a plot

    I added setAxisAutoScale() lines to enableZoomMode() slot as follow (lines 13-15):
    Qt Code:
    1. void MainWin::enableZoomMode(bool on)
    2. {
    3. d_panner->setEnabled(on);
    4.  
    5. d_zoomer[0]->setEnabled(on);
    6. d_zoomer[0]->zoom(0);
    7.  
    8. d_zoomer[1]->setEnabled(on);
    9. d_zoomer[1]->zoom(0);
    10.  
    11. d_picker->setEnabled(!on);
    12.  
    13. d_plot->setAxisAutoScale(QwtPlot::yLeft);
    14. d_plot->setAxisAutoScale(QwtPlot::yRight);
    15. d_plot->setAxisAutoScale(QwtPlot::xBottom);
    16. d_plot->replot();
    17. }
    To copy to clipboard, switch view to plain text mode 

    now when I click zoom button the plot is not rescaled:


    I can zoom correctly, but on mouse right-click to zoom out the scale decreases back to what was at the beginning, once again:


    how to avoid this behaviour?

    thanks

Similar Threads

  1. Put plot axis out of the plot
    By KosyakOFF in forum Qwt
    Replies: 7
    Last Post: 21st June 2013, 13:36
  2. qwt plot
    By kamalasan in forum Qwt
    Replies: 6
    Last Post: 18th June 2011, 16:24
  3. Cpu Plot walkthrough
    By maxpayne in forum Qwt
    Replies: 1
    Last Post: 13th October 2008, 11:16
  4. Plot Picker x=0
    By sun in forum Qwt
    Replies: 2
    Last Post: 7th October 2008, 07:43
  5. Replies: 7
    Last Post: 22nd September 2008, 22:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.