#190 QwtDateScaleEngine not adapting correctly

None
closed
None
5
2013-08-26
2013-06-11
No

When using a QwtDateScaleEngine with data ranging from 0m0s to 5m59s makes a scale that does not end with a major tick, whereas the Floating attribute is never set. Major step is 2m, medium step 1m, and minor step 30s. The scale seems to end around 6m40. Could it be 400 seconds ?

With data ranging from 0m0s to 6m29s, the scale ends with a major ticks, but it is 6m0s, so the curve is not completely displayed

Discussion

  • Eric Lemanissier

    Here are screenshots

     
  • Uwe Rathmann

    Uwe Rathmann - 2013-06-12

    Confirmed - the code below demonstrates the bad alignment:

    QDateTime dt1( QDate( 2010, 10, 10 ), QTime( 0, 0, 0 ) );
    QDateTime dt2( QDate( 2010, 10, 10 ), QTime( 0, 5, 59 ) );
    
    double x1 = QwtDate::toDouble( dt1 );
    double x2 = QwtDate::toDouble( dt2 );
    double stepSize;
    
    QwtDateScaleEngine se;
    se.autoScale( 10, x1, x2, stepSize );
    
    qDebug() << dt1 << dt2;
    qDebug() << QwtDate::toDateTime( x1, Qt::LocalTime )
        << QwtDate::toDateTime( x2, Qt::LocalTime ) << stepSize;
    

    The output is:

    QDateTime("Sun Oct 10 00:00:00 2010") QDateTime("Sun Oct 10 00:05:59 2010")
    QDateTime("Sun Oct 10 00:00:00 2010") QDateTime("Sun Oct 10 00:06:40 2010") 50000

     
  • Uwe Rathmann

    Uwe Rathmann - 2013-06-12
    • assigned_to: Uwe Rathmann
    • Group: -->
     
  • Uwe Rathmann

    Uwe Rathmann - 2013-06-18

    QwtDateScaleEngine::alignDate with up == true ( ceiling ) doesn't work ( floors instead ), what is the reason for the problem with 6:29.

     
  • Uwe Rathmann

    Uwe Rathmann - 2013-06-30

    The ceiling error is fixed in SVN ( trunk and 6.1 ).

    QwtDateScaleEngine in Qwt 6.1.0 is incomplete - the calculation of the ticks is done, but the autoscaling part is using code that aligns like for a linear scale with a base 10. So the bad alignment ( to 400 ) is not really a bug - more an issue of using a weak/wrong algorithm. The problem here is that a time/date scale needs more than one algorithm - one for each type of interval ( ms, s, h, d, w, m, y ).

    I will try to implement something better for 6.1.1.

     
  • Uwe Rathmann

    Uwe Rathmann - 2013-08-26
     
  • Uwe Rathmann

    Uwe Rathmann - 2013-08-26

    Fixed in trunk and 6.1 branch

     
  • Uwe Rathmann

    Uwe Rathmann - 2013-08-26
    • status: open --> closed
     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks