Results 1 to 4 of 4

Thread: Align x-axis to enabled x-axis

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    50
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    4

    Default Align x-axis to enabled x-axis

    Hi,

    I'm looking for a way to align this three different plots so that they use the same x-axis (In the attached pictures you can see why it's not working).
    When I set different titles for the y-axis, my y-axis aren't aligned anymore. I did it the same way it is realised in the plotmatrix example. is there a way to consider the title of the axis?

    Qt Code:
    1. double maxExtent = 0;
    2.  
    3. const QList<QwtPlot *> Plots = this->findChildren<QwtPlot *>();
    4. foreach( QwtPlot *p, Plots ){
    5. QwtScaleWidget *scaleWidget = p->axisWidget( QwtPlot::yLeft );
    6.  
    7. QwtScaleDraw *sd = scaleWidget->scaleDraw();
    8. sd->setMinimumExtent( 0.0 );
    9.  
    10. const double extent = sd->extent( scaleWidget->font() );
    11. if ( extent > maxExtent )
    12. maxExtent = extent;
    13. }
    14.  
    15. foreach( QwtPlot *p, Plots ){
    16. QwtScaleWidget *scaleWidget = p->axisWidget( QwtPlot::yLeft );
    17.  
    18. scaleWidget->scaleDraw()->setMinimumExtent( maxExtent );
    19. }
    To copy to clipboard, switch view to plain text mode 


    Additionally I want the first plots height to be as big as possible and the others to have a minimum height. I already set vertical SizePolicy for the mainplot expanding and the others fixed.
    The number of plots in my window differs but the first one is the main plot. Also the number of curves in the other plots can be different.
    Attached Images Attached Images

Similar Threads

  1. Replies: 1
    Last Post: 21st April 2014, 20:01
  2. Axis Title to axis label alignment
    By ROCKSTAR in forum Qwt
    Replies: 0
    Last Post: 5th February 2014, 12:47
  3. Replies: 7
    Last Post: 10th July 2013, 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
  •  
Qt is a trademark of The Qt Company.