Hi Faramia,
the main idea is that you have the normal x-axis in the plot, I mean
x from 1 to ...
and you have to convert to hours, in the label method
for example, when x = 1 then hour = 7:00
virtual QwtText label(double v) const v is the x-value in the plot
{
// check if v is an integer value
// if yes do this
qDebug() << "basetime to string" << baseTime.toString() << "v:" << v << "i:" << i;
qDebug() << baseTime.addSecs(3600*v).toString();
return baseTime.addSecs(3600*v).toString();
// if not
return EMPTY_STRING;
}
then, you have to change your code to
setAxisScale(xBottom, 1,1+numOfHours, 1); // numOfHours = number of hours you want to show
QTime myTime(7,00);
setAxisScaleDraw(QwtPlot::xBottom,
new QwtScaleDrawTime(myTime));
Bookmarks