Results 1 to 10 of 10

Thread: QwtPlotRescaler extra space

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2017
    Posts
    11
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    1

    Default Re: QwtPlotRescaler extra space

    That solved half of my problem, thank you! Now when I first open the app, the dimensions are correct but the xBottom axis doesn't have the right Interval, and so the image is "cut" at the very beginning, and if I try to resize the window, everything is just perfect. Is it an initial setup configuration problem in my updatelayout function? How can I Setup my plot so that it starts with the right data interval? I have tried to set an axis manually but it doesn't seem to work!
    Thanks
    dddd.PNG
    The interval should be [-1.5, 1.5]
    Last edited by airflow; 27th January 2018 at 19:48. Reason: add image

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

    Default Re: QwtPlotRescaler extra space

    Well QwtPlot::updateLayout() is about adjusting the content to a given geometry, not about changing the geometry. So the posted implementation will never work !

    Better try something like this:
    Qt Code:
    1. class YourPlotLayout: public QwtPlotLayout
    2. {
    3. public:
    4. virtual void activate( const QwtPlot *plot,
    5. const QRectF &rect, Options options )
    6. {
    7. const QRectF rect = adjustedRect( plot, rect );
    8. QwtPlotLayout::activate( plot, adjustedRect, options );
    9. }
    10. };
    To copy to clipboard, switch view to plain text mode 
    and
    Qt Code:
    1. plot->setPlotLayout( new YourPlotLayout() );
    To copy to clipboard, switch view to plain text mode 
    Then it boils down to finding an implementation for YourPlotLayout::adjustedRect(). Here you have to start with finding a square rectangle for the canvas, that has to be expanded, by the space needed for the axes, title, footer, legend.

    Of course you could also try to find a complete new implementation for YourPlotLayout::activate(). In this case you would also start with the square canvas, but then you would also calculate all the other geometries yourself.

    Uwe

Similar Threads

  1. QwtPlotRescaler does not work
    By A1exander_Z in forum Qwt
    Replies: 2
    Last Post: 26th February 2016, 12:49
  2. Remove extra space around legend
    By adeas31 in forum Qwt
    Replies: 0
    Last Post: 17th November 2015, 14:21
  3. AutoScal affects QwtPlotRescaler
    By jesse_mark in forum Qwt
    Replies: 0
    Last Post: 28th November 2012, 16:00
  4. Make QwtPlotRescaler reflect data changes
    By hector1984 in forum Qwt
    Replies: 1
    Last Post: 26th August 2010, 11:06
  5. Replies: 3
    Last Post: 28th September 2007, 21: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
  •  
Qt is a trademark of The Qt Company.