Results 1 to 3 of 3

Thread: How is best way to change the scale range?

  1. #1
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How is best way to change the scale range?

    Hi all.

    E.g. I have some Plot with two axes (X and Y). I need to implement changing of
    the Y-axis range using "dragging" with the mouse. It is looks like the user dragging
    the Y-axis to up or down (like using wheels scrolling).

    I have implemented the mouse filter and intercept the MousePressed/Move/Released
    events. In this case I just re-calculate the desired Y-axis ranges and change its
    with:

    Qt Code:
    1. ...
    2. QwtPlot::setAxisScale(axis, newMin, newMax, newStep);
    3. ...
    To copy to clipboard, switch view to plain text mode 

    It is similar to the code from the "event_filter" example with the scrollLeftAxis()
    method.

    BUT, I'm not sure that is is best way in point of view performance. Maybe is it
    better to use the QwtPlotZoomer or other stuff? Could, please, someone advise
    something for this issue?

    BR,
    Denis

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

    Default Re: How is best way to change the scale range?

    Changing the axes is always done with QwtPlot::setAxisScale or QwtPlot::setAxisScaleDiv ( if you want to set the ticks manually ).
    QwtPlotZoomer, QwtPlotMagnifier etc are only noise on top.

    The only thing that's different is QwtPlotPanner as it grabs the content to an image moving it around without causing replots until releasing it.
    But this is visually not perfect. Have a look the the spectrogram example ( drag with the middle mouse button ).

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    kuzulis (13th November 2016)

  4. #3
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How is best way to change the scale range?

    Ahh.. yes, I have looked on QwtPlotZoomer, and see that its method void QwtPlotZoomer::rescale() use setAxisScale()...

    Many thanks...

Similar Threads

  1. change 'scale map' of QwtPolarGrid number!
    By sampad1370 in forum Qwt
    Replies: 2
    Last Post: 5th April 2016, 14:38
  2. Dynamically change slider max range
    By Don_Hannes in forum Qt Programming
    Replies: 2
    Last Post: 3rd October 2012, 17:19
  3. How to change the scroll area range in QTableView?
    By josentop in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2012, 15:13
  4. change manually the scale of y-axis
    By fatecasino in forum Qwt
    Replies: 2
    Last Post: 14th February 2011, 21:24
  5. Replies: 1
    Last Post: 21st April 2010, 03:54

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.