overflow.jpgHello,
I'm trying to show date and time in the axis scale getting the values from datadase and seting to a double like this:
xData
->push_back
( QString(dt.
date().
toString("yyyyMMdd") + dt.
time().
toString("hhmmss")).
toDouble() );
xData->push_back( QString(dt.date().toString("yyyyMMdd") + dt.time().toString("hhmmss")).toDouble() );
To copy to clipboard, switch view to plain text mode
xData will receive a double like this 20110825093005, but in the graph show me: 2,01108e+13.
I tried use this:
{
public:
format(fmt)
{
}
virtual QwtText label
(double v
) const {
data
= QString::number(v,
'f',
0).
left(8);
hora
= QString::number(v,
'f',
0).
right(6);
t.
setDate( QDate::fromString( data,
"yyyyMMdd"));
t.
setTime( QTime::fromString( hora,
"hhmmss"));
return t.toString(format);
}
private:
};
class TimeScaleDraw: public QwtScaleDraw
{
public:
TimeScaleDraw(QString fmt):
format(fmt)
{
}
virtual QwtText label(double v) const
{
QDateTime t;
QString data, hora;
data = QString::number(v, 'f', 0).left(8);
hora = QString::number(v, 'f', 0).right(6);
t.setDate( QDate::fromString( data, "yyyyMMdd"));
t.setTime( QTime::fromString( hora, "hhmmss"));
return t.toString(format);
}
private:
QString format;
};
To copy to clipboard, switch view to plain text mode
But the double v value that i receive ignores time value, something like this: 20110825000000. Works for the data, but not for the time.
Bookmarks