Results 1 to 5 of 5

Thread: Problem with twitching on axis-ends

  1. #1
    Join Date
    May 2011
    Posts
    17
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Problem with twitching on axis-ends

    Hi.

    I have a problem with twitching in my plot. This twitching comes when the y-, or x-axis is swapping between having a value label at the end or having a tick at the end.

    It's best demonstrated by these two screens:
    screen2.PNGscreen1.PNG
    If you test with the oscilloscope example, and adjust the displayed seconds, back and forth, you will see what I mean by twitching.

    This is a bit annoying, especially when having live values thats going up and down.

    I have based my widget on the refreshtest example, and managed to work around the problem by setting:

    Qt Code:
    1. canvas()->setFrameStyle(QFrame::Box | QFrame::Plain );
    2. canvas()->setLineWidth(5);
    To copy to clipboard, switch view to plain text mode 

    But this adds a black border around the canvas, and I haven't figured out a way to make that border transparent, or inherit color from application.

    If someone have a suggestion on how to workaround this, please let me know.

    Gerhard

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

    Default Re: Problem with twitching on axis-ends

    What about setting a margin between the end of the scales and the canvas border: see QwtPlotLayout::setCanvasMargin().

    The margin should be larger than half of the width of your tick labels. You could rotate the tick labels, so that you only need half of the font height - or something in between like in the cpuplot example.

    Uwe

  3. #3
    Join Date
    May 2011
    Posts
    17
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with twitching on axis-ends

    Thank you for your reply Uwe.

    I managed to solve it by setting plotLayout()->setAlignCanvasToScales(false); for the vertical twitching.

    But I also have the problem of twitching horizontally. Whenever a major tick on the y-axis appear that has a number of characters which is greater than the rest. For example you have a range from 0-2, and when the curve goes down to -1, you have one additional character, "-" and "1".

    Example:
    Qt Code:
    1. Y-axis
    2. ---
    3. |2|
    4. ---
    5. |1|
    6. ---
    7. |0|
    8. ----
    9. |-1|
    10. ----
    To copy to clipboard, switch view to plain text mode 


    Is there a way to set a fixed size for the label on the major tick? For instance setting it to 7 characters if you know your y-values ranges from -999999 to 9999999.

    Example of wanted behaviour:
    Qt Code:
    1. Y-axis
    2. ------
    3. | 2|
    4. ------
    5. | 1|
    6. ------
    7. | 0|
    8. ------
    9. | -1|
    10. ------
    To copy to clipboard, switch view to plain text mode 


    Your help is greatly appreciated.

    Gerhard

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

    Default Re: Problem with twitching on axis-ends

    This is one of the FAQs: grep for setMinimumExtent.

    Also check the event_filter example.

    Uwe

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

    ghm (6th October 2011)

  6. #5
    Join Date
    May 2011
    Posts
    17
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with twitching on axis-ends

    That did the trick.

    Thank you Uwe, you've been very helpfull!

    Gerhard

Similar Threads

  1. Replies: 9
    Last Post: 3rd May 2011, 21:21
  2. How to "detect" when editing a cell in QTableWidget ends?
    By dobedidoo in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2011, 13:53
  3. Axis problem with tiling QWTplots
    By dtakeshita in forum Qwt
    Replies: 7
    Last Post: 6th December 2010, 11:00
  4. Replies: 0
    Last Post: 9th August 2010, 10:46
  5. Replies: 1
    Last Post: 19th May 2009, 11:14

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.