Results 1 to 8 of 8

Thread: Can force the axis' backbone extend to align with the edge of the canvas?

  1. #1
    Join Date
    Jun 2013
    Posts
    56
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Can force the axis' backbone extend to align with the edge of the canvas?

    Hi, Uwe
    How can I force the axis' backbone extend to align with the edge of the canvas?
    By default, it seems the axis' backbone is aligned with the plot grid.

    Nicho

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

    Default Re: Can force the axis' backbone extend to align with the edge of the canvas?

    Check the examples - f.e spectrogram.

    Uwe

  3. #3
    Join Date
    Jun 2013
    Posts
    56
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Can force the axis' backbone extend to align with the edge of the canvas?

    Quote Originally Posted by Uwe View Post
    Check the examples - f.e spectrogram.

    Uwe
    Uwe,
    Again, I meet two questions about plot matrix.
    First one:
    I have used this function to align the backbone:
    plotLayout()->setAlignCanvasToScales( true );
    But that will make the spacing between columns be different.
    I guess that is because the far right axis label of some plots is too long and causes the different spacing, right?
    And is there a way to fix it?

    Another question :
    The size of each plot is different from each other.
    Is there a way to make them be the same size?

    Thanks a lot.

    Nicho
    Last edited by Nicho; 2nd July 2013 at 10:08. Reason: updated contents

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,278
    Thanked 872 Times in 820 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can force the axis' backbone extend to align with the edge of the canvas?

    For both questions the same answer: you have to remove the grid layout that is used in the PlotMatrix class and implement a new method

    Qt Code:
    1. void PlotMatrix::layoutPlots( const QRect &rect )
    2. {
    3. // calculate and assign the geometries of your plots here
    4. ...
    5. }
    To copy to clipboard, switch view to plain text mode 

    In PlotMatrix::resizeEvent() and some other places that have an effect on the size of your plots you have to call:

    Qt Code:
    1. layoutPlots( contentsRect() );
    To copy to clipboard, switch view to plain text mode 
    As you probably want to have the same size for the canvases ( not the plots ! ) you have to subtract the sizeHints() of the scales, legends and titles ( QwtPlot is a composite widget ! ).

    Uwe

  5. #5
    Join Date
    Jun 2013
    Posts
    56
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Can force the axis' backbone extend to align with the edge of the canvas?

    Uwe,
    In plot matrix, the width of the plots in the far left column is smaller than the others.
    And in my application, in some situation, the height also has this problem.
    Seeing the pic below:
    prob-3.jpg

    I wish, yes, maybe the canvases to have the same size in pixel.
    I have thought the grid layout will layout all the plots as average size.
    But now it seems not.
    I don't know why.
    And how to subtract the sizeHints() of such as scales?
    Can you take scales as an example to tell me what should I code in the sizeHints() when I subtract it?

    Thank you.
    Nicho

  6. #6
    Join Date
    Jun 2013
    Posts
    56
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Can force the axis' backbone extend to align with the edge of the canvas?

    any help ?

  7. #7
    Join Date
    Jun 2013
    Posts
    56
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Can force the axis' backbone extend to align with the edge of the canvas?

    Could Uwe give me a hand for my question in detail?

  8. #8
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,278
    Thanked 872 Times in 820 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can force the axis' backbone extend to align with the edge of the canvas?

    My previous answer is still valid - it is exactly what you have to do.

    Uwe

Similar Threads

  1. Force format for Axis numbering
    By FreddyKay in forum Qwt
    Replies: 1
    Last Post: 28th June 2013, 06:42
  2. Replies: 6
    Last Post: 7th June 2013, 13:39
  3. Edge-detection (maybe using QGL?)
    By mwgobetti in forum Newbie
    Replies: 6
    Last Post: 20th January 2012, 13:32
  4. Replies: 9
    Last Post: 3rd May 2011, 21:21
  5. Replies: 0
    Last Post: 9th August 2010, 10:46

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.