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:

Qt Code:
  1. //panner:
  2. graphCandlePanner = new QwtPlotPanner( graphCandle->canvas() );
  3. graphCandlePanner->setMouseButton( Qt::MidButton );
  4. graphCandlePanner->setCursor(QCursor(Qt::ClosedHandCursor));
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. //Scale draw modifications
  2.  
  3. class DateScaleDraw: public QwtDateScaleDraw
  4. {
  5. public:
  6. DateScaleDraw( Qt::TimeSpec timeSpec ):
  7. QwtDateScaleDraw( timeSpec )
  8. {
  9. //setDateFormat( QwtDate::Millisecond, "hh:mm:ss:zzz" );
  10. setDateFormat( QwtDate::Second, "hh:mm:ss\ndd" );
  11. setDateFormat( QwtDate::Minute, "hh:mm\n dd MMM" );
  12. setDateFormat( QwtDate::Hour, "hh:mm\ndd MMM" );
  13. setDateFormat( QwtDate::Day, "dd MMM" );
  14. setDateFormat( QwtDate::Week, "ww/MMM" );
  15. setDateFormat( QwtDate::Month, "MMM/yyyy" );
  16. }
  17. };
  18.  
  19. //Axis code
  20. QwtDateScaleDraw *scaleDraw = new DateScaleDraw( Qt::UTC );
  21. QwtDateScaleEngine *scaleEngine = new QwtDateScaleEngine( Qt::UTC );
  22.  
  23. graphCandle->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw );
  24. graphCandle->setAxisScaleEngine( QwtPlot::xBottom, scaleEngine );
  25. //graphCandle->setAxisScale(QwtPlot::xBottom,0,intervalo);
  26. graphCandle->setAxisLabelRotation( QwtPlot::xBottom, -50.0 );
  27. graphCandle->setAxisLabelAlignment( QwtPlot::xBottom, Qt::AlignLeft | Qt::AlignBottom );
  28. //graphCandle->setAxisTitle( QwtPlot::yLeft, QString( "Price [R$]" ) );
  29. graphCandle->setMinimumHeight(200);
  30.  
  31. //the second graph have a very similar code.
To copy to clipboard, switch view to plain text mode 

Thanks,

Momergil