I need to dynamically display about 30,000 DAQ points. The x-axis display range is [0,1000]. When I select the graph, the width of the pen is set to 2. At this time, the spectrogram drawing is stuck.

The main code:

QVector<double> m_x, m_y; void ChartTest::timerEvent(QTimerEvent *evt) { Q_UNUSED(evt) for (int i = 0; i < m_chart->graphCount(); ++i){ auto pG = m_chart->graph(i); generateTestData(50000, &m_x, &m_y); pG->setData(m_x, m_y); } m_chart->replot(); } void ChartTest::generateTestData(int n, QVector<double> *x, QVector<double> *y) { x->resize(n); y->resize(n); double yScale = (rand()/(double)RAND_MAX + 0.5)*2; double r1 = (rand()/(double)RAND_MAX - 0.5)*2; double r2 = (rand()/(double)RAND_MAX - 0.5)*2; double r3 = (rand()/(double)RAND_MAX - 0.5)*2; double r4 = (rand()/(double)RAND_MAX - 0.5)*2; double xStep = 1000.0 / n; for (int i=0; i<n; i++) { x->data()[i] = i * xStep; y->data()[i] = (qSin(x->data()[i]*r1*5)*qSin(qCos(x->data()[i]*r2)*r4*3)+ r3*qCos(qSin(x->data()[i])*r4*2))*yScale; } }

When the x-axis

**range is small**, such as [0,100],[-5,5], even if the line width is 2 and the amount of data is equal,

**it will not freeze.**

Does the drawing range of the X axis affect the drawing speed?

I want the line width to be 2 when selected, but I can't stand the drawing lag. Can anyone give me advice?