Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QChart addSeries() function generates mysterious point (Bug?)
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 432 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LordHoratio
    wrote on last edited by LordHoratio
    #1

    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:
    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved