Important: Please read the Qt Code of Conduct -

QChart odd Y-Axis default values

  • Hello all,

    For part of my project on a QChart, I need to also cover rare situations in which all binary data is the same: either 0 or 1

    We add the points to the lienseries "series" as follows and the output is:

    QVector<double> data {1, 1, 1};
    for(int i=0; i<data.size(); i++) {
            QPointF p (i, data[i]);
            *series << p;


    Y values: from 0.5 to 1.5

    And if data is {0, 0, 0}, the output using the above snippet code is:


    Y values: from -0.5 to 0.5!!

    Why do the values on the y axes change and the resulting line is always on the middle of the chart, please?

    I didn't find any specific clue on the Docs to solve the issue. What I want is when the data is all zero, the line sits on the floor, and on the top when data is all one.

Log in to reply