how to fix the scale in the y-axis.but should be movable in x direction
how to fix the scale in the y-axis.but should be movable in x direction
If I got you right, try something like this:
plot->axisRect(0)->setRangeZoomFactor(.5,1);
This is more straightforward
plot->axisRect(0)->setRangeZoom(Qt::Horizontal;
connect(ui->customPlot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel())); ///.... void MainWindow::mouseWheel() { zoomed = true; if( QApplication::keyboardModifiers() == Qt::ControlModifier ) { ui->customPlot->axisRect()->setRangeZoom(Qt::Horizontal); qDebug() << "----------x Axis changed by wheel-----------"; } else { ui->customPlot->axisRect()->setRangeZoom(Qt::Horizontal | Qt::Vertical); qDebug() << "----------xy Axis changed by wheel-----------"; } qDebug() << "----------zoomed by wheel-----------"; }
it's worked for me