Results 1 to 2 of 2

Thread: [Date/Time Axis] Plotting timestamps from a PostgreSQL DB in a QwtPlotCurve

  1. #1
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default [Date/Time Axis] Plotting timestamps from a PostgreSQL DB in a QwtPlotCurve

    Hello Qwt experts!

    I've been looking around Qwt docs and source code to see how I could set dates to the x axis of a plot. I am fetching data from a PostgreSQL DB and type of data that would go on the x axis is timestamp w/o time zone. The format is "yyyy-MM-dd hh:mm:ss".

    Now, how would you setData so that QwtPlotCurve understands how ot order it chronologically?

    Thank you,

    P.-S. I don't have any compilable code. I have no idea how to do this. Tell me if you need any precision.

  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: [Date/Time Axis] Plotting timestamps from a PostgreSQL DB in a QwtPlotCurve

    Map your dates into doubles ( f.e number of seconds since some reference point ) and then do the same like in the cpuplot example.

    Unfortunately Qwt has no scale engine for Time/Date scales yet, that calculates ticks for months/weeks/days/hours/minutes/seconds depending on the current interval. So if you want to have this you have to do these calculation on your own and set the ticks manually using QwtPlot::setAxisScaleDiv().

    HTH,
    Uwe

  3. The following user says thank you to Uwe for this useful post:

    valandil (2nd August 2011)

Similar Threads

  1. Time/Date Axis
    By sigger in forum Qwt
    Replies: 12
    Last Post: 1st May 2011, 10:55
  2. Replies: 2
    Last Post: 6th July 2010, 15:21
  3. Replies: 3
    Last Post: 27th December 2009, 01:00
  4. real time plotting
    By agostain in forum Qwt
    Replies: 0
    Last Post: 10th August 2009, 11:47
  5. real time plotting
    By gyre in forum Qwt
    Replies: 4
    Last Post: 11th December 2007, 17:13

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.