PDA

View Full Version : [Date/Time Axis] Plotting timestamps from a PostgreSQL DB in a QwtPlotCurve



valandil
2nd August 2011, 16:26
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.

Uwe
2nd August 2011, 18:01
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