Results 1 to 4 of 4

Thread: QwtDateScaleDraw understading

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2016
    Posts
    8
    Thanks
    2

    Default QwtDateScaleDraw understading

    Hi,

    I'm have trouble understanding how the QwtDateScaleDraw properties works, I'would like to draw a plot from an array of dates and one of doubles (both comes from database). I've been struggling at the very beggining just to display my date in a particular format, such as dd/mm/yyyy.

    I've done several tests to try to understand how things works but I'm stucked.

    here is where i'm at the moment :

    Qt Code:
    1. //My dates values convert to double (as i think it works )
    2. //firstDate and lastDate are the first and the last QDate value of my array of dates
    3.  
    4. double minValue=QwtDate::toDouble(QDateTime(firstDate));
    5. double maxValue=QwtDate::toDouble(QDateTime(lastDate));
    6.  
    7. QwtPlot *plot= new QwtPlot();
    8.  
    9. QwtDateScaleDraw* scaleDraw= new QwtDateScaleDraw(Qt::LocalTime);
    10. scaleDraw->setDateFormat(QwtDate::Day,"dd/mm/yy");
    11.  
    12. plot->setAxisScaleDraw(QwtPlot::xBottom,scaleDraw);
    13. plot->setAxisScale(QwtPlot::xBottom, minValue,maxValue);
    To copy to clipboard, switch view to plain text mode 

    I do have the correct first and last values but they are displayed with hour, mins, sec and ms. My dates can variate from day to year (f.e values 1 : 2000/01/01 value 2 : 2000/01/20 value 3 : 2000/04/01 value 4 : 2002/01/01), what i mean is that i have a huge range of values. and so i don't care about the hour and lesser values.

    Among all of this when i've tried to use the QwtDateScaleEngine, it just messes up all of my layout organisation. (I add my plot to a layout which is inside a layout with fixed size)

    So here is my questions :

    Does QwtDatmScaleEngine change layout disposition ?
    Do you know anything that could help me trying to figure out how to get familiar with the dates qwt functions (besides examples which i've had a look at) ?

    Sorry for my english/programation level.

    Thanks in advance,
    Stank.

    EDIT : Actually I checked again and I do not have the correct first value displayed on my X axis (I've got the day before instead);
    Last edited by Stank; 4th May 2016 at 13:41.

Similar Threads

  1. Replies: 3
    Last Post: 1st February 2016, 08:04
  2. Replies: 1
    Last Post: 14th October 2015, 07:29

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.