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):
ui->resultScatterChart->chart()->removeAllSeries(); QScatterSeries *resultScatterSeries = new QScatterSeries(); resultScatterSeries->setMarkerShape(QScatterSeries::MarkerShapeRectangle); resultScatterSeries->setMarkerSize(10.0); 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(); theChart->addSeries(resultScatterSeries); theChart->createDefaultAxes();
The result of running this code with a single result in the vector is thus:
Here's what happens when I comment out the call to setDefaultAxes():
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:
- The chart only contains one series by the end of the function
- 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?