I want to have multiple graphs whose data can go over the other graphs. I can already do that, but I want to be able to dinamically change the range of the x-axis, and of all the y-axis (the y-axes should all have the same range).

Now, during the execution, I don't see how to change the ranges.

Here's how I create my graphs :

void CentralMiddleLayer::displayFirstLoading()
    plot = new QCustomPlot;
    nbGraph = 32;

    // Offset the data so they're not on top of each other
    QCPRange defaultRange(-100., 100.); // y-axis range
    for (int i = 0; i < nbGraph; i++)
        QCPAxis *axis = plot->axisRect()->addAxis(QCPAxis::atLeft);
        axis->setRange(defaultRange.lower - (nbGraph - 1 - i) * defaultRange.size(), defaultRange.upper + i * defaultRange.size()); // I don't really understand why this work actually...

        QCPGraph *graph = new QCPGraph(plot->xAxis, axis);

    // Set the data to the plot
    for(int i = 0; i< plot->graphCount(); i++)
        plot->graph(i)->setData(x, matrix[i], true); // I don't give the matrix contents here, but it's simply an array of arrays containing double values

    // Set plot characteristics
    plot->xAxis->setRange(0, 10000.0); // Number of point per page


    plot->axisRect()->setMargins(QMargins(0, 10, 0, 0));
    plot->setStyleSheet(("background:hsva(255, 255, 255, 0%);"));


Do you have an advice to dynamically change the scales ?
Or maybe a better way to display graphs that can be evenly spaced but can still be drawn over adjacents graphs if the data demands it ?