I have 2 QwtPlot objects on the same widget and both plot will use same x-axis (it has to be two different plot, not overlap on the same one). Both plots will not have x-axis displayed and an external QwtScaleWidget will display the x-axis. I have all this in a grid layout.
The issue I'm running into is:
- The QwtPlot grid tick does not line up with the QwtScaleWidget ticks.
void MyWidget::SyncScale ()
{
xAxis
->setScaleDiv
(m_pQwtPlot1
->axisScaleEngine
(QwtPlot::xBottom)->transformation
(),
m_pQwtPlot1
->axisWidget
(QwtPlot::xBottom)->scaleDraw
()->scaleDiv
());
int start, end;
m_pQwtPlot1
->axisWidget
(QwtPlot::xBottom)->getBorderDistHint
(start, end
);
xAxis->setBorderDist(start, end);
}
void MyWidget::SyncScale ()
{
xAxis->setScaleDiv(m_pQwtPlot1->axisScaleEngine(QwtPlot::xBottom)->transformation(),
m_pQwtPlot1->axisWidget(QwtPlot::xBottom)->scaleDraw()->scaleDiv());
int start, end;
m_pQwtPlot1->axisWidget(QwtPlot::xBottom)->getBorderDistHint(start, end);
xAxis->setBorderDist(start, end);
}
To copy to clipboard, switch view to plain text mode
Any support/help are greatly appreciated!
Bookmarks