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. qlineseries with multiple data points
Forum Updated to NodeBB v4.3 + New Features

qlineseries with multiple data points

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.2k Views 1 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.
  • R Offline
    R Offline
    rafael
    wrote on last edited by
    #1

    I have a qlineseries with 7 million data points.

    if(m_LineSeries->points().isEmpty())
           {
               ConvertToLineSeries(m_Pressures,m_LineSeries);
    
              QtCharts::QChart *chart = new QtCharts::QChart();
              chart->legend()->hide();
              chart->addSeries(m_LineSeries);
              chart->createDefaultAxes();
              chart->setTitle("Simple line chart example");
    
              QtCharts::QChartView *chartView = new QtCharts::QChartView(chart);
              chartView->setRenderHint(QPainter::Antialiasing);
    
              ui->layout->addWidget(chartView);
           }
    

    The main window is very slow to respond. I am trying to resize the mainwindow and it keeps saying not responding.
    How can i make it so that the window stays reponsive, even just clicking on the window makes the program freeze for a few seconds before i can do anything.

    JonBJ Pl45m4P 2 Replies Last reply
    0
    • R rafael

      I have a qlineseries with 7 million data points.

      if(m_LineSeries->points().isEmpty())
             {
                 ConvertToLineSeries(m_Pressures,m_LineSeries);
      
                QtCharts::QChart *chart = new QtCharts::QChart();
                chart->legend()->hide();
                chart->addSeries(m_LineSeries);
                chart->createDefaultAxes();
                chart->setTitle("Simple line chart example");
      
                QtCharts::QChartView *chartView = new QtCharts::QChartView(chart);
                chartView->setRenderHint(QPainter::Antialiasing);
      
                ui->layout->addWidget(chartView);
             }
      

      The main window is very slow to respond. I am trying to resize the mainwindow and it keeps saying not responding.
      How can i make it so that the window stays reponsive, even just clicking on the window makes the program freeze for a few seconds before i can do anything.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @rafael
      The answer is: since you don't want to plot 7 million data points on the screen (right?), you want to thin out how many you create....

      1 Reply Last reply
      0
      • R rafael

        I have a qlineseries with 7 million data points.

        if(m_LineSeries->points().isEmpty())
               {
                   ConvertToLineSeries(m_Pressures,m_LineSeries);
        
                  QtCharts::QChart *chart = new QtCharts::QChart();
                  chart->legend()->hide();
                  chart->addSeries(m_LineSeries);
                  chart->createDefaultAxes();
                  chart->setTitle("Simple line chart example");
        
                  QtCharts::QChartView *chartView = new QtCharts::QChartView(chart);
                  chartView->setRenderHint(QPainter::Antialiasing);
        
                  ui->layout->addWidget(chartView);
               }
        

        The main window is very slow to respond. I am trying to resize the mainwindow and it keeps saying not responding.
        How can i make it so that the window stays reponsive, even just clicking on the window makes the program freeze for a few seconds before i can do anything.

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by
        #3

        @rafael

        There is no way / reason to display 7 million data points at the same time in a lineseries on the screen.

        Use zoom features or down-sampling strategies to reduce the amout of samples plotted at a time.


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rafael
          wrote on last edited by rafael
          #4

          I had a test program in python and i was using matplotlib to plot the data.
          i guess matplotlib does some downsampling in the background, because the plots are responsive.

          I was just using the same technique here.
          load all the data points, and plot.

          do you know of a library that does this, downsample and upsample data?

          void ConvertToLineSeries(std::vector<Pressure> data, QtCharts::QLineSeries *series)
          {
              int count = 0;
          
              for(auto &p : data)
              {       
          
                  if(count == (32 * 10))
                  {
                      p.GetTimeStamp();
                      p.GetPressure();
          
                      series->append(p.GetTimeStamp().time_since_epoch().count(),p.GetPressure());
          
                      count = 0;
                  }
          
                  count++;
          
              }
          
              qDebug() << series->points()[0];
          }
          

          seems to be better , i'm only displaying data every 320 samples which reduced it to 21,875.

          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