//panner:
graphCandlePanner->setMouseButton( Qt::MidButton );
graphCandlePanner
->setCursor
(QCursor(Qt
::ClosedHandCursor));
//panner:
graphCandlePanner = new QwtPlotPanner( graphCandle->canvas() );
graphCandlePanner->setMouseButton( Qt::MidButton );
graphCandlePanner->setCursor(QCursor(Qt::ClosedHandCursor));
To copy to clipboard, switch view to plain text mode
//Scale draw modifications
class DateScaleDraw: public QwtDateScaleDraw
{
public:
DateScaleDraw( Qt::TimeSpec timeSpec ):
QwtDateScaleDraw( timeSpec )
{
//setDateFormat( QwtDate::Millisecond, "hh:mm:ss:zzz" );
setDateFormat( QwtDate::Second, "hh:mm:ss\ndd" );
setDateFormat( QwtDate::Minute, "hh:mm\n dd MMM" );
setDateFormat( QwtDate::Hour, "hh:mm\ndd MMM" );
setDateFormat( QwtDate::Day, "dd MMM" );
setDateFormat( QwtDate::Week, "ww/MMM" );
setDateFormat( QwtDate::Month, "MMM/yyyy" );
}
};
//Axis code
QwtDateScaleDraw *scaleDraw = new DateScaleDraw( Qt::UTC );
QwtDateScaleEngine *scaleEngine = new QwtDateScaleEngine( Qt::UTC );
graphCandle
->setAxisScaleDraw
( QwtPlot::xBottom, scaleDraw
);
graphCandle
->setAxisScaleEngine
( QwtPlot::xBottom, scaleEngine
);
//graphCandle->setAxisScale(QwtPlot::xBottom,0,intervalo);
graphCandle
->setAxisLabelRotation
( QwtPlot::xBottom,
-50.0 );
graphCandle
->setAxisLabelAlignment
( QwtPlot::xBottom, Qt
::AlignLeft | Qt
::AlignBottom );
//graphCandle->setAxisTitle( QwtPlot::yLeft, QString( "Price [R$]" ) );
graphCandle->setMinimumHeight(200);
//the second graph have a very similar code.
//Scale draw modifications
class DateScaleDraw: public QwtDateScaleDraw
{
public:
DateScaleDraw( Qt::TimeSpec timeSpec ):
QwtDateScaleDraw( timeSpec )
{
//setDateFormat( QwtDate::Millisecond, "hh:mm:ss:zzz" );
setDateFormat( QwtDate::Second, "hh:mm:ss\ndd" );
setDateFormat( QwtDate::Minute, "hh:mm\n dd MMM" );
setDateFormat( QwtDate::Hour, "hh:mm\ndd MMM" );
setDateFormat( QwtDate::Day, "dd MMM" );
setDateFormat( QwtDate::Week, "ww/MMM" );
setDateFormat( QwtDate::Month, "MMM/yyyy" );
}
};
//Axis code
QwtDateScaleDraw *scaleDraw = new DateScaleDraw( Qt::UTC );
QwtDateScaleEngine *scaleEngine = new QwtDateScaleEngine( Qt::UTC );
graphCandle->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw );
graphCandle->setAxisScaleEngine( QwtPlot::xBottom, scaleEngine );
//graphCandle->setAxisScale(QwtPlot::xBottom,0,intervalo);
graphCandle->setAxisLabelRotation( QwtPlot::xBottom, -50.0 );
graphCandle->setAxisLabelAlignment( QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom );
//graphCandle->setAxisTitle( QwtPlot::yLeft, QString( "Price [R$]" ) );
graphCandle->setMinimumHeight(200);
//the second graph have a very similar code.
To copy to clipboard, switch view to plain text mode
Bookmarks