Results 1 to 3 of 3

Thread: Axis scaling bug if asked to plot an empty curve?

  1. #1
    Join Date
    Oct 2012
    Location
    Burlington, Massachusetts, United States
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Axis scaling bug if asked to plot an empty curve?

    If one of the curves that you're asked to plot is empty of data, axis scaling appears to include an extent starting at 0,0. I think the fix is for the code in qwt_plot_axis needs to recognize and allow for an invalid QRectF return. Perhaps thus:

    -jrm


    *** x86_linux_na/src/qwt_plot_axis.cpp 2011-08-01 10:34:05.000000000 -0400
    --- qwt_plot_axis.cpp 2012-11-15 13:16:14.000000000 -0500
    ***************
    *** 619,626 ****
    if ( axisAutoScale( item->xAxis() ) || axisAutoScale( item->yAxis() ) )
    {
    const QRectF rect = item->boundingRect();
    ! intv[item->xAxis()] |= QwtInterval( rect.left(), rect.right() );
    ! intv[item->yAxis()] |= QwtInterval( rect.top(), rect.bottom() );
    }
    }

    --- 619,628 ----
    if ( axisAutoScale( item->xAxis() ) || axisAutoScale( item->yAxis() ) )
    {
    const QRectF rect = item->boundingRect();
    ! if (rect.isValid()) {
    ! intv[item->xAxis()] |= QwtInterval( rect.left(), rect.right() );
    ! intv[item->yAxis()] |= QwtInterval( rect.top(), rect.bottom() );
    ! }
    }
    }

  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: Axis scaling bug if asked to plot an empty curve?

    The fix excludes empty rectangles that you get f.e from markers or curves with one point ( or a horizontal or vertical line ).

    Instead it needs to be:

    Qt Code:
    1. const QRectF rect = item->boundingRect();
    2.  
    3. if ( rect.width() >= 0.0 )
    4. intv[item->xAxis()] |= QwtInterval( rect.left(), rect.right() );
    5.  
    6. if ( rect.height() >= 0.0 )
    7. intv[item->yAxis()] |= QwtInterval( rect.top(), rect.bottom() );
    To copy to clipboard, switch view to plain text mode 

    Fixed in SVN ( trunk and 6.0 ),

    Uwe

  3. #3
    Join Date
    Oct 2012
    Location
    Burlington, Massachusetts, United States
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Axis scaling bug if asked to plot an empty curve?

    Excellent! Many thanks! -jrm

Similar Threads

  1. QwtSpectogram and scaling the Axis
    By revellix in forum Qwt
    Replies: 1
    Last Post: 25th August 2011, 10:36
  2. improve the auto scaling of axis
    By 21did21 in forum Qwt
    Replies: 7
    Last Post: 7th July 2011, 20:26
  3. Replies: 3
    Last Post: 18th May 2011, 21:33
  4. Y axis not auto scaling
    By pkj in forum Qwt
    Replies: 0
    Last Post: 12th May 2011, 17:05
  5. Replies: 9
    Last Post: 3rd May 2011, 22:21

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.