Results 1 to 7 of 7

Thread: QwtPlotMarker not recognized by autoscale

  1. #1
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default QwtPlotMarker not recognized by autoscale

    Hello,

    i'm using the QwtPlotMarkers to indicate values that underrange a lower limit.
    I have enabled autoscale on yLeft. The top part of my picture shows
    the plot during measurement and you can see only a part of the arrows going down.

    When use the panner to move the content i can see the arrows.

    autoscale and QwtPlotMarker.png

    Is there a way to change the autoscale function that it recognized my makers?

    Hint:
    The probem happens only if the curve where i attached the arrows is also
    the curve with the lowest measurement points of all attached curves.
    If there are lower y values of any curve the yLeft shows the next decade and the arrows are visible.

    Stefan

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

    Default Re: QwtPlotMarker not recognized by autoscale

    Qt Code:
    1. marker->setItemAttribute( QwtPlotItem::AutoScale, true );
    To copy to clipboard, switch view to plain text mode 
    The default setting for curves is on, for markers it is off.

    Uwe

  3. #3
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QwtPlotMarker not recognized by autoscale

    Hello Uwe,

    i add that attribute to my item, but it seems not to work in combination with QwtLogScaleEngine

    Qt Code:
    1. void PlotManager::setSamplesPressure( int curveId, const QPolygonF &points )
    2. {
    3. d_data->curvesPressure.at( curveId )->setSamples( points );
    4.  
    5. // underrange
    6. if( (points.last().y()<d_data->curveMinP.at( curveId )) )
    7. {
    8. // an arrow at a specific position
    9. QwtPlotMarker *mPos = new QwtPlotMarker( QString("%1 underrange").arg( d_data->curvesPressure.at(curveId)->title().text()));
    10. mPos->setRenderHint( QwtPlotItem::RenderAntialiased, true );
    11. mPos->setSymbol( new ArrowSymbol( d_data->curveColor.at( curveId ), true ));
    12. mPos->setValue( QPointF( points.last().x(), points.last().y() ) );
    13. mPos->setItemAttribute( QwtPlotItem::Legend, d_data->legendUnderrange.at( curveId ) );
    14. mPos->setItemAttribute( QwtPlotItem::AutoScale, true );
    15. d_data->legendUnderrange[ curveId ] = false;
    16. mPos->attach( d_matrix->plotWidgets.at(0) );
    17. qDebug() << Q_FUNC_INFO << mPos->boundingRect();
    18. d_data->lockedUnderrange[curveId] = true;
    19. }
    20.  
    21. d_matrix->plotWidgets[0]->replot();
    22. }
    To copy to clipboard, switch view to plain text mode 

    the debug output is

    Qt Code:
    1. void PlotManager::setSamplesPressure(int, const QPolygonF&) QRectF(71,0.0001 0x0)
    To copy to clipboard, switch view to plain text mode 

    It seems that the boundingRect() is calculated wrong.

    Stefan

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

    Default Re: QwtPlotMarker not recognized by autoscale

    In your case the bounding rectangle is a point at 71, 0.0001 - it should be points.last().
    Note that the symbol is not part of the bounding rectangle ( plot coordinates ! ).

    Uwe

  5. #5
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QwtPlotMarker not recognized by autoscale

    Hello Uwe,

    first of all, thank you for your answer on this sunny day in Bavaria :-)
    but I don't understand you answer.

    The function setSamplesPressure is called every time if a new measurement values was append to the QPolygonF points.
    I check if only the last point (the newest) is under a specific value (underrange) and add an arrow to the plot. So i will
    get a lot of arrows on plot as you can see in that picture.

    I got a lot of Debug outputs...

    from
    Qt Code:
    1. void PlotManager::setSamplesPressure(int, const QPolygonF&) QRectF(60,0.0001 0x0)
    2. void PlotManager::setSamplesPressure(int, const QPolygonF&) QRectF(61,0.0001 0x0)
    3. void PlotManager::setSamplesPressure(int, const QPolygonF&) QRectF(62,0.0001 0x0)
    4.  
    5. ....
    6.  
    7. void PlotManager::setSamplesPressure(int, const QPolygonF&) QRectF(120,0.0001 0x0)
    8. void PlotManager::setSamplesPressure(int, const QPolygonF&) QRectF(121,0.0001 0x0)
    9. void PlotManager::setSamplesPressure(int, const QPolygonF&) QRectF(122,0.0001 0x0)
    To copy to clipboard, switch view to plain text mode 

    My guess was that it will be ignored by autoscale, because it is a point and i don't know why?
    It seems that settings the QwtPlotItem::AutoScale to true is not all.

    From documentation
    "The boundingRect() of the item is included in the autoscaling calculation as long as its width or height is >= 0.0."

    1) What is the boundingRect() for you? It is a QRectF around the arrow, or not? If i'm right, why is it a point?
    2) What shoud be points.last()?

    Thx
    Stefan

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

    Default Re: QwtPlotMarker not recognized by autoscale

    Quote Originally Posted by HappyCoder View Post
    1) What is the boundingRect() for you? It is a QRectF around the arrow, or not?
    It is a rectangle around the marker position ( = a point ) the one you have assigned with QwtPlotMarker::setValue().
    2) What shoud be points.last()?
    Don't ask me the code snippet is from your application.

    Uwe

  7. #7
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QwtPlotMarker not recognized by autoscale

    Maybe i got what you mean. I add a point to the plot at points.last() with a symbol. The point
    itself is within the scale but the symbol is not. Due to that

    Qt Code:
    1. marker->setItemAttribute( QwtPlotItem::AutoScale, true );
    To copy to clipboard, switch view to plain text mode 

    has no effect in my case.

Similar Threads

  1. Replies: 0
    Last Post: 15th July 2015, 09:47
  2. Replies: 5
    Last Post: 4th July 2013, 07:24
  3. Disabling autoscale is not wirking
    By P@u1 in forum Qwt
    Replies: 2
    Last Post: 27th July 2011, 09:25
  4. Autoscale QTableWidget columns on resize
    By genjix in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2011, 21:09
  5. autoScale doesn't work
    By Braunstein in forum Qwt
    Replies: 4
    Last Post: 12th November 2010, 18:22

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.