Results 1 to 4 of 4

Thread: Issue with QwtPlot::setAxisScaleDiv();

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,313
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Issue with QwtPlot::setAxisScaleDiv();

    Quote Originally Posted by icosahedron View Post
    Will overloading QwtPlot::setAxisScaleEngine() allow me to reflect irregularity from prepared QwtScaleDiv ?
    Qt Code:
    1. class YourScaleEngine: public QwtLinearScaleEngine
    2. {
    3. public:
    4. virtual QwtScaleDiv divideScale( double x1, double x2, int , int , double ) const
    5. {
    6. const QwtInterval interval = QwtInterval( x1, x2 ).normalized();
    7. QList<double> ticks[QwtScaleDiv::NTickTypes];
    8.  
    9. // fill the ticks somehow according to interval
    10. // here you can set whatever ticks you want as long as
    11. // they are inside the interval x1/x2
    12.  
    13. ticks[QwtScaleDiv::MajorTick] += ...;
    14. ....
    15.  
    16. QwtScaleDiv scaleDiv( interval, ticks );
    17. if ( x1 > x2 )
    18. scaleDiv.invert();
    19.  
    20. return scaleDiv;
    21. }
    22. };
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. plot->setAxisScaleEngine( axis, new YourScaleEngine() );
    To copy to clipboard, switch view to plain text mode 

    Also it completely puzzles me why setAxisScaleDiv() works only once at plot creation time ?
    Because all what modifies a scale ( f.e panning, zooming ) has to do it in the end with setAxisScaleDiv() and your initial assignment gets overwritten.

    Uwe

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

    icosahedron (28th December 2012)

Similar Threads

  1. Replies: 9
    Last Post: 25th October 2012, 19:55
  2. setAxisScaleDiv - my scale div is invalid
    By frankiefrank in forum Qwt
    Replies: 3
    Last Post: 11th February 2011, 13:43
  3. QwtPlot margins
    By jmsbc in forum Qwt
    Replies: 0
    Last Post: 2nd October 2009, 18:11
  4. Replies: 0
    Last Post: 15th May 2009, 15:12
  5. Replies: 6
    Last Post: 14th May 2009, 12:02

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.