Unsolved qlineseries with multiple data points
-
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. -
@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.... -
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.
-
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.