|
|
|
@ -83,39 +83,6 @@ KDChartAxesPainter::~KDChartAxesPainter()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if COMPAT_TQT_VERSION < 0x030000
|
|
|
|
|
TQDateTime dateTimeFromString( const TQString& s ) // only ISODate is allowed
|
|
|
|
|
{
|
|
|
|
|
int year( s.mid( 0, 4 ).toInt() );
|
|
|
|
|
int month( s.mid( 5, 2 ).toInt() );
|
|
|
|
|
int day( s.mid( 8, 2 ).toInt() );
|
|
|
|
|
TQString t( s.mid( 11 ) );
|
|
|
|
|
int hour( t.mid( 0, 2 ).toInt() );
|
|
|
|
|
int minute( t.mid( 3, 2 ).toInt() );
|
|
|
|
|
int second( t.mid( 6, 2 ).toInt() );
|
|
|
|
|
int msec( t.mid( 9, 3 ).toInt() );
|
|
|
|
|
if ( year && month && day )
|
|
|
|
|
return TQDateTime( TQDate( year, month, day ),
|
|
|
|
|
TQTime( hour, minute, second, msec ) );
|
|
|
|
|
else
|
|
|
|
|
return TQDateTime();
|
|
|
|
|
}
|
|
|
|
|
TQString dateTimeToString( const TQDateTime& dt ) // ISODate is returned
|
|
|
|
|
{
|
|
|
|
|
TQString date;
|
|
|
|
|
TQString month(
|
|
|
|
|
TQString::number( dt.date().month() ).rightJustify( 2, '0' ) );
|
|
|
|
|
TQString day(
|
|
|
|
|
TQString::number( dt.date().day() ).rightJustify( 2, '0' ) );
|
|
|
|
|
date = TQString::number( dt.date().year() ) + "-" + month + "-" + day;
|
|
|
|
|
TQString time;
|
|
|
|
|
time.sprintf( "%.2d:%.2d:%.2d",
|
|
|
|
|
dt.time().hour(), dt.time().minute(), dt.time().second() );
|
|
|
|
|
return date + "T" + time;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
ReCalculate the labels based upon given nDelta and nDeltaPix.
|
|
|
|
|
|
|
|
|
@ -577,11 +544,7 @@ void KDChartAxesPainter::paintAxes( TQPainter* painter,
|
|
|
|
|
if( sameDay ){
|
|
|
|
|
commonDtHeader = TQString::number( dLow.day() )
|
|
|
|
|
+ ". "
|
|
|
|
|
#if COMPAT_TQT_VERSION >= 0x030000
|
|
|
|
|
+ TQDate::longMonthName( dLow.month() )
|
|
|
|
|
#else
|
|
|
|
|
+ dLow.monthName( dLow.month() )
|
|
|
|
|
#endif
|
|
|
|
|
+ ' '
|
|
|
|
|
+ TQString::number( dLow.year() );
|
|
|
|
|
if( sameHour ){
|
|
|
|
@ -614,11 +577,7 @@ void KDChartAxesPainter::paintAxes( TQPainter* painter,
|
|
|
|
|
commonDtHeader += "00";
|
|
|
|
|
}
|
|
|
|
|
}else if( sameMonth )
|
|
|
|
|
#if COMPAT_TQT_VERSION >= 0x030000
|
|
|
|
|
commonDtHeader = TQDate::longMonthName( dLow.month() )
|
|
|
|
|
#else
|
|
|
|
|
commonDtHeader = dLow.monthName( dLow.month() )
|
|
|
|
|
#endif
|
|
|
|
|
+ ' '
|
|
|
|
|
+ TQString::number( dLow.year() );
|
|
|
|
|
else if( sameYear )
|
|
|
|
@ -689,14 +648,9 @@ void KDChartAxesPainter::paintAxes( TQPainter* painter,
|
|
|
|
|
|
|
|
|
|
TQString text;
|
|
|
|
|
if( cv.isDateTime ){
|
|
|
|
|
#if COMPAT_TQT_VERSION >= 0x030000
|
|
|
|
|
TQDateTime dt( TQDateTime::fromString( *it,
|
|
|
|
|
Qt::ISODate ) );
|
|
|
|
|
text = dt.toString( formatDT );
|
|
|
|
|
#else
|
|
|
|
|
TQDateTime dt( dateTimeFromString( *it ) );
|
|
|
|
|
text = dt.toString();
|
|
|
|
|
#endif
|
|
|
|
|
}else{
|
|
|
|
|
text = *it;
|
|
|
|
|
}
|
|
|
|
@ -1690,14 +1644,9 @@ void KDChartAxesPainter::paintAxes( TQPainter* painter,
|
|
|
|
|
++labelIter ) {
|
|
|
|
|
TQDateTime dt;
|
|
|
|
|
if( cv.isDateTime ){
|
|
|
|
|
#if COMPAT_TQT_VERSION >= 0x030000
|
|
|
|
|
dt = TQDateTime::fromString( *labelIter,
|
|
|
|
|
Qt::ISODate );
|
|
|
|
|
label = dt.toString( formatDT );
|
|
|
|
|
#else
|
|
|
|
|
dt = dateTimeFromString( *labelIter );
|
|
|
|
|
label = dt.toString();
|
|
|
|
|
#endif
|
|
|
|
|
}else{
|
|
|
|
|
label = *labelIter;
|
|
|
|
|
}
|
|
|
|
@ -3282,11 +3231,7 @@ void KDChartAxesPainter::calculateLabelTexts(
|
|
|
|
|
if( autoDtLabels )
|
|
|
|
|
labelTexts.append( "x" );
|
|
|
|
|
else
|
|
|
|
|
#if COMPAT_TQT_VERSION >= 0x030000
|
|
|
|
|
labelTexts.append( dt.toString( Qt::ISODate ) );
|
|
|
|
|
#else
|
|
|
|
|
labelTexts.append( dateTimeToString( dt ) );
|
|
|
|
|
#endif
|
|
|
|
|
bDone = (goDown ? (dt < dtLow ) : (dt > dtHigh));
|
|
|
|
|
/*if( bDone ){
|
|
|
|
|
dtHigh = dt;
|
|
|
|
@ -4430,12 +4375,7 @@ void KDChartAxesPainter::paintData( TQPainter* painter,
|
|
|
|
|
//ourClipRect.setRight( ourClipRect.right() - 1 );
|
|
|
|
|
|
|
|
|
|
const TQWMatrix & world = painter->worldMatrix();
|
|
|
|
|
ourClipRect =
|
|
|
|
|
#if COMPAT_TQT_VERSION >= 0x030000
|
|
|
|
|
world.mapRect( ourClipRect );
|
|
|
|
|
#else
|
|
|
|
|
world.map( ourClipRect );
|
|
|
|
|
#endif
|
|
|
|
|
ourClipRect = world.mapRect( ourClipRect );
|
|
|
|
|
painter->setClipRect( ourClipRect );
|
|
|
|
|
painter->translate( _dataRect.x(), _dataRect.y() );
|
|
|
|
|
|
|
|
|
|