QCustomPlot Discussion and Comments

Fixing the Scale in y axis(disable zoom)Return to overview

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:

This is more straightforward


connect(ui->customPlot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel())); 


void MainWindow::mouseWheel() 
    zoomed = true;
    if( QApplication::keyboardModifiers() == Qt::ControlModifier ) {
            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