Hello, I also have a question about the time axis X.
Value for the X axis, I get in the loop from the database in the format of Unix time like 1328612875.
From the example cpuplot, write the following:
{
public:
TimeScaleDraw
(const QTime &base
): baseTime(base)
{
}
virtual QwtText label
(double v
) const {
QTime upTime
= baseTime.
addSecs((int)v
);
return upTime.toString();
}
private:
};
QTime TrendTop
::upTime() const {
return t;
}
class TimeScaleDraw: public QwtScaleDraw
{
public:
TimeScaleDraw(const QTime &base):
baseTime(base)
{
}
virtual QwtText label(double v) const
{
QTime upTime = baseTime.addSecs((int)v);
return upTime.toString();
}
private:
QTime baseTime;
};
QTime TrendTop::upTime() const
{
QTime t;
t=QTime::currentTime();
return t;
}
To copy to clipboard, switch view to plain text mode
But time is displayed on the X axis does not correspond to reality.
Can you please tell what I need to fix?
Bookmarks