Important: Please read the Qt Code of Conduct -

QChart addSeries() function generates mysterious point (Bug?)

  • I have a shared pointer named resultsPtr that points to a vector of synthesisResults (custom class). A synthesis result has a latency vale and area value that I'm trying to display on a scatter chart. I have a QchartView I created from the editor and here is the pertinent source code (I can include the whole thing if necessary):

    QScatterSeries *resultScatterSeries = new QScatterSeries();
    resultScatterSeries->setColor(QColor(230, 200, 0));
    for (unsigned int i = 0; i < resultsPtr->size(); i++)
        resultScatterSeries->append(resultsPtr->at(i).area, resultsPtr->at(i).latency);
    QChart *theChart = ui->resultScatterChart->chart();

    The result of running this code with a single result in the vector is thus:
    0_1504337651851_Screenshot from 2017-09-02 02:27:11.png

    Here's what happens when I comment out the call to setDefaultAxes():
    0_1504338259511_Screenshot from 2017-09-02 02:43:04.png
    Note the extra dot at the top of chart, outside the grid. Interestingly, even if I comment out the call to append inside the loop, that point will still appear in that exact position even without the grid.

    Here is all I could establish while trying to debug:

    1. The chart only contains one series by the end of the function
    2. That series only has 1 point; the one that displays in the center of the chart

    By all accounts, it seems that point there shouldn't even exist. How do I get rid of it?

Log in to reply