Results 1 to 6 of 6

Thread: Problems with vanishing ticks

  1. #1
    Join Date
    Oct 2019
    Posts
    22
    Qt products
    Qt5
    Platforms
    Windows

    Default Problems with vanishing ticks

    Hello,

    the following images describe the problem better than I could with words. In the first image, there is some data displayed. The last data point has an x value of 20.

    Image1.png

    The second image shows the same data, just shifted one pixel to the right.

    Image2.png

    As you can see, the tick with the "20" disappeared completly and leaves a blank space, although there is more than enough space apparently.

    I am aware of the method QwtScaleEngine::setAttribute and we set the "Floating" attribute to true. Still the tick at the end disappears. I also checked the methods QwtScaleWidget::setMinBorderDist and QwtScaleWidget::setBorderDist and set all values to 0 (I tried even negative numbers), but it did not help at all.

    We are using Qt 5.12 and Qwt 6.1.3.

    Has anyone a solution for the problem?

  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: Problems with vanishing ticks

    QwtPlot does not offer scales, where the ticks go inwards - so this is probably custom code.

    Uwe
    Last edited by Uwe; 3rd October 2019 at 15:18.

  3. #3
    Join Date
    Oct 2019
    Posts
    22
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Problems with vanishing ticks

    Quote Originally Posted by Uwe View Post
    QwtPlot does not offer scales, where the ticks go inwards - so this is probably custom code.

    Uwe
    While it is true, that we customized some parts of the QwtPlot, the inside ticks are created with means from the qwt library only. We simply created a QwtPlotScaleItem with the opposite alignment for each axis (e.g. QwtScaleDraw::RightScale for QwtPlot::yLeft). Other features (like QwtScaleEngine) were not customized. So the positioning and visibility of the ticks are still calculated by the qwt engine.

  4. #4
    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: Problems with vanishing ticks

    Quote Originally Posted by mwh View Post
    We simply created a QwtPlotScaleItem with the opposite alignment for each axis (e.g. QwtScaleDraw::RightScale for QwtPlot::yLeft).
    And how is your scale item connected to which scale engine ?

    Uwe

  5. #5
    Join Date
    Oct 2019
    Posts
    22
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Problems with vanishing ticks

    Quote Originally Posted by Uwe View Post
    And how is your scale item connected to which scale engine ?

    Uwe
    Like this:

    Qt Code:
    1. // This code is taken from your example code in the documention of QwtPlotScaleItem
    2. auto scaleItem = new QwtPlotScaleItem(QwtScaleDraw::TopScale, 0.0);
    3. scaleItem->setFont(plot->axisWidget(QwtPlot::xBottom)->font());
    4. // This is the customized part
    5. scaleItem->setXAxis(QwtPlot::xBottom);
    6. scaleItem->setScaleDivFromAxis(true);
    7. // This is from your documentation again
    8. scaleItem->attach(plot);
    To copy to clipboard, switch view to plain text mode 

    According to your documentation the setSCaleDivFromAxis method synchronizes the scale item with the corresponding axis. Am I missing anything?

  6. #6
    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: Problems with vanishing ticks

    O.k. so you are using a scale item, that is fed by the scale engine of the bottom scale, but you gave no information about how this one is set up.
    Maybe it makes more sense, that you upload a small compilable tarball demonstrating the problem.

    Uwe

Similar Threads

  1. Slider with log ticks?
    By drmacro in forum Qt Programming
    Replies: 7
    Last Post: 2nd April 2017, 17:49
  2. How to use explicit labels/ticks?
    By ssample in forum Qwt
    Replies: 3
    Last Post: 18th January 2013, 12:16
  3. Replies: 14
    Last Post: 30th October 2012, 16:45
  4. Qslider Ticks not displayed
    By iaguirre in forum Qt Programming
    Replies: 1
    Last Post: 30th March 2010, 06:09
  5. how to number the ticks of QSlider
    By babu198649 in forum Newbie
    Replies: 4
    Last Post: 11th June 2008, 14: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.