Results 1 to 5 of 5

Thread: QwtPlotCurve not plotting dots for milliseconds

  1. #1
    Join Date
    Jun 2015
    Posts
    109
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QwtPlotCurve not plotting dots for milliseconds

    Hello,

    I have a graph that plotting data in terms of dots (y is const) on the x-axis. but its plotting dots only for integer(seconds) values not for double(milliseconds).
    I read that, I need to overload draw function, but I didn't understand how it will help me.

    Please give me some suggestions.

    Thanks

  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: QwtPlotCurve not plotting dots for milliseconds

    Qwt knows about x and y coordinates in doubles. Whatever you are doing with seconds/milliseconds - it is probably some sort of logic, that is implemented in application code.

    Uwe

  3. #3
    Join Date
    Jun 2015
    Posts
    109
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlotCurve not plotting dots for milliseconds

    Yes, I just want to know in which method should I dig for this and what things will help me in what way?
    I'm not asking for complete logic, but just guidance to do that.

    The confusion is because if I think to overload below method,
    Qt Code:
    1. void MyCurve::drawDots(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
    2. {
    3.  
    4. qDebug()<<canvasRect<<from<<to;
    5. QwtPlotCurve::drawDots(p, xMap, yMap, canvasRect, from, to);
    6. }
    To copy to clipboard, switch view to plain text mode 

    Then we can find from and to are integer. So for any logic, it will not accept double values or either convert it to an integer.
    Now QPainter object, this will only paint the points from-to, so which things will help here or is there any other method to accept logic for double?

    Thanks
    Last edited by npatil15; 12th December 2019 at 06:25.

  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: QwtPlotCurve not plotting dots for milliseconds

    QwtPlotCurve represents an array of points ( QPointF ) and from/to are indexes related to this array - no values.

    Uwe

  5. #5
    Join Date
    Jun 2015
    Posts
    109
    Thanks
    20
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlotCurve not plotting dots for milliseconds

    I have tried this one, like adding points 1,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0. I have used setSamples(points) in which I have added all those values.
    But in the end its only plotting dots for 1 and 2. I have tried to print all values of that array(points) and I can see those values but still, it's not working.

    So why it's not accepting those double values here?

    Thanks


    Added after 1 37 minutes:


    Sorry, it's my mistake, I have use int while passing double value to setSamples().

    Now it's working fine for milliseconds too.

    Thanks for patience.
    Last edited by npatil15; 12th December 2019 at 11:00.

Similar Threads

  1. Scale change for seconds / milliseconds
    By Nijaguna in forum Qwt
    Replies: 2
    Last Post: 16th January 2017, 13:55
  2. Replies: 0
    Last Post: 3rd January 2012, 12:16
  3. Replies: 1
    Last Post: 2nd August 2011, 19:01
  4. Milliseconds from QDateTime
    By scamE in forum Qt Programming
    Replies: 3
    Last Post: 12th September 2010, 20:46
  5. Replies: 2
    Last Post: 6th July 2010, 15:21

Tags for this Thread

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.