How to harmonize the scales and pannings of various QwtPlot?
Hello!
In my software I need to draw 2 or more QwtPlot, one under the other. The case is that theese graphs are connected: many events that happens in one graph must release a equivalente event in the other.
For now there are two things that I need to connect: the XBottom axis scale and the horizontal panning event.
For the panning, always when its done the horizontal component of the panning (the vertical move is irrelevant) that is performed in one graph must also occur iddentically in the other, so if I move 10.0 to the right in one, the other must also move 10.0 to the right at the same time.
For the scale, one must also be connected to the other so each xBottom scale modification in one graph affects the equivalent in the other. So for example if I perform a zoom in one graph and therefore the xBottom scale changes, the equivalent change must occur in the other graph.
The problem is: i simply have no idea of how to do this :P
Any typ?
Details:
Code:
//panner:
graphCandlePanner->setMouseButton( Qt::MidButton );
graphCandlePanner
->setCursor
(QCursor(Qt
::ClosedHandCursor));
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.
Thanks,
Momergil
Re: How to harmonize the scales and pannings of various QwtPlot?
Modifications of an axis scale are indicated by:
Connect to these signals and update whatever needs to be updated on the other plot.
Uwe
Re: How to harmonize the scales and pannings of various QwtPlot?
Well, I simply can't find any way to reach this signals. Could you give me a code example please?
Re: How to harmonize the scales and pannings of various QwtPlot?
And none of the examples show how to use it either...
Re: How to harmonize the scales and pannings of various QwtPlot?
Code:
plot->connect( plot->axisWidget( ... ), SIGNAL( scaleDivChanged() ), ... );
Uwe