Page 2 of 2 FirstFirst 12
Results 21 to 26 of 26

Thread: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.

  1. #21
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,172
    Thanked 836 Times in 785 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.

    Have a look at: http://qwt.sourceforge.net/class_qwt_series_data.html and http://qwt.sourceforge.net/class_qwt...05dfae2d1668e6

    The implementation could be like this:

    Qt Code:
    1. virtual QPointF YourData::sample( size_t index ) const
    2. {
    3. qreal currentX = ...;
    4. qreal x = ...;
    5. qreal y = ...;
    6.  
    7. return QPointF( x - currentX, y );
    8. }
    To copy to clipboard, switch view to plain text mode 
    This translates "ms since being started" into "ms before now" and you can set a range of [-10000, 0] to always see the samples of the last 10 seconds.
    Be careful, that calculating x/y/currentX is not expensive - in case you need to render many points ( many more than 400 isn't ).

    In case of having many points outside of the 10s ( or whatever your frame is ) it might be worth to enable polygon clipping.

    Uwe

  2. #22
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    308
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.

    Uwe, many thanks, I will try it.

  3. #23
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    308
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.

    Uwe,

    Qt Code:
    1. virtual QPointF YourData::sample( size_t index ) const
    2. {
    3. ...
    4. qreal currentX = ...;
    5. ...
    6. }
    To copy to clipboard, switch view to plain text mode 

    Are you sure that this will not a bootleneck too? Because for this situation we need to call the QDateTime::currentDatetime() each time for each sample...

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

    Default Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.

    Quote Originally Posted by kuzulis View Post
    Because for this situation we need to call the QDateTime::currentDatetime() each time for each sample...
    Of course you have to calculate your reference time only once and not for each call of sample().
    So what about storing QDateTime::currentDatetime() as reference time inside of the data object, whenever you receive a new set of samples.

    You could also rely on the fact, that iterating over samples always starts at index 0 and always update the reference time on this one.
    But I wouldn't recommend to do this, as you always have a delay until the plot is updated and then you have a gap between the data and the reference time.

    Uwe

  5. #25
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    308
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.

    Uwe,

    So, your idea is to calculate the reference time like this:

    e.g.:

    Qt Code:
    1. ...
    2.  
    3. MySeriesData : public QwtSeriesData
    4. {
    5. ...
    6. MySeriesData (qint64 reftime, const QVector<QPointF> &samples)
    7. : m_reftime(reftime)
    8. , m_samples(samples)
    9. {
    10. }
    11.  
    12. QPointF sample(size_t index) const
    13. {
    14. ...
    15. ...
    16. return QPointF(x - m_reftime, y);
    17. }
    18.  
    19. private:
    20. qint64 m_reftime= 0;
    21. QVector<QPointF> m_samples;
    22. }
    23. ...
    24.  
    25. // And then...
    26. const auto reftime = QDateTime::currentMSecsSinceEpoch();
    27. curve->setData(new MySeriesData(reftime, samples));
    28. ..
    To copy to clipboard, switch view to plain text mode 

    ?

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

    Default Re: Qwt 6.3.0 (from qwt-code-r2921-trunk) compilation fails on Ubuntu 18.04.

    Well, m_reftime is a qint64, while the samples are doubles. But as long as they match, why not.

    Uwe

Similar Threads

  1. Replies: 2
    Last Post: 13th December 2011, 16:44
  2. Mingw Cross-compilation of trunk webkit-qt
    By zcrendel in forum Qt Programming
    Replies: 0
    Last Post: 3rd November 2011, 17:23
  3. Compilation fails in Windows XP
    By sim in forum Newbie
    Replies: 3
    Last Post: 1st July 2010, 16:56
  4. qgl_use_font error during compilation of QT git trunk
    By manuels in forum Installation and Deployment
    Replies: 0
    Last Post: 6th March 2010, 14:05
  5. Qt 4.6.1 Compilation fails!
    By Diegol in forum Installation and Deployment
    Replies: 1
    Last Post: 10th February 2010, 16:36

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.