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. add one million points to a series,
Forum Updated to NodeBB v4.3 + New Features

add one million points to a series,

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 908 Views 2 Watching
  • 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.
  • A Offline
    A Offline
    amwps290
    wrote on last edited by
    #1

    I want to paint a curve of one million point ,but the program always crush.the reason is

    Out of memory in ....\include/QtCore/../../src/corelib/tools/qvector.h, line 564
    terminate called without an active exception

    the code:

    chart = new QChart();
    
        series = new QSplineSeries();
    
        for (long long i = 0; i < 1000000; i++)
        {
            series->append(i, 60);
        }
    
    
        chart->legend()->hide();
        chart->addSeries(series);
    
        QValueAxis *_pValueAxisH = new QValueAxis();
    
        _pValueAxisH->setMin(0);
        _pValueAxisH->setMax(1000000);
        _pValueAxisH->setGridLineVisible(false);
        _pValueAxisH->setTickCount(2);
        _pValueAxisH->setLinePenColor(QColor(Qt::darkBlue));
    
        QValueAxis *_pValueAxisV = new QValueAxis();
    
        _pValueAxisV->setMin(0);
        _pValueAxisV->setMax(75);
        _pValueAxisV->setGridLineVisible(false);
        _pValueAxisV->setTickCount(6);
        _pValueAxisV->setLinePenColor(QColor(Qt::darkBlue));
    
        chart->addAxis(_pValueAxisH, Qt::AlignBottom);
        chart->addAxis(_pValueAxisV, Qt::AlignLeft);
    
        chart->setContentsMargins(0, 0, 0, 0);
        chart->setMargins(QMargins(0, 0, 0, 0));
        chart->setBackgroundRoundness(0);
    
        series->attachAxis(_pValueAxisH);
        series->attachAxis(_pValueAxisV);
    
        ui->graphicsView->setChart(chart);
        ui->graphicsView->setRenderHint(QPainter::Antialiasing);
    
    jsulmJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Please provide a minimal compilable example that triggers this behavior.

      Also:

      • which version of Qt are you using ?
      • on which OS ?
      • 32 or 64 bit ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      2
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Don't do it. Noone can distinguish them anyway.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        3
        • A amwps290

          I want to paint a curve of one million point ,but the program always crush.the reason is

          Out of memory in ....\include/QtCore/../../src/corelib/tools/qvector.h, line 564
          terminate called without an active exception

          the code:

          chart = new QChart();
          
              series = new QSplineSeries();
          
              for (long long i = 0; i < 1000000; i++)
              {
                  series->append(i, 60);
              }
          
          
              chart->legend()->hide();
              chart->addSeries(series);
          
              QValueAxis *_pValueAxisH = new QValueAxis();
          
              _pValueAxisH->setMin(0);
              _pValueAxisH->setMax(1000000);
              _pValueAxisH->setGridLineVisible(false);
              _pValueAxisH->setTickCount(2);
              _pValueAxisH->setLinePenColor(QColor(Qt::darkBlue));
          
              QValueAxis *_pValueAxisV = new QValueAxis();
          
              _pValueAxisV->setMin(0);
              _pValueAxisV->setMax(75);
              _pValueAxisV->setGridLineVisible(false);
              _pValueAxisV->setTickCount(6);
              _pValueAxisV->setLinePenColor(QColor(Qt::darkBlue));
          
              chart->addAxis(_pValueAxisH, Qt::AlignBottom);
              chart->addAxis(_pValueAxisV, Qt::AlignLeft);
          
              chart->setContentsMargins(0, 0, 0, 0);
              chart->setMargins(QMargins(0, 0, 0, 0));
              chart->setBackgroundRoundness(0);
          
              series->attachAxis(_pValueAxisH);
              series->attachAxis(_pValueAxisV);
          
              ui->graphicsView->setChart(chart);
              ui->graphicsView->setRenderHint(QPainter::Antialiasing);
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @amwps290 said in add one million points to a series,:

          I want to paint a curve of one million point

          Why? Why do you think your curve needs so many points? It would be more efficient to reduce the amount of points as nobody will be able to see the difference.
          Why do you use long long as data type for your points?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • SGaistS SGaist

            Hi and welcome to devnet,

            Please provide a minimal compilable example that triggers this behavior.

            Also:

            • which version of Qt are you using ?
            • on which OS ?
            • 32 or 64 bit ?
            A Offline
            A Offline
            amwps290
            wrote on last edited by
            #5

            @SGaist

            thank you for your reply.

            the environemnt:

            OS: win10 2004
            Qt Version: 5.12.9

            The first time I used a 32-bit environment, and then I installed a 64-bit environment, but this problem did not occur

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              So it did only occur in 32bit mode ? So it means that you are using way too much data.

              As my fellows already wrote: 1 million points does not make sense to be shown as is.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              A 1 Reply Last reply
              0
              • SGaistS SGaist

                So it did only occur in 32bit mode ? So it means that you are using way too much data.

                As my fellows already wrote: 1 million points does not make sense to be shown as is.

                A Offline
                A Offline
                amwps290
                wrote on last edited by
                #7

                @SGaist Thank you! I will reduce the acount of data point

                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