Important: Please read the Qt Code of Conduct -

QChart with several lines : zoom out to show all lines

  • Hi all!

    My QChart is showing audio data to display it on real time. When the lenght of data reaches the maximum of default X or Y axis, the chart scrolls ( it 'slides' to the left, or to up and down ); so there are momment when the QChart only displays a fraction of the curve.
    Once the data generation has stopped, a new generation process can arrive, so the QChart displays a new curve ( a new series is added to QChart) and the display process re begins as described.

    As QChart may show only a fraction of the curve(s), I'd like to have a function that zooms out to display all the curves in a glance. I've thought of iterating over all the series ( a QList<QAbstractSeries *> ) to get the maximum lenght between them ( to get the X axis max value ) and also to get the maximum and minimum values ( to the max/min values of Y axis ). And the use the QChart's axisY/axisX() functions:


    But I'm sure i'm missing something because I can't belive there's no implemented function to do this faster.
    Does anyone know a more efficient solution??
    Thank you very much!

Log in to reply