PDA

View Full Version : Label on QwtDateScaleDraw vanishes once and get back, strange behavior



HappyCoder
12th October 2015, 17:10
Hello,

in my application it is possible to switch on the x-axis between

QwtLinearScaleEngine/HourMinuteSecondsScaleDraw (relative time starting from zero)

and

QwtDateScaleEngine/DateScaleDraw (absolute time starting at UTC Offset).

Our time values is a double in seconds and the lables are overloaded
(but that is not the source for this behavior. Without them just wrong labels are shown
but it happens also. I add these only because the labels are not original Qwt if someone
asking for that.)

QwtScaleDraw for QwtLinearScaleEngine:


class HourMinuteSecondsScaleDraw: public QwtScaleDraw
{
public:
virtual QwtText label( double value ) const
{
QTime n(0,0,0);
QTime t;
t = n.addSecs( value );
return t.toString(Qt::ISODate);
}
};


QwtScaleDraw for QwtDateScaleEngine:



class DateScaleDraw: public QwtDateScaleDraw
{
public:
DateScaleDraw( Qt::TimeSpec spec) : QwtDateScaleDraw (spec)
{
}

virtual QwtText label( double value ) const
{
return QwtDateScaleDraw::label( value*1000 );
}
};


1.) when i start a measurement with QwtLinearScaleEngine/HourMinuteSecondsScaleDraw
everything is fine and the lables are always visible at any time.
11428

2.) when i start a measurement with QwtDateScaleEngine/DateScaleDraw for the first
measurement data the labels vanishes and return when 2 measurment points in out data.
11429

It is hard to find a good entry point for debugging or why this happens. Can anybody
give me a hint why the lables for QwtDateScaleDrawEngine vanishes shortly?

Thx

Uwe
14th October 2015, 07:29
When working with the QwtDateScale classes values need to be dates: stored as ms since Epoch ( see http://qwt.sourceforge.net/class_qwt_date.html#details )
But to me it looks like you are looking for something like this: http://sourceforge.net/p/qwt/feature-requests/56

Uwe