QCustomPlot Discussion and Comments

How to make the axis range automatically adapt to the size of the plot window?Return to overview

like this:

https://i.loli.net/2019/05/27/5ceb8418a407374207.gif

solve..

rewrite QCustomPlot.resizeEvent()

    Q_UNUSED(event)
    // resize and repaint the buffer:
    setViewport(rect());
    double xRange = this->width();
    double yRange = this->height();
    this->xAxis->setRange(0, xRange);
    this->yAxis->setRange(0, yRange);
    this->xAxis2->setRange(0, xRange);

    replot(rpQueuedRefresh);